예제 #1
0
        /// <summary>
        /// Creates a new MineSiteAcreage record using async
        /// </summary>
        public static async Task CreateAsync(MineSiteAcreageDO DO)
        {
            SqlParameter _PermitKey = new SqlParameter("PermitKey", SqlDbType.Int);
            SqlParameter _MineSiteCategoryID = new SqlParameter("MineSiteCategoryID", SqlDbType.VarChar);
            SqlParameter _MineSiteTopicID = new SqlParameter("MineSiteTopicID", SqlDbType.VarChar);
            SqlParameter _ProposedAmount = new SqlParameter("ProposedAmount", SqlDbType.BigInt);
            
            _PermitKey.Value = DO.PermitKey;
            _MineSiteCategoryID.Value = DO.MineSiteCategoryID;
            _MineSiteTopicID.Value = DO.MineSiteTopicID;
            _ProposedAmount.Value = DO.ProposedAmount;
            
            SqlParameter[] _params = new SqlParameter[] {
                _PermitKey,
                _MineSiteCategoryID,
                _MineSiteTopicID,
                _ProposedAmount
            };

            string pid = ConfigurationManager.AppSettings["ePermitDAL"];

            await DataCommon.ExecuteNonQueryAsync("[dbo].[MineSiteAcreage_Insert]", _params, pid);
            
        }
        public MineSiteInformationBO WriteDataToTables(int PermitKey, ModelStateDictionary ModelState)
        {
            MineSiteInformationBO data = new MineSiteInformationBO();

            data.SiteName = this.SiteName;
            data.MineType = this.MineType;
            data.ProposedReminedAcres = this.ProposedReminedAcres;
            data.MSHAID = this.MSHAID;
            data.PermitKey = PermitKey;
            data.MineSiteAcreage = new List<MineSiteAcreageDO>();

            if (this.TribalPermittedMineral > 0)
            {
                MineSiteAcreageDO NewRow = new MineSiteAcreageDO()
                {
                    MineSiteCategoryID = "Tribal",
                    MineSiteTopicID = "Permitted Mineral",
                    ProposedAmount = this.TribalPermittedMineral,
                    PermitKey = PermitKey
                };
                data.MineSiteAcreage.Add(NewRow);
            }

            if (this.FederalPermittedMineral > 0)
            {
                MineSiteAcreageDO NewRow = new MineSiteAcreageDO()
                {
                    MineSiteCategoryID = "Federal",
                    MineSiteTopicID = "Permitted Mineral",
                    ProposedAmount = this.FederalPermittedMineral,
                    PermitKey = PermitKey
                };
                data.MineSiteAcreage.Add(NewRow);
            }

            if (this.StatePermittedMineral > 0)
            {
                MineSiteAcreageDO NewRow = new MineSiteAcreageDO()
                {
                    MineSiteCategoryID = "State",
                    MineSiteTopicID = "Permitted Mineral",
                    ProposedAmount = this.StatePermittedMineral,
                    PermitKey = PermitKey
                };
                data.MineSiteAcreage.Add(NewRow);
            }

            if (this.PrivatePermittedMineral > 0)
            {
                MineSiteAcreageDO NewRow = new MineSiteAcreageDO()
                {
                    MineSiteCategoryID = "Private",
                    MineSiteTopicID = "Permitted Mineral",
                    ProposedAmount = this.PrivatePermittedMineral,
                    PermitKey = PermitKey
                };
                data.MineSiteAcreage.Add(NewRow);
            }

            if (this.CountyPermittedMineral > 0)
            {
                MineSiteAcreageDO NewRow = new MineSiteAcreageDO()
                {
                    MineSiteCategoryID = "County",
                    MineSiteTopicID = "Permitted Mineral",
                    ProposedAmount = this.CountyPermittedMineral,
                    PermitKey = PermitKey
                };
                data.MineSiteAcreage.Add(NewRow);
            }

            if (this.TribalPermittedSurface > 0)
            {
                MineSiteAcreageDO NewRow = new MineSiteAcreageDO()
                {
                    MineSiteCategoryID = "Tribal",
                    MineSiteTopicID = "Permitted Surface",
                    ProposedAmount = this.TribalPermittedSurface,
                    PermitKey = PermitKey
                };
                data.MineSiteAcreage.Add(NewRow);
            }

            if (this.FederalPermittedSurface > 0)
            {
                MineSiteAcreageDO NewRow = new MineSiteAcreageDO()
                {
                    MineSiteCategoryID = "Federal",
                    MineSiteTopicID = "Permitted Surface",
                    ProposedAmount = this.FederalPermittedSurface,
                    PermitKey = PermitKey
                };
                data.MineSiteAcreage.Add(NewRow);
            }

            if (this.StatePermittedSurface > 0)
            {
                MineSiteAcreageDO NewRow = new MineSiteAcreageDO()
                {
                    MineSiteCategoryID = "State",
                    MineSiteTopicID = "Permitted Surface",
                    ProposedAmount = this.StatePermittedSurface,
                    PermitKey = PermitKey
                };
                data.MineSiteAcreage.Add(NewRow);
            }

            if (this.PrivatePermittedSurface > 0)
            {
                MineSiteAcreageDO NewRow = new MineSiteAcreageDO()
                {
                    MineSiteCategoryID = "Private",
                    MineSiteTopicID = "Permitted Surface",
                    ProposedAmount = this.PrivatePermittedSurface,
                    PermitKey = PermitKey
                };
                data.MineSiteAcreage.Add(NewRow);
            }

            if (this.CountyPermittedSurface > 0)
            {
                MineSiteAcreageDO NewRow = new MineSiteAcreageDO()
                {
                    MineSiteCategoryID = "County",
                    MineSiteTopicID = "Permitted Surface",
                    ProposedAmount = this.CountyPermittedSurface,
                    PermitKey = PermitKey
                };
                data.MineSiteAcreage.Add(NewRow);
            }
            if (this.TribalDisturbedMineral > 0)
            {
                MineSiteAcreageDO NewRow = new MineSiteAcreageDO()
                {
                    MineSiteCategoryID = "Tribal",
                    MineSiteTopicID = "Disturbed Mineral",
                    ProposedAmount = this.TribalDisturbedMineral,
                    PermitKey = PermitKey
                };
                data.MineSiteAcreage.Add(NewRow);
            }

            if (this.FederalDisturbedMineral > 0)
            {
                MineSiteAcreageDO NewRow = new MineSiteAcreageDO()
                {
                    MineSiteCategoryID = "Federal",
                    MineSiteTopicID = "Disturbed Mineral",
                    ProposedAmount = this.FederalDisturbedMineral,
                    PermitKey = PermitKey
                };
                data.MineSiteAcreage.Add(NewRow);
            }

            if (this.StateDisturbedMineral > 0)
            {
                MineSiteAcreageDO NewRow = new MineSiteAcreageDO()
                {
                    MineSiteCategoryID = "State",
                    MineSiteTopicID = "Disturbed Mineral",
                    ProposedAmount = this.StateDisturbedMineral,
                    PermitKey = PermitKey
                };
                data.MineSiteAcreage.Add(NewRow);
            }

            if (this.PrivateDisturbedMineral > 0)
            {
                MineSiteAcreageDO NewRow = new MineSiteAcreageDO()
                {
                    MineSiteCategoryID = "Private",
                    MineSiteTopicID = "Disturbed Mineral",
                    ProposedAmount = this.PrivateDisturbedMineral,
                    PermitKey = PermitKey
                };
                data.MineSiteAcreage.Add(NewRow);
            }

            if (this.CountyDisturbedMineral > 0)
            {
                MineSiteAcreageDO NewRow = new MineSiteAcreageDO()
                {
                    MineSiteCategoryID = "County",
                    MineSiteTopicID = "Disturbed Mineral",
                    ProposedAmount = this.CountyDisturbedMineral,
                    PermitKey = PermitKey
                };
                data.MineSiteAcreage.Add(NewRow);
            }

            if (this.TribalDisturbedSurface > 0)
            {
                MineSiteAcreageDO NewRow = new MineSiteAcreageDO()
                {
                    MineSiteCategoryID = "Tribal",
                    MineSiteTopicID = "Disturbed Surface",
                    ProposedAmount = this.TribalDisturbedSurface,
                    PermitKey = PermitKey
                };
                data.MineSiteAcreage.Add(NewRow);
            }

            if (this.FederalDisturbedSurface > 0)
            {
                MineSiteAcreageDO NewRow = new MineSiteAcreageDO()
                {
                    MineSiteCategoryID = "Federal",
                    MineSiteTopicID = "Disturbed Surface",
                    ProposedAmount = this.FederalDisturbedSurface,
                    PermitKey = PermitKey
                };
                data.MineSiteAcreage.Add(NewRow);
            }

            if (this.StateDisturbedSurface > 0)
            {
                MineSiteAcreageDO NewRow = new MineSiteAcreageDO()
                {
                    MineSiteCategoryID = "State",
                    MineSiteTopicID = "Disturbed Surface",
                    ProposedAmount = this.StateDisturbedSurface,
                    PermitKey = PermitKey
                };
                data.MineSiteAcreage.Add(NewRow);
            }

            if (this.PrivateDisturbedSurface > 0)
            {
                MineSiteAcreageDO NewRow = new MineSiteAcreageDO()
                {
                    MineSiteCategoryID = "Private",
                    MineSiteTopicID = "Disturbed Surface",
                    ProposedAmount = this.PrivateDisturbedSurface,
                    PermitKey = PermitKey
                };
                data.MineSiteAcreage.Add(NewRow);
            }

            if (this.CountyDisturbedSurface > 0)
            {
                MineSiteAcreageDO NewRow = new MineSiteAcreageDO()
                {
                    MineSiteCategoryID = "County",
                    MineSiteTopicID = "Disturbed Surface",
                    ProposedAmount = this.CountyDisturbedSurface,
                    PermitKey = PermitKey
                };
                data.MineSiteAcreage.Add(NewRow);
            }

            if (this.TribalReservedTonnage > 0)
            {
                MineSiteAcreageDO NewRow = new MineSiteAcreageDO()
                {
                    MineSiteCategoryID = "Tribal",
                    MineSiteTopicID = "Reserved Tonnage",
                    ProposedAmount = this.TribalReservedTonnage,
                    PermitKey = PermitKey
                };
                data.MineSiteAcreage.Add(NewRow);
            }

            if (this.FederalReservedTonnage > 0)
            {
                MineSiteAcreageDO NewRow = new MineSiteAcreageDO()
                {
                    MineSiteCategoryID = "Federal",
                    MineSiteTopicID = "Reserved Tonnage",
                    ProposedAmount = this.FederalReservedTonnage,
                    PermitKey = PermitKey
                };
                data.MineSiteAcreage.Add(NewRow);
            }

            if (this.StateReservedTonnage > 0)
            {
                MineSiteAcreageDO NewRow = new MineSiteAcreageDO()
                {
                    MineSiteCategoryID = "State",
                    MineSiteTopicID = "Reserved Tonnage",
                    ProposedAmount = this.StateReservedTonnage,
                    PermitKey = PermitKey
                };
                data.MineSiteAcreage.Add(NewRow);
            }

            if (this.PrivateReservedTonnage > 0)
            {
                MineSiteAcreageDO NewRow = new MineSiteAcreageDO()
                {
                    MineSiteCategoryID = "Private",
                    MineSiteTopicID = "Reserved Tonnage",
                    ProposedAmount = this.PrivateReservedTonnage,
                    PermitKey = PermitKey
                };
                data.MineSiteAcreage.Add(NewRow);
            }

            if (this.CountyReservedTonnage > 0)
            {
                MineSiteAcreageDO NewRow = new MineSiteAcreageDO()
                {
                    MineSiteCategoryID = "County",
                    MineSiteTopicID = "Reserved Tonnage",
                    ProposedAmount = this.CountyReservedTonnage,
                    PermitKey = PermitKey
                };
                data.MineSiteAcreage.Add(NewRow);
            }
            return data;
        }
예제 #3
0
        /// <summary>
        /// Updates a MineSiteAcreage record and returns the number of records affected
        /// </summary>
        public static int Update(MineSiteAcreageDO DO)
        {
            SqlParameter _PermitKey = new SqlParameter("PermitKey", SqlDbType.Int);
            SqlParameter _MineSiteCategoryID = new SqlParameter("MineSiteCategoryID", SqlDbType.VarChar);
            SqlParameter _MineSiteTopicID = new SqlParameter("MineSiteTopicID", SqlDbType.VarChar);
            SqlParameter _ProposedAmount = new SqlParameter("ProposedAmount", SqlDbType.BigInt);
            
            _PermitKey.Value = DO.PermitKey;
            _MineSiteCategoryID.Value = DO.MineSiteCategoryID;
            _MineSiteTopicID.Value = DO.MineSiteTopicID;
            _ProposedAmount.Value = DO.ProposedAmount;
            
            SqlParameter[] _params = new SqlParameter[] {
                _PermitKey,
                _MineSiteCategoryID,
                _MineSiteTopicID,
                _ProposedAmount
            };

            string pid = ConfigurationManager.AppSettings["ePermitDAL"];

            return DataCommon.ExecuteScalar("[dbo].[MineSiteAcreage_Update]", _params, pid);
        }
예제 #4
0
        /// <summary>
        /// Selects MineSiteAcreage records by PK
        /// </summary>
        public static async Task<MineSiteAcreageDO[]> GetByPKAsync(Int32 PermitKey,
 String MineSiteCategoryID,
 String MineSiteTopicID)
        {

            SqlParameter _PermitKey = new SqlParameter("PermitKey", SqlDbType.Int);
            SqlParameter _MineSiteCategoryID = new SqlParameter("MineSiteCategoryID", SqlDbType.VarChar);
            SqlParameter _MineSiteTopicID = new SqlParameter("MineSiteTopicID", SqlDbType.VarChar);
			
            _PermitKey.Value = PermitKey;
            _MineSiteCategoryID.Value = MineSiteCategoryID;
            _MineSiteTopicID.Value = MineSiteTopicID;
			
            SqlParameter[] _params = new SqlParameter[] {
                _PermitKey,
                _MineSiteCategoryID,
                _MineSiteTopicID
            };

            string pid = ConfigurationManager.AppSettings["ePermitDAL"];

            SafeReader sr = await DataCommon.ExecuteSafeReaderAsync("[dbo].[MineSiteAcreage_GetByPK]", _params, pid);


            List<MineSiteAcreageDO> objs = new List<MineSiteAcreageDO>();
			
            while(sr.Read())
            {
                MineSiteAcreageDO obj = new MineSiteAcreageDO();
				
                obj.PermitKey = sr.GetInt32(sr.GetOrdinal("PermitKey"));
                obj.MineSiteCategoryID = sr.GetString(sr.GetOrdinal("MineSiteCategoryID"));
                obj.MineSiteTopicID = sr.GetString(sr.GetOrdinal("MineSiteTopicID"));
                obj.ProposedAmount = sr.GetInt64(sr.GetOrdinal("ProposedAmount"));
                

                objs.Add(obj);
            }

            return objs.ToArray();
        }
예제 #5
0
        /// <summary>
        /// Gets all MineSiteAcreage records
        /// </summary>
        public static async Task<MineSiteAcreageDO[]> GetAllAsync()
        {

            string pid = ConfigurationManager.AppSettings["ePermitDAL"];

            SafeReader sr = await DataCommon.ExecuteSafeReaderAsync("[dbo].[MineSiteAcreage_GetAll]", new SqlParameter[] { }, pid);
            
            List<MineSiteAcreageDO> objs = new List<MineSiteAcreageDO>();
            
            while(sr.Read()){

                MineSiteAcreageDO obj = new MineSiteAcreageDO();
                
                obj.PermitKey = sr.GetInt32(sr.GetOrdinal("PermitKey"));
                obj.MineSiteCategoryID = sr.GetString(sr.GetOrdinal("MineSiteCategoryID"));
                obj.MineSiteTopicID = sr.GetString(sr.GetOrdinal("MineSiteTopicID"));
                obj.ProposedAmount = sr.GetInt64(sr.GetOrdinal("ProposedAmount"));
                


                objs.Add(obj);
            }

            return objs.ToArray();
        }
예제 #6
0
        /// <summary>
        /// Deletes a MineSiteAcreage record
        /// </summary>
        public static async Task<int> DeleteAsync(MineSiteAcreageDO DO)
        {
            SqlParameter _PermitKey = new SqlParameter("PermitKey", SqlDbType.Int);
            SqlParameter _MineSiteCategoryID = new SqlParameter("MineSiteCategoryID", SqlDbType.VarChar);
            SqlParameter _MineSiteTopicID = new SqlParameter("MineSiteTopicID", SqlDbType.VarChar);
            
            _PermitKey.Value = DO.PermitKey;
            _MineSiteCategoryID.Value = DO.MineSiteCategoryID;
            _MineSiteTopicID.Value = DO.MineSiteTopicID;
            
            SqlParameter[] _params = new SqlParameter[] {
                _PermitKey,
                _MineSiteCategoryID,
                _MineSiteTopicID
            };

            string pid = ConfigurationManager.AppSettings["ePermitDAL"];

            return await DataCommon.ExecuteScalarAsync("[dbo].[MineSiteAcreage_Delete]", _params, pid);
        }