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