private void btnAdd_Click(object sender, EventArgs e) { var aeroplanedetail = new { PlaneID = tBPlaneID.Text, PlaneName = tBPlaneName.Text, FlightNumber = tBFlightNumber.Text, Source = tBSource.Text, Destination = tBDestination.Text }; bool r = AeroplaneControllers.AddUser(aeroplanedetail); if (r) { tBPlaneID.Text = ""; tBPlaneName.Text = ""; tBFlightNumber.Text = ""; tBFlightNumber.Text = ""; tBSource.Text = ""; tBDestination.Text = ""; MessageBox.Show("Aeroplanedetail Added"); dataGridView1.DataSource = AeroplaneControllers.GetAllUsers(); } else { MessageBox.Show("Aeroplanedetail not Added"); } }
private void btnDelete_Click(object sender, EventArgs e) { var r = AeroplaneControllers.DeleteUser(tBPlaneID.Text); if (r) { tBPlaneID.Text = ""; tBPlaneName.Text = ""; MessageBox.Show("Success on Update"); dataGridView1.DataSource = AeroplaneControllers.GetAllUsers(); } else { tBPlaneID.Text = ""; tBPlaneName.Text = ""; MessageBox.Show("Can not Delete"); } }
private void btnUpdate_Click(object sender, EventArgs e) { var aeroplanedetail = new { PlaneID = tBPlaneID.Text, PlaneName = tBSearch2.Text, /*FlightNumber = tBFlightNumber.Text, * Source = tBSource.Text, * Destination = tBDestination.Text*/ }; bool r = AeroplaneControllers.UpdateUser(aeroplanedetail); if (r) { MessageBox.Show("Information Updated"); dataGridView1.DataSource = AeroplaneControllers.GetAllUsers(); } else { MessageBox.Show("Information not Updated"); } }
public Aeroplane() { InitializeComponent(); dataGridView1.DataSource = AeroplaneControllers.GetAllUsers(); }