Ejemplo n.º 1
0
        private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            var selectedRow = dataGridView1.Rows[e.RowIndex].Cells;

            if (label1.Text == "Продукты")
            {
                var edt = new ProductEditForm(selectedRow[0].Value.ToString(), selectedRow[1].Value.ToString(), Convert.ToDecimal(selectedRow[2].Value), selectedRow[3].Value.ToString());
                edt.ShowDialog();
                productTableAdapter.Fill(databaseForLabDataSet.Product);
            }
            else if (label1.Text == "Склады")
            {
                var edt = new StockEditForm(Convert.ToInt32(selectedRow[0].Value), selectedRow[1].Value.ToString());
                edt.ShowDialog();
                stockTableAdapter.Fill(databaseForLabDataSet.Stock);
            }
            else if (label1.Text == "Организации")
            {
                var edt = new SupplierEditForm(selectedRow[0].Value.ToString(), selectedRow[1].Value.ToString());
                edt.ShowDialog();
                supplierTableAdapter.Fill(databaseForLabDataSet.Supplier);
            }
            else if (label1.Text == "Работяги")
            {
                var edt = new EmployeeEditForm(Convert.ToInt32(selectedRow[0].Value), selectedRow[1].Value.ToString(), Convert.ToInt32(selectedRow[2].Value.ToString()), selectedRow[3].Value.ToString(), selectedRow[4].Value.ToString(), Convert.ToDateTime(selectedRow[5].Value));
                edt.ShowDialog();
                employeeTableAdapter.Fill(databaseForLabDataSet.Employee);
            }
        }
Ejemplo n.º 2
0
 private void AddItemStripButton_Click(object sender, EventArgs e)
 {
     if (label1.Text == "Продукты")
     {
         var edt = new ProductEditForm();
         edt.ShowDialog();
         productTableAdapter.Fill(databaseForLabDataSet.Product);
     }
     if (label1.Text == "Склады")
     {
         var edt = new StockEditForm();
         edt.ShowDialog();
         stockTableAdapter.Fill(databaseForLabDataSet.Stock);
     }
     databaseForLabDataSet.AcceptChanges();
     if (label1.Text == "Организации")
     {
         var edt = new SupplierEditForm();
         edt.ShowDialog();
         supplierTableAdapter.Fill(databaseForLabDataSet.Supplier);
     }
     if (label1.Text == "Работяги")
     {
         var edt = new EmployeeEditForm();
         edt.ShowDialog();
         employeeTableAdapter.Fill(databaseForLabDataSet.Employee);
     }
 }