コード例 #1
0
        private void UpdateToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Edit.isChanging = true;
            var issueDataTable = new Computer_Hardware_DepartmentDataSet.IssueDataTable();

            issueTableAdapter.Fill(issueDataTable);
            var           selected = dataGridViewMain.CurrentRow;
            var           row      = selected.Cells;
            EditIssueForm editForm = new EditIssueForm(
                Convert.ToInt32(row[0].Value),
                row[1].Value.ToString(),
                row[2].Value.ToString(),
                row[3].Value.ToString(),
                Convert.ToInt32(row[4].Value),
                Convert.ToInt32(row[5].Value),
                row[6].Value.ToString(),
                Convert.ToDateTime(row[7].Value),
                Convert.ToInt32(row[8].Value),
                Convert.ToInt32(row[9].Value)
                );

            editForm.ShowDialog();
            issueTableAdapter.Fill(computer_Hardware_DepartmentDataSet.Issue);
            computer_Hardware_DepartmentDataSet.AcceptChanges();
        }
コード例 #2
0
        private void AddToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Edit.isChanging = false;
            var editForm = new EditIssueForm();

            editForm.ShowDialog();
            issueTableAdapter.Fill(computer_Hardware_DepartmentDataSet.Issue);
            computer_Hardware_DepartmentDataSet.AcceptChanges();
        }
コード例 #3
0
        private void ButtonRed_Click(object sender, EventArgs e)
        {
            Edit.isChanging = true;
            var selected = dataGridViewMain.CurrentRow;
            var row      = selected.Cells;

            try
            {
                if (dataGridViewMain.DataSource == issueBindingSource)
                {
                    var issueDataTable = new Computer_Hardware_DepartmentDataSet.IssueDataTable();
                    issueTableAdapter.Fill(issueDataTable);
                    EditIssueForm editForm = new EditIssueForm(Convert.ToInt32(row[0].Value),
                                                               row[1].Value.ToString(),
                                                               row[2].Value.ToString(),
                                                               row[3].Value.ToString(),
                                                               Convert.ToInt32(row[4].Value),
                                                               Convert.ToInt32(row[5].Value),
                                                               row[6].Value.ToString(),
                                                               Convert.ToDateTime(row[7].Value),
                                                               Convert.ToInt32(row[8].Value),
                                                               Convert.ToInt32(row[9].Value)
                                                               );
                    editForm.ShowDialog();
                    issueTableAdapter.Fill(computer_Hardware_DepartmentDataSet.Issue);
                    computer_Hardware_DepartmentDataSet.AcceptChanges();
                }
                else if (dataGridViewMain.DataSource == modelsBindingSource1)
                {
                    var modelDataTable = new Computer_Hardware_DepartmentDataSet.ModelsDataTable();
                    modelsTableAdapter.Fill(modelDataTable);
                    EditModelsForm editModels = new EditModelsForm(Convert.ToInt32(row[0].Value),
                                                                   row[1].Value.ToString(),
                                                                   Convert.ToInt32(row[2].Value),
                                                                   Convert.ToInt32(row[3].Value)
                                                                   );
                    editModels.ShowDialog();
                    modelsTableAdapter.Fill(computer_Hardware_DepartmentDataSet.Models);
                    computer_Hardware_DepartmentDataSet.AcceptChanges();
                }
                else if (dataGridViewMain.DataSource == supplyBindingSource)
                {
                    var supplyDataTable = new Computer_Hardware_DepartmentDataSet.SupplyDataTable();
                    supplyTableAdapter.Fill(supplyDataTable);
                    EditSuppliesForm editSupplies = new EditSuppliesForm(Convert.ToInt32(row[0].Value),
                                                                         Convert.ToInt32(row[1].Value),
                                                                         Convert.ToDecimal(row[2].Value),
                                                                         Convert.ToInt32(row[3].Value),
                                                                         Convert.ToInt32(row[4].Value));
                    editSupplies.ShowDialog();
                    supplyTableAdapter.Fill(computer_Hardware_DepartmentDataSet.Supply);
                    computer_Hardware_DepartmentDataSet.AcceptChanges();
                }
                else if (dataGridViewMain.DataSource == suppliersBindingSource)
                {
                    var suppliersDataTable = new Computer_Hardware_DepartmentDataSet.SuppliersDataTable();
                    suppliersTableAdapter.Fill(suppliersDataTable);
                    EditSuppliersForm editSuppliers = new EditSuppliersForm(Convert.ToInt32(row[0].Value),
                                                                            row[1].Value.ToString(),
                                                                            row[2].Value.ToString());
                    editSuppliers.ShowDialog();
                    suppliersTableAdapter.Fill(computer_Hardware_DepartmentDataSet.Suppliers);
                    computer_Hardware_DepartmentDataSet.AcceptChanges();
                }
                else if (dataGridViewMain.DataSource == typesOfProductsBindingSource)
                {
                    var typesOfProductsDataTable = new Computer_Hardware_DepartmentDataSet.Types_of_ProductsDataTable();
                    types_of_ProductsTableAdapter.Fill(typesOfProductsDataTable);
                    EditTypesForm editTypes = new EditTypesForm(Convert.ToInt32(row[0].Value), row[1].Value.ToString());
                    editTypes.ShowDialog();
                    types_of_ProductsTableAdapter.Fill(computer_Hardware_DepartmentDataSet.Types_of_Products);
                    computer_Hardware_DepartmentDataSet.AcceptChanges();
                }
                else if (dataGridViewMain.DataSource == employeesBindingSource)
                {
                    var employeesDataTable = new Computer_Hardware_DepartmentDataSet.EmployeesDataTable();
                    employeesTableAdapter.Fill(employeesDataTable);
                    EditEmployeesForm editEmployees = new EditEmployeesForm(Convert.ToInt32(row[0].Value),
                                                                            row[1].Value.ToString(),
                                                                            row[2].Value.ToString(),
                                                                            row[3].Value.ToString(),
                                                                            row[4].Value.ToString(),
                                                                            row[5].Value.ToString());
                    editEmployees.ShowDialog();
                    employeesTableAdapter.Fill(computer_Hardware_DepartmentDataSet.Employees);
                    computer_Hardware_DepartmentDataSet.AcceptChanges();
                }
                else if (dataGridViewMain.DataSource == deliveryBindingSource)
                {
                    var deliveryDataTable = new Computer_Hardware_DepartmentDataSet.DeliveryDataTable();
                    deliveryTableAdapter.Fill(deliveryDataTable);
                    EditDeliveryForm editDelivery = new EditDeliveryForm(Convert.ToInt32(row[0].Value),
                                                                         row[1].Value.ToString(),
                                                                         Convert.ToInt32(row[2].Value),
                                                                         Convert.ToInt32(row[3].Value));
                    editDelivery.ShowDialog();
                    deliveryTableAdapter.Fill(computer_Hardware_DepartmentDataSet.Delivery);
                    computer_Hardware_DepartmentDataSet.AcceptChanges();
                }
                dataGridViewMain.ClearSelection();
            }
            catch (Exception ex)
            {
                MessageBox.Show(@"Error: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #4
0
 private void ButtonAdd_Click(object sender, EventArgs e)
 {
     Edit.isChanging = false;
     LastId          = Convert.ToInt32(dataGridViewMain.RowCount);
     try
     {
         if (dataGridViewMain.DataSource == issueBindingSource)
         {
             EditIssueForm editIssue = new EditIssueForm();
             editIssue.ShowDialog();
             issueTableAdapter.Fill(computer_Hardware_DepartmentDataSet.Issue);
             computer_Hardware_DepartmentDataSet.AcceptChanges();
         }
         else if (dataGridViewMain.DataSource == modelsBindingSource1)
         {
             EditModelsForm editModels = new EditModelsForm();
             editModels.ShowDialog();
             modelsTableAdapter.Fill(computer_Hardware_DepartmentDataSet.Models);
             computer_Hardware_DepartmentDataSet.AcceptChanges();
         }
         else if (dataGridViewMain.DataSource == supplyBindingSource)
         {
             EditSuppliesForm editSupplies = new EditSuppliesForm();
             editSupplies.ShowDialog();
             supplyTableAdapter.Fill(computer_Hardware_DepartmentDataSet.Supply);
             computer_Hardware_DepartmentDataSet.AcceptChanges();
         }
         else if (dataGridViewMain.DataSource == suppliersBindingSource)
         {
             EditSuppliersForm editSuppliers = new EditSuppliersForm();
             editSuppliers.ShowDialog();
             suppliersTableAdapter.Fill(computer_Hardware_DepartmentDataSet.Suppliers);
             computer_Hardware_DepartmentDataSet.AcceptChanges();
         }
         else if (dataGridViewMain.DataSource == typesOfProductsBindingSource)
         {
             EditTypesForm editTypes = new EditTypesForm();
             editTypes.ShowDialog();
             types_of_ProductsTableAdapter.Fill(computer_Hardware_DepartmentDataSet.Types_of_Products);
             computer_Hardware_DepartmentDataSet.AcceptChanges();
         }
         else if (dataGridViewMain.DataSource == employeesBindingSource)
         {
             EditEmployeesForm editEmployees = new EditEmployeesForm();
             editEmployees.ShowDialog();
             employeesTableAdapter.Fill(computer_Hardware_DepartmentDataSet.Employees);
             computer_Hardware_DepartmentDataSet.AcceptChanges();
         }
         else if (dataGridViewMain.DataSource == deliveryBindingSource)
         {
             EditDeliveryForm editDelivery = new EditDeliveryForm();
             editDelivery.ShowDialog();
             deliveryTableAdapter.Fill(computer_Hardware_DepartmentDataSet.Delivery);
             computer_Hardware_DepartmentDataSet.AcceptChanges();
         }
         dataGridViewMain.ClearSelection();
     }
     catch (Exception ex)
     {
         MessageBox.Show(@"Error: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }