protected void SaveOrganizationButton_Click(object sender, EventArgs e) { //Create the organizacion in the database if (OrganizationId == 0) { try { OrganizationBLL.InsertOrganization(OrganizationNameTextBox.Text); } catch (Exception exc) { SystemMessages.DisplaySystemErrorMessage(exc.Message); return; } SystemMessages.DisplaySystemMessage(Resources.Organization.MessageCreateOk); } else { try { OrganizationBLL.UpdateOrganization(OrganizationId, OrganizationNameTextBox.Text); } catch (Exception exc) { SystemMessages.DisplaySystemErrorMessage(exc.Message); return; } SystemMessages.DisplaySystemMessage(Resources.Organization.MessageUpdateOk); } Response.Redirect("~/Organization/ListOrganizations.aspx"); }
protected void AddOrganization_Click(object sender, EventArgs e) { if (!Page.IsValid) { return; } //Verify if exists with the same name OrganizationBLL theBLL = new OrganizationBLL(); Organization theOrg = null; try { theOrg = theBLL.GetOrganizationByName(OrganizationName.Text); } catch {} if (theOrg != null) { SystemMessages.DisplaySystemErrorMessage(Resources.Organization.MessageNameExists); return; } //Create the organizacion in the database int organizationId = 0; try { organizationId = OrganizationBLL.InsertOrganization(OrganizationName.Text); } catch (Exception exc) { SystemMessages.DisplaySystemErrorMessage(exc.Message); return; } SystemMessages.DisplaySystemMessage(Resources.Organization.MessageCreateOk); Response.Redirect("~/Organization/ListOrganizations.aspx"); }