コード例 #1
0
ファイル: Company.cs プロジェクト: nathantownsend/ePermitDAL
        /// <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);
            
        }
コード例 #2
0
ファイル: Company.cs プロジェクト: nathantownsend/ePermitDAL
        /// <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);
        }
コード例 #3
0
ファイル: Company.cs プロジェクト: nathantownsend/ePermitDAL
        /// <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();
        }
コード例 #4
0
ファイル: Company.cs プロジェクト: nathantownsend/ePermitDAL
        /// <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();
        }
コード例 #5
0
ファイル: Company.cs プロジェクト: nathantownsend/ePermitDAL
        /// <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);
        }