Example #1
0
    public BarContext bar()
    {
        BarContext _localctx = new BarContext(Context, State);

        EnterRule(_localctx, 32, RULE_bar);
        int _la;

        try {
            EnterOuterAlt(_localctx, 1);
            {
                State = 141;
                _la   = TokenStream.La(1);
                if (!((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__1) | (1L << T__2) | (1L << T__3) | (1L << T__4) | (1L << T__5) | (1L << T__6) | (1L << T__7))) != 0)))
                {
                    ErrorHandler.RecoverInline(this);
                }
                else
                {
                    Consume();
                }
            }
        }
        catch (RecognitionException re) {
            _localctx.exception = re;
            ErrorHandler.ReportError(this, re);
            ErrorHandler.Recover(this, re);
        }
        finally {
            ExitRule();
        }
        return(_localctx);
    }
Example #2
0
        public void SetUp()
        {
            barContext = new BarContext();
            InitData(barContext);


            barService = new BarService(barContext);
        }
        private static string GetUserNameOfTakenOrder(string name)
        {
            if (name == null)
            {
                return(null);
            }
            var context = new BarContext();

            return(context.Users.SingleOrDefault(p => p.Name == name).UserName);
        }
Example #4
0
        private static int ZwrocIdKlienta(Klient klient)
        {
            int id = 0;

            using (var db = new BarContext())
            {
                id = db.Klienci.First(k => k.Imie == klient.Imie &&
                                      k.Nazwisko == klient.Nazwisko &&
                                      k.Telefon == klient.Telefon &&
                                      k.Email == klient.Email).Id;
            }
            return(id);
        }
Example #5
0
        private static bool CzyKlientIstnieje(Klient klient)
        {
            bool result = false;

            using (var db = new BarContext())
            {
                result = db.Klienci.Any(k => k.Imie == klient.Imie &&
                                        k.Nazwisko == klient.Nazwisko &&
                                        k.Telefon == klient.Telefon &&
                                        k.Email == klient.Email);
            }
            return(result);
        }
Example #6
0
        public ViewModel()
        {
            if (System.ComponentModel.DesignerProperties.GetIsInDesignMode(new System.Windows.DependencyObject()))
            {
                Tables = new ObservableCollection <Table>
                {
                    new Table()
                    {
                        Id = 1, Name = "Table 1"
                    },
                    new Table()
                    {
                        Id = 2, Name = "Table 2"
                    }
                };
                AddOrderSelectedTable = Tables[0];

                Drinks = new ObservableCollection <Drink>
                {
                    new Drink()
                    {
                        Id = 1, Name = "Cuba Libre", RecommendedPrice = 20
                    },
                    new Drink()
                    {
                        Id = 2, Name = "Beer", RecommendedPrice = 10
                    },
                    new Drink()
                    {
                        Id = 3, Name = "Wine", RecommendedPrice = 10
                    }
                };
                AddOrderSelectedDrink = new Drink()
                {
                    Id = 1, Name = "Cuba Libre", RecommendedPrice = 20
                };
                LastMonthOrders = new ObservableCollection <Order>();
            }
            else
            {
                Database.SetInitializer(new ContextInit());
                this.barContext = new BarContext();
                this.barService = new BarService(this.barContext);
                Refresh();
            }
        }
Example #7
0
 public BarController(BarContext context)
 {
     Context = context;
 }
Example #8
0
 public PowiadomienieSms(BarContext db)
 {
     this.db = db;
 }
Example #9
0
 public OrdersController(BarContext context)
 {
     _context = context;
 }
Example #10
0
 public KoszykController()
 {
     db             = new BarContext();
     sessionManager = new SessionManager();
     koszykManager  = new KoszykManager(sessionManager, db);
 }
Example #12
0
 public KoszykManager(ISessionManager session, BarContext db)
 {
     this.session = session;
     this.db      = db;
 }
Example #13
0
        private void InitData(BarContext bc)
        {
            bc.Tables.Add(new Table()
            {
                Name = "Table 1"
            });
            bc.Tables.Add(new Table()
            {
                Name = "Table 2"
            });
            bc.Tables.Add(new Table()
            {
                Name = "Table 3"
            });
            bc.Tables.Add(new Table()
            {
                Name = "Table 4"
            });

            Ingredient rum = bc.Ingredients.Add(new Ingredient()
            {
                Name = "Rum"
            });
            Ingredient coke = bc.Ingredients.Add(new Ingredient()
            {
                Name = "Coke"
            });
            Ingredient beer = bc.Ingredients.Add(new Ingredient()
            {
                Name = "Beer"
            });
            Ingredient wine = bc.Ingredients.Add(new Ingredient()
            {
                Name = "Wine"
            });
            Ingredient soda = bc.Ingredients.Add(new Ingredient()
            {
                Name = "Soda"
            });

            bc.Drinks.Add(new Drink()
            {
                Name = "Cuba Libre", RecommendedPrice = 20, Ingredients = new List <Ingredient>(new Ingredient[] { rum, coke })
            });
            bc.Drinks.Add(new Drink()
            {
                Name = "Aperol Spritz", RecommendedPrice = 20, Ingredients = new List <Ingredient>(new Ingredient[] { wine, soda })
            });
            bc.Drinks.Add(new Drink()
            {
                Name = "Beer", RecommendedPrice = 15, Ingredients = new List <Ingredient>(new Ingredient[] { beer })
            });
            bc.Drinks.Add(new Drink()
            {
                Name = "Wine", RecommendedPrice = 10, Ingredients = new List <Ingredient>(new Ingredient[] { wine })
            });
            bc.Drinks.Add(new Drink()
            {
                Name = "Soda", RecommendedPrice = 5, Ingredients = new List <Ingredient>(new Ingredient[] { soda })
            });

            bc.SaveChanges();
        }
Example #14
0
 public BarService(BarContext barContext)
 {
     this.barContext = barContext;
 }
Example #15
0
        static void Main(string[] args)
        {
            //Liquors
            Liqour limeJuice     = new Liqour("LIME JUICE", Color.Green);
            Liqour tripleSec     = new Liqour("TRIPLE SEC", Color.White);
            Liqour tequila       = new Liqour("TEQUILA", Color.Yellow);
            Liqour darkRum       = new Liqour("DARK RUM", Color.Orange);
            Liqour orangeCuracao = new Liqour("ORANGE CURACAO", Color.Orange);
            Liqour almondSyrup   = new Liqour("ALMOND SYRUP", Color.Green);

            //Accessories
            Accessory saltRim         = new Accessory("salt rim");
            Accessory crushedIce      = new Accessory("crushed ice");
            Accessory limeSegment     = new Accessory("lime segment");
            Accessory limeSection     = new Accessory("lime section");
            Accessory marachinoCherry = new Accessory("marachino cherry");


            //Drinks
            Drink margarita = new Drink("MARGARITA", new List <Item>()
            {
                new Item(60, Measurement.ml, limeJuice),
                new Item(30, Measurement.ml, tripleSec),
                new Item(60, Measurement.ml, tequila),
                new Item(saltRim),
                new Item(crushedIce),
                new Item(limeSegment),
            });
            Drink maiTai = new Drink("MAI TAI", new List <Item>()
            {
                new Item(50, Measurement.ml, darkRum),
                new Item(15, Measurement.ml, orangeCuracao),
                new Item(10, Measurement.ml, limeJuice),
                new Item(60, Measurement.ml, almondSyrup),
                new Item(limeSection),
                new Item(marachinoCherry),
                new Item(limeSegment),
            });

            List <Drink> availableDrinks = new List <Drink>()
            {
                margarita,
                maiTai
            };

            using (var db = new BarContext())
            {
                db.Configuration.LazyLoadingEnabled = true;

                foreach (Drink drinkToAdd in availableDrinks)
                {
                    db.Drinks.Add(drinkToAdd);
                }
                db.SaveChanges();


                var query = db.Drinks.Include(x => x.Items.Select(xx => xx.ingridient));
                Console.WriteLine("All Drinks in the database:");
                Console.WriteLine();
                foreach (var item in query)
                {
                    Console.WriteLine(item.Name);
                    Console.WriteLine("---Ingridients");

                    if (item.AllLiqours.Any())
                    {
                        Console.WriteLine("-------Liqours:");
                        foreach (Item liqourItem in item.AllLiqours)
                        {
                            Liqour liqour = (Liqour)liqourItem.ingridient;
                            Console.WriteLine($"----------{liqourItem.Amount}{liqourItem.MeasureType} {liqourItem.ingridient.Name} with color: {liqour.LiqourColor}");
                        }
                    }

                    if (item.AllAccessories.Any())
                    {
                        Console.WriteLine("-------Accesories:");
                        foreach (Item accessory in item.AllAccessories)
                        {
                            Console.WriteLine($"----------{accessory.ingridient.Name}");
                        }
                    }

                    //db.RemoveDrink(item);

                    Console.WriteLine();
                }
            }
            Console.WriteLine("Press any key to exit...");
            Console.ReadKey();
        }
Example #16
0

        
Example #17
0
 public BarMenusController(BarContext context)
 {
     _context = context;
 }
Example #18
0
 public ProdutoRepository(BarContext barContext)
 {
     _barContext = barContext;
 }