private void btnSave_Click(object sender, EventArgs e) { hasTheSaveButtonPressed = true; App application = new App(); bool ok = false; if (string.IsNullOrEmpty(txtApplicationName.Text)) { MessageBox.Show("Please enter the Application name."); return; } else { application.ApplicationId = GlobalApplicationId; application.ApplicationName = txtApplicationName.Text; } if (GlobalEditOrNew == "Edit") { //UPDATE APPLICATION ok = DALHelpers.UpdateApplication(application); if (ok == true) { MessageBox.Show("The record was successfully saved!"); } else { MessageBox.Show("Error: An error has ocurred when trying to update the Application!"); } ActivityLog.ApplicationLogger(application, "UPDATE", GlobalApplicationName, Environment.UserName); this.Close(); } else //NEW APPLICATION { ok = DALHelpers.AddApplication(application); if (ok == true) { ActivityLog.ApplicationLogger(application, "CREATE", "", Environment.UserName); MessageBox.Show("The record was successfully saved!"); } this.Close(); } }