Beispiel #1
0
        /// <summary>
        /// Change Shipping Address
        /// </summary>
        static void ChangeShippingAddress()
        {
            int Type;

            WriteLine("Enter All The Details Below Showed");

            try
            {
                WriteLine("------------------Enter Your Shipping Details ------------------");
                WriteLine("Enter Country:");
                ad.CustomerCountry = ReadLine();
                bd.ValidatingCountry(ad);
                //bd.IsCountryExists(ad.CustomerCountry);
                WriteLine("Enter Your Name:");
                ad.CustomerName = ReadLine();
                bd.ValidatingState(ad);
                WriteLine("Enter Mobile Number:");
                ad.MobileNumber = ReadLine();
                bd.ValidatingPhoneNumber(ad);
                WriteLine("Enter Your Pincode:");
                ad.PinCode = ReadLine();
                WriteLine("Enter Flat/DoorNumber:");
                ad.FlatNo = ReadLine();
                WriteLine("Enter Your Area");
                ad.AreaColony = ReadLine();
                WriteLine("Enter your LandMark:");
                ad.LandMark = ReadLine();
                WriteLine("Enter your Town/City:");
                ad.Town = ReadLine();
                WriteLine("Enter your State");
                ad.State = ReadLine();
                WriteLine("Enter true if this is your Default address otherwise enter false");
                ad.DefaultAddressOrNot = Convert.ToBoolean(ReadLine());
                WriteLine("Enter your Address 0 for Type Home or 1 for Office");
                bool val = int.TryParse(ReadLine(), out Type);
                ad.AddressId = (AddressType)Type;
                WriteLine("These are your Address Details");
                WriteLine("Country: " + ad.CustomerCountry);
                WriteLine("Name: " + ad.CustomerName);
                WriteLine("Mobile Number: " + ad.MobileNumber);
                WriteLine("PinCode: " + ad.PinCode);
                WriteLine("FlatNo " + ad.FlatNo);
                WriteLine("Area: " + ad.AreaColony);
                WriteLine("LandMark: " + ad.LandMark);
                WriteLine("Town/City: " + ad.Town);
                WriteLine("State: " + ad.State);
                WriteLine("Address Type: " + ad.AddressId);
                bd.AddAddress(ad);
            }
            catch (AddressException ex)
            {
                WriteLine(ex.Message);
            }
        }
Beispiel #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");
                }
            }
        }