static void Main(string[] args)
        {
            Customer       customer20     = new Customer();
            Plant          plant10        = new Plant();
            ToyDomain      toyDomain      = new ToyDomain();
            PlantDomain    plantDomain    = new PlantDomain();
            ToyType        toyType10      = new ToyType();
            Customer       customer       = new Customer();
            ToyTypeDomain  toyTypeDomain  = new ToyTypeDomain();
            CustomerDomain customerDomain = new CustomerDomain();
            OrderDomain    orderDomain    = new OrderDomain();

repeate:
            Console.WriteLine("--->>Welcome to Toy Store application<<---");

            Console.WriteLine("-->>Choose form the below given options<<--");

            Console.WriteLine("=1.1:->Enter ToyType..{this option adds which type of toy you Manufacturing}");
            Console.WriteLine("=1.2:->Show list of ToyTypes..{this option shows whole list of entered ToyTypes}");
            Console.WriteLine("=1.3:->Delete ToyType..{this option deletes selected field}");
            Console.WriteLine("=2.1:->Enter Plant..{this option adds the information regarding to the Manufacturing Plants}");
            Console.WriteLine("=2.2:->Show  list of Plants..{this option shows list of Manufacturing Plants}");
            Console.WriteLine("=2.3:->Delete Plant..{this option deletes Manufacturing plants}");
            Console.WriteLine("=3.1:->Enter Customer..{this option adds the information regarding to Customer}");
            Console.WriteLine("=3.2:->Show list of Customers..{this option shows list of Customers}");
            Console.WriteLine("=3.3:->Delete Customer..{this option deletes Customers}");
            Console.WriteLine("=4.1:->Enter Toys..{this option adds information regarding to the Toys}");
            Console.WriteLine("=4.2:->Show list of Toys..{this option shows the list of enterd Toys}");
            Console.WriteLine("=5.1:->Enter Order..{this option adds order details}");
            Console.WriteLine("=5.2:->Show list of Orders..{this option shows the list of enterd Orders}");
            Console.WriteLine("Enter any other numeric key to Exit the program");
            double c = double.Parse(Console.ReadLine());

            switch (c)
            {
            case 1.1:
                toyTypeDomain.AddToyType();
                Console.WriteLine("");
                goto repeate;

            case 1.2:
                Console.WriteLine("Id\t ToyType");
                foreach (ToyType toyType in toyTypeDomain.GetToyType())
                {
                    Console.WriteLine($"{toyType.ToyTypeId}\t  {toyType.ToyTypeName}");
                }
                Console.WriteLine("");
                goto repeate;

            case 1.3:
                Console.WriteLine("--->>Delete ToyType<<---");
                Console.WriteLine("Enter typeId");
                toyType10.ToyTypeId = Int32.Parse(Console.ReadLine());
                toyTypeDomain.DeleteToyType(toyType10);
                Console.WriteLine("");
                goto repeate;

            case 2.1:
                plantDomain.AddPlant();
                Console.WriteLine("");
                goto repeate;

            case 2.2:
                Console.WriteLine("Id\tPlantName PlantAddress");
                foreach (Plant plant in plantDomain.GetAllPlant())
                {
                    Console.WriteLine($"{plant.PlantId}\t{plant.PlantName}\t\t{plant.PlantAddress}");
                }
                Console.WriteLine("");
                goto repeate;

            case 2.3:
                Console.WriteLine("--->> Delete Plant <<---");
                Console.WriteLine("Enter Id To delete Plant: ");
                plant10.PlantId = Int32.Parse(Console.ReadLine());
                plantDomain.DeletePlant(plant10);
                Console.WriteLine("");
                goto repeate;

            case 3.1:
                customerDomain.AddCustomer();
                Console.WriteLine("");
                goto repeate;

            case 3.2:
                Console.WriteLine("\n--->> View All Customers <<---");

                Console.WriteLine("Id \t CustomerName \t CustomerAddress");
                foreach (Customer customer1 in customerDomain.GetAllCustomers())
                {
                    Console.WriteLine($"{customer1.CustomerId}\t  {customer1.CustomerName}\t\t{customer1.CustomerPermanentAddress} ");
                }
                Console.WriteLine("");
                goto repeate;

            case 3.3:
                Console.WriteLine("--->> Delete Plant <<---");
                Console.WriteLine("Enter Id To delete Plant: ");
                customer20.CustomerId = Int32.Parse(Console.ReadLine());
                customerDomain.DeleteCustomer(customer20);
                Console.WriteLine("");
                goto repeate;

            case 4.1:
                toyDomain.AddToy();
                Console.WriteLine("");
                goto repeate;

            case 4.2:
                Console.WriteLine("\n--->> View All Toys <<---");

                Console.WriteLine("Id \t ToyPrice\tToyTypeId\tPlantId");
                foreach (Toy toy in toyDomain.GetAllToy())
                {
                    Console.WriteLine($"{toy.ToyId}\t  {toy.ToyPrice}\t\t{toy.ToyTypeId}\t\t{toy.PlantId} ");
                }
                Console.WriteLine("");
                goto repeate;

            case 5.1:
                orderDomain.AddOrder();
                Console.WriteLine("");
                goto repeate;

            case 5.2:
                Console.WriteLine("\n--->> View All Orders <<---");

                Console.WriteLine("Id \tQuantity\tAddress\tDiscount\tToyId\tCustomerId");
                foreach (Order order in orderDomain.GetAllOrders())
                {
                    Console.WriteLine($"{order.OrderId}\t{order.OrderQuantity}\t\t{order.OrderAddress}\t{order.OrderDiscount}\t\t{order.ToyId}\t\t{order.CustomerId} ");
                }
                Console.WriteLine("");
                goto repeate;

            default:
                break;
            }

            /* customerDomain.AddCustomer();*/

            /*Console.WriteLine("\n--->> View All Customers <<---");
             *
             * Console.WriteLine("Id \t CustomerName \t CustomerAddress");
             * foreach (Customer customer1 in customerDomain.GetAllCustomers())
             * {
             *
             *  Console.WriteLine($"{customer1.CustomerId}\t  {customer1.CustomerName}\t\t{customer1.CustomerPermanentAddress} ");
             * }
             *
             *
             * Console.WriteLine("--->> Delete Customer <<---");
             * Console.WriteLine("Enter Id To delete Customer: ");
             * customer.CustomerId = Int32.Parse(Console.ReadLine());
             *
             *
             * Console.WriteLine("Hello World!");
             * Console.ReadLine();*/

            /*toyTypeDomain.AddToyType();*/

            /*Console.Writeline("Delete ToyType");
             * Console.WriteLine("Enter typeId");
             * toyType.ToyTypeId = Int32.Parse(Console.ReadLine());
             * toyTypeDomain.DeleteToyType(toyType);*/

            /*toyDomain.AddToy();*/

            /*Console.WriteLine("\n--->> View All Toys <<---");
             *
             * Console.WriteLine("Id \t ToyPrice\tToyTypeId\tPlantId" );
             * foreach (Toy toy in toyDomain.GetAllToy())
             * {
             *  Console.WriteLine($"{toy.ToyId}\t  {toy.ToyPrice}\t\t{toy.ToyTypeId}\t\t{toy.PlantId} ");
             * }*/


            //orderDomain.AddOrder();

            /*Console.WriteLine("\n--->> View All Orders <<---");
             *
             * Console.WriteLine("Id \tQuantity\tAddress\tDiscount\tToyId\tCustomerId");
             * foreach (Order order in orderDomain.GetAllOrders())
             * {
             *  Console.WriteLine($"{order.OrderId}\t{order.OrderQuantity}\t\t{order.OrderAddress}\t{order.OrderDiscount}\t\t{order.ToyId}\t\t{order.CustomerId} ");
             * }*/
        }
示例#2
0
        static void Main(string[] args)
        {
            bool           carryon = true;
            char           ch;
            int            i;
            OrderDomain    orderDomain    = new OrderDomain();
            CustomerDomain customerDomain = new CustomerDomain();
            CompanyDomain  companyDomain  = new CompanyDomain();

            Console.WriteLine("----------------Welcome in ToySelling Application-------------");
            while (carryon)
            {
                Console.WriteLine("\n1. Customer Registration\t2.Company Registration\n3. Add Toy In Production\t 4. View Toys\n5. View Customers \n6 . Add Shipping Address\t7. Show Address \n 8. Add Order In Cart\t9. View Cart Order  \n10. Place Order \t 11. View Invoice\n\nEnter Your Choice : ");
                int choice = Convert.ToInt32(Console.ReadLine());
                switch (choice)
                {
                case 1:
                    Customer customer = new Customer();
                    Console.WriteLine("\nEnter Name :");
                    customer.Name = Console.ReadLine();
                    Console.WriteLine("\nEnter Mobile No :");
                    customer.MobileNo = Convert.ToInt32(Console.ReadLine()).ToString();
                    Console.WriteLine("\nEnter City :");
                    customer.City = Console.ReadLine();

                    customerDomain.AddCustomer(customer);
                    Console.WriteLine("\nDo you want to continue? Press y for yes");
                    ch = Convert.ToChar(Console.ReadLine());
                    if (ch.Equals('y') || ch.Equals('Y'))
                    {
                        carryon = true;
                    }
                    else
                    {
                        carryon = false;
                    }
                    break;

                case 2:
                    Company company = new Company();
                    Console.WriteLine("\nEnter Name :");
                    company.CompanyName = Console.ReadLine();
                    Console.WriteLine("\nEnter City :");
                    company.City = Console.ReadLine();

                    companyDomain.AddCompany(company);
                    Console.WriteLine("\nDo you want to continue? Press y for yes");
                    ch = Convert.ToChar(Console.ReadLine());
                    if (ch.Equals('y') || ch.Equals('Y'))
                    {
                        carryon = true;
                    }
                    else
                    {
                        carryon = false;
                    }
                    break;

                case 3:
                    ToyProduction toyProduction = new ToyProduction();
                    Console.WriteLine("\nEnter Toy Id :");
                    toyProduction.ToyId = Convert.ToInt32(Console.ReadLine());
                    Console.WriteLine("\nEnter CompanyId :");
                    toyProduction.CompanyId = Convert.ToInt32(Console.ReadLine());
                    Console.WriteLine("\nEnter Price :");
                    toyProduction.Price = Convert.ToInt32(Console.ReadLine());
                    Console.WriteLine("\nEnter Quantity :");
                    toyProduction.Quantity = Convert.ToInt32(Console.ReadLine());
                    CompanyDomain companyDomain1 = new CompanyDomain();
                    companyDomain1.AddToyProduction(toyProduction);
                    Console.WriteLine("\nDo you want to continue? Press y for yes");
                    ch = Convert.ToChar(Console.ReadLine());
                    if (ch.Equals('y') || ch.Equals('Y'))
                    {
                        carryon = true;
                    }
                    else
                    {
                        carryon = false;
                    }
                    break;

                case 4:
                    CompanyDomain cd = new CompanyDomain();
                    i = 1;
                    foreach (ToyProduction toy in cd.GetToyProduction())
                    {
                        Console.WriteLine("Toy - " + i);
                        Console.WriteLine("ToyProductionId : " + toy.ProductionId);
                        Console.WriteLine("ToyId : " + toy.ToyId);
                        Console.WriteLine("CompanyId : " + toy.CompanyId);
                        Console.WriteLine("Price : " + toy.Price);
                        Console.WriteLine("Total Toy : " + toy.Quantity);
                        Console.WriteLine("------------------------------------------------");
                    }
                    Console.WriteLine("\nDo you want to continue? Press y for yes");
                    ch = Convert.ToChar(Console.ReadLine());
                    if (ch.Equals('y') || ch.Equals('Y'))
                    {
                        carryon = true;
                    }
                    else
                    {
                        carryon = false;
                    }

                    break;

                case 5:
                    foreach (Customer customer1 in customerDomain.GetCustomers())
                    {
                        Console.WriteLine("Customer Id : " + customer1.CustomerId);
                        Console.WriteLine("Name : " + customer1.Name);
                        Console.WriteLine("Mobile No : " + customer1.MobileNo);
                        Console.WriteLine("Ciry : " + customer1.City);
                        Console.WriteLine("------------------------------------------------");
                    }
                    Console.WriteLine("\nDo you want to continue? Press y for yes");
                    ch = Convert.ToChar(Console.ReadLine());
                    if (ch.Equals('y') || ch.Equals('Y'))
                    {
                        carryon = true;
                    }
                    else
                    {
                        carryon = false;
                    }

                    break;

                case 6:
                    CustomerAddress customerAddress = new CustomerAddress();
                    Console.WriteLine("\nEnter Address :");
                    customerAddress.Address = Console.ReadLine();
                    Console.WriteLine("\nEnter Custermer Id :");
                    customerAddress.CustomerId = Convert.ToInt32(Console.ReadLine());
                    CustomerDomain cust = new CustomerDomain();
                    cust.AddAddress(customerAddress);
                    Console.WriteLine("\nDo you want to continue? Press y for yes");
                    ch = Convert.ToChar(Console.ReadLine());
                    if (ch.Equals('y') || ch.Equals('Y'))
                    {
                        carryon = true;
                    }
                    else
                    {
                        carryon = false;
                    }

                    break;

                case 7:
                    CustomerAddress ca = new CustomerAddress();
                    Console.WriteLine("Enter Customer Id :");
                    ca.CustomerId = Convert.ToInt32(Console.ReadLine());
                    foreach (CustomerAddress customer1 in customerDomain.GetCustomerAddresses(ca))
                    {
                        Console.WriteLine("Customer Id : " + customer1.CustomerId);
                        Console.WriteLine("Address Id : " + customer1.AddressId);
                        Console.WriteLine("Address : " + customer1.Address);
                        Console.WriteLine("------------------------------------------------");
                    }
                    Console.WriteLine("\nDo you want to continue? Press y for yes");
                    ch = Convert.ToChar(Console.ReadLine());
                    if (ch.Equals('y') || ch.Equals('Y'))
                    {
                        carryon = true;
                    }
                    else
                    {
                        carryon = false;
                    }

                    break;

                case 8:
                    Order order = new Order();
                    Console.WriteLine("\nEnter Custermer Id :");
                    order.CustomerId = Convert.ToInt32(Console.ReadLine());
                    Console.WriteLine("\nEnter ToyProduction Id :");
                    order.ProductionId = Convert.ToInt32(Console.ReadLine());
                    Console.WriteLine("\nEnter Quantity :");
                    order.Quantity = Convert.ToInt32(Console.ReadLine());
                    Console.WriteLine("\nEnter Shipping Address Id :");
                    order.AddressId = Convert.ToInt32(Console.ReadLine());
                    Console.WriteLine("\nEnter Order Date :");
                    order.OrderDate = Convert.ToDateTime(Console.ReadLine());

                    orderDomain.AddOrder(order);
                    Console.WriteLine("\nDo you want to continue? Press y for yes");
                    ch = Convert.ToChar(Console.ReadLine());
                    if (ch.Equals('y') || ch.Equals('Y'))
                    {
                        carryon = true;
                    }
                    else
                    {
                        carryon = false;
                    }

                    break;

                case 9:
                    foreach (Order orders in orderDomain.GetOrders())
                    {
                        Console.WriteLine("Order Id : " + orders.OderId);
                        Console.WriteLine("ToyId : " + orders.CustomerId);
                        Console.WriteLine("ToyId : " + orders.ProductionId);
                        Console.WriteLine("AddressId : " + orders.AddressId);
                        Console.WriteLine("------------------------------------------------");
                    }
                    Console.WriteLine("\nDo you want to continue? Press y for yes");
                    ch = Convert.ToChar(Console.ReadLine());
                    if (ch.Equals('y') || ch.Equals('Y'))
                    {
                        carryon = true;
                    }
                    else
                    {
                        carryon = false;
                    }

                    break;

                case 10:
                    orderDomain.GetOrderById();
                    Console.WriteLine("\nDo you want to continue? Press y for yes");
                    ch = Convert.ToChar(Console.ReadLine());
                    if (ch.Equals('y') || ch.Equals('Y'))
                    {
                        carryon = true;
                    }
                    else
                    {
                        carryon = false;
                    }
                    break;

                case 11:
                    Invoice invoice = new Invoice();
                    invoice = orderDomain.GetInvoiceById();
                    Console.WriteLine("Invoice Id :" + invoice.InvoiceId);
                    Console.WriteLine("Order Id :" + invoice.OrderId);
                    Console.WriteLine("Price :" + invoice.Price);
                    Console.WriteLine("Offer Id :" + invoice.OfferId);
                    Console.WriteLine("Final Price :" + invoice.FinalPrice);
                    Console.WriteLine("\nDo you want to continue? Press y for yes");
                    ch = Convert.ToChar(Console.ReadLine());
                    if (ch.Equals('y') || ch.Equals('Y'))
                    {
                        carryon = true;
                    }
                    else
                    {
                        carryon = false;
                    }
                    break;

                default:
                    carryon = false;
                    break;
                }
            }
        }
示例#3
0
 public IActionResult Post(Customers customer)
 {
     customerDomain.AddCustomer(customer);
     return(Ok("Done Successfully"));
 }
示例#4
0
 public IActionResult Post(Customers customers)
 {
     domain.AddCustomer(customers);
     return(Ok());
 }