示例#1
0
 public Restaurant(Meniu meniu, Orar orar, int nrMese, string adresa, string nume)
 {
     this.meniu  = meniu;
     this.orar   = orar;
     this.nrMese = nrMese;
     this.adresa = adresa;
     this.nume   = nume;
 }
示例#2
0
 public static Meniu GetInstance()
 {
     if (_instance == null)
     {
         _instance = new Meniu();
     }
     return(_instance);
 }
示例#3
0
 public Model()
 {
     try
     {
         loadDB();
     } catch (SqlException sqlEx)
     {
         throw sqlEx;
     }
     _menu  = Meniu.GetInstance();
     lastID = getIdOfCommand();
 }
示例#4
0
 public Form1()
 {
     try
     {
         _model     = new Model();
         _presenter = new Presenter(this, _model);
         InitializeComponent();
         SetPresenter(_presenter);
         SetModel(_model);
         panelEmployee.Visible = false;
         _meniu = Meniu.GetInstance();
         initControls();
         loadCommandsFromDB();
     } catch (SqlException sqlEx)
     {
         MessageBox.Show("Eroare la deschiderea bazei de date:\r\n" + sqlEx.Message, "EROARE", MessageBoxButtons.OK, MessageBoxIcon.Error);
         Application.Exit();
     }
 }
示例#5
0
 void setMeniu(Meniu meniu)
 {
     this.meniu = meniu;
 }
示例#6
0
        static void Main(string[] args)
        {
            Console.WriteLine("1. Afisare Restaurante");
            Console.WriteLine("2. Adaugare Restaurante");
            Console.WriteLine("3. Modificare Restaurante");
            Console.WriteLine("4. Stergere Restaurante");
            Console.WriteLine("0. Exit");
            Console.WriteLine("Alegeti Optiunea");
            string opt = Console.ReadLine();

            RestaurantBL.RestauranteBusinessLogic restaurantebl = new RestaurantBL.RestauranteBusinessLogic();
            while (!(string.Equals(opt, "0")))
            {
                if (string.Equals(opt, "1"))
                {
                    restaurantebl.AfisareRestaurante();
                }
                if (string.Equals(opt, "4"))
                {
                    string nume = Console.ReadLine();
                    restaurantebl.StergereRestaurant(nume);
                }
                if (string.Equals(opt, "2"))
                {
                    Console.WriteLine("dati ingredientul");
                    string ingredient = Console.ReadLine();
                    Restaurant.Ingredient        i           = new Restaurant.Ingredient(ingredient);
                    List <Restaurant.Ingredient> ingrediente = new List <Restaurant.Ingredient>();
                    ingrediente.Add(i);
                    Console.WriteLine("dati pretul");
                    string pret = Console.ReadLine();
                    Console.WriteLine("dati numele");
                    string nume = Console.ReadLine();
                    Console.WriteLine("dati gramaj");
                    string gramaj = Console.ReadLine();
                    Restaurant.Preparate        preparat  = new Restaurant.Preparate(ingrediente, Convert.ToInt16(pret), nume, Convert.ToInt16(gramaj));
                    List <Restaurant.Preparate> preparate = new List <Restaurant.Preparate>();
                    preparate.Add(preparat);
                    Console.WriteLine("dati ora deschidere");
                    string oraDeschidere = Console.ReadLine();
                    Console.WriteLine("dati ora inchidere");
                    string          oraInchidere = Console.ReadLine();
                    Restaurant.Orar orar         = new Restaurant.Orar(Convert.ToInt16(oraDeschidere), Convert.ToInt16(oraInchidere));
                    Console.WriteLine("dati pretul bauturii");
                    string pretBautura = Console.ReadLine();
                    Console.WriteLine("dati numele bauturii");
                    string numeBautura = Console.ReadLine();
                    Console.WriteLine("dati cantitatea");
                    string                    cantitate = Console.ReadLine();
                    Restaurant.Bautura        bautura   = new Restaurant.Bautura(Convert.ToInt16(pret), nume, Convert.ToInt16(cantitate));
                    List <Restaurant.Bautura> bauturi   = new List <Restaurant.Bautura>();
                    bauturi.Add(bautura);
                    Restaurant.Meniu meniu = new Restaurant.Meniu(preparate, bauturi);
                    Console.WriteLine("dati numarul de mese ");
                    string nrMese = Console.ReadLine();
                    Console.WriteLine("dati adresa");
                    string adresa = Console.ReadLine();
                    Console.WriteLine("dati numele restaurantului");
                    string numeRestaurant            = Console.ReadLine();
                    Restaurant.Restaurant restaurant = new Restaurant.Restaurant(meniu, orar, Convert.ToInt16(nrMese), adresa, numeRestaurant);
                    restaurantebl.AdaugareRestaurante(restaurant);
                }
                if (string.Equals(opt, "3"))
                {
                    Console.WriteLine("dati ingredientul");
                    string ingredient = Console.ReadLine();
                    Restaurant.Ingredient        i           = new Restaurant.Ingredient(ingredient);
                    List <Restaurant.Ingredient> ingrediente = new List <Restaurant.Ingredient>();
                    ingrediente.Add(i);
                    Console.WriteLine("dati pretul");
                    string pret = Console.ReadLine();
                    Console.WriteLine("dati numele");
                    string nume = Console.ReadLine();
                    Console.WriteLine("dati gramaj");
                    string gramaj = Console.ReadLine();
                    Restaurant.Preparate        preparat  = new Restaurant.Preparate(ingrediente, Convert.ToInt16(pret), nume, Convert.ToInt16(gramaj));
                    List <Restaurant.Preparate> preparate = new List <Restaurant.Preparate>();
                    preparate.Add(preparat);
                    Console.WriteLine("dati ora deschidere");
                    string oraDeschidere = Console.ReadLine();
                    Console.WriteLine("dati ora inchidere");
                    string          oraInchidere = Console.ReadLine();
                    Restaurant.Orar orar         = new Restaurant.Orar(Convert.ToInt16(oraDeschidere), Convert.ToInt16(oraInchidere));
                    Console.WriteLine("dati pretul bauturii");
                    string pretBautura = Console.ReadLine();
                    Console.WriteLine("dati numele bauturii");
                    string numeBautura = Console.ReadLine();
                    Console.WriteLine("dati cantitatea");
                    string                    cantitate = Console.ReadLine();
                    Restaurant.Bautura        bautura   = new Restaurant.Bautura(Convert.ToInt16(pret), nume, Convert.ToInt16(cantitate));
                    List <Restaurant.Bautura> bauturi   = new List <Restaurant.Bautura>();
                    bauturi.Add(bautura);
                    Restaurant.Meniu meniu = new Restaurant.Meniu(preparate, bauturi);
                    Console.WriteLine("dati numarul de mese ");
                    string nrMese = Console.ReadLine();
                    Console.WriteLine("dati adresa");
                    string adresa = Console.ReadLine();
                    Console.WriteLine("dati numele restaurantului");
                    string numeRestaurant            = Console.ReadLine();
                    Restaurant.Restaurant restaurant = new Restaurant.Restaurant(meniu, orar, Convert.ToInt16(nrMese), adresa, numeRestaurant);
                    restaurantebl.ModificareRestaurant(restaurant);
                }
                Console.WriteLine("Dati optiunea");
                opt = Console.ReadLine();
            }
        }