Пример #1
0
        private void insertEdit(int param, string name)
        {
            if (dTable.Rows.Count != 0 && dataGrid.SelectedIndex != -1)
            {
            }
            else
            {
                if (param == 1)
                {
                    MessageBox.Show($"Нет данных для редактирования", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }
            }
            switch (name)
            {
            case "Conference":
            {
                InsEdit insEdit;
                if (param == 0)
                {
                    insEdit = new InsEdit("Добавление", name, dbConnectionString);
                }
                else
                {
                    insEdit = new InsEdit("Изменение", name, dTable.Rows[dataGrid.SelectedIndex], dbConnectionString);
                }
                insEdit.Tag = param;
                insEdit.ShowDialog();
                break;
            }

            case "SectionLeaders":
            {
                InsEdit insEdit;
                if (param == 0)
                {
                    insEdit = new InsEdit("Добавление", name, dbConnectionString);
                }
                else
                {
                    insEdit = new InsEdit("Изменение", name, dTable.Rows[dataGrid.SelectedIndex], dbConnectionString);
                }
                insEdit.Tag = param;
                insEdit.ShowDialog();
                break;
            }

            case "Section":
            {
                InsEdit insEdit;
                if (param == 0)
                {
                    insEdit = new InsEdit("Добавление", name, dbConnectionString);
                }
                else
                {
                    insEdit = new InsEdit("Изменение", name, dTable.Rows[dataGrid.SelectedIndex], dbConnectionString);
                }
                insEdit.Tag = param;
                insEdit.ShowDialog();
                break;
            }

            case "Member":
            {
                InsEdit insEdit;
                if (param == 0)
                {
                    insEdit = new InsEdit("Добавление", name, dbConnectionString);
                }
                else
                {
                    insEdit = new InsEdit("Изменение", name, dTable.Rows[dataGrid.SelectedIndex], dbConnectionString);
                }
                insEdit.Tag = param;
                insEdit.ShowDialog();
                break;
            }

            case "Lecture":
            {
                InsEdit insEdit;
                if (param == 0)
                {
                    insEdit = new InsEdit("Добавление", name, dbConnectionString);
                }
                else
                {
                    insEdit = new InsEdit("Изменение", name, dTable.Rows[dataGrid.SelectedIndex], dbConnectionString);
                }
                insEdit.Tag = param;
                insEdit.ShowDialog();
                break;
            }
            }
            dTable.Clear();
            adapter = new NpgsqlDataAdapter(sqlQuery, dbConn);
            adapter.Fill(dTable);
            dataGrid.DataContext = dTable;
        }
Пример #2
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.InsEditWindow = ((Lab6._2.InsEdit)(target));
                return;

            case 2:
                this.gridInsEdit = ((System.Windows.Controls.Grid)(target));
                return;

            case 3:
                this.button1 = ((System.Windows.Controls.Button)(target));

            #line 12 "..\..\InsEdit.xaml"
                this.button1.Click += new System.Windows.RoutedEventHandler(this.button1_Click);

            #line default
            #line hidden
                return;

            case 4:
                this.button2 = ((System.Windows.Controls.Button)(target));

            #line 13 "..\..\InsEdit.xaml"
                this.button2.Click += new System.Windows.RoutedEventHandler(this.button2_Click);

            #line default
            #line hidden
                return;

            case 5:
                this.label1 = ((System.Windows.Controls.Label)(target));
                return;

            case 6:
                this.label2 = ((System.Windows.Controls.Label)(target));
                return;

            case 7:
                this.label3 = ((System.Windows.Controls.Label)(target));
                return;

            case 8:
                this.label4 = ((System.Windows.Controls.Label)(target));
                return;

            case 9:
                this.label5 = ((System.Windows.Controls.Label)(target));
                return;

            case 10:
                this.label6 = ((System.Windows.Controls.Label)(target));
                return;

            case 11:
                this.textBox1 = ((System.Windows.Controls.TextBox)(target));
                return;

            case 12:
                this.textBox2 = ((System.Windows.Controls.TextBox)(target));
                return;

            case 13:
                this.textBox3 = ((System.Windows.Controls.TextBox)(target));
                return;

            case 14:
                this.textBox4 = ((System.Windows.Controls.TextBox)(target));
                return;

            case 15:
                this.textBox5 = ((System.Windows.Controls.TextBox)(target));
                return;

            case 16:
                this.textBox6 = ((System.Windows.Controls.TextBox)(target));
                return;

            case 17:
                this.datePicker1 = ((System.Windows.Controls.DatePicker)(target));
                return;

            case 18:
                this.datePicker2 = ((System.Windows.Controls.DatePicker)(target));
                return;

            case 19:
                this.comboBox1 = ((System.Windows.Controls.ComboBox)(target));
                return;

            case 20:
                this.comboBox2 = ((System.Windows.Controls.ComboBox)(target));
                return;
            }
            this._contentLoaded = true;
        }