private void btnSaveEmployer_Click(object sender, EventArgs e) { //Create a new row that variables will be added into DataRow newEmployerRow = DM.dtEmployer.NewRow(); if ((txtAddEmployerName.Text == "") || (txtAddEmployerPN.Text == "") || (txtAddEmployerSuburb.Text == "") || (txtAddEmployerSA.Text == "")) { MessageBox.Show("You must type a value for each of the text fields", "Error"); return; } else { //Update rows newEmployerRow["EmployerName"] = txtAddEmployerName.Text; newEmployerRow["Street Address"] = txtAddEmployerSA.Text; newEmployerRow["Suburb"] = txtAddEmployerSuburb.Text; newEmployerRow["PhoneNumber"] = txtAddEmployerPN.Text; DM.dtEmployer.Rows.Add(newEmployerRow); MessageBox.Show("Employer added successfully", "Success"); //Update tables DM.UpdateEmployer(); } return; }
//save the new add private void btnSaveEmployer_Click(object sender, EventArgs e) { DataRow newEmployerRow = DM.dtEmployer.NewRow(); //If any of the text areas are empty then do not write data and return if ((txtpnlAddPhoneNumber.Text == "") || (txtpnlAddEmployerName.Text == "") || (txtpnlAddStreetAddress.Text == "") || (txtpnlAddSuburb.Text == "")) { MessageBox.Show("You must enter a value for each of the text fields"); return; } //Add the new row to the Table else { newEmployerRow["PhoneNumber"] = txtpnlAddPhoneNumber.Text; newEmployerRow["EmployerName"] = txtpnlAddEmployerName.Text; newEmployerRow["Street Address"] = txtpnlAddStreetAddress.Text; newEmployerRow["Suburb"] = txtpnlAddSuburb.Text; DM.dtEmployer.Rows.Add(newEmployerRow); DM.UpdateEmployer(); MessageBox.Show("Employer added successfully", "Success"); return; } }
private void btnDeleteApplication_Click(object sender, EventArgs e) { DataRow deleteApplicationRow = DM.dtApplication.Rows[cmApplication.Position]; if (MessageBox.Show("Are you sure you want to delete this application record?", "Warning", MessageBoxButtons.OKCancel) == DialogResult.OK) { deleteApplicationRow.Delete(); DM.UpdateEmployer(); MessageBox.Show("Application deleted successfully"); } else { return; } }