Example #1
0
        private void ButtonEdit_Click(object sender, RoutedEventArgs e)
        {
            List <HelpStruct> rowsToEdit = new List <HelpStruct>();

            foreach (DataRowView row in fittingsGrid.SelectedItems)
            {
                rowsToEdit.Add(new HelpStruct {
                    customerNickname = row.Row.ItemArray[0].ToString(), idOrder = int.Parse(row.Row.ItemArray[1].ToString())
                });
            }

            if (rowsToEdit.Count > 0)
            {
                Window edit_window;

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

                //Обновление списка
                RefreshList();
            }
        }
Example #2
0
        private void ButtonCreateNew_Click(object sender, RoutedEventArgs e)
        {
            Window create_window = new FittingRecordWindow(WaysToOpenForm.WaysToOpen.create);

            create_window.ShowDialog();
            RefreshList();
        }
Example #3
0
        private void DataGridCell_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            int    row_index   = fittingsGrid.SelectedIndex;
            string nickname    = "";
            int    idOrder     = -1;
            int    current_row = 0;

            foreach (DataRowView row in fittingsGrid.Items)
            {
                if (current_row != row_index)
                {
                    current_row++;
                    continue;
                }
                nickname = row.Row.ItemArray[0].ToString();
                idOrder  = int.Parse(row.Row.ItemArray[1].ToString());
                break;
            }

            Window edit_window = new FittingRecordWindow(WaysToOpenForm.WaysToOpen.edit, idOrder, nickname);

            edit_window.ShowDialog();
            RefreshList();
        }