/// <summary> /// Creates a new NonCompliance record /// </summary> public static int Create(NonComplianceDO DO) { SqlParameter _NonComplianceTypeID = new SqlParameter("NonComplianceTypeID", SqlDbType.VarChar); SqlParameter _PermitKey = new SqlParameter("PermitKey", SqlDbType.Int); SqlParameter _DateOfIssuance = new SqlParameter("DateOfIssuance", SqlDbType.DateTime); SqlParameter _NameOfRegulatoryAuthority = new SqlParameter("NameOfRegulatoryAuthority", SqlDbType.VarChar); SqlParameter _ReasonForAction = new SqlParameter("ReasonForAction", SqlDbType.VarChar); SqlParameter _CurrentStatus = new SqlParameter("CurrentStatus", SqlDbType.VarChar); SqlParameter _ProceedingTypeID = new SqlParameter("ProceedingTypeID", SqlDbType.VarChar); SqlParameter _DateOfProceedings = new SqlParameter("DateOfProceedings", SqlDbType.DateTime); SqlParameter _LocationOfProceedings = new SqlParameter("LocationOfProceedings", SqlDbType.VarChar); SqlParameter _CurrentStatusOfProceedings = new SqlParameter("CurrentStatusOfProceedings", SqlDbType.VarChar); SqlParameter _DateOfForfeiture = new SqlParameter("DateOfForfeiture", SqlDbType.DateTime); SqlParameter _BondAmount = new SqlParameter("BondAmount", SqlDbType.VarChar); SqlParameter _BondIssuanceDate = new SqlParameter("BondIssuanceDate", SqlDbType.DateTime); _NonComplianceTypeID.Value = DO.NonComplianceTypeID; _PermitKey.Value = DO.PermitKey; _DateOfIssuance.Value = DO.DateOfIssuance; _NameOfRegulatoryAuthority.Value = DO.NameOfRegulatoryAuthority; _ReasonForAction.Value = DO.ReasonForAction; _CurrentStatus.Value = DO.CurrentStatus; _ProceedingTypeID.Value = DO.ProceedingTypeID; _DateOfProceedings.Value = DO.DateOfProceedings; _LocationOfProceedings.Value = DO.LocationOfProceedings; _CurrentStatusOfProceedings.Value = DO.CurrentStatusOfProceedings; _DateOfForfeiture.Value = DO.DateOfForfeiture; _BondAmount.Value = DO.BondAmount; _BondIssuanceDate.Value = DO.BondIssuanceDate; SqlParameter[] _params = new SqlParameter[] { _NonComplianceTypeID, _PermitKey, _DateOfIssuance, _NameOfRegulatoryAuthority, _ReasonForAction, _CurrentStatus, _ProceedingTypeID, _DateOfProceedings, _LocationOfProceedings, _CurrentStatusOfProceedings, _DateOfForfeiture, _BondAmount, _BondIssuanceDate }; string pid = ConfigurationManager.AppSettings["ePermitDAL"]; return DataCommon.ExecuteScalar("[dbo].[NonCompliance_Insert]", _params, pid); }
public NonComplianceDO GetDataObject() { NonComplianceDO data = new NonComplianceDO() { BondAmount = this.BondAmount, BondIssuanceDate = this.BondIssuanceDate, CurrentStatus = this.CurrentStatus, CurrentStatusOfProceedings = this.CurrentStatusOfProceedings, DateOfForfeiture = this.DateOfForfeiture, DateOfIssuance = this.DateOfIssuance, DateOfProceedings = this.DateOfProceedings, LocationOfProceedings = this.LocationOfProceedings, NameOfRegulatoryAuthority = this.NameOfRegulatoryAuthority, NonComplianceID = this.NonComplianceID, NonComplianceTypeID = this.NonComplianceTypeID, PermitKey = this.PermitKey, ProceedingTypeID = this.ProceedingTypeID, ReasonForAction = this.ReasonForAction }; return data; }
/// <summary> /// Selects NonCompliance records by PK /// </summary> public static async Task<NonComplianceDO[]> GetByPKAsync(Int32 NonComplianceID) { SqlParameter _NonComplianceID = new SqlParameter("NonComplianceID", SqlDbType.Int); _NonComplianceID.Value = NonComplianceID; SqlParameter[] _params = new SqlParameter[] { _NonComplianceID }; string pid = ConfigurationManager.AppSettings["ePermitDAL"]; SafeReader sr = await DataCommon.ExecuteSafeReaderAsync("[dbo].[NonCompliance_GetByPK]", _params, pid); List<NonComplianceDO> objs = new List<NonComplianceDO>(); while(sr.Read()) { NonComplianceDO obj = new NonComplianceDO(); obj.NonComplianceID = sr.GetInt32(sr.GetOrdinal("NonComplianceID")); obj.NonComplianceTypeID = sr.GetString(sr.GetOrdinal("NonComplianceTypeID")); obj.PermitKey = sr.GetInt32(sr.GetOrdinal("PermitKey")); obj.DateOfIssuance = sr.GetDateTime(sr.GetOrdinal("DateOfIssuance")); obj.NameOfRegulatoryAuthority = sr.GetString(sr.GetOrdinal("NameOfRegulatoryAuthority")); obj.ReasonForAction = sr.GetString(sr.GetOrdinal("ReasonForAction")); obj.CurrentStatus = sr.GetString(sr.GetOrdinal("CurrentStatus")); if (sr.IsDBNull(sr.GetOrdinal("ProceedingTypeID"))) { obj.ProceedingTypeID = null; } else { obj.ProceedingTypeID = sr.GetString(sr.GetOrdinal("ProceedingTypeID")); } if (sr.IsDBNull(sr.GetOrdinal("DateOfProceedings"))) { obj.DateOfProceedings = null; } else { obj.DateOfProceedings = sr.GetDateTime(sr.GetOrdinal("DateOfProceedings")); } if (sr.IsDBNull(sr.GetOrdinal("LocationOfProceedings"))) { obj.LocationOfProceedings = null; } else { obj.LocationOfProceedings = sr.GetString(sr.GetOrdinal("LocationOfProceedings")); } if (sr.IsDBNull(sr.GetOrdinal("CurrentStatusOfProceedings"))) { obj.CurrentStatusOfProceedings = null; } else { obj.CurrentStatusOfProceedings = sr.GetString(sr.GetOrdinal("CurrentStatusOfProceedings")); } if (sr.IsDBNull(sr.GetOrdinal("DateOfForfeiture"))) { obj.DateOfForfeiture = null; } else { obj.DateOfForfeiture = sr.GetDateTime(sr.GetOrdinal("DateOfForfeiture")); } if (sr.IsDBNull(sr.GetOrdinal("BondAmount"))) { obj.BondAmount = null; } else { obj.BondAmount = sr.GetString(sr.GetOrdinal("BondAmount")); } if (sr.IsDBNull(sr.GetOrdinal("BondIssuanceDate"))) { obj.BondIssuanceDate = null; } else { obj.BondIssuanceDate = sr.GetDateTime(sr.GetOrdinal("BondIssuanceDate")); } objs.Add(obj); } return objs.ToArray(); }
/// <summary> /// Deletes a NonCompliance record /// </summary> public static async Task<int> DeleteAsync(NonComplianceDO DO) { SqlParameter _NonComplianceID = new SqlParameter("NonComplianceID", SqlDbType.Int); _NonComplianceID.Value = DO.NonComplianceID; SqlParameter[] _params = new SqlParameter[] { _NonComplianceID }; string pid = ConfigurationManager.AppSettings["ePermitDAL"]; return await DataCommon.ExecuteScalarAsync("[dbo].[NonCompliance_Delete]", _params, pid); }