Esempio n. 1
0
        private void dataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            DataGrid    grid = sender as DataGrid;
            DataGridRow dgr  = grid.ItemContainerGenerator.ContainerFromItem(grid.SelectedItem) as DataGridRow;

            if (dgr != null)
            {
                Order ord = (Order)dgr.Item;

                OrderView orderEdit = new OrderView(ord);

                orderEdit.Show();
            }
        }
Esempio n. 2
0
        // Создание нового заказа
        private void ButtonNewOrder_Click(object sender, RoutedEventArgs e)
        {
            // Получение максимального номера заказа
            string     getNewOrdId    = $"SELECT IDENT_CURRENT('dbo.orders');";
            SqlCommand sqlGetNewOrdId = new SqlCommand(getNewOrdId, LoginView.connection);

            if (LoginView.connection.State == ConnectionState.Closed)
            {
                LoginView.connection.Open();
            }

            // Открытие пустого заказа с максимальным номером +1
            Order ord = new Order();

            ord.Ord_id = Convert.ToInt32(sqlGetNewOrdId.ExecuteScalar());
            ord.Ord_id++;
            ord.Ord_date_created = DateTime.Now;

            // Открываем новый заказ с новый id
            OrderView orderEdit = new OrderView(ord);

            orderEdit.Show();
        }