private void idBtnCancel_Click(object sender, EventArgs e) { FormCancelButton = true; if (InitFromMenu != true) { var obj = new MastersVehicle(); obj.Show(); } this.Close(); }
private void Vehicle_FormClosing(object sender, FormClosingEventArgs e) { if (FormCancelButton == false) { if (InitFromMenu != true) { var obj = new MastersVehicle(); obj.Show(); } } }
private void idBtnSave_Click(object sender, EventArgs e) { var objVehicleInfo = GetValueFromTextBox(); var ErrorCounter = 0; var ErrorMessage = "Following fields should not be empty \n\n"; if (string.IsNullOrEmpty(objVehicleInfo.VehicleNum)) { ErrorCounter++; ErrorMessage += ErrorCounter.ToString() + "] " + "Please Enter Vehicle Number \n"; } if (string.IsNullOrEmpty(objVehicleInfo.VehicleBrand)) { ErrorCounter++; ErrorMessage += ErrorCounter.ToString() + "] " + "Please enter Vehicle Brand / Type\n"; } if (ErrorCounter > 0) { MessageBox.Show(ErrorMessage, "Warning !..."); return; } if (string.IsNullOrEmpty(objVehicleInfo.ID)) { var IsPresent = VehicleBl.IsVehicleAlreadyPresent(objVehicleInfo.VehicleNum); if (IsPresent == true) { MessageBox.Show("Item already Exist with Name : " + objVehicleInfo.VehicleNum, "Warning !..."); return; } VehicleBl.SaveVehicle(objVehicleInfo); } else { VehicleBl.UpdateVehicle(objVehicleInfo); } FormCancelButton = true; if (InitFromMenu != true) { MastersVehicle obj = new MastersVehicle(); obj.Show(); } this.Close(); }
private void vehicleMasterToolStripMenuItem_Click(object sender, EventArgs e) { var obj = new MastersVehicle(); obj.Show(); }