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

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

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

            if (idsToDelete.Count > 0)
            {
                Window editWindow;

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

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

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

            Window editWindow = new SuppliersRecordWindow(WaysToOpenForm.WaysToOpen.edit, id);

            editWindow.ShowDialog();
            RefreshList();
        }