Exemplo n.º 1
0
        /// <summary>
        /// Removing Customer All Addresses
        /// </summary>
        static void RemoveMyAddresses()
        {
            AddressDetail        ad = new AddressDetail();
            AddressBusinessLogic ab = new AddressBusinessLogic();

            try { ab.RemoveAllAddresses(ad); }
            catch (AddressException ae)
            {
                throw new AddressException("For you there were no Adderesses");
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Updating Particular Address Of the Customer
        /// </summary>
        static void UpdateAddress()
        {
            WriteLine("These are your addresses");
            List <AddressDetail> Addresses = bd.GetAllCustomerAddresses(ad);

            foreach (var address in Addresses)
            {
                WriteLine("Address Type: " + address.AddressId);
                WriteLine("Country: " + address.CustomerCountry);
                WriteLine("Name: " + address.CustomerName);
                WriteLine("Mobile Number: " + address.MobileNumber);
                WriteLine("PinCode: " + address.PinCode);
                WriteLine("FlatNo " + address.FlatNo);
                WriteLine("Area: " + address.AreaColony);
                WriteLine("LandMark: " + address.LandMark);
                WriteLine("Town/City: " + address.Town);
                WriteLine("State: " + address.State);
                WriteLine("State: " + address.DefaultAddressOrNot);
            }
            WriteLine("Enter Your Address Id to change");
            int  Option;
            bool b = int.TryParse(ReadLine(), out Option);

            if (b)
            {
                try
                {
                    AddressDetail        add      = Addresses[Option];
                    AddressBusinessLogic updating = new AddressBusinessLogic();
                    WriteLine("Enter Your Details to be Updates");
                    do
                    {
                        WriteLine("Enter 1 to Update Country");
                        WriteLine("Enter 2 to Update Customer Name");
                        WriteLine("Enter 3 to Update Customer Mobile Number");
                        WriteLine("Enter 4 to Update Mobile Number");
                        WriteLine("Enter 5 to Update Pincode");
                        WriteLine("Enter 6 to Update FaltNo");
                        WriteLine("Enter 7 to Update Area");
                        WriteLine("Enter 8 to Update LandMark");
                        WriteLine("Enter 9 to Update Town");
                        WriteLine("Enter 10 update State");
                        WriteLine("Enter 11 to Update DefaultAddress");
                        WriteLine("Enter 12 to Update Address Type");
                        int  Option1;
                        bool bb = int.TryParse(ReadLine(), out Option1);
                        if (bb)
                        {
                            switch (Option1)
                            {
                            case 1:
                                add.CustomerCountry = ReadLine();
                                updating.ValidatingCountry(add);
                                break;

                            case 2:
                                add.CustomerName = ReadLine();
                                //updating.ValidatingCountry(add);
                                break;

                            case 3:
                                add.MobileNumber = ReadLine();
                                updating.ValidatingPhoneNumber(add);
                                break;

                            case 4:
                                add.PinCode = ReadLine();
                                break;

                            case 5:
                                add.PinCode = ReadLine();
                                break;

                            case 6:
                                add.FlatNo = ReadLine();
                                break;

                            case 7:
                                add.AreaColony = ReadLine();
                                break;

                            case 8:
                                add.LandMark = ReadLine();
                                break;

                            case 9:
                                add.Town = ReadLine();
                                updating.ValidatingState(add);
                                break;

                            case 10:
                                add.DefaultAddressOrNot = Convert.ToBoolean(ReadLine());
                                break;

                            case 11:
                                int  Type;
                                bool val = int.TryParse(ReadLine(), out Type);
                                add.AddressId = (AddressType)Type;
                                break;
                            }
                        }
                    } while (true);
                    bd.UpdateExistingAddress(add);
                }
                catch (AddressException ae)
                {
                    WriteLine("Enter Valid Address id to Update");
                }
            }
        }