private static void FromTemplateFormSection(ref SqlCommand cmd, TemplateFormSectionBE o) { cmd.Parameters.AddWithValue("FormID", o.FormID); cmd.Parameters.AddWithValue("Section", o.Section); cmd.Parameters.AddWithValue("Description", o.Description); cmd.Parameters.AddWithValue("Sequence", o.Sequence); }
private static TemplateFormSectionBE ToTemplateFormSectionBE(SqlDataReader rdr) { TemplateFormSectionBE o = new TemplateFormSectionBE(); o.FormID = Functions.ToInt(rdr["FormID"]); o.Section = Functions.TrimRight(rdr["Section"]); o.Description = Functions.TrimRight(rdr["Description"]); o.Sequence = Functions.ToInt(rdr["Sequence"]); return o; }
public static bool UpdateTemplateFormSection(TemplateFormSectionBE o) { bool success = false; using (SqlConnection conn = new SqlConnection(_connectionstring)) { conn.Open(); SqlCommand cmd = new SqlCommand("usp_TemplateFormSection_Update", conn); cmd.CommandType = CommandType.StoredProcedure; BusinessEntityHelper.ReplaceNullProperties<TemplateFormSectionBE>(o); FromTemplateFormSection(ref cmd, o); cmd.ExecuteNonQuery(); success = true; } return success; }
public static TemplateFormSectionBE FetchTemplateFormSection(int formId, string section) { TemplateFormSectionBE o = null; using (SqlConnection conn = new SqlConnection(_connectionstring)) { conn.Open(); SqlCommand cmd = new SqlCommand("usp_TemplateFormSection_Fetch", conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("FormID", formId); cmd.Parameters.AddWithValue("Section", section); using (SqlDataReader reader = cmd.ExecuteReader()) { if (reader.Read()) o = ToTemplateFormSectionBE(reader); } } return o; }