Beispiel #1
0
        internal void UpdateCustomText(CustomText customText)
        {
            string sql = @"UPDATE dbo.OfferCustomTexts 
SET typ_prof=@typ_prof, text_order=@text_order, lang_ID=@lang_ID, report_key=@report_key, custom_text=@custom_text, is_header=@is_header, keep_together=@keep_together, pg_break=@pg_break, last_footer=@last_footer, once_key=@once_key, [optional]=@optional, opt_desc=@opt_desc
WHERE ID=@id";

            using (SqlCommand cmd = GetCmd(sql))
            {
                AddCommonParameters(customText, cmd);
                cmd.ExecuteNonQuery();
            }
        }
Beispiel #2
0
        internal void DeleteCustomText(CustomText customText)
        {
            if (customText.ID == 0)
            {
                return;
            }

            using (SqlCommand cmd = GetCmd("DELETE FROM dbo.OfferCustomTexts WHERE ID=@id"))
            {
                cmd.AddParameterWithValue("@id", customText.ID);
                cmd.ExecuteNonQuery();
            }
        }
Beispiel #3
0
 private static void AddCommonParameters(CustomText customText, SqlCommand cmd)
 {
     cmd.AddParameterWithValue("@id", customText.ID);
     cmd.AddParameterWithValue("@typ_prof", customText.typ_prof);
     cmd.AddParameterWithValue("@text_order", customText.text_order);
     cmd.AddParameterWithValue("@lang_ID", customText.lang_ID);
     cmd.AddParameterWithValue("@report_key", customText.report_key);
     cmd.AddParameterWithValue("@custom_text", customText.custom_text);
     cmd.AddParameterWithValue("@is_header", customText.is_header);
     cmd.AddParameterWithValue("@keep_together", customText.keep_together);
     cmd.AddParameterWithValue("@pg_break", customText.pg_break);
     cmd.AddParameterWithValue("@last_footer", customText.last_footer);
     cmd.AddParameterWithValue("@once_key", customText.once_key);
     cmd.AddParameterWithValue("@optional", customText.optional);
     cmd.AddParameterWithValue("@opt_desc", customText.opt_desc);
 }
Beispiel #4
0
        internal void CreateCustomText(CustomText customText)
        {
            if (customText.ID == 0)
            {
                using (SqlCommand cmd = GetCmd("SELECT ISNULL(MAX(ID),0)+1 FROM dbo.OfferCustomTexts"))
                {
                    customText.ID = (int)cmd.ExecuteScalar();
                }
            }

            string sql = @"INSERT INTO dbo.OfferCustomTexts (id, typ_prof, text_order, lang_ID, report_key, custom_text, is_header, keep_together, pg_break, last_footer, once_key, [optional], opt_desc) 
VALUES (@id, @typ_prof, @text_order, @lang_ID, @report_key, @custom_text, @is_header, @keep_together, @pg_break, @last_footer, @once_key, @optional, @opt_desc);";

            using (SqlCommand cmd = GetCmd(sql))
            {
                AddCommonParameters(customText, cmd);
                cmd.ExecuteNonQuery();
            }
        }
Beispiel #5
0
 public CustomTextViewModel(CustomText model)
 {
     _model = model;
 }