private void SAVEButton_Click(object sender, EventArgs e) { TypeOfTrip aType = new TypeOfTrip(); aType.TypeNo = typeNoTextBox.Text; aType.TypeName = typeNameTextBox.Text; TypeOfTripBL typeBLOBj = new TypeOfTripBL(); bool result = typeBLOBj.SaveNewTypeBL(aType); if (result) { MessageBox.Show("Succesfuly added new Location!", "Done!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); this.PopulateGridView(); IntitialButtonMood(); CleanTextBar(); } else { DialogResult dialog = MessageBox.Show("Please fill all the text", "ERROR", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); if (dialog == DialogResult.Cancel) { this.Close(); } } }
private void PopulateGridView() { DataTable dt = new DataTable(); TypeOfTripBL typeBLOBj = new TypeOfTripBL(); dt = typeBLOBj.GetExistingdTypeBL(); typeOfTripDataGridView.DataSource = dt; }
private void deleteButton_Click(object sender, EventArgs e) { TypeOfTrip aType = new TypeOfTrip(); aType.TypeNo = typeNoTextBox.Text; aType.TypeName = typeNameTextBox.Text; TypeOfTripBL typeBLOBj = new TypeOfTripBL(); bool result = typeBLOBj.DeleteTypeBL(aType); if (result) { MessageBox.Show("Succesfuly Deleted", "Done!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); this.PopulateGridView(); IntitialButtonMood(); CleanTextBar(); } else { MessageBox.Show("Something wrong!", "Aleart", MessageBoxButtons.OK, MessageBoxIcon.Error); } }