예제 #1
0
        private void addCrewButton_Click(object sender, EventArgs e)
        {
            int      maxId    = dataController.GetMaxId(crewsDataTable, "crew_id");
            CrewForm crewForm = new CrewForm(crewsDataTable.NewRow(), false, maxId);

            if (crewForm.ShowDialog() == DialogResult.OK)
            {
                CrewController crewController = new CrewController(crewForm.Row);
                int            result         = crewController.Insert();
                if (result == 0)
                {
                    MessageBox.Show("Ошибка выполнения вставки");
                }

                FillTables();
                ShowRowsCountEverywhere();
            }
        }
예제 #2
0
        private void editCrewButton_Click(object sender, EventArgs e)
        {
            DataGridViewRow selectedRow = crewsDataGridView.SelectedRows[0];
            int             crewId      = (int)selectedRow.Cells["crewidDataGridViewTextBoxColumn"].Value;

            DataRow[] rows = crewsDataTable.Select(String.Format("crew_id = {0}", crewId));

            int      maxId    = dataController.GetMaxId(crewsDataTable, "crew_id");
            CrewForm crewForm = new CrewForm(rows[0], true, maxId);

            if (crewForm.ShowDialog() == DialogResult.OK)
            {
                CrewController crewController = new CrewController(crewForm.Row);
                int            result         = crewController.Update();
                if (result == 0)
                {
                    MessageBox.Show("Ошибка выполнения редактирования");
                }

                FillTables();
                ShowRowsCountEverywhere();
            }
        }