Exemple #1
0
        /// <summary>
        /// Creates a new Company record using async
        /// </summary>
        public static async Task<int> CreateAsync(CompanyDO DO)
        {
            SqlParameter _CompanyName = new SqlParameter("CompanyName", SqlDbType.VarChar);
            
            _CompanyName.Value = DO.CompanyName;
            
            SqlParameter[] _params = new SqlParameter[] {
                _CompanyName
            };

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

            return await DataCommon.ExecuteScalarAsync("[dbo].[Company_Insert]", _params, pid);
            
        }
Exemple #2
0
        /// <summary>
        /// Updates a Company record and returns the number of records affected
        /// </summary>
        public static int Update(CompanyDO DO)
        {
            SqlParameter _CompanyID = new SqlParameter("CompanyID", SqlDbType.Int);
            SqlParameter _CompanyName = new SqlParameter("CompanyName", SqlDbType.VarChar);
            
            _CompanyID.Value = DO.CompanyID;
            _CompanyName.Value = DO.CompanyName;
            
            SqlParameter[] _params = new SqlParameter[] {
                _CompanyID,
                _CompanyName
            };

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

            return DataCommon.ExecuteScalar("[dbo].[Company_Update]", _params, pid);
        }
Exemple #3
0
        /// <summary>
        /// Gets all Company records
        /// </summary>
        public static async Task<CompanyDO[]> GetAllAsync()
        {

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

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

                CompanyDO obj = new CompanyDO();
                
                obj.CompanyID = sr.GetInt32(sr.GetOrdinal("CompanyID"));
                obj.CompanyName = sr.GetString(sr.GetOrdinal("CompanyName"));
                


                objs.Add(obj);
            }

            return objs.ToArray();
        }
Exemple #4
0
        /// <summary>
        /// Selects Company records by PK
        /// </summary>
        public static async Task<CompanyDO[]> GetByPKAsync(Int32 CompanyID)
        {

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

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

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


            List<CompanyDO> objs = new List<CompanyDO>();
			
            while(sr.Read())
            {
                CompanyDO obj = new CompanyDO();
				
                obj.CompanyID = sr.GetInt32(sr.GetOrdinal("CompanyID"));
                obj.CompanyName = sr.GetString(sr.GetOrdinal("CompanyName"));
                

                objs.Add(obj);
            }

            return objs.ToArray();
        }
Exemple #5
0
        /// <summary>
        /// Deletes a Company record
        /// </summary>
        public static async Task<int> DeleteAsync(CompanyDO DO)
        {
            SqlParameter _CompanyID = new SqlParameter("CompanyID", SqlDbType.Int);
            
            _CompanyID.Value = DO.CompanyID;
            
            SqlParameter[] _params = new SqlParameter[] {
                _CompanyID
            };

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

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