Пример #1
0
        /// <summary>
        /// Creates a new Address record using async
        /// </summary>
        public static async Task<int> CreateAsync(AddressDO DO)
        {
            SqlParameter _AddressTypeID = new SqlParameter("AddressTypeID", SqlDbType.VarChar);
            SqlParameter _Address1 = new SqlParameter("Address1", SqlDbType.VarChar);
            SqlParameter _Address2 = new SqlParameter("Address2", SqlDbType.VarChar);
            SqlParameter _POBox = new SqlParameter("POBox", SqlDbType.VarChar);
            SqlParameter _City = new SqlParameter("City", SqlDbType.VarChar);
            SqlParameter _StateID = new SqlParameter("StateID", SqlDbType.VarChar);
            SqlParameter _Zipcode = new SqlParameter("Zipcode", SqlDbType.VarChar);
            SqlParameter _ContactID = new SqlParameter("ContactID", SqlDbType.Int);
            
            _AddressTypeID.Value = DO.AddressTypeID;
            _Address1.Value = DO.Address1;
            _Address2.Value = DO.Address2;
            _POBox.Value = DO.POBox;
            _City.Value = DO.City;
            _StateID.Value = DO.StateID;
            _Zipcode.Value = DO.Zipcode;
            _ContactID.Value = DO.ContactID;
            
            SqlParameter[] _params = new SqlParameter[] {
                _AddressTypeID,
                _Address1,
                _Address2,
                _POBox,
                _City,
                _StateID,
                _Zipcode,
                _ContactID
            };

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

            return await DataCommon.ExecuteScalarAsync("[dbo].[Address_Insert]", _params, pid);
            
        }
Пример #2
0
        public AddressDO WriteTemporaryAddressDataToTable()
        {
            AddressDO data = new AddressDO()
            {
                AddressID = this.AddressID2,
                AddressTypeID = this.AddressTypeID2,
                Address1 = this.Address21,
                Address2 = this.Address22,
                POBox = this.POBox2,
                City = this.City2,
                StateID = this.StateID2,
                Zipcode = this.ZipCode2,
                ContactID = this.ContactID
            };

            return data;
        }
Пример #3
0
        public AddressDO WritePermanentAddressDataToTable()
        {
            AddressDO data = new AddressDO()
               {
                   AddressID = this.AddressID1,
                   AddressTypeID = this.AddressTypeID1,
                   Address1 = this.Address11,
                   Address2 = this.Address12,
                   POBox = this.POBox1,
                   City = this.City1,
                   StateID = this.StateID1,
                   Zipcode = this.ZipCode1,
                   ContactID = this.ContactID
               };

            return data;
        }
Пример #4
0
        /// <summary>
        /// Selects Address records by PK
        /// </summary>
        public static async Task<AddressDO[]> GetByPKAsync(Int32 AddressID)
        {

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

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

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


            List<AddressDO> objs = new List<AddressDO>();
			
            while(sr.Read())
            {
                AddressDO obj = new AddressDO();
				
                obj.AddressID = sr.GetInt32(sr.GetOrdinal("AddressID"));
                obj.AddressTypeID = sr.GetString(sr.GetOrdinal("AddressTypeID"));
                obj.City = sr.GetString(sr.GetOrdinal("City"));
                obj.StateID = sr.GetString(sr.GetOrdinal("StateID"));
                obj.ContactID = sr.GetInt32(sr.GetOrdinal("ContactID"));
                if (sr.IsDBNull(sr.GetOrdinal("Address1"))) { obj.Address1 = null; } else { obj.Address1 = sr.GetString(sr.GetOrdinal("Address1")); }
                if (sr.IsDBNull(sr.GetOrdinal("Address2"))) { obj.Address2 = null; } else { obj.Address2 = sr.GetString(sr.GetOrdinal("Address2")); }
                if (sr.IsDBNull(sr.GetOrdinal("POBox"))) { obj.POBox = null; } else { obj.POBox = sr.GetString(sr.GetOrdinal("POBox")); }
                if (sr.IsDBNull(sr.GetOrdinal("Zipcode"))) { obj.Zipcode = null; } else { obj.Zipcode = sr.GetString(sr.GetOrdinal("Zipcode")); }

                objs.Add(obj);
            }

            return objs.ToArray();
        }
Пример #5
0
        /// <summary>
        /// Gets all Address records
        /// </summary>
        public static AddressDO[] GetAll()
        {

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

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

                AddressDO obj = new AddressDO();
                
                obj.AddressID = sr.GetInt32(sr.GetOrdinal("AddressID"));
                obj.AddressTypeID = sr.GetString(sr.GetOrdinal("AddressTypeID"));
                obj.City = sr.GetString(sr.GetOrdinal("City"));
                obj.StateID = sr.GetString(sr.GetOrdinal("StateID"));
                obj.ContactID = sr.GetInt32(sr.GetOrdinal("ContactID"));
                if (sr.IsDBNull(sr.GetOrdinal("Address1"))) { obj.Address1 = null; } else { obj.Address1 = sr.GetString(sr.GetOrdinal("Address1")); }
                if (sr.IsDBNull(sr.GetOrdinal("Address2"))) { obj.Address2 = null; } else { obj.Address2 = sr.GetString(sr.GetOrdinal("Address2")); }
                if (sr.IsDBNull(sr.GetOrdinal("POBox"))) { obj.POBox = null; } else { obj.POBox = sr.GetString(sr.GetOrdinal("POBox")); }
                if (sr.IsDBNull(sr.GetOrdinal("Zipcode"))) { obj.Zipcode = null; } else { obj.Zipcode = sr.GetString(sr.GetOrdinal("Zipcode")); }


                objs.Add(obj);
            }

            return objs.ToArray();
        }
Пример #6
0
        /// <summary>
        /// Deletes a Address record
        /// </summary>
        public static async Task<int> DeleteAsync(AddressDO DO)
        {
            SqlParameter _AddressID = new SqlParameter("AddressID", SqlDbType.Int);
            
            _AddressID.Value = DO.AddressID;
            
            SqlParameter[] _params = new SqlParameter[] {
                _AddressID
            };

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

            return await DataCommon.ExecuteScalarAsync("[dbo].[Address_Delete]", _params, pid);
        }
        public AddressDO GetFirstAddressDataObject()
        {
            AddressDO data = new AddressDO()
               {
                   AddressID = this.AddressID,
                   AddressTypeID = this.AddressTypeID,
                   Address1 = this.Address11,
                   Address2 = this.Address12,
                   POBox = this.POBox,
                   City = this.City,
                   StateID = this.StateID,
                   Zipcode = this.ZipCode,
                   ContactID = this.ContactID
               };

            return data;
        }