Ejemplo n.º 1
0
        public bool UpdateAddressDAL(Address_Entities updateAddress)
        {
            bool AddressUpdated = false;

            try
            {
                for (int i = 0; i < addressList.Count; i++)
                {
                    if (addressList[i].AddressID == updateAddress.AddressID)
                    {
                        addressList[i].Line1     = updateAddress.Line1;
                        addressList[i].Line2     = updateAddress.Line2;
                        addressList[i].City      = updateAddress.City;
                        addressList[i].Pincode   = updateAddress.Pincode;
                        addressList[i].State     = updateAddress.State;
                        addressList[i].ContactNo = updateAddress.ContactNo;
                        AddressUpdated           = true;
                    }
                }
            }
            catch (SystemException ex)
            {
                throw new GreatOutdoorsException(ex.Message);
            }
            return(AddressUpdated);
        }
Ejemplo n.º 2
0
        public bool DeleteAddressDAL(int deleteAddressID)
        {
            bool addressDeleted = false;

            try
            {
                Address_Entities deleteAddress = null;
                foreach (Address_Entities item in addressList)
                {
                    if (item.AddressID == deleteAddressID)
                    {
                        deleteAddress = item;
                    }
                }

                if (deleteAddress != null)
                {
                    addressList.Remove(deleteAddress);
                    addressDeleted = true;
                }
            }
            catch (Exception ex)
            {
                throw new GreatOutdoorsException(ex.Message);
            }
            return(addressDeleted);
        }
Ejemplo n.º 3
0
        public bool AddAddressDAL(Address_Entities address)
        {
            bool addressAdded;

            try
            {
                addressList.Add(address);
                addressAdded = true;
            }
            catch (SystemException ex)
            {
                throw new GreatOutdoorsException(ex.Message);
            }
            return(addressAdded);
        }
Ejemplo n.º 4
0
        public static Address_Entities SearchAddressBL(int searchAddressID)
        {
            Address_Entities searchAddress = null;

            try
            {
                Address_DAL addressDAL = new Address_DAL();
                searchAddress = addressDAL.SearchAddressDAL(searchAddressID);
            }
            catch (GOException ex)
            {
                throw new GOException(ex.Message);
            }
            return(searchAddress);
        }
Ejemplo n.º 5
0
        public static Address_Entities SearchAddressBL(int searchAddressID)
        {
            Address_Entities searchAddress = null;

            try
            {
                Address_DAL addressDAL = new Address_DAL();
                searchAddress = addressDAL.SearchAddressDAL(searchAddressID);
            }
            catch (GreatOutdoorsException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(searchAddress);
        }
Ejemplo n.º 6
0
        public static bool AddAddressBL(Address_Entities newAddress)
        {
            bool AddressAdded = false;

            try
            {
                if (ValidateAddress(newAddress))
                {
                    Address_DAL addressDAL = new Address_DAL();
                    AddressAdded = addressDAL.AddAddressDAL(newAddress);
                }
            }
            catch (GOException ex)
            {
                throw new GOException(ex.Message);
            }

            return(AddressAdded);
        }
Ejemplo n.º 7
0
        public Address_Entities SearchAddressDAL(int searchAddressID)
        {
            Address_Entities searchAddress = null;

            try
            {
                foreach (Address_Entities address in addressList)
                {
                    if (address.AddressID == searchAddressID)
                    {
                        searchAddress = address;
                    }
                }
            }
            catch (SystemException ex)
            {
                throw new GreatOutdoorsException(ex.Message);
            }
            return(searchAddress);
        }
Ejemplo n.º 8
0
        private static bool ValidateAddress(Address_Entities address)
        {
            StringBuilder sb           = new StringBuilder();
            bool          validAddress = true;

            if (address.Line1 == string.Empty)
            {
                validAddress = false;
                sb.Append(Environment.NewLine + "Address Line1 Required");
            }
            if (address.Line2 == string.Empty)
            {
                validAddress = false;
                sb.Append(Environment.NewLine + "Address Line2 Required");
            }
            if (address.ContactNo.Length != 10 || address.ContactNo.Length != 7)
            {
                validAddress = false;
                sb.Append(Environment.NewLine + "Required 7 or 10 Digit Contact Number");
            }
            if (address.City == null)
            {
                validAddress = false;
                sb.Append(Environment.NewLine + "City Name Required");
            }
            if (address.Pincode.ToString().Length != 6)
            {
                validAddress = false;
                sb.Append(Environment.NewLine + "Invalid Pincode");
            }
            if (address.State == null)
            {
                validAddress = false;
                sb.Append(Environment.NewLine + "State Name Required");
            }
            if (validAddress == false)
            {
                throw new GreatOutdoorsException(sb.ToString());
            }
            return(validAddress);
        }
Ejemplo n.º 9
0
        public static bool AddAddressBL(Address_Entities newAddress)
        {
            bool AddressAdded = false;

            try
            {
                if (ValidateAddress(newAddress))
                {
                    Address_DAL addressDAL = new Address_DAL();
                    AddressAdded = addressDAL.AddAddressDAL(newAddress);
                }
            }
            catch (GreatOutdoorsException)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(AddressAdded);
        }
Ejemplo n.º 10
0
        public static bool UpdateAddressBL(Address_Entities updateAddress)
        {
            bool addressUpdated = false;

            try
            {
                if (ValidateAddress(updateAddress))
                {
                    Address_DAL addressDAL = new Address_DAL();
                    addressUpdated = addressDAL.UpdateAddressDAL(updateAddress);
                }
            }
            catch (GreatOutdoorsException)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(addressUpdated);
        }
Ejemplo n.º 11
0
        public static bool UpdateAddressBL(Address_Entities updateAddress)
        {
            bool addressUpdated = false;

            try
            {
                if (ValidateAddress(updateAddress))
                {
                    Address_DAL addressDAL = new Address_DAL();
                    addressUpdated = addressDAL.UpdateAddressDAL(updateAddress);
                }
                else
                {
                    throw new GOException("Invalid Address Credentials");
                }
            }
            catch (GOException ex)
            {
                throw new GOException(ex.Message);
            }

            return(addressUpdated);
        }