protected void Add_Click(object sender, EventArgs e) { //Prepare rolPB DTO for addition. SuRolepb rolePb = new SuRolepb(); rolePb.Active = true; rolePb.CreBy = UserAccount.UserID; rolePb.PBID = new SCG.DB.DTO.Dbpb(); rolePb.PBID.Pbid = Convert.ToInt64(ctlDropDownListPB.SelectedValue); rolePb.RoleID = new SuRole(); rolePb.RoleID.RoleID = RoleID; rolePb.UpdBy = UserAccount.UserID; rolePb.UpdPgm = ProgramCode; try { SuRolepbService.AddRolepb(rolePb); } catch (ServiceValidationException ex) { ValidationErrors.MergeErrors(ex.ValidationErrors); } finally { RefreshGridView(); ctlDropDownListPB.PBRoleNameBind(RoleID); } }
protected void Delete_Click(object sender, EventArgs e) { //list was chcecked. //List<SuRolepb> list = new List<SuRolepb>(); //traversal in GridView foreach (GridViewRow row in ctlGridRole.Rows) { //traversal in a row if (((CheckBox)(row.Cells[0].Controls[1])).Checked) { int rowIndex = row.RowIndex; short rolePbID = short.Parse(ctlGridRole.DataKeys[rowIndex].Value.ToString()); SuRolepb rolePb = new SuRolepb(); rolePb.RolePBID = rolePbID; SuRolepbService.DeleteRolepb(rolePb); } } RefreshGridView(); ctlDropDownListPB.PBRoleNameBind(RoleID); }