示例#1
0
 public PremineLandUseVM(PremineLandUseDO DO)
 {
     this.PremineLandUseID = DO.PremineLandUseID;
     this.PremineLandUse = DO.PremineLandUse;
     this.PermitKey = DO.PermitKey;
     this.Acres = DO.Acres;
 }
示例#2
0
        public PremineLandUseDO WriteDataToTables()
        {
            PremineLandUseDO data = new PremineLandUseDO()
            {
                PremineLandUseID = this.PremineLandUseID,
                PremineLandUse = this.PremineLandUse,
                PermitKey = this.PermitKey,
                Acres = this.Acres

            };

            return data;
        }
        /// <summary>
        /// Creates a new PremineLandUse record using async
        /// </summary>
        public static async Task<int> CreateAsync(PremineLandUseDO DO)
        {
            SqlParameter _PermitKey = new SqlParameter("PermitKey", SqlDbType.Int);
            SqlParameter _PremineLandUse = new SqlParameter("PremineLandUse", SqlDbType.VarChar);
            SqlParameter _Acres = new SqlParameter("Acres", SqlDbType.Int);
            
            _PermitKey.Value = DO.PermitKey;
            _PremineLandUse.Value = DO.PremineLandUse;
            _Acres.Value = DO.Acres;
            
            SqlParameter[] _params = new SqlParameter[] {
                _PermitKey,
                _PremineLandUse,
                _Acres
            };

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

            return await DataCommon.ExecuteScalarAsync("[dbo].[PremineLandUse_Insert]", _params, pid);
            
        }
        /// <summary>
        /// Updates a PremineLandUse record and returns the number of records affected
        /// </summary>
        public static int Update(PremineLandUseDO DO)
        {
            SqlParameter _PremineLandUseID = new SqlParameter("PremineLandUseID", SqlDbType.Int);
            SqlParameter _PermitKey = new SqlParameter("PermitKey", SqlDbType.Int);
            SqlParameter _PremineLandUse = new SqlParameter("PremineLandUse", SqlDbType.VarChar);
            SqlParameter _Acres = new SqlParameter("Acres", SqlDbType.Int);
            
            _PremineLandUseID.Value = DO.PremineLandUseID;
            _PermitKey.Value = DO.PermitKey;
            _PremineLandUse.Value = DO.PremineLandUse;
            _Acres.Value = DO.Acres;
            
            SqlParameter[] _params = new SqlParameter[] {
                _PremineLandUseID,
                _PermitKey,
                _PremineLandUse,
                _Acres
            };

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

            return DataCommon.ExecuteScalar("[dbo].[PremineLandUse_Update]", _params, pid);
        }
 public ActionResult PremineLandUseAdd(int PermitKey)
 {
     PremineLandUseDO PMLU = new PremineLandUseDO();
     PremineLandUseVM model = new PremineLandUseVM(PMLU);
     model.PermitKey = PermitKey;
     return PartialView("PremineLandUseAddEdit", model);
 }
        /// <summary>
        /// Selects PremineLandUse records by PK
        /// </summary>
        public static async Task<PremineLandUseDO[]> GetByPKAsync(Int32 PremineLandUseID)
        {

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

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

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


            List<PremineLandUseDO> objs = new List<PremineLandUseDO>();
			
            while(sr.Read())
            {
                PremineLandUseDO obj = new PremineLandUseDO();
				
                obj.PremineLandUseID = sr.GetInt32(sr.GetOrdinal("PremineLandUseID"));
                obj.PermitKey = sr.GetInt32(sr.GetOrdinal("PermitKey"));
                obj.PremineLandUse = sr.GetString(sr.GetOrdinal("PremineLandUse"));
                obj.Acres = sr.GetInt32(sr.GetOrdinal("Acres"));
                

                objs.Add(obj);
            }

            return objs.ToArray();
        }
        /// <summary>
        /// Gets all PremineLandUse records
        /// </summary>
        public static async Task<PremineLandUseDO[]> GetAllAsync()
        {

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

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

                PremineLandUseDO obj = new PremineLandUseDO();
                
                obj.PremineLandUseID = sr.GetInt32(sr.GetOrdinal("PremineLandUseID"));
                obj.PermitKey = sr.GetInt32(sr.GetOrdinal("PermitKey"));
                obj.PremineLandUse = sr.GetString(sr.GetOrdinal("PremineLandUse"));
                obj.Acres = sr.GetInt32(sr.GetOrdinal("Acres"));
                


                objs.Add(obj);
            }

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

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

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