示例#1
0
 /// <summary>
 /// converts a county data object to a county business object
 /// </summary>
 /// <param name="county"></param>
 /// <returns></returns>
 private CountyBO GetCounty(CountyDO county)
 {
     CountyBO bo = new CountyBO() { CountyID = county.CountyID, Description = county.Description, PermitKey = PermitKey };
     if (SelectedCounties.Find(c => c.CountyID == bo.CountyID) != null) // is this county in the Selected counties list?
         bo.Selected = true;
     return bo;
 }
示例#2
0
        /// <summary>
        /// Creates a new County record using async
        /// </summary>
        public static async Task<int> CreateAsync(CountyDO DO)
        {
            SqlParameter _FIPSStateID = new SqlParameter("FIPSStateID", SqlDbType.VarChar);
            SqlParameter _FIPSCountyID = new SqlParameter("FIPSCountyID", SqlDbType.VarChar);
            SqlParameter _Description = new SqlParameter("Description", SqlDbType.VarChar);
            
            _FIPSStateID.Value = DO.FIPSStateID;
            _FIPSCountyID.Value = DO.FIPSCountyID;
            _Description.Value = DO.Description;
            
            SqlParameter[] _params = new SqlParameter[] {
                _FIPSStateID,
                _FIPSCountyID,
                _Description
            };

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

            return await DataCommon.ExecuteScalarAsync("[dbo].[County_Insert]", _params, pid);
            
        }
示例#3
0
        /// <summary>
        /// Updates a County record and returns the number of records affected
        /// </summary>
        public static int Update(CountyDO DO)
        {
            SqlParameter _CountyID = new SqlParameter("CountyID", SqlDbType.Int);
            SqlParameter _FIPSStateID = new SqlParameter("FIPSStateID", SqlDbType.VarChar);
            SqlParameter _FIPSCountyID = new SqlParameter("FIPSCountyID", SqlDbType.VarChar);
            SqlParameter _Description = new SqlParameter("Description", SqlDbType.VarChar);
            
            _CountyID.Value = DO.CountyID;
            _FIPSStateID.Value = DO.FIPSStateID;
            _FIPSCountyID.Value = DO.FIPSCountyID;
            _Description.Value = DO.Description;
            
            SqlParameter[] _params = new SqlParameter[] {
                _CountyID,
                _FIPSStateID,
                _FIPSCountyID,
                _Description
            };

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

            return DataCommon.ExecuteScalar("[dbo].[County_Update]", _params, pid);
        }
示例#4
0
        /// <summary>
        /// Selects County records by PK
        /// </summary>
        public static async Task<CountyDO[]> GetByPKAsync(Int32 CountyID)
        {

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

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

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


            List<CountyDO> objs = new List<CountyDO>();
			
            while(sr.Read())
            {
                CountyDO obj = new CountyDO();
				
                obj.CountyID = sr.GetInt32(sr.GetOrdinal("CountyID"));
                obj.FIPSStateID = sr.GetString(sr.GetOrdinal("FIPSStateID"));
                obj.FIPSCountyID = sr.GetString(sr.GetOrdinal("FIPSCountyID"));
                obj.Description = sr.GetString(sr.GetOrdinal("Description"));
                

                objs.Add(obj);
            }

            return objs.ToArray();
        }
示例#5
0
        /// <summary>
        /// Gets all County records
        /// </summary>
        public static async Task<CountyDO[]> GetAllAsync()
        {

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

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

                CountyDO obj = new CountyDO();
                
                obj.CountyID = sr.GetInt32(sr.GetOrdinal("CountyID"));
                obj.FIPSStateID = sr.GetString(sr.GetOrdinal("FIPSStateID"));
                obj.FIPSCountyID = sr.GetString(sr.GetOrdinal("FIPSCountyID"));
                obj.Description = sr.GetString(sr.GetOrdinal("Description"));
                


                objs.Add(obj);
            }

            return objs.ToArray();
        }
示例#6
0
        /// <summary>
        /// Deletes a County record
        /// </summary>
        public static async Task<int> DeleteAsync(CountyDO DO)
        {
            SqlParameter _CountyID = new SqlParameter("CountyID", SqlDbType.Int);
            
            _CountyID.Value = DO.CountyID;
            
            SqlParameter[] _params = new SqlParameter[] {
                _CountyID
            };

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

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