/// <summary> /// Creates a new TOCRules record using async /// </summary> public static async Task<int> CreateAsync(TOCRulesDO DO) { SqlParameter _Section = new SqlParameter("Section", SqlDbType.VarChar); SqlParameter _SubSection = new SqlParameter("SubSection", SqlDbType.VarChar); SqlParameter _TOCID = new SqlParameter("TOCID", SqlDbType.Int); _Section.Value = DO.Section; _SubSection.Value = DO.SubSection; _TOCID.Value = DO.TOCID; SqlParameter[] _params = new SqlParameter[] { _Section, _SubSection, _TOCID }; string pid = ConfigurationManager.AppSettings["ePermitDAL"]; return await DataCommon.ExecuteScalarAsync("[dbo].[TOCRules_Insert]", _params, pid); }
/// <summary> /// Updates a TOCRules record and returns the number of records affected /// </summary> public static int Update(TOCRulesDO DO) { SqlParameter _TOCRulesID = new SqlParameter("TOCRulesID", SqlDbType.Int); SqlParameter _Section = new SqlParameter("Section", SqlDbType.VarChar); SqlParameter _SubSection = new SqlParameter("SubSection", SqlDbType.VarChar); SqlParameter _TOCID = new SqlParameter("TOCID", SqlDbType.Int); _TOCRulesID.Value = DO.TOCRulesID; _Section.Value = DO.Section; _SubSection.Value = DO.SubSection; _TOCID.Value = DO.TOCID; SqlParameter[] _params = new SqlParameter[] { _TOCRulesID, _Section, _SubSection, _TOCID }; string pid = ConfigurationManager.AppSettings["ePermitDAL"]; return DataCommon.ExecuteScalar("[dbo].[TOCRules_Update]", _params, pid); }
/// <summary> /// Selects TOCRules records by TOCRulesSubSectionTOCID /// </summary> public static async Task<TOCRulesDO[]> GetByTOCRulesSubSectionTOCIDAsync(String SubSection, Int32 TOCID) { SqlParameter _SubSection = new SqlParameter("SubSection", SqlDbType.VarChar); SqlParameter _TOCID = new SqlParameter("TOCID", SqlDbType.Int); _SubSection.Value = SubSection; _TOCID.Value = TOCID; SqlParameter[] _params = new SqlParameter[] { _SubSection, _TOCID }; string pid = ConfigurationManager.AppSettings["ePermitDAL"]; SafeReader sr = await DataCommon.ExecuteSafeReaderAsync("[dbo].[TOCRules_GetByTOCRulesSubSectionTOCID]", _params, pid); List<TOCRulesDO> objs = new List<TOCRulesDO>(); while(sr.Read()) { TOCRulesDO obj = new TOCRulesDO(); obj.TOCRulesID = sr.GetInt32(sr.GetOrdinal("TOCRulesID")); obj.Section = sr.GetString(sr.GetOrdinal("Section")); obj.SubSection = sr.GetString(sr.GetOrdinal("SubSection")); obj.TOCID = sr.GetInt32(sr.GetOrdinal("TOCID")); objs.Add(obj); } return objs.ToArray(); }
/// <summary> /// Selects TOCRules records by SectionSubSection /// </summary> public static TOCRulesDO[] GetBySectionSubSection(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 = DataCommon.ExecuteSafeReader("[dbo].[TOCRules_GetBySectionSubSection]", _params, pid); List<TOCRulesDO> objs = new List<TOCRulesDO>(); while(sr.Read()) { TOCRulesDO obj = new TOCRulesDO(); obj.TOCRulesID = sr.GetInt32(sr.GetOrdinal("TOCRulesID")); obj.Section = sr.GetString(sr.GetOrdinal("Section")); obj.SubSection = sr.GetString(sr.GetOrdinal("SubSection")); obj.TOCID = sr.GetInt32(sr.GetOrdinal("TOCID")); objs.Add(obj); } return objs.ToArray(); }
/// <summary> /// Gets all TOCRules records /// </summary> public static async Task<TOCRulesDO[]> GetAllAsync() { string pid = ConfigurationManager.AppSettings["ePermitDAL"]; SafeReader sr = await DataCommon.ExecuteSafeReaderAsync("[dbo].[TOCRules_GetAll]", new SqlParameter[] { }, pid); List<TOCRulesDO> objs = new List<TOCRulesDO>(); while(sr.Read()){ TOCRulesDO obj = new TOCRulesDO(); obj.TOCRulesID = sr.GetInt32(sr.GetOrdinal("TOCRulesID")); obj.Section = sr.GetString(sr.GetOrdinal("Section")); obj.SubSection = sr.GetString(sr.GetOrdinal("SubSection")); obj.TOCID = sr.GetInt32(sr.GetOrdinal("TOCID")); objs.Add(obj); } return objs.ToArray(); }
/// <summary> /// Deletes a TOCRules record /// </summary> public static async Task<int> DeleteAsync(TOCRulesDO DO) { SqlParameter _TOCRulesID = new SqlParameter("TOCRulesID", SqlDbType.Int); _TOCRulesID.Value = DO.TOCRulesID; SqlParameter[] _params = new SqlParameter[] { _TOCRulesID }; string pid = ConfigurationManager.AppSettings["ePermitDAL"]; return await DataCommon.ExecuteScalarAsync("[dbo].[TOCRules_Delete]", _params, pid); }