protected void ctlAdd_Click(object sender, ImageClickEventArgs e) { SuUserPersonalLevel su; try { if (Mode.Equals(FlagEnum.EditFlag)) { su = QueryProvider.SuUserPersonalLevelQuery.FindByIdentity(SUPL); } else { su = new SuUserPersonalLevel(); } su.PersonalLevel = ctlPersonalLevel.Text; su.Description = ctlDescription.Text; su.Active = ctlActive.Checked; su.Ordinal = ctlOrdinal.Text; if (Mode.Equals(FlagEnum.EditFlag)) { SuUserPersonalLevelService.UpdateSuUserPersonalLevel(su); } else if (Mode.Equals(FlagEnum.NewFlag)) { SuUserPersonalLevelService.AddSuUserPersonalLevel(su); } Notify_Ok(sender, e); } catch (ServiceValidationException ex) { ValidationErrors.MergeErrors(ex.ValidationErrors); ctlUpdatePanel.Update(); } }
public void Initialize(string mode, string supl) { Mode = mode; SUPL = supl; if (Mode.Equals(FlagEnum.EditFlag)) { SuUserPersonalLevel su = QueryProvider.SuUserPersonalLevelQuery.FindByIdentity(SUPL); ctlPersonalLevel.Text = su.PersonalLevel; ctlDescription.Text = su.Description; ctlActive.Checked = su.Active; ctlOrdinal.Text = su.Ordinal; ctlUpdatePanel.Update(); } else if (Mode.Equals(FlagEnum.NewFlag)) { ResetValue(); } }
protected void ctlMaintainPersonalLevelGrid_RowCommand(object sender, GridViewCommandEventArgs e) { int rowIndex; if (e.CommandName.Equals("MaintainPersonalLevelEdit")) { rowIndex = ((GridViewRow)((ImageButton)e.CommandSource).NamingContainer).RowIndex; MaintainPersonalLevelCode = ctlMaintainPersonalLevelGrid.DataKeys[rowIndex].Values["PersonalLevel"].ToString(); ctlMaintainPersonalLevelEditor.Initialize(FlagEnum.EditFlag, MaintainPersonalLevelCode); ctlMaintainPersonalLevelEditor.ShowPopUp(); } if (e.CommandName.Equals("MaintainPersonalLevelDelete")) { try { rowIndex = ((GridViewRow)((ImageButton)e.CommandSource).NamingContainer).RowIndex; MaintainPersonalLevelCode = ctlMaintainPersonalLevelGrid.DataKeys[rowIndex].Value.ToString(); SuUserPersonalLevel su = QueryProvider.SuUserPersonalLevelQuery.FindByIdentity(MaintainPersonalLevelCode); SuUserPersonalLevelService.Delete(su); } catch (Exception ex) { if (((System.Data.SqlClient.SqlException)(ex.GetBaseException())).Number == 547) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "AlertInUseData", "alert('This data is now in use.');", true); ctlMaintainPersonalLevelGrid.DataCountAndBind(); } } ctlMaintainPersonalLevelGrid.DataCountAndBind(); ctlUpdatePanel.Update(); } }