/// <summary> /// Creates a new PerformanceStandardRule record using async /// </summary> public static async Task<int> CreateAsync(PerformanceStandardRuleDO DO) { SqlParameter _PermitKey = new SqlParameter("PermitKey", SqlDbType.Int); SqlParameter _Section = new SqlParameter("Section", SqlDbType.VarChar); SqlParameter _SubSection = new SqlParameter("SubSection", SqlDbType.VarChar); SqlParameter _TOCID = new SqlParameter("TOCID", SqlDbType.Int); SqlParameter _OperatorComments = new SqlParameter("OperatorComments", SqlDbType.VarChar); _PermitKey.Value = DO.PermitKey; _Section.Value = DO.Section; _SubSection.Value = DO.SubSection; _TOCID.Value = DO.TOCID; _OperatorComments.Value = DO.OperatorComments; SqlParameter[] _params = new SqlParameter[] { _PermitKey, _Section, _SubSection, _TOCID, _OperatorComments }; string pid = ConfigurationManager.AppSettings["ePermitDAL"]; return await DataCommon.ExecuteScalarAsync("[dbo].[PerformanceStandardRule_Insert]", _params, pid); }
/// <summary> /// Selects PerformanceStandardRule records by PK /// </summary> public static async Task<PerformanceStandardRuleDO[]> GetByPKAsync(Int32 PerformanceStandardRuleID) { SqlParameter _PerformanceStandardRuleID = new SqlParameter("PerformanceStandardRuleID", SqlDbType.Int); _PerformanceStandardRuleID.Value = PerformanceStandardRuleID; SqlParameter[] _params = new SqlParameter[] { _PerformanceStandardRuleID }; string pid = ConfigurationManager.AppSettings["ePermitDAL"]; SafeReader sr = await DataCommon.ExecuteSafeReaderAsync("[dbo].[PerformanceStandardRule_GetByPK]", _params, pid); List<PerformanceStandardRuleDO> objs = new List<PerformanceStandardRuleDO>(); while(sr.Read()) { PerformanceStandardRuleDO obj = new PerformanceStandardRuleDO(); obj.PerformanceStandardRuleID = sr.GetInt32(sr.GetOrdinal("PerformanceStandardRuleID")); obj.PermitKey = sr.GetInt32(sr.GetOrdinal("PermitKey")); obj.Section = sr.GetString(sr.GetOrdinal("Section")); obj.SubSection = sr.GetString(sr.GetOrdinal("SubSection")); obj.TOCID = sr.GetInt32(sr.GetOrdinal("TOCID")); if (sr.IsDBNull(sr.GetOrdinal("OperatorComments"))) { obj.OperatorComments = null; } else { obj.OperatorComments = sr.GetString(sr.GetOrdinal("OperatorComments")); } objs.Add(obj); } return objs.ToArray(); }
/// <summary> /// Gets all PerformanceStandardRule records /// </summary> public static PerformanceStandardRuleDO[] GetAll() { string pid = ConfigurationManager.AppSettings["ePermitDAL"]; SafeReader sr = DataCommon.ExecuteSafeReader("[dbo].[PerformanceStandardRule_GetAll]", new SqlParameter[] { }, pid); List<PerformanceStandardRuleDO> objs = new List<PerformanceStandardRuleDO>(); while(sr.Read()){ PerformanceStandardRuleDO obj = new PerformanceStandardRuleDO(); obj.PerformanceStandardRuleID = sr.GetInt32(sr.GetOrdinal("PerformanceStandardRuleID")); obj.PermitKey = sr.GetInt32(sr.GetOrdinal("PermitKey")); obj.Section = sr.GetString(sr.GetOrdinal("Section")); obj.SubSection = sr.GetString(sr.GetOrdinal("SubSection")); obj.TOCID = sr.GetInt32(sr.GetOrdinal("TOCID")); if (sr.IsDBNull(sr.GetOrdinal("OperatorComments"))) { obj.OperatorComments = null; } else { obj.OperatorComments = sr.GetString(sr.GetOrdinal("OperatorComments")); } objs.Add(obj); } return objs.ToArray(); }
/// <summary> /// Selects PerformanceStandardRule records by PermitKeySectionSubSection /// </summary> public static PerformanceStandardRuleDO[] GetByPermitKeySectionSubSection(Int32 PermitKey, String Section, String SubSection) { SqlParameter _PermitKey = new SqlParameter("PermitKey", SqlDbType.Int); SqlParameter _Section = new SqlParameter("Section", SqlDbType.VarChar); SqlParameter _SubSection = new SqlParameter("SubSection", SqlDbType.VarChar); _PermitKey.Value = PermitKey; _Section.Value = Section; _SubSection.Value = SubSection; SqlParameter[] _params = new SqlParameter[] { _PermitKey, _Section, _SubSection }; string pid = ConfigurationManager.AppSettings["ePermitDAL"]; SafeReader sr = DataCommon.ExecuteSafeReader("[dbo].[PerformanceStandardRule_GetByPermitKeySectionSubSection]", _params, pid); List<PerformanceStandardRuleDO> objs = new List<PerformanceStandardRuleDO>(); while(sr.Read()) { PerformanceStandardRuleDO obj = new PerformanceStandardRuleDO(); obj.PerformanceStandardRuleID = sr.GetInt32(sr.GetOrdinal("PerformanceStandardRuleID")); obj.PermitKey = sr.GetInt32(sr.GetOrdinal("PermitKey")); obj.Section = sr.GetString(sr.GetOrdinal("Section")); obj.SubSection = sr.GetString(sr.GetOrdinal("SubSection")); obj.TOCID = sr.GetInt32(sr.GetOrdinal("TOCID")); if (sr.IsDBNull(sr.GetOrdinal("OperatorComments"))) { obj.OperatorComments = null; } else { obj.OperatorComments = sr.GetString(sr.GetOrdinal("OperatorComments")); } objs.Add(obj); } return objs.ToArray(); }
/// <summary> /// Deletes a PerformanceStandardRule record /// </summary> public static async Task<int> DeleteAsync(PerformanceStandardRuleDO DO) { SqlParameter _PerformanceStandardRuleID = new SqlParameter("PerformanceStandardRuleID", SqlDbType.Int); _PerformanceStandardRuleID.Value = DO.PerformanceStandardRuleID; SqlParameter[] _params = new SqlParameter[] { _PerformanceStandardRuleID }; string pid = ConfigurationManager.AppSettings["ePermitDAL"]; return await DataCommon.ExecuteScalarAsync("[dbo].[PerformanceStandardRule_Delete]", _params, pid); }