Ejemplo n.º 1
0
        private void Orders(object sender, RoutedEventArgs e)
        {
            OrdersWindow mw = new OrdersWindow();

            mw.Show();
            this.Close();
        }
Ejemplo n.º 2
0
        private void Adding(object sender, RoutedEventArgs e)
        {
            if (NumberOrder.Text == "" || DateOrder.Text == "" || CostOrder.Text == "" || IDStatusOrder.SelectedValue.ToString() == "" || IDBook.SelectedValue.ToString() == "" || IDCustomer.SelectedValue.ToString() == "")
            {
                MessageBox.Show("Возникла ошибка! Возможно вы не заполнили поля");
                return;
            }
            else
            {
                Orders orders = new Orders();
                orders.NumberOrder   = Convert.ToInt32(NumberOrder.Text);
                orders.DateOrder     = Convert.ToDateTime(DateOrder.Text);
                orders.CostOrder     = Convert.ToInt32(CostOrder.Text);
                orders.IDStatusOrder = Convert.ToInt32(IDStatusOrder.SelectedValue.ToString());
                orders.IDBook        = Convert.ToInt32(IDBook.SelectedValue.ToString());
                orders.IDCustomer    = Convert.ToInt32(IDCustomer.SelectedValue.ToString());

                db.Orders.Add(orders);
                db.SaveChanges();
                MessageBox.Show("Добавлен заказ");
                OrdersWindow ow = new OrdersWindow();
                ow.Show();
                this.Close();
            }
        }