Exemple #1
0
        private void AddBIO_Click(object sender, RoutedEventArgs e)
        {
            Entities.OrderInTime order = new Entities.OrderInTime();
            order.WaiterID = waiterid;
            order.TableID  = 1;

            order = Requests.MethodsWaiter.InsertOrderInTime(context, order);

            //Context contextnew = new Context();

            Entities.BludoInOrder bio = new Entities.BludoInOrder();
            try
            {
                bio.BludoAmount = int.Parse(AmountB.Text);
                bio.BludoStatus = (Status.SelectedItem).ToString();
                bio.OrderID     = order.OrderID;

                var bludo = Requests.MethodsOrder.GetBludoByName(context, (ChooseB.SelectedItem).ToString());
                bio.BludoID   = bludo.BludoID;
                bio.OrderTime = DateTime.Now;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Проверьте правильность ввода данных.");
            }

            Requests.MethodsWaiter.InsertBludoInOrder(context, bio);

            ChooseB.SelectedItem = null;
            Status.SelectedItem  = null;
            AmountB.Text         = "";

            (App.Current.Windows[1]).IsEnabled = true;
        }
        public List <Entities.BludoInOrder> GetAllBludosInOrder()
        {
            List <Entities.BludoInOrder> listBludosIO = new List <Entities.BludoInOrder>();

            using (TeamProjectEntities6 entities = new TeamProjectEntities6())
            {
                var bludosIO = from r in entities.BludoInOrder
                               select r;
                foreach (BludoInOrder singleBludoIO in bludosIO)
                {
                    Entities.BludoInOrder bo = new Entities.BludoInOrder();
                    bo.OrderID     = singleBludoIO.id;
                    bo.BludoID     = int.Parse(singleBludoIO.id_Bludo.ToString());
                    bo.BludoAmount = int.Parse(singleBludoIO.number_Bludo.ToString());
                    bo.BludoStatus = singleBludoIO.status;
                    bo.OrderTime   = DateTime.Parse(singleBludoIO.ordertime.ToString());

                    listBludosIO.Add(bo);
                }
            }
            return(listBludosIO);
        }