protected void btnAgencyNotesSave_Click(object sender, EventArgs e) { var roleId = 0; try { roleId = Int32.Parse(ddlAgencyNotesRole.SelectedValue); } catch { } var role = AgencyViewBLL.RoleGetById(roleId); var agencyNotesId = 0; try { agencyNotesId = Int32.Parse(hidAgencyNotesId.Value); } catch { } AgencyNotes agencyNotes = null; agencyNotes = AgencyViewBLL.AgencyNotesGetById(agencyNotesId); if (agencyNotes == null || agencyNotes.Id == 0) { agencyNotes = new AgencyNotes(); } agencyNotes.Agency = Agency; agencyNotes.Role = role; agencyNotes.Note = txtAgencyNotesNote.Text; AgencyViewBLL.AgencyNotesSaveOrUpdate(agencyNotes); Response.Redirect(Request.RawUrl); }
protected void rptAgencyNotes_ItemCommand(object source, RepeaterCommandEventArgs e) { var agencyNotesId = 0; if (e.CommandName == "Delete") { try { agencyNotesId = Convert.ToInt32(e.CommandArgument); } catch { } var agencyNotes = AgencyViewBLL.AgencyNotesGetById(agencyNotesId); AgencyViewBLL.DeleteAgencyNotes(agencyNotes); } Response.Redirect(Request.RawUrl); }