private void UPDATE_Click(object sender, EventArgs e) { if (OCD.Text == "" || HGD.Text == "" || EWD.Text == "" || PWD.Text == "") { MessageBox.Show("PLZ_FILL_RECOMMENDED_DATA__!!"); } else { con.Open(); SqlDataAdapter sda = new SqlDataAdapter("UPDATE Vehicle_Maintenance SET Vehicle_ID='" + Vehicle_ID.Text + "',Vehicle_Number='" + Vehicle_No.Text + "',Oil_Changing_Date='" + OCD.Text + "',Half_Greasing_Date='" + HGD.Text + "',Pump_Work_Date='" + PWD.Text + "',Extra_Work='" + Extra_Work.Text + "',Date='" + Date.Text + "' WHERE Maintenance_ID='" + Maintenance_ID.Text + "'", con); sda.SelectCommand.ExecuteNonQuery(); con.Close(); MessageBox.Show("UPADTED_SUCCESSFULLY__!!!"); Maintenance_ID.Text = ""; Vehicle_ID.Text = ""; Vehicle_No.Text = ""; OCD.Text = ""; HGD.Text = ""; EWD.Text = ""; PWD.Text = ""; Extra_Work.Text = ""; Date.Text = ""; Maintenance_ID.Focus(); } }
private void SAVE_Click(object sender, EventArgs e) { if (Maintenance_ID.Text == "" || Vehicle_ID.Text == "" || Vehicle_No.Text == "" || OCD.Text == "" || HGD.Text == "" || EWD.Text == "" || PWD.Text == "" || Extra_Work.Text == "" || Date.Text == "") { MessageBox.Show("PLEASE_FILL_UP_ALL_DATA__!!!"); } else { con.Open(); SqlDataAdapter sda = new SqlDataAdapter("INSERT INTO Vehicle_Maintenance(Maintenance_ID,Vehicle_ID,Vehicle_Number,Oil_Changing_Date,Half_Greasing_Date,Engine_Work_Date,Pump_Work_Date,Extra_Work,date)VALUES('" + Maintenance_ID.Text + "','" + Vehicle_ID.Text + "','" + Vehicle_No.Text + "','" + OCD.Text + "','" + HGD.Text + "','" + EWD.Text + "','" + PWD.Text + "','" + Extra_Work.Text + "','" + Date.Text + "')", con); sda.SelectCommand.ExecuteNonQuery(); con.Close(); Maintenance_ID.Text = ""; Vehicle_ID.Text = ""; Vehicle_No.Text = ""; OCD.Text = ""; HGD.Text = ""; EWD.Text = ""; PWD.Text = ""; Extra_Work.Text = ""; Date.Text = ""; Maintenance_ID.Focus(); MessageBox.Show("SAVED_SUCCESSFULLY!!!"); Add_Vehicle_Maintenance_Detail ds = new Add_Vehicle_Maintenance_Detail(); this.Dispose(false); ds.Show(); } }
private void CLEAR_Click(object sender, EventArgs e) { Maintenance_ID.Text = ""; Vehicle_ID.Text = ""; Maintenance_ID.Focus(); MessageBox.Show("ALL_CLEARED__!!!"); }
private void CLEAR_Click(object sender, EventArgs e) { Maintenance_ID.Text = ""; Vehicle_ID.Text = ""; Vehicle_No.Text = ""; OCD.Text = ""; HGD.Text = ""; EWD.Text = ""; PWD.Text = ""; Extra_Work.Text = ""; Date.Text = ""; Maintenance_ID.Focus(); MessageBox.Show("ALL_CLEARED___!!"); }
private void DELETE_Click(object sender, EventArgs e) { if (Vehicle_ID.Text == "" || Maintenance_ID.Text == "") { MessageBox.Show("PLEASE_FILL_ALL_RECOMMENDED_DATA_FIRST_!!"); } else { con.Open(); SqlCommand sda = new SqlCommand("DELETE FROM Vehicle_Maintenance WHERE Maintenance_ID='" + Maintenance_ID.Text + "' and Vehicle_ID='" + Vehicle_ID.Text + "'", con); sda.ExecuteNonQuery(); con.Close(); Maintenance_ID.Text = ""; Vehicle_ID.Text = ""; Maintenance_ID.Focus(); MessageBox.Show("DATA_DELETED_SUCCESSFULLY__!!!"); } }