Exemple #1
0
        private void ButtonCreateNew_Click(object sender, RoutedEventArgs e)
        {
            Window create_window = new ProductRecordWindow(WaysToOpenForm.WaysToOpen.create);

            create_window.ShowDialog();
            RefreshList();
        }
Exemple #2
0
        private void ButtonEdit_Click(object sender, RoutedEventArgs e)
        {
            List <int> id_ProductsToDelete = new List <int>();

            foreach (DataRowView row in productsGrid.SelectedItems)
            {
                id_ProductsToDelete.Add((int)row.Row.ItemArray[0]);
            }

            if (id_ProductsToDelete.Count > 0)
            {
                Window create_window;

                //Первые окна мы открываем немодально, последнее модально, чтоб потом сразу обновились данные на форме
                if (id_ProductsToDelete.Count > 1)
                {
                    for (int i = 0; i < id_ProductsToDelete.Count - 1; i++)
                    {
                        create_window = new ProductRecordWindow(WaysToOpenForm.WaysToOpen.edit, id_ProductsToDelete[i]);
                        create_window.Show();
                    }
                }
                //Заключительная форма
                create_window = new ProductRecordWindow(WaysToOpenForm.WaysToOpen.edit, id_ProductsToDelete[id_ProductsToDelete.Count - 1]);
                create_window.ShowDialog();

                //Обновление списка
                RefreshList();
            }
        }
Exemple #3
0
        private void DataGridCell_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            int row_index   = productsGrid.SelectedIndex;
            int id_Product  = -1;
            int current_row = 0;

            foreach (DataRowView row in productsGrid.Items)
            {
                if (current_row != row_index)
                {
                    current_row++;
                    continue;
                }
                id_Product = (int)row.Row.ItemArray[0];
                break;
            }

            Window create_window = new ProductRecordWindow(WaysToOpenForm.WaysToOpen.edit, id_Product);

            create_window.ShowDialog();
            RefreshList();
        }