コード例 #1
0
        private void Controller()
        {
            int menu;


            using (var db = new enterpriseEntities())
            {
                menu = SelectOption();

                do
                {
                    switch (menu)
                    {
                    case 1:
                        db.products.Add(Product());
                        db.SaveChanges();
                        break;

                    case 2:
                        db.customers.Add(Client());
                        db.SaveChanges();
                        break;

                    case 3:

                        db.manufacturers.Add(Manufacturer());
                        db.SaveChanges();
                        break;

                    case 4:
                        ShowProducts();
                        break;

                    case 5:
                        ShowCustomers();
                        break;

                    case 6:
                        ShowManufacturers();
                        break;

                    case 7:
                        Environment.Exit(0);
                        break;

                    default:
                        Console.WriteLine("Key error, introduce 1/2/3/4");
                        break;
                    }
                    menu = SelectOption();
                } while (menu != 7);
            }
        }
コード例 #2
0
        private void ShowManufacturers()
        {
            using (var db = new enterpriseEntities())
            {
                var query = from manufacturers in db.manufacturers
                            select manufacturers;

                foreach (manufacturers manufacturers in query)

                {
                    Console.Write(manufacturers.id_manufacturer + " " + manufacturers.name + " " + manufacturers.municipality);

                    Console.WriteLine();
                }

                Console.Write("Press any key to return menu: ");
                Console.ReadKey();

                Console.Clear();
            }
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: guillemsoler/miniBDDcsharp
        /*
         * private static buys Buy()
         * {
         *  String productV = " ";
         *  String customerV = " ";
         *  DateTime buyDateV = Convert.ToDateTime(Console.ReadLine());
         *  String units = " ";
         *
         *
         *
         *  Console.WriteLine("Introduce the manufacturer name");
         *  nameV = Console.ReadLine();
         *  Console.WriteLine("Introduce the manufacturer municipality");
         *  municipalityV = Console.ReadLine();
         *  Console.WriteLine("Added succesfully");
         *  System.Threading.Thread.Sleep(600);
         *  Console.Clear();
         *
         *  return new orders
         *  {
         *      name = nameV,
         *      municipality = municipalityV
         *  };
         */
        private void MostrarProductes()
        {
            using (var db = new enterpriseEntities())
            {
                var query = from ms in db.manufacturers
                            select ms;

                foreach (manufacturers manufacture in query)

                {
                    Console.Write(manufacture.id_manufacturer + " " + manufacture.name);

                    Console.WriteLine();
                }

                Console.Write("Press any key to return menu: ");
                Console.ReadKey();

                Console.Clear();
            }
        }
コード例 #4
0
        private void ShowProducts()
        {
            using (var db = new enterpriseEntities())
            {
                var query = from product in db.products
                            orderby product.title
                            select product;

                foreach (products product in query)

                {
                    Console.Write(product.id_product + " " + product.title + " " + product.manufacturers + " " + product.price);

                    Console.WriteLine();
                }

                Console.Write("Press any key to return menu: ");
                Console.ReadKey();

                Console.Clear();
            }
        }
コード例 #5
0
        private void ShowCustomers()
        {
            using (var db = new enterpriseEntities())
            {
                var query = from customers in db.customers
                            select customers;

                foreach (customers customers in query)

                {
                    Console.Write(customers.id_customer + " " + customers.nif + " " + customers.name + " " + customers.surname +
                                  " " + customers.birth_date + " " + customers.gender + " " + customers.email + " " + customers.phone_number
                                  + " " + customers.credit_card);

                    Console.WriteLine();
                }

                Console.Write("Press any key to return menu: ");
                Console.ReadKey();

                Console.Clear();
            }
        }