示例#1
0
 public DishWithAddition(DishService.DishWithAddition dish)
 {
     Name        = dish.Name;
     Id          = dish.Id;
     Price       = dish.Price;
     Description = dish.Description;
     DishGroupId = dish.DishGroupId;
     Additions   = new List <Addition>();
     foreach (DishService.Addition add in dish.Additions)
     {
         Additions.Add(new Addition(add));
     }
 }
示例#2
0
        /*
         * Handler obsługujący zdarzenie kliknięcia w przycisk wysyłający zamówienie
         * Wysyła zamówienie
         * @param {Object} sender - objekt wywołujący zdarzenie
         * @param {EventArgs} e - Event
         * @return void
         */
        private void sendOrder_Click(object sender, EventArgs e)
        {
            var ord = new DishService.Order();

            ord.Email               = emailBox.Text;
            ord.Comment             = note.Text;
            ord.DishWithAdditionses = new List <DishService.DishWithAddition>();
            foreach (var dwa in Order.DishWithAdditionses)
            {
                var dishServiceDwa = new DishService.DishWithAddition();
                dishServiceDwa.Id          = dwa.Id;
                dishServiceDwa.Price       = dwa.Price;
                dishServiceDwa.Description = dwa.Description;
                dishServiceDwa.DishGroupId = dwa.DishGroupId;
                dishServiceDwa.Name        = dwa.Name;
                dishServiceDwa.Additions   = new List <DishService.Addition>();
                foreach (var add in dwa.GetAdditions())
                {
                    var a = new DishService.Addition();
                    a.Price       = add.Price;
                    a.Name        = add.Name;
                    a.DishGroupId = add.DishGroupId;
                    a.Id          = add.Id;
                    dishServiceDwa.Additions.Add(a);
                }

                ord.DishWithAdditionses.Add(dishServiceDwa);
            }

            if (Client.SubmitOrder(ord))
            {
                MessageBox.Show("Złożono zamówienie");
            }
            else
            {
                MessageBox.Show("Nie udało się złożyć zamówienia");
            }
        }