Пример #1
0
        private void editButton_Click(object sender, RoutedEventArgs e)
        {
            if (parametersGrid.SelectedItems.Count > 0)
            {
                var procParamName = parametersGrid.SelectedItems[0] as BaseProcedureParameterNames;

                if (procParamName == null)
                {
                    return;
                }

                var dialog = new BaseProcedureParameterNameEditWindow(procParamName);

                if (dialog.ShowDialog() == true)
                {
                    try
                    {
                        db.BaseProcedureParameterNames_Update(procParamName.BaseProcedureParameterNameId, procParamName.Name);

                        parametersGrid.ItemsSource = null;
                        parametersGrid.ItemsSource = db.BaseProcedureParameterNames.Where(p => p.BaseProcedureId == BaseProcedure.BaseProcedureId).ToList();
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("Проверьте введённые значения");
                    }
                }
            }
        }
Пример #2
0
        private void addButton_Click(object sender, RoutedEventArgs e)
        {
            var procParamName = new BaseProcedureParameterNames();
            var dialog        = new BaseProcedureParameterNameEditWindow(procParamName);

            if (dialog.ShowDialog() == true)
            {
                try
                {
                    db.BaseProcedureParameterNames_Create(procParamName.Name, BaseProcedure.BaseProcedureId);

                    parametersGrid.ItemsSource = null;
                    parametersGrid.ItemsSource = db.BaseProcedureParameterNames.Where(p => p.BaseProcedureId == BaseProcedure.BaseProcedureId).ToList();
                }
                catch (Exception)
                {
                    MessageBox.Show("Проверьте введённые значения");
                }
            }
        }