Пример #1
0
 public ProposedSoilSalvageDepthVM(ProposedSoilSalvageDepthDO DO)
 {
     this.ProposedSoilSalvageDepthID = DO.ProposedSoilSalvageDepthID;
     this.SalvageDepth = DO.SalvageDepth;
     this.PermitKey = DO.PermitKey;
     this.Acres = DO.Acres;
     this.SoilType = DO.SoilType;
 }
        /// <summary>
        /// Creates a new ProposedSoilSalvageDepth record using async
        /// </summary>
        public static async Task<int> CreateAsync(ProposedSoilSalvageDepthDO DO)
        {
            SqlParameter _PermitKey = new SqlParameter("PermitKey", SqlDbType.Int);
            SqlParameter _SoilType = new SqlParameter("SoilType", SqlDbType.VarChar);
            SqlParameter _SalvageDepth = new SqlParameter("SalvageDepth", SqlDbType.VarChar);
            SqlParameter _Acres = new SqlParameter("Acres", SqlDbType.Int);
            
            _PermitKey.Value = DO.PermitKey;
            _SoilType.Value = DO.SoilType;
            _SalvageDepth.Value = DO.SalvageDepth;
            _Acres.Value = DO.Acres;
            
            SqlParameter[] _params = new SqlParameter[] {
                _PermitKey,
                _SoilType,
                _SalvageDepth,
                _Acres
            };

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

            return await DataCommon.ExecuteScalarAsync("[dbo].[ProposedSoilSalvageDepth_Insert]", _params, pid);
            
        }
        /// <summary>
        /// Updates a ProposedSoilSalvageDepth record and returns the number of records affected
        /// </summary>
        public static int Update(ProposedSoilSalvageDepthDO DO)
        {
            SqlParameter _ProposedSoilSalvageDepthID = new SqlParameter("ProposedSoilSalvageDepthID", SqlDbType.Int);
            SqlParameter _PermitKey = new SqlParameter("PermitKey", SqlDbType.Int);
            SqlParameter _SoilType = new SqlParameter("SoilType", SqlDbType.VarChar);
            SqlParameter _SalvageDepth = new SqlParameter("SalvageDepth", SqlDbType.VarChar);
            SqlParameter _Acres = new SqlParameter("Acres", SqlDbType.Int);
            
            _ProposedSoilSalvageDepthID.Value = DO.ProposedSoilSalvageDepthID;
            _PermitKey.Value = DO.PermitKey;
            _SoilType.Value = DO.SoilType;
            _SalvageDepth.Value = DO.SalvageDepth;
            _Acres.Value = DO.Acres;
            
            SqlParameter[] _params = new SqlParameter[] {
                _ProposedSoilSalvageDepthID,
                _PermitKey,
                _SoilType,
                _SalvageDepth,
                _Acres
            };

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

            return DataCommon.ExecuteScalar("[dbo].[ProposedSoilSalvageDepth_Update]", _params, pid);
        }
        /// <summary>
        /// Selects ProposedSoilSalvageDepth records by PK
        /// </summary>
        public static async Task<ProposedSoilSalvageDepthDO[]> GetByPKAsync(Int32 ProposedSoilSalvageDepthID)
        {

            SqlParameter _ProposedSoilSalvageDepthID = new SqlParameter("ProposedSoilSalvageDepthID", SqlDbType.Int);
			
            _ProposedSoilSalvageDepthID.Value = ProposedSoilSalvageDepthID;
			
            SqlParameter[] _params = new SqlParameter[] {
                _ProposedSoilSalvageDepthID
            };

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

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


            List<ProposedSoilSalvageDepthDO> objs = new List<ProposedSoilSalvageDepthDO>();
			
            while(sr.Read())
            {
                ProposedSoilSalvageDepthDO obj = new ProposedSoilSalvageDepthDO();
				
                obj.ProposedSoilSalvageDepthID = sr.GetInt32(sr.GetOrdinal("ProposedSoilSalvageDepthID"));
                obj.PermitKey = sr.GetInt32(sr.GetOrdinal("PermitKey"));
                obj.SoilType = sr.GetString(sr.GetOrdinal("SoilType"));
                obj.SalvageDepth = sr.GetString(sr.GetOrdinal("SalvageDepth"));
                obj.Acres = sr.GetInt32(sr.GetOrdinal("Acres"));
                

                objs.Add(obj);
            }

            return objs.ToArray();
        }
        /// <summary>
        /// Gets all ProposedSoilSalvageDepth records
        /// </summary>
        public static ProposedSoilSalvageDepthDO[] GetAll()
        {

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

            SafeReader sr = DataCommon.ExecuteSafeReader("[dbo].[ProposedSoilSalvageDepth_GetAll]", new SqlParameter[] { }, pid);
            
            List<ProposedSoilSalvageDepthDO> objs = new List<ProposedSoilSalvageDepthDO>();
            
            while(sr.Read()){

                ProposedSoilSalvageDepthDO obj = new ProposedSoilSalvageDepthDO();
                
                obj.ProposedSoilSalvageDepthID = sr.GetInt32(sr.GetOrdinal("ProposedSoilSalvageDepthID"));
                obj.PermitKey = sr.GetInt32(sr.GetOrdinal("PermitKey"));
                obj.SoilType = sr.GetString(sr.GetOrdinal("SoilType"));
                obj.SalvageDepth = sr.GetString(sr.GetOrdinal("SalvageDepth"));
                obj.Acres = sr.GetInt32(sr.GetOrdinal("Acres"));
                


                objs.Add(obj);
            }

            return objs.ToArray();
        }
        /// <summary>
        /// Deletes a ProposedSoilSalvageDepth record
        /// </summary>
        public static async Task<int> DeleteAsync(ProposedSoilSalvageDepthDO DO)
        {
            SqlParameter _ProposedSoilSalvageDepthID = new SqlParameter("ProposedSoilSalvageDepthID", SqlDbType.Int);
            
            _ProposedSoilSalvageDepthID.Value = DO.ProposedSoilSalvageDepthID;
            
            SqlParameter[] _params = new SqlParameter[] {
                _ProposedSoilSalvageDepthID
            };

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

            return await DataCommon.ExecuteScalarAsync("[dbo].[ProposedSoilSalvageDepth_Delete]", _params, pid);
        }
Пример #7
0
        public ProposedSoilSalvageDepthDO WriteSoilSalvageDepth()
        {
            ProposedSoilSalvageDepthDO data = new ProposedSoilSalvageDepthDO()
            {
                ProposedSoilSalvageDepthID = this.ProposedSoilSalvageDepthID,
                SalvageDepth = this.SalvageDepth,
                PermitKey = this.PermitKey,
                Acres = this.Acres,
                SoilType = this.SoilType

            };

            return data;
        }