Griffin.MvcContrib.SqlServer.Localization.SqlLocalizedTypesRepository.Update C# (CSharp) 메소드

Update() 공개 메소드

Update translation
public Update ( CultureInfo culture, TypePromptKey key, string translatedText ) : void
culture System.Globalization.CultureInfo Culture that the prompt is for
key TypePromptKey Unique key, in the specified language only, for the prompt to get)
translatedText string Translated text string
리턴 void
        public void Update(CultureInfo culture, TypePromptKey key, string translatedText)
        {
            if (culture == null) throw new ArgumentNullException("culture");
            if (key == null) throw new ArgumentNullException("key");
            if (translatedText == null) throw new ArgumentNullException("translatedText");

            var sql = "UPDATE LocalizedTypes SET Value=@value, UpdatedAt=@updat, UpdatedBy=@updby WHERE LocaleId = @lcid AND [Key] = @key";

            using (var cmd = _db.Connection.CreateCommand())
            {
                cmd.CommandText = sql;
                cmd.AddParameter("value", translatedText);
                cmd.AddParameter("updat", DateTime.Now);
                cmd.AddParameter("updby", Thread.CurrentPrincipal.Identity.Name);
                cmd.AddParameter("lcid", culture.LCID);
                cmd.AddParameter("key", key.ToString());
                cmd.ExecuteNonQuery();
            }
        }