コード例 #1
0
    protected void Page_PreRender(object sender, EventArgs e)
    {
        if (String.IsNullOrWhiteSpace(TrnKey))
        {
            SetErrorMessage("Invalid TrnKey");
            return;
        }

        if (String.IsNullOrWhiteSpace(ModuleName))
        {
            SetErrorMessage("Invalid ModuleName");
            return;
        }

        if (String.IsNullOrWhiteSpace(LanguagePair))
        {
            SetErrorMessage("Invalid LanguagePair");
            return;
        }

        using (var db = DcFactory.Create <CommonDataDataContext>())
        {
            var trn = (from n in db.CD_Translations
                       where n.DateDeleted == null &&
                       n.TrnKey.ToLower() == TrnKey.ToLower() &&
                       n.LanguagePair.ToLower() == LanguagePair.ToLower() &&
                       n.ModuleName.ToLower() == ModuleName.ToLower()
                       select n).Single();

            tbDefaultText.Text    = trn.DefaultText;
            tbTranslatedText.Text = trn.TranslatedText;
        }
    }
コード例 #2
0
    protected void btSave_Click(object sender, EventArgs e)
    {
        using (var db = DcFactory.Create <CommonDataDataContext>())
        {
            var dbTrn = (from n in db.CD_Translations
                         where n.DateDeleted == null &&
                         n.TrnKey.ToLower() == TrnKey.ToLower() &&
                         n.LanguagePair.ToLower() == LanguagePair.ToLower() &&
                         n.ModuleName.ToLower() == ModuleName.ToLower()
                         select n).Single();

            dbTrn.DefaultText    = tbDefaultText.Text;
            dbTrn.TranslatedText = tbTranslatedText.Text;

            db.SubmitChanges();

            SetSuccessMessage("Save successfully");
        }
    }
コード例 #3
0
    protected void btSave_Click(object sender, EventArgs e)
    {
        using (var session = Hb8Factory.CreateSession())
        {
            var dbTrn = (from n in session.Query <CD_Translation>()
                         where n.DateDeleted == null &&
                         n.TrnKey.ToLower() == TrnKey.ToLower() &&
                         n.LanguagePair.ToLower() == LanguagePair.ToLower() &&
                         n.ModuleName.ToLower() == ModuleName.ToLower()
                         select n).Single();

            dbTrn.DefaultText    = tbDefaultText.Text;
            dbTrn.TranslatedText = tbTranslatedText.Text;

            session.SubmitChanges(dbTrn);

            SetSuccessMessage("Save successfully");
        }
    }