public ActionResult EditSubSection(RuleSubSectionDO RuleSubSection) { try { RuleBLL.Save(RuleSubSection); AjaxResult result = new AjaxResult(AjaxResult.AjaxStatus.OK, "The SubSection was updated"); result.Data.Add("SubSection", RuleSubSection); return Json(result); } catch (Exception ex) { AjaxResult result = new AjaxResult(AjaxResult.AjaxStatus.ERROR, ex.Message); return Json(result); } }
/// <summary> /// Updates a RuleSubSection record and returns the number of records affected /// </summary> public static int Update(RuleSubSectionDO DO) { SqlParameter _Section = new SqlParameter("Section", SqlDbType.VarChar); SqlParameter _SubSection = new SqlParameter("SubSection", SqlDbType.VarChar); SqlParameter _Description = new SqlParameter("Description", SqlDbType.VarChar); _Section.Value = DO.Section; _SubSection.Value = DO.SubSection; _Description.Value = DO.Description; SqlParameter[] _params = new SqlParameter[] { _Section, _SubSection, _Description }; string pid = ConfigurationManager.AppSettings["ePermitDAL"]; return DataCommon.ExecuteScalar("[dbo].[RuleSubSection_Update]", _params, pid); }
/// <summary> /// Creates a new RuleSubSection record using async /// </summary> public static async Task CreateAsync(RuleSubSectionDO DO) { SqlParameter _Section = new SqlParameter("Section", SqlDbType.VarChar); SqlParameter _SubSection = new SqlParameter("SubSection", SqlDbType.VarChar); SqlParameter _Description = new SqlParameter("Description", SqlDbType.VarChar); _Section.Value = DO.Section; _SubSection.Value = DO.SubSection; _Description.Value = DO.Description; SqlParameter[] _params = new SqlParameter[] { _Section, _SubSection, _Description }; string pid = ConfigurationManager.AppSettings["ePermitDAL"]; await DataCommon.ExecuteNonQueryAsync("[dbo].[RuleSubSection_Insert]", _params, pid); }
/// <summary> /// Selects RuleSubSection records by SectionSubSection /// </summary> public static async Task<RuleSubSectionDO[]> GetBySectionSubSectionAsync(String Section, String SubSection) { SqlParameter _Section = new SqlParameter("Section", SqlDbType.VarChar); SqlParameter _SubSection = new SqlParameter("SubSection", SqlDbType.VarChar); _Section.Value = Section; _SubSection.Value = SubSection; SqlParameter[] _params = new SqlParameter[] { _Section, _SubSection }; string pid = ConfigurationManager.AppSettings["ePermitDAL"]; SafeReader sr = await DataCommon.ExecuteSafeReaderAsync("[dbo].[RuleSubSection_GetBySectionSubSection]", _params, pid); List<RuleSubSectionDO> objs = new List<RuleSubSectionDO>(); while(sr.Read()) { RuleSubSectionDO obj = new RuleSubSectionDO(); obj.Section = sr.GetString(sr.GetOrdinal("Section")); obj.SubSection = sr.GetString(sr.GetOrdinal("SubSection")); obj.Description = sr.GetString(sr.GetOrdinal("Description")); objs.Add(obj); } return objs.ToArray(); }
/// <summary> /// Gets all RuleSubSection records /// </summary> public static async Task<RuleSubSectionDO[]> GetAllAsync() { string pid = ConfigurationManager.AppSettings["ePermitDAL"]; SafeReader sr = await DataCommon.ExecuteSafeReaderAsync("[dbo].[RuleSubSection_GetAll]", new SqlParameter[] { }, pid); List<RuleSubSectionDO> objs = new List<RuleSubSectionDO>(); while(sr.Read()){ RuleSubSectionDO obj = new RuleSubSectionDO(); obj.Section = sr.GetString(sr.GetOrdinal("Section")); obj.SubSection = sr.GetString(sr.GetOrdinal("SubSection")); obj.Description = sr.GetString(sr.GetOrdinal("Description")); objs.Add(obj); } return objs.ToArray(); }
/// <summary> /// Deletes a RuleSubSection record /// </summary> public static async Task<int> DeleteAsync(RuleSubSectionDO DO) { SqlParameter _SubSection = new SqlParameter("SubSection", SqlDbType.VarChar); _SubSection.Value = DO.SubSection; SqlParameter[] _params = new SqlParameter[] { _SubSection }; string pid = ConfigurationManager.AppSettings["ePermitDAL"]; return await DataCommon.ExecuteScalarAsync("[dbo].[RuleSubSection_Delete]", _params, pid); }