private void dataGridView1_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { if (dataGridView.CurrentRow.Index >= dataGridView.RowCount - 1) { return; } id.Text = dataGridView1[0, dataGridView1.CurrentRow.Index].Value.ToString(); int Id = int.Parse(id.Text); ShowShipping(Id); shipping Shipping = Functions.FindShipping(Id); if (dataGridView1.CurrentCell.ColumnIndex == 1) { DriversForm DF = new DriversForm(Shipping.DriverId); DF.Show(); return; } if (dataGridView1.CurrentCell.ColumnIndex == 2) { CarsForm CF = new CarsForm(Shipping.CarId); CF.Show(); return; } if (dataGridView1.CurrentCell.ColumnIndex == 3) { FreightsForm FF = new FreightsForm(Shipping.FreightId); FF.Show(); return; } }
public static void getDrivers() { projektEntities ctx = new projektEntities(); var query = from driver in ctx.drivers select new { Driver = driver }; DriversForm.clearDataGridView(); foreach (var result in query) { DriversForm.fillDataGridView(result.Driver.Id, result.Driver.Name, result.Driver.Surname, result.Driver.Wage, result.Driver.ADR_License, result.Driver.Employed, result.Driver.Busy, result.Driver.Comment); } }
private void button2_Click(object sender, EventArgs e) { DriversForm DF = new DriversForm(); DF.Show(); }