public override void UserControlLoad() { if (this.ownerPage == null) { throw new UMSException("Current Page is null or is not inheritor of BasicPage."); } loadInitControls(); this.pnlFormData.Visible = true; if (!string.IsNullOrEmpty(this.CurrentEntityMasterID) && this.CurrentEntityMasterID != Constants.INVALID_ID_STRING) { this.currentEntity = this.ownerPage.AdminClientRef.GetRoleByID(this.CurrentEntityMasterID); } else { this.currentEntity = this.ownerPage.AdminClientRef.GetRoleByID(this.hdnRowMasterKey.Value); } if (currentEntity != null) { this.tbxName.Text = currentEntity.Name; this.tbxDescription.Text = currentEntity.Description; this.tbxIntCode.Text = currentEntity.RoleIntCode; this.CurrentId = currentEntity.EntityID.ToString(); List<PermittedActionDataView> listAction = this.AdminClientRef. GetAllPermittedActionsByRole(this.CurrentId, this.GridViewSortExpression, this.GridViewSortDirection).ToList(); this.gvPermittedAction.DataSource = listAction; if (NewPageIndex.HasValue) { this.gvPermittedAction.PageIndex = NewPageIndex.Value; } this.gvPermittedAction.DataBind(); } else { this.lbResultContext.Text = string.Empty; this.tbxName.Text = string.Empty; this.tbxDescription.Text = string.Empty; this.tbxIntCode.Text = string.Empty; List<PermittedAction> listAction = new List<PermittedAction>(); this.gvPermittedAction.DataSource = listAction; if (NewPageIndex.HasValue) { this.gvPermittedAction.PageIndex = NewPageIndex.Value; } this.gvPermittedAction.DataBind(); this.CurrentId = string.Empty; } }
/// <summary> /// Create a new Role object. /// </summary> /// <param name="idRole">Initial value of the idRole property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="viewNoActive">Initial value of the ViewNoActive property.</param> public static Role CreateRole(global::System.Int32 idRole, global::System.String name, global::System.Boolean viewNoActive) { Role role = new Role(); role.idRole = idRole; role.Name = name; role.ViewNoActive = viewNoActive; return role; }
/// <summary> /// Deprecated Method for adding a new object to the Roles EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToRoles(Role role) { base.AddObject("Roles", role); }
protected void btnSave_Click(object sender, EventArgs e) { if (!this.ownerPage.CheckUserActionPermission(ETEMEnums.SecuritySettings.RoleSave, false)) { return; } if (string.IsNullOrEmpty(this.CurrentId)) { this.currentEntity = new Role(); } else { this.currentEntity = this.ownerPage.AdminClientRef.GetRoleByID(this.CurrentId); if (this.currentEntity == null) { this.lbResultContext.Text = String.Format(BaseHelper.GetCaptionString("Entity_Role_Not_Found_By_ID"), this.CurrentId); this.ownerPage.FormLoad(); return; } } currentEntity.Name = this.tbxName.Text; currentEntity.Description = this.tbxDescription.Text; currentEntity.RoleIntCode = this.tbxIntCode.Text; CallContext resultContext = new CallContext(); resultContext.CurrentConsumerID = this.ownerPage.UserProps.IdUser; resultContext = this.ownerPage.AdminClientRef.RoleSave(currentEntity, resultContext); CheckIfResultIsSuccess(lbResultContext); this.lbResultContext.Text = resultContext.Message; this.hdnRowMasterKey.Value = resultContext.EntityID; this.ownerPage.ReloadSettingApplication(); this.ownerPage.FormLoad(); }