示例#1
0
 public Order(DishService.Order order)
 {
     Email               = order.Email;
     Comment             = order.Comment;
     Date                = order.Date;
     DishWithAdditionses = new List <DishWithAddition>();
     foreach (DishService.DishWithAddition dwa in order.DishWithAdditionses)
     {
         DishWithAdditionses.Add(new DishWithAddition(dwa));
     }
 }
示例#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");
            }
        }