/// <summary> /// Creates a new instance of the UserPermitVM /// </summary> /// <param name="permit"></param> /// <param name="user"></param> public UserPermitVM(PermitDO permit, myCoalUser user) { Permit = permit; User = user; List<PermitRegistrationBO> registrations = PermitRegistrationBLL.GetPermitRegistrationsByRegistrationID(User.RegistrationId); Registration = registrations.Where(r => r.PermitRegistration.PermitKey == Permit.PermitKey).FirstOrDefault(); }
/// <summary> /// Updates a Permit record and returns the number of records affected /// </summary> public static async Task<int> UpdateAsync(PermitDO DO) { SqlParameter _PermitKey = new SqlParameter("PermitKey", SqlDbType.Int); SqlParameter _PermitID = new SqlParameter("PermitID", SqlDbType.VarChar); SqlParameter _ApplicationTypeID = new SqlParameter("ApplicationTypeID", SqlDbType.VarChar); SqlParameter _PermitStatusID = new SqlParameter("PermitStatusID", SqlDbType.VarChar); SqlParameter _StatusDate = new SqlParameter("StatusDate", SqlDbType.DateTime); SqlParameter _ApplicationNumber = new SqlParameter("ApplicationNumber", SqlDbType.VarChar); SqlParameter _ApplicationDescriptionOfInterests = new SqlParameter("ApplicationDescriptionOfInterests", SqlDbType.VarChar); SqlParameter _SiteName = new SqlParameter("SiteName", SqlDbType.VarChar); SqlParameter _MineTypeID = new SqlParameter("MineTypeID", SqlDbType.VarChar); SqlParameter _MSHAID = new SqlParameter("MSHAID", SqlDbType.VarChar); SqlParameter _ProposedReminedAcres = new SqlParameter("ProposedReminedAcres", SqlDbType.Int); SqlParameter _LegalDescriptionOfAccess = new SqlParameter("LegalDescriptionOfAccess", SqlDbType.VarChar); SqlParameter _Latitude = new SqlParameter("Latitude", SqlDbType.VarChar); SqlParameter _Longitude = new SqlParameter("Longitude", SqlDbType.VarChar); SqlParameter _NewspaperName = new SqlParameter("NewspaperName", SqlDbType.VarChar); SqlParameter _NearestTown = new SqlParameter("NearestTown", SqlDbType.VarChar); SqlParameter _LegalRightToEnter = new SqlParameter("LegalRightToEnter", SqlDbType.VarChar); SqlParameter _LitigationStatus = new SqlParameter("LitigationStatus", SqlDbType.Bit); SqlParameter _StatusOfLitigation = new SqlParameter("StatusOfLitigation", SqlDbType.VarChar); SqlParameter _LandsUnsuitable = new SqlParameter("LandsUnsuitable", SqlDbType.Bit); SqlParameter _LifeOfMineYears = new SqlParameter("LifeOfMineYears", SqlDbType.Int); SqlParameter _AnnualAnticipatedProductionInTons = new SqlParameter("AnnualAnticipatedProductionInTons", SqlDbType.Int); SqlParameter _TotalAnticipatedProductionInTons = new SqlParameter("TotalAnticipatedProductionInTons", SqlDbType.Int); SqlParameter _LifeOfMineComments = new SqlParameter("LifeOfMineComments", SqlDbType.VarChar); SqlParameter _OtherBondFormDescription = new SqlParameter("OtherBondFormDescription", SqlDbType.VarChar); SqlParameter _CulturalResourcesDescription = new SqlParameter("CulturalResourcesDescription", SqlDbType.VarChar); SqlParameter _UniqueSpecialCharacteristicsAndGeologicFormations = new SqlParameter("UniqueSpecialCharacteristicsAndGeologicFormations", SqlDbType.VarChar); SqlParameter _UniqueSpecialCharacteristicsAdverselyAffectedByMining = new SqlParameter("UniqueSpecialCharacteristicsAdverselyAffectedByMining", SqlDbType.Bit); SqlParameter _GeologicInformationUndesirable = new SqlParameter("GeologicInformationUndesirable", SqlDbType.Bit); SqlParameter _AverageWindDirection = new SqlParameter("AverageWindDirection", SqlDbType.VarChar); SqlParameter _AverageWindVelocity = new SqlParameter("AverageWindVelocity", SqlDbType.Decimal); SqlParameter _PrimeFarmlandInvestigation = new SqlParameter("PrimeFarmlandInvestigation", SqlDbType.Bit); SqlParameter _ResourcesAffectedByProposedOperation = new SqlParameter("ResourcesAffectedByProposedOperation", SqlDbType.Bit); SqlParameter _ResourcesAffectedByProposedOperationDescription = new SqlParameter("ResourcesAffectedByProposedOperationDescription", SqlDbType.VarChar); SqlParameter _ProposedMiningWithinPublicRoads = new SqlParameter("ProposedMiningWithinPublicRoads", SqlDbType.Bit); SqlParameter _ProposedMiningWithinPublicRoadsDescription = new SqlParameter("ProposedMiningWithinPublicRoadsDescription", SqlDbType.VarChar); SqlParameter _AdjacentToValleyHoldingStream = new SqlParameter("AdjacentToValleyHoldingStream", SqlDbType.Bit); SqlParameter _AlluvialValleyFloorDeterminationRequested = new SqlParameter("AlluvialValleyFloorDeterminationRequested", SqlDbType.Bit); SqlParameter _TypeAndMethodOfMiningPlanDescription = new SqlParameter("TypeAndMethodOfMiningPlanDescription", SqlDbType.VarChar); SqlParameter _AnnualAnticipatedMiningProductionInTons = new SqlParameter("AnnualAnticipatedMiningProductionInTons", SqlDbType.Int); SqlParameter _TotalAnticipatedMiningProductionInTons = new SqlParameter("TotalAnticipatedMiningProductionInTons", SqlDbType.Int); SqlParameter _TotalMiningReservesInTons = new SqlParameter("TotalMiningReservesInTons", SqlDbType.Int); SqlParameter _ToxicAndUndesirableMaterialsDisposalPlan = new SqlParameter("ToxicAndUndesirableMaterialsDisposalPlan", SqlDbType.VarChar); SqlParameter _FireContingencyPlan = new SqlParameter("FireContingencyPlan", SqlDbType.VarChar); SqlParameter _ComplianceWithAirAndWaterQualityLaws = new SqlParameter("ComplianceWithAirAndWaterQualityLaws", SqlDbType.VarChar); SqlParameter _NoxiousWeedsManagementPlan = new SqlParameter("NoxiousWeedsManagementPlan", SqlDbType.VarChar); SqlParameter _BlastingPlan = new SqlParameter("BlastingPlan", SqlDbType.VarChar); SqlParameter _AirPollutionControlPlan = new SqlParameter("AirPollutionControlPlan", SqlDbType.VarChar); SqlParameter _FishAndWildlifePlan = new SqlParameter("FishAndWildlifePlan", SqlDbType.VarChar); SqlParameter _MiningConductedWithin500FeetUndergroundMine = new SqlParameter("MiningConductedWithin500FeetUndergroundMine", SqlDbType.Bit); SqlParameter _MiningConductedWithin500FeetUndergroundMineDescription = new SqlParameter("MiningConductedWithin500FeetUndergroundMineDescription", SqlDbType.VarChar); SqlParameter _DiversionConstructed = new SqlParameter("DiversionConstructed", SqlDbType.Bit); SqlParameter _DisposalOfExcessSpoilRequired = new SqlParameter("DisposalOfExcessSpoilRequired", SqlDbType.Bit); SqlParameter _TransportationFacilitiesPlanDescription = new SqlParameter("TransportationFacilitiesPlanDescription", SqlDbType.VarChar); SqlParameter _CoalConservationPlanDescription = new SqlParameter("CoalConservationPlanDescription", SqlDbType.VarChar); SqlParameter _AugerMiningIncluded = new SqlParameter("AugerMiningIncluded", SqlDbType.Bit); SqlParameter _AugerMiningPlanDescription = new SqlParameter("AugerMiningPlanDescription", SqlDbType.VarChar); SqlParameter _BackfillAndGradingPlanDescription = new SqlParameter("BackfillAndGradingPlanDescription", SqlDbType.VarChar); SqlParameter _DrainageBasinReclamationPlanDescription = new SqlParameter("DrainageBasinReclamationPlanDescription", SqlDbType.VarChar); SqlParameter _SoilHandlingPlanDescription = new SqlParameter("SoilHandlingPlanDescription", SqlDbType.VarChar); SqlParameter _PostmineRevegetationTypesDiscussion = new SqlParameter("PostmineRevegetationTypesDiscussion", SqlDbType.VarChar); SqlParameter _SealedMineOpeningsPlanDescription = new SqlParameter("SealedMineOpeningsPlanDescription", SqlDbType.VarChar); SqlParameter _CADDrawing = new SqlParameter("CADDrawing", SqlDbType.Bit); SqlParameter _Completeness = new SqlParameter("Completeness", SqlDbType.Bit); SqlParameter _Acceptability = new SqlParameter("Acceptability", SqlDbType.Bit); SqlParameter _AccessCode = new SqlParameter("AccessCode", SqlDbType.VarChar); SqlParameter _AssignedTo = new SqlParameter("AssignedTo", SqlDbType.VarChar); SqlParameter _CompletenessRound = new SqlParameter("CompletenessRound", SqlDbType.TinyInt); SqlParameter _AcceptabilityRound = new SqlParameter("AcceptabilityRound", SqlDbType.TinyInt); SqlParameter _FacilitiesManagementPlan = new SqlParameter("FacilitiesManagementPlan", SqlDbType.VarChar); SqlParameter _FacilitiesReclamationPlan = new SqlParameter("FacilitiesReclamationPlan", SqlDbType.VarChar); SqlParameter _CoalPreparation = new SqlParameter("CoalPreparation", SqlDbType.Bit); SqlParameter _BondSurety = new SqlParameter("BondSurety", SqlDbType.Bit); SqlParameter _BondCollateral = new SqlParameter("BondCollateral", SqlDbType.Bit); SqlParameter _ExpirationDateOfInsurance = new SqlParameter("ExpirationDateOfInsurance", SqlDbType.DateTime); SqlParameter _MasterCAD = new SqlParameter("MasterCAD", SqlDbType.Bit); SqlParameter _GeologicInformationMiningIdentified = new SqlParameter("GeologicInformationMiningIdentified", SqlDbType.Bit); SqlParameter _NotAllCoalWillBeMined = new SqlParameter("NotAllCoalWillBeMined", SqlDbType.Bit); SqlParameter _EndOfLifeActivitiesComments = new SqlParameter("EndOfLifeActivitiesComments", SqlDbType.VarChar); SqlParameter _PreviouslyMined = new SqlParameter("PreviouslyMined", SqlDbType.Bit); SqlParameter _GeneralPlanForSedimentationPondsAndWaterImpoundments = new SqlParameter("GeneralPlanForSedimentationPondsAndWaterImpoundments", SqlDbType.VarChar); SqlParameter _PostMineLandUseComments = new SqlParameter("PostMineLandUseComments", SqlDbType.VarChar); SqlParameter _LandUseComments = new SqlParameter("LandUseComments", SqlDbType.VarChar); SqlParameter _ReviewStateID = new SqlParameter("ReviewStateID", SqlDbType.VarChar); SqlParameter _OtherPermitInformationProspecting = new SqlParameter("OtherPermitInformationProspecting", SqlDbType.VarChar); SqlParameter _OtherPermitInformationBonding = new SqlParameter("OtherPermitInformationBonding", SqlDbType.VarChar); SqlParameter _OtherPermitInformationSpecialDepartmentalProgramProcedures = new SqlParameter("OtherPermitInformationSpecialDepartmentalProgramProcedures", SqlDbType.VarChar); SqlParameter _OtherPermitInformationMiscellaneousProvisions = new SqlParameter("OtherPermitInformationMiscellaneousProvisions", SqlDbType.VarChar); SqlParameter _OtherPermitInformationDefinitions = new SqlParameter("OtherPermitInformationDefinitions", SqlDbType.Bit); SqlParameter _OtherPermitInformationFormatSupplementalInformation = new SqlParameter("OtherPermitInformationFormatSupplementalInformation", SqlDbType.Bit); SqlParameter _SynchTo = new SqlParameter("SynchTo", SqlDbType.Int); SqlParameter _RevisionDescription = new SqlParameter("RevisionDescription", SqlDbType.VarChar); SqlParameter _PendingWithdraw = new SqlParameter("PendingWithdraw", SqlDbType.VarChar); _PermitKey.Value = DO.PermitKey; _PermitID.Value = DO.PermitID; _ApplicationTypeID.Value = DO.ApplicationTypeID; _PermitStatusID.Value = DO.PermitStatusID; _StatusDate.Value = DO.StatusDate; _ApplicationNumber.Value = DO.ApplicationNumber; _ApplicationDescriptionOfInterests.Value = DO.ApplicationDescriptionOfInterests; _SiteName.Value = DO.SiteName; _MineTypeID.Value = DO.MineTypeID; _MSHAID.Value = DO.MSHAID; _ProposedReminedAcres.Value = DO.ProposedReminedAcres; _LegalDescriptionOfAccess.Value = DO.LegalDescriptionOfAccess; _Latitude.Value = DO.Latitude; _Longitude.Value = DO.Longitude; _NewspaperName.Value = DO.NewspaperName; _NearestTown.Value = DO.NearestTown; _LegalRightToEnter.Value = DO.LegalRightToEnter; _LitigationStatus.Value = DO.LitigationStatus; _StatusOfLitigation.Value = DO.StatusOfLitigation; _LandsUnsuitable.Value = DO.LandsUnsuitable; _LifeOfMineYears.Value = DO.LifeOfMineYears; _AnnualAnticipatedProductionInTons.Value = DO.AnnualAnticipatedProductionInTons; _TotalAnticipatedProductionInTons.Value = DO.TotalAnticipatedProductionInTons; _LifeOfMineComments.Value = DO.LifeOfMineComments; _OtherBondFormDescription.Value = DO.OtherBondFormDescription; _CulturalResourcesDescription.Value = DO.CulturalResourcesDescription; _UniqueSpecialCharacteristicsAndGeologicFormations.Value = DO.UniqueSpecialCharacteristicsAndGeologicFormations; _UniqueSpecialCharacteristicsAdverselyAffectedByMining.Value = DO.UniqueSpecialCharacteristicsAdverselyAffectedByMining; _GeologicInformationUndesirable.Value = DO.GeologicInformationUndesirable; _AverageWindDirection.Value = DO.AverageWindDirection; _AverageWindVelocity.Value = DO.AverageWindVelocity; _PrimeFarmlandInvestigation.Value = DO.PrimeFarmlandInvestigation; _ResourcesAffectedByProposedOperation.Value = DO.ResourcesAffectedByProposedOperation; _ResourcesAffectedByProposedOperationDescription.Value = DO.ResourcesAffectedByProposedOperationDescription; _ProposedMiningWithinPublicRoads.Value = DO.ProposedMiningWithinPublicRoads; _ProposedMiningWithinPublicRoadsDescription.Value = DO.ProposedMiningWithinPublicRoadsDescription; _AdjacentToValleyHoldingStream.Value = DO.AdjacentToValleyHoldingStream; _AlluvialValleyFloorDeterminationRequested.Value = DO.AlluvialValleyFloorDeterminationRequested; _TypeAndMethodOfMiningPlanDescription.Value = DO.TypeAndMethodOfMiningPlanDescription; _AnnualAnticipatedMiningProductionInTons.Value = DO.AnnualAnticipatedMiningProductionInTons; _TotalAnticipatedMiningProductionInTons.Value = DO.TotalAnticipatedMiningProductionInTons; _TotalMiningReservesInTons.Value = DO.TotalMiningReservesInTons; _ToxicAndUndesirableMaterialsDisposalPlan.Value = DO.ToxicAndUndesirableMaterialsDisposalPlan; _FireContingencyPlan.Value = DO.FireContingencyPlan; _ComplianceWithAirAndWaterQualityLaws.Value = DO.ComplianceWithAirAndWaterQualityLaws; _NoxiousWeedsManagementPlan.Value = DO.NoxiousWeedsManagementPlan; _BlastingPlan.Value = DO.BlastingPlan; _AirPollutionControlPlan.Value = DO.AirPollutionControlPlan; _FishAndWildlifePlan.Value = DO.FishAndWildlifePlan; _MiningConductedWithin500FeetUndergroundMine.Value = DO.MiningConductedWithin500FeetUndergroundMine; _MiningConductedWithin500FeetUndergroundMineDescription.Value = DO.MiningConductedWithin500FeetUndergroundMineDescription; _DiversionConstructed.Value = DO.DiversionConstructed; _DisposalOfExcessSpoilRequired.Value = DO.DisposalOfExcessSpoilRequired; _TransportationFacilitiesPlanDescription.Value = DO.TransportationFacilitiesPlanDescription; _CoalConservationPlanDescription.Value = DO.CoalConservationPlanDescription; _AugerMiningIncluded.Value = DO.AugerMiningIncluded; _AugerMiningPlanDescription.Value = DO.AugerMiningPlanDescription; _BackfillAndGradingPlanDescription.Value = DO.BackfillAndGradingPlanDescription; _DrainageBasinReclamationPlanDescription.Value = DO.DrainageBasinReclamationPlanDescription; _SoilHandlingPlanDescription.Value = DO.SoilHandlingPlanDescription; _PostmineRevegetationTypesDiscussion.Value = DO.PostmineRevegetationTypesDiscussion; _SealedMineOpeningsPlanDescription.Value = DO.SealedMineOpeningsPlanDescription; _CADDrawing.Value = DO.CADDrawing; _Completeness.Value = DO.Completeness; _Acceptability.Value = DO.Acceptability; _AccessCode.Value = DO.AccessCode; _AssignedTo.Value = DO.AssignedTo; _CompletenessRound.Value = DO.CompletenessRound; _AcceptabilityRound.Value = DO.AcceptabilityRound; _FacilitiesManagementPlan.Value = DO.FacilitiesManagementPlan; _FacilitiesReclamationPlan.Value = DO.FacilitiesReclamationPlan; _CoalPreparation.Value = DO.CoalPreparation; _BondSurety.Value = DO.BondSurety; _BondCollateral.Value = DO.BondCollateral; _ExpirationDateOfInsurance.Value = DO.ExpirationDateOfInsurance; _MasterCAD.Value = DO.MasterCAD; _GeologicInformationMiningIdentified.Value = DO.GeologicInformationMiningIdentified; _NotAllCoalWillBeMined.Value = DO.NotAllCoalWillBeMined; _EndOfLifeActivitiesComments.Value = DO.EndOfLifeActivitiesComments; _PreviouslyMined.Value = DO.PreviouslyMined; _GeneralPlanForSedimentationPondsAndWaterImpoundments.Value = DO.GeneralPlanForSedimentationPondsAndWaterImpoundments; _PostMineLandUseComments.Value = DO.PostMineLandUseComments; _LandUseComments.Value = DO.LandUseComments; _ReviewStateID.Value = DO.ReviewStateID; _OtherPermitInformationProspecting.Value = DO.OtherPermitInformationProspecting; _OtherPermitInformationBonding.Value = DO.OtherPermitInformationBonding; _OtherPermitInformationSpecialDepartmentalProgramProcedures.Value = DO.OtherPermitInformationSpecialDepartmentalProgramProcedures; _OtherPermitInformationMiscellaneousProvisions.Value = DO.OtherPermitInformationMiscellaneousProvisions; _OtherPermitInformationDefinitions.Value = DO.OtherPermitInformationDefinitions; _OtherPermitInformationFormatSupplementalInformation.Value = DO.OtherPermitInformationFormatSupplementalInformation; _SynchTo.Value = DO.SynchTo; _RevisionDescription.Value = DO.RevisionDescription; _PendingWithdraw.Value = DO.PendingWithdraw; SqlParameter[] _params = new SqlParameter[] { _PermitKey, _PermitID, _ApplicationTypeID, _PermitStatusID, _StatusDate, _ApplicationNumber, _ApplicationDescriptionOfInterests, _SiteName, _MineTypeID, _MSHAID, _ProposedReminedAcres, _LegalDescriptionOfAccess, _Latitude, _Longitude, _NewspaperName, _NearestTown, _LegalRightToEnter, _LitigationStatus, _StatusOfLitigation, _LandsUnsuitable, _LifeOfMineYears, _AnnualAnticipatedProductionInTons, _TotalAnticipatedProductionInTons, _LifeOfMineComments, _OtherBondFormDescription, _CulturalResourcesDescription, _UniqueSpecialCharacteristicsAndGeologicFormations, _UniqueSpecialCharacteristicsAdverselyAffectedByMining, _GeologicInformationUndesirable, _AverageWindDirection, _AverageWindVelocity, _PrimeFarmlandInvestigation, _ResourcesAffectedByProposedOperation, _ResourcesAffectedByProposedOperationDescription, _ProposedMiningWithinPublicRoads, _ProposedMiningWithinPublicRoadsDescription, _AdjacentToValleyHoldingStream, _AlluvialValleyFloorDeterminationRequested, _TypeAndMethodOfMiningPlanDescription, _AnnualAnticipatedMiningProductionInTons, _TotalAnticipatedMiningProductionInTons, _TotalMiningReservesInTons, _ToxicAndUndesirableMaterialsDisposalPlan, _FireContingencyPlan, _ComplianceWithAirAndWaterQualityLaws, _NoxiousWeedsManagementPlan, _BlastingPlan, _AirPollutionControlPlan, _FishAndWildlifePlan, _MiningConductedWithin500FeetUndergroundMine, _MiningConductedWithin500FeetUndergroundMineDescription, _DiversionConstructed, _DisposalOfExcessSpoilRequired, _TransportationFacilitiesPlanDescription, _CoalConservationPlanDescription, _AugerMiningIncluded, _AugerMiningPlanDescription, _BackfillAndGradingPlanDescription, _DrainageBasinReclamationPlanDescription, _SoilHandlingPlanDescription, _PostmineRevegetationTypesDiscussion, _SealedMineOpeningsPlanDescription, _CADDrawing, _Completeness, _Acceptability, _AccessCode, _AssignedTo, _CompletenessRound, _AcceptabilityRound, _FacilitiesManagementPlan, _FacilitiesReclamationPlan, _CoalPreparation, _BondSurety, _BondCollateral, _ExpirationDateOfInsurance, _MasterCAD, _GeologicInformationMiningIdentified, _NotAllCoalWillBeMined, _EndOfLifeActivitiesComments, _PreviouslyMined, _GeneralPlanForSedimentationPondsAndWaterImpoundments, _PostMineLandUseComments, _LandUseComments, _ReviewStateID, _OtherPermitInformationProspecting, _OtherPermitInformationBonding, _OtherPermitInformationSpecialDepartmentalProgramProcedures, _OtherPermitInformationMiscellaneousProvisions, _OtherPermitInformationDefinitions, _OtherPermitInformationFormatSupplementalInformation, _SynchTo, _RevisionDescription, _PendingWithdraw }; string pid = ConfigurationManager.AppSettings["ePermitDAL"]; return await DataCommon.ExecuteScalarAsync("[dbo].[Permit_Update]", _params, pid); }
/// <summary> /// Selects Permit records by PK /// </summary> public static async Task<PermitDO[]> GetByPKAsync(Int32 PermitKey) { SqlParameter _PermitKey = new SqlParameter("PermitKey", SqlDbType.Int); _PermitKey.Value = PermitKey; SqlParameter[] _params = new SqlParameter[] { _PermitKey }; string pid = ConfigurationManager.AppSettings["ePermitDAL"]; SafeReader sr = await DataCommon.ExecuteSafeReaderAsync("[dbo].[Permit_GetByPK]", _params, pid); List<PermitDO> objs = new List<PermitDO>(); while(sr.Read()) { PermitDO obj = new PermitDO(); obj.PermitKey = sr.GetInt32(sr.GetOrdinal("PermitKey")); obj.ApplicationTypeID = sr.GetString(sr.GetOrdinal("ApplicationTypeID")); obj.PermitStatusID = sr.GetString(sr.GetOrdinal("PermitStatusID")); obj.SiteName = sr.GetString(sr.GetOrdinal("SiteName")); obj.AccessCode = sr.GetString(sr.GetOrdinal("AccessCode")); if (sr.IsDBNull(sr.GetOrdinal("PermitID"))) { obj.PermitID = null; } else { obj.PermitID = sr.GetString(sr.GetOrdinal("PermitID")); } if (sr.IsDBNull(sr.GetOrdinal("StatusDate"))) { obj.StatusDate = null; } else { obj.StatusDate = sr.GetDateTime(sr.GetOrdinal("StatusDate")); } if (sr.IsDBNull(sr.GetOrdinal("ApplicationNumber"))) { obj.ApplicationNumber = null; } else { obj.ApplicationNumber = sr.GetString(sr.GetOrdinal("ApplicationNumber")); } if (sr.IsDBNull(sr.GetOrdinal("ApplicationDescriptionOfInterests"))) { obj.ApplicationDescriptionOfInterests = null; } else { obj.ApplicationDescriptionOfInterests = sr.GetString(sr.GetOrdinal("ApplicationDescriptionOfInterests")); } if (sr.IsDBNull(sr.GetOrdinal("MineTypeID"))) { obj.MineTypeID = null; } else { obj.MineTypeID = sr.GetString(sr.GetOrdinal("MineTypeID")); } if (sr.IsDBNull(sr.GetOrdinal("MSHAID"))) { obj.MSHAID = null; } else { obj.MSHAID = sr.GetString(sr.GetOrdinal("MSHAID")); } if (sr.IsDBNull(sr.GetOrdinal("ProposedReminedAcres"))) { obj.ProposedReminedAcres = null; } else { obj.ProposedReminedAcres = sr.GetInt32(sr.GetOrdinal("ProposedReminedAcres")); } if (sr.IsDBNull(sr.GetOrdinal("LegalDescriptionOfAccess"))) { obj.LegalDescriptionOfAccess = null; } else { obj.LegalDescriptionOfAccess = sr.GetString(sr.GetOrdinal("LegalDescriptionOfAccess")); } if (sr.IsDBNull(sr.GetOrdinal("Latitude"))) { obj.Latitude = null; } else { obj.Latitude = sr.GetString(sr.GetOrdinal("Latitude")); } if (sr.IsDBNull(sr.GetOrdinal("Longitude"))) { obj.Longitude = null; } else { obj.Longitude = sr.GetString(sr.GetOrdinal("Longitude")); } if (sr.IsDBNull(sr.GetOrdinal("NewspaperName"))) { obj.NewspaperName = null; } else { obj.NewspaperName = sr.GetString(sr.GetOrdinal("NewspaperName")); } if (sr.IsDBNull(sr.GetOrdinal("NearestTown"))) { obj.NearestTown = null; } else { obj.NearestTown = sr.GetString(sr.GetOrdinal("NearestTown")); } if (sr.IsDBNull(sr.GetOrdinal("LegalRightToEnter"))) { obj.LegalRightToEnter = null; } else { obj.LegalRightToEnter = sr.GetString(sr.GetOrdinal("LegalRightToEnter")); } if (sr.IsDBNull(sr.GetOrdinal("LitigationStatus"))) { obj.LitigationStatus = null; } else { obj.LitigationStatus = sr.GetBoolean(sr.GetOrdinal("LitigationStatus")); } if (sr.IsDBNull(sr.GetOrdinal("StatusOfLitigation"))) { obj.StatusOfLitigation = null; } else { obj.StatusOfLitigation = sr.GetString(sr.GetOrdinal("StatusOfLitigation")); } if (sr.IsDBNull(sr.GetOrdinal("LandsUnsuitable"))) { obj.LandsUnsuitable = null; } else { obj.LandsUnsuitable = sr.GetBoolean(sr.GetOrdinal("LandsUnsuitable")); } if (sr.IsDBNull(sr.GetOrdinal("LifeOfMineYears"))) { obj.LifeOfMineYears = null; } else { obj.LifeOfMineYears = sr.GetInt32(sr.GetOrdinal("LifeOfMineYears")); } if (sr.IsDBNull(sr.GetOrdinal("AnnualAnticipatedProductionInTons"))) { obj.AnnualAnticipatedProductionInTons = null; } else { obj.AnnualAnticipatedProductionInTons = sr.GetInt32(sr.GetOrdinal("AnnualAnticipatedProductionInTons")); } if (sr.IsDBNull(sr.GetOrdinal("TotalAnticipatedProductionInTons"))) { obj.TotalAnticipatedProductionInTons = null; } else { obj.TotalAnticipatedProductionInTons = sr.GetInt32(sr.GetOrdinal("TotalAnticipatedProductionInTons")); } if (sr.IsDBNull(sr.GetOrdinal("LifeOfMineComments"))) { obj.LifeOfMineComments = null; } else { obj.LifeOfMineComments = sr.GetString(sr.GetOrdinal("LifeOfMineComments")); } if (sr.IsDBNull(sr.GetOrdinal("OtherBondFormDescription"))) { obj.OtherBondFormDescription = null; } else { obj.OtherBondFormDescription = sr.GetString(sr.GetOrdinal("OtherBondFormDescription")); } if (sr.IsDBNull(sr.GetOrdinal("CulturalResourcesDescription"))) { obj.CulturalResourcesDescription = null; } else { obj.CulturalResourcesDescription = sr.GetString(sr.GetOrdinal("CulturalResourcesDescription")); } if (sr.IsDBNull(sr.GetOrdinal("UniqueSpecialCharacteristicsAndGeologicFormations"))) { obj.UniqueSpecialCharacteristicsAndGeologicFormations = null; } else { obj.UniqueSpecialCharacteristicsAndGeologicFormations = sr.GetString(sr.GetOrdinal("UniqueSpecialCharacteristicsAndGeologicFormations")); } if (sr.IsDBNull(sr.GetOrdinal("UniqueSpecialCharacteristicsAdverselyAffectedByMining"))) { obj.UniqueSpecialCharacteristicsAdverselyAffectedByMining = null; } else { obj.UniqueSpecialCharacteristicsAdverselyAffectedByMining = sr.GetBoolean(sr.GetOrdinal("UniqueSpecialCharacteristicsAdverselyAffectedByMining")); } if (sr.IsDBNull(sr.GetOrdinal("GeologicInformationUndesirable"))) { obj.GeologicInformationUndesirable = null; } else { obj.GeologicInformationUndesirable = sr.GetBoolean(sr.GetOrdinal("GeologicInformationUndesirable")); } if (sr.IsDBNull(sr.GetOrdinal("AverageWindDirection"))) { obj.AverageWindDirection = null; } else { obj.AverageWindDirection = sr.GetString(sr.GetOrdinal("AverageWindDirection")); } if (sr.IsDBNull(sr.GetOrdinal("AverageWindVelocity"))) { obj.AverageWindVelocity = null; } else { obj.AverageWindVelocity = sr.GetDecimal(sr.GetOrdinal("AverageWindVelocity")); } if (sr.IsDBNull(sr.GetOrdinal("PrimeFarmlandInvestigation"))) { obj.PrimeFarmlandInvestigation = null; } else { obj.PrimeFarmlandInvestigation = sr.GetBoolean(sr.GetOrdinal("PrimeFarmlandInvestigation")); } if (sr.IsDBNull(sr.GetOrdinal("ResourcesAffectedByProposedOperation"))) { obj.ResourcesAffectedByProposedOperation = null; } else { obj.ResourcesAffectedByProposedOperation = sr.GetBoolean(sr.GetOrdinal("ResourcesAffectedByProposedOperation")); } if (sr.IsDBNull(sr.GetOrdinal("ResourcesAffectedByProposedOperationDescription"))) { obj.ResourcesAffectedByProposedOperationDescription = null; } else { obj.ResourcesAffectedByProposedOperationDescription = sr.GetString(sr.GetOrdinal("ResourcesAffectedByProposedOperationDescription")); } if (sr.IsDBNull(sr.GetOrdinal("ProposedMiningWithinPublicRoads"))) { obj.ProposedMiningWithinPublicRoads = null; } else { obj.ProposedMiningWithinPublicRoads = sr.GetBoolean(sr.GetOrdinal("ProposedMiningWithinPublicRoads")); } if (sr.IsDBNull(sr.GetOrdinal("ProposedMiningWithinPublicRoadsDescription"))) { obj.ProposedMiningWithinPublicRoadsDescription = null; } else { obj.ProposedMiningWithinPublicRoadsDescription = sr.GetString(sr.GetOrdinal("ProposedMiningWithinPublicRoadsDescription")); } if (sr.IsDBNull(sr.GetOrdinal("AdjacentToValleyHoldingStream"))) { obj.AdjacentToValleyHoldingStream = null; } else { obj.AdjacentToValleyHoldingStream = sr.GetBoolean(sr.GetOrdinal("AdjacentToValleyHoldingStream")); } if (sr.IsDBNull(sr.GetOrdinal("AlluvialValleyFloorDeterminationRequested"))) { obj.AlluvialValleyFloorDeterminationRequested = null; } else { obj.AlluvialValleyFloorDeterminationRequested = sr.GetBoolean(sr.GetOrdinal("AlluvialValleyFloorDeterminationRequested")); } if (sr.IsDBNull(sr.GetOrdinal("TypeAndMethodOfMiningPlanDescription"))) { obj.TypeAndMethodOfMiningPlanDescription = null; } else { obj.TypeAndMethodOfMiningPlanDescription = sr.GetString(sr.GetOrdinal("TypeAndMethodOfMiningPlanDescription")); } if (sr.IsDBNull(sr.GetOrdinal("AnnualAnticipatedMiningProductionInTons"))) { obj.AnnualAnticipatedMiningProductionInTons = null; } else { obj.AnnualAnticipatedMiningProductionInTons = sr.GetInt32(sr.GetOrdinal("AnnualAnticipatedMiningProductionInTons")); } if (sr.IsDBNull(sr.GetOrdinal("TotalAnticipatedMiningProductionInTons"))) { obj.TotalAnticipatedMiningProductionInTons = null; } else { obj.TotalAnticipatedMiningProductionInTons = sr.GetInt32(sr.GetOrdinal("TotalAnticipatedMiningProductionInTons")); } if (sr.IsDBNull(sr.GetOrdinal("TotalMiningReservesInTons"))) { obj.TotalMiningReservesInTons = null; } else { obj.TotalMiningReservesInTons = sr.GetInt32(sr.GetOrdinal("TotalMiningReservesInTons")); } if (sr.IsDBNull(sr.GetOrdinal("ToxicAndUndesirableMaterialsDisposalPlan"))) { obj.ToxicAndUndesirableMaterialsDisposalPlan = null; } else { obj.ToxicAndUndesirableMaterialsDisposalPlan = sr.GetString(sr.GetOrdinal("ToxicAndUndesirableMaterialsDisposalPlan")); } if (sr.IsDBNull(sr.GetOrdinal("FireContingencyPlan"))) { obj.FireContingencyPlan = null; } else { obj.FireContingencyPlan = sr.GetString(sr.GetOrdinal("FireContingencyPlan")); } if (sr.IsDBNull(sr.GetOrdinal("ComplianceWithAirAndWaterQualityLaws"))) { obj.ComplianceWithAirAndWaterQualityLaws = null; } else { obj.ComplianceWithAirAndWaterQualityLaws = sr.GetString(sr.GetOrdinal("ComplianceWithAirAndWaterQualityLaws")); } if (sr.IsDBNull(sr.GetOrdinal("NoxiousWeedsManagementPlan"))) { obj.NoxiousWeedsManagementPlan = null; } else { obj.NoxiousWeedsManagementPlan = sr.GetString(sr.GetOrdinal("NoxiousWeedsManagementPlan")); } if (sr.IsDBNull(sr.GetOrdinal("BlastingPlan"))) { obj.BlastingPlan = null; } else { obj.BlastingPlan = sr.GetString(sr.GetOrdinal("BlastingPlan")); } if (sr.IsDBNull(sr.GetOrdinal("AirPollutionControlPlan"))) { obj.AirPollutionControlPlan = null; } else { obj.AirPollutionControlPlan = sr.GetString(sr.GetOrdinal("AirPollutionControlPlan")); } if (sr.IsDBNull(sr.GetOrdinal("FishAndWildlifePlan"))) { obj.FishAndWildlifePlan = null; } else { obj.FishAndWildlifePlan = sr.GetString(sr.GetOrdinal("FishAndWildlifePlan")); } if (sr.IsDBNull(sr.GetOrdinal("MiningConductedWithin500FeetUndergroundMine"))) { obj.MiningConductedWithin500FeetUndergroundMine = null; } else { obj.MiningConductedWithin500FeetUndergroundMine = sr.GetBoolean(sr.GetOrdinal("MiningConductedWithin500FeetUndergroundMine")); } if (sr.IsDBNull(sr.GetOrdinal("MiningConductedWithin500FeetUndergroundMineDescription"))) { obj.MiningConductedWithin500FeetUndergroundMineDescription = null; } else { obj.MiningConductedWithin500FeetUndergroundMineDescription = sr.GetString(sr.GetOrdinal("MiningConductedWithin500FeetUndergroundMineDescription")); } if (sr.IsDBNull(sr.GetOrdinal("DiversionConstructed"))) { obj.DiversionConstructed = null; } else { obj.DiversionConstructed = sr.GetBoolean(sr.GetOrdinal("DiversionConstructed")); } if (sr.IsDBNull(sr.GetOrdinal("DisposalOfExcessSpoilRequired"))) { obj.DisposalOfExcessSpoilRequired = null; } else { obj.DisposalOfExcessSpoilRequired = sr.GetBoolean(sr.GetOrdinal("DisposalOfExcessSpoilRequired")); } if (sr.IsDBNull(sr.GetOrdinal("TransportationFacilitiesPlanDescription"))) { obj.TransportationFacilitiesPlanDescription = null; } else { obj.TransportationFacilitiesPlanDescription = sr.GetString(sr.GetOrdinal("TransportationFacilitiesPlanDescription")); } if (sr.IsDBNull(sr.GetOrdinal("CoalConservationPlanDescription"))) { obj.CoalConservationPlanDescription = null; } else { obj.CoalConservationPlanDescription = sr.GetString(sr.GetOrdinal("CoalConservationPlanDescription")); } if (sr.IsDBNull(sr.GetOrdinal("AugerMiningIncluded"))) { obj.AugerMiningIncluded = null; } else { obj.AugerMiningIncluded = sr.GetBoolean(sr.GetOrdinal("AugerMiningIncluded")); } if (sr.IsDBNull(sr.GetOrdinal("AugerMiningPlanDescription"))) { obj.AugerMiningPlanDescription = null; } else { obj.AugerMiningPlanDescription = sr.GetString(sr.GetOrdinal("AugerMiningPlanDescription")); } if (sr.IsDBNull(sr.GetOrdinal("BackfillAndGradingPlanDescription"))) { obj.BackfillAndGradingPlanDescription = null; } else { obj.BackfillAndGradingPlanDescription = sr.GetString(sr.GetOrdinal("BackfillAndGradingPlanDescription")); } if (sr.IsDBNull(sr.GetOrdinal("DrainageBasinReclamationPlanDescription"))) { obj.DrainageBasinReclamationPlanDescription = null; } else { obj.DrainageBasinReclamationPlanDescription = sr.GetString(sr.GetOrdinal("DrainageBasinReclamationPlanDescription")); } if (sr.IsDBNull(sr.GetOrdinal("SoilHandlingPlanDescription"))) { obj.SoilHandlingPlanDescription = null; } else { obj.SoilHandlingPlanDescription = sr.GetString(sr.GetOrdinal("SoilHandlingPlanDescription")); } if (sr.IsDBNull(sr.GetOrdinal("PostmineRevegetationTypesDiscussion"))) { obj.PostmineRevegetationTypesDiscussion = null; } else { obj.PostmineRevegetationTypesDiscussion = sr.GetString(sr.GetOrdinal("PostmineRevegetationTypesDiscussion")); } if (sr.IsDBNull(sr.GetOrdinal("SealedMineOpeningsPlanDescription"))) { obj.SealedMineOpeningsPlanDescription = null; } else { obj.SealedMineOpeningsPlanDescription = sr.GetString(sr.GetOrdinal("SealedMineOpeningsPlanDescription")); } if (sr.IsDBNull(sr.GetOrdinal("CADDrawing"))) { obj.CADDrawing = null; } else { obj.CADDrawing = sr.GetBoolean(sr.GetOrdinal("CADDrawing")); } if (sr.IsDBNull(sr.GetOrdinal("Completeness"))) { obj.Completeness = null; } else { obj.Completeness = sr.GetBoolean(sr.GetOrdinal("Completeness")); } if (sr.IsDBNull(sr.GetOrdinal("Acceptability"))) { obj.Acceptability = null; } else { obj.Acceptability = sr.GetBoolean(sr.GetOrdinal("Acceptability")); } if (sr.IsDBNull(sr.GetOrdinal("AssignedTo"))) { obj.AssignedTo = null; } else { obj.AssignedTo = sr.GetString(sr.GetOrdinal("AssignedTo")); } if (sr.IsDBNull(sr.GetOrdinal("CompletenessRound"))) { obj.CompletenessRound = null; } else { obj.CompletenessRound = sr.GetInt16(sr.GetOrdinal("CompletenessRound")); } if (sr.IsDBNull(sr.GetOrdinal("AcceptabilityRound"))) { obj.AcceptabilityRound = null; } else { obj.AcceptabilityRound = sr.GetInt16(sr.GetOrdinal("AcceptabilityRound")); } if (sr.IsDBNull(sr.GetOrdinal("FacilitiesManagementPlan"))) { obj.FacilitiesManagementPlan = null; } else { obj.FacilitiesManagementPlan = sr.GetString(sr.GetOrdinal("FacilitiesManagementPlan")); } if (sr.IsDBNull(sr.GetOrdinal("FacilitiesReclamationPlan"))) { obj.FacilitiesReclamationPlan = null; } else { obj.FacilitiesReclamationPlan = sr.GetString(sr.GetOrdinal("FacilitiesReclamationPlan")); } if (sr.IsDBNull(sr.GetOrdinal("CoalPreparation"))) { obj.CoalPreparation = null; } else { obj.CoalPreparation = sr.GetBoolean(sr.GetOrdinal("CoalPreparation")); } if (sr.IsDBNull(sr.GetOrdinal("BondSurety"))) { obj.BondSurety = null; } else { obj.BondSurety = sr.GetBoolean(sr.GetOrdinal("BondSurety")); } if (sr.IsDBNull(sr.GetOrdinal("BondCollateral"))) { obj.BondCollateral = null; } else { obj.BondCollateral = sr.GetBoolean(sr.GetOrdinal("BondCollateral")); } if (sr.IsDBNull(sr.GetOrdinal("ExpirationDateOfInsurance"))) { obj.ExpirationDateOfInsurance = null; } else { obj.ExpirationDateOfInsurance = sr.GetDateTime(sr.GetOrdinal("ExpirationDateOfInsurance")); } if (sr.IsDBNull(sr.GetOrdinal("MasterCAD"))) { obj.MasterCAD = null; } else { obj.MasterCAD = sr.GetBoolean(sr.GetOrdinal("MasterCAD")); } if (sr.IsDBNull(sr.GetOrdinal("GeologicInformationMiningIdentified"))) { obj.GeologicInformationMiningIdentified = null; } else { obj.GeologicInformationMiningIdentified = sr.GetBoolean(sr.GetOrdinal("GeologicInformationMiningIdentified")); } if (sr.IsDBNull(sr.GetOrdinal("NotAllCoalWillBeMined"))) { obj.NotAllCoalWillBeMined = null; } else { obj.NotAllCoalWillBeMined = sr.GetBoolean(sr.GetOrdinal("NotAllCoalWillBeMined")); } if (sr.IsDBNull(sr.GetOrdinal("EndOfLifeActivitiesComments"))) { obj.EndOfLifeActivitiesComments = null; } else { obj.EndOfLifeActivitiesComments = sr.GetString(sr.GetOrdinal("EndOfLifeActivitiesComments")); } if (sr.IsDBNull(sr.GetOrdinal("PreviouslyMined"))) { obj.PreviouslyMined = null; } else { obj.PreviouslyMined = sr.GetBoolean(sr.GetOrdinal("PreviouslyMined")); } if (sr.IsDBNull(sr.GetOrdinal("GeneralPlanForSedimentationPondsAndWaterImpoundments"))) { obj.GeneralPlanForSedimentationPondsAndWaterImpoundments = null; } else { obj.GeneralPlanForSedimentationPondsAndWaterImpoundments = sr.GetString(sr.GetOrdinal("GeneralPlanForSedimentationPondsAndWaterImpoundments")); } if (sr.IsDBNull(sr.GetOrdinal("PostMineLandUseComments"))) { obj.PostMineLandUseComments = null; } else { obj.PostMineLandUseComments = sr.GetString(sr.GetOrdinal("PostMineLandUseComments")); } if (sr.IsDBNull(sr.GetOrdinal("LandUseComments"))) { obj.LandUseComments = null; } else { obj.LandUseComments = sr.GetString(sr.GetOrdinal("LandUseComments")); } if (sr.IsDBNull(sr.GetOrdinal("ReviewStateID"))) { obj.ReviewStateID = null; } else { obj.ReviewStateID = sr.GetString(sr.GetOrdinal("ReviewStateID")); } if (sr.IsDBNull(sr.GetOrdinal("OtherPermitInformationProspecting"))) { obj.OtherPermitInformationProspecting = null; } else { obj.OtherPermitInformationProspecting = sr.GetString(sr.GetOrdinal("OtherPermitInformationProspecting")); } if (sr.IsDBNull(sr.GetOrdinal("OtherPermitInformationBonding"))) { obj.OtherPermitInformationBonding = null; } else { obj.OtherPermitInformationBonding = sr.GetString(sr.GetOrdinal("OtherPermitInformationBonding")); } if (sr.IsDBNull(sr.GetOrdinal("OtherPermitInformationSpecialDepartmentalProgramProcedures"))) { obj.OtherPermitInformationSpecialDepartmentalProgramProcedures = null; } else { obj.OtherPermitInformationSpecialDepartmentalProgramProcedures = sr.GetString(sr.GetOrdinal("OtherPermitInformationSpecialDepartmentalProgramProcedures")); } if (sr.IsDBNull(sr.GetOrdinal("OtherPermitInformationMiscellaneousProvisions"))) { obj.OtherPermitInformationMiscellaneousProvisions = null; } else { obj.OtherPermitInformationMiscellaneousProvisions = sr.GetString(sr.GetOrdinal("OtherPermitInformationMiscellaneousProvisions")); } if (sr.IsDBNull(sr.GetOrdinal("OtherPermitInformationDefinitions"))) { obj.OtherPermitInformationDefinitions = null; } else { obj.OtherPermitInformationDefinitions = sr.GetBoolean(sr.GetOrdinal("OtherPermitInformationDefinitions")); } if (sr.IsDBNull(sr.GetOrdinal("OtherPermitInformationFormatSupplementalInformation"))) { obj.OtherPermitInformationFormatSupplementalInformation = null; } else { obj.OtherPermitInformationFormatSupplementalInformation = sr.GetBoolean(sr.GetOrdinal("OtherPermitInformationFormatSupplementalInformation")); } if (sr.IsDBNull(sr.GetOrdinal("SynchTo"))) { obj.SynchTo = null; } else { obj.SynchTo = sr.GetInt32(sr.GetOrdinal("SynchTo")); } if (sr.IsDBNull(sr.GetOrdinal("RevisionDescription"))) { obj.RevisionDescription = null; } else { obj.RevisionDescription = sr.GetString(sr.GetOrdinal("RevisionDescription")); } if (sr.IsDBNull(sr.GetOrdinal("PendingWithdraw"))) { obj.PendingWithdraw = null; } else { obj.PendingWithdraw = sr.GetString(sr.GetOrdinal("PendingWithdraw")); } objs.Add(obj); } return objs.ToArray(); }
/// <summary> /// Deletes a Permit record /// </summary> public static async Task<int> DeleteAsync(PermitDO DO) { SqlParameter _PermitKey = new SqlParameter("PermitKey", SqlDbType.Int); _PermitKey.Value = DO.PermitKey; SqlParameter[] _params = new SqlParameter[] { _PermitKey }; string pid = ConfigurationManager.AppSettings["ePermitDAL"]; return await DataCommon.ExecuteScalarAsync("[dbo].[Permit_Delete]", _params, pid); }
public ActionResult NewPermit(NewPermitVM model) { if (!ModelState.IsValid) return PartialView(model); try { PermitDO newPermit = new PermitDO() { SiteName = model.SiteName, ApplicationTypeID = "Permit", PermitID = model.PermitId }; int permitKey = PermitBLL.Save(newPermit, (int)myCoalUser.GetInstance().RegistrationId); AjaxResult result = new AjaxResult(AjaxResult.AjaxStatus.OK, "The permit was created"); result.Data.Add("PermitKey", permitKey); return Json(result); } catch (Exception ex) { AjaxResult result = new AjaxResult(AjaxResult.AjaxStatus.ERROR, ex.Message); return Json(result); } }