/// <summary> /// Creates a new AVS record /// </summary> public static int Create(AVSDO DO) { SqlParameter _AVSTypeID = new SqlParameter("AVSTypeID", 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.Decimal); SqlParameter _BondIssuanceDate = new SqlParameter("BondIssuanceDate", SqlDbType.DateTime); SqlParameter _NOVCONumber = new SqlParameter("NOVCONumber", SqlDbType.VarChar); SqlParameter _MSHAID = new SqlParameter("MSHAID", SqlDbType.VarChar); SqlParameter _AbatementActionsTaken = new SqlParameter("AbatementActionsTaken", SqlDbType.VarChar); SqlParameter _NameOfPersonCompanyOrganization = new SqlParameter("NameOfPersonCompanyOrganization", SqlDbType.VarChar); _AVSTypeID.Value = DO.AVSTypeID; _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; _NOVCONumber.Value = DO.NOVCONumber; _MSHAID.Value = DO.MSHAID; _AbatementActionsTaken.Value = DO.AbatementActionsTaken; _NameOfPersonCompanyOrganization.Value = DO.NameOfPersonCompanyOrganization; SqlParameter[] _params = new SqlParameter[] { _AVSTypeID, _PermitKey, _DateOfIssuance, _NameOfRegulatoryAuthority, _ReasonForAction, _CurrentStatus, _ProceedingTypeID, _DateOfProceedings, _LocationOfProceedings, _CurrentStatusOfProceedings, _DateOfForfeiture, _BondAmount, _BondIssuanceDate, _NOVCONumber, _MSHAID, _AbatementActionsTaken, _NameOfPersonCompanyOrganization }; return DataCommon.ExecuteScalar("[dbo].[AVS_Insert]", _params, "dbo"); }
/// <summary> /// Deletes a AVS record /// </summary> public static int Delete(AVSDO DO) { SqlParameter _AVSID = new SqlParameter("AVSID", SqlDbType.Int); _AVSID.Value = DO.AVSID; SqlParameter[] _params = new SqlParameter[] { _AVSID }; return DataCommon.ExecuteScalar("[dbo].[AVS_Delete]", _params, "dbo"); }
/// <summary> /// Selects AVS records by PK /// </summary> public static AVSDO[] GetByPK(Int32 AVSID) { SqlParameter _AVSID = new SqlParameter("AVSID", SqlDbType.Int); _AVSID.Value = AVSID; SqlParameter[] _params = new SqlParameter[] { _AVSID }; SafeReader sr = DataCommon.ExecuteSafeReader("[dbo].[AVS_GetByPK]", _params, "dbo"); List<AVSDO> objs = new List<AVSDO>(); while(sr.Read()) { AVSDO obj = new AVSDO(); obj.AVSID = sr.GetInt32(sr.GetOrdinal("AVSID")); obj.AVSTypeID = sr.GetString(sr.GetOrdinal("AVSTypeID")); 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")); obj.ProceedingTypeID = sr.GetString(sr.GetOrdinal("ProceedingTypeID")); obj.DateOfProceedings = sr.GetDateTime(sr.GetOrdinal("DateOfProceedings")); obj.LocationOfProceedings = sr.GetString(sr.GetOrdinal("LocationOfProceedings")); 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.GetDecimal(sr.GetOrdinal("BondAmount")); } if (sr.IsDBNull(sr.GetOrdinal("BondIssuanceDate"))) { obj.BondIssuanceDate = null; } else { obj.BondIssuanceDate = sr.GetDateTime(sr.GetOrdinal("BondIssuanceDate")); } if (sr.IsDBNull(sr.GetOrdinal("NOVCONumber"))) { obj.NOVCONumber = null; } else { obj.NOVCONumber = sr.GetString(sr.GetOrdinal("NOVCONumber")); } if (sr.IsDBNull(sr.GetOrdinal("MSHAID"))) { obj.MSHAID = null; } else { obj.MSHAID = sr.GetString(sr.GetOrdinal("MSHAID")); } if (sr.IsDBNull(sr.GetOrdinal("AbatementActionsTaken"))) { obj.AbatementActionsTaken = null; } else { obj.AbatementActionsTaken = sr.GetString(sr.GetOrdinal("AbatementActionsTaken")); } if (sr.IsDBNull(sr.GetOrdinal("NameOfPersonCompanyOrganization"))) { obj.NameOfPersonCompanyOrganization = null; } else { obj.NameOfPersonCompanyOrganization = sr.GetString(sr.GetOrdinal("NameOfPersonCompanyOrganization")); } objs.Add(obj); } return objs.ToArray(); }