示例#1
0
        protected void lnkSave_Click(object sender, EventArgs e)
        {
            var menus = new Menus();

            foreach (GridViewRow gvRow in gvMenuRights.Rows)
            {
                var checkBox = gvRow.FindControl("chkSelect") as CheckBox;
                if (checkBox != null && checkBox.Checked)
                {
                    menus.Add(new FBTS.Model.Control.Menu
                    {
                        MenuCode  = ((HiddenField)gvRow.FindControl("hidMenuCode")).Value,
                        MenuOrder = Convert.ToDecimal(((TextBox)gvRow.FindControl("txtLevel")).Text)
                    });
                }
            }
            var menuAccessRights = new MenuAccessRights
            {
                AccessLevelId = SelectedAccessLevel,
                AccessRights  = menus,
                DataBaseInfo  = UserContext.DataBaseInfo
            };

            if (_controlPanel.SetMenuAccessRights(menuAccessRights))
            {
                CustomMessageControl.MessageBodyText = GlobalCustomResource.AccessRightSaved;
                CustomMessageControl.MessageType     = MessageTypes.Success;
                CustomMessageControl.ShowMessage();
                AuditLog.LogEvent(UserContext, SysEventType.INFO, "ACCESS RIGHT SAVED",
                                  GlobalCustomResource.AccessRightSaved, true);
                lnkAddNew.Enabled = true;
                lnkAddNew.Style.Add("cursor", "Pointer");
                BindData(BindType.List);
            }
            else
            {
                CustomMessageControl.MessageBodyText = GlobalCustomResource.AccessRightFailed;
                CustomMessageControl.MessageType     = MessageTypes.Error;
                CustomMessageControl.ShowMessage();
                AuditLog.LogEvent(UserContext, SysEventType.INFO, "ACCESS RIGHT UPDATE FAILED",
                                  GlobalCustomResource.AccessRightFailed, true);
            }
        }
示例#2
0
        protected void lnkSaveAccessLevel_Click(object sender, EventArgs e)
        {
            var menus = new Menus();

            foreach (GridViewRow gvRow in gvMenuRights.Rows)
            {
                var checkBox = gvRow.FindControl("chkSelect") as CheckBox;
                if (checkBox != null && checkBox.Checked)
                {
                    menus.Add(new FBTS.Model.Control.Menu
                    {
                        MenuCode  = ((HiddenField)gvRow.FindControl("hidMenuCode")).Value,
                        MenuOrder = Convert.ToDecimal(((TextBox)gvRow.FindControl("txtLevel")).Text)
                    });
                }
            }
            var menuAccessRights = new MenuAccessRights
            {
                UserId       = UserCode,
                AccessRights = menus,
                DataBaseInfo = UserContext.DataBaseInfo
            };

            //UserProfilePresenter.SaveMenuRights(menuAccessRights)
            if (_controlPanel.SetMenuAccessRights(menuAccessRights))
            {
                CustomMessageControl.MessageBodyText = GlobalCustomResource.UserProfileSaved;
                CustomMessageControl.MessageType     = MessageTypes.Success;
                CustomMessageControl.ShowMessage();
                AuditLog.LogEvent(UserContext, SysEventType.INFO, "USERPROFILE SAVED",
                                  GlobalCustomResource.UserProfileSaved, true);
            }
            else
            {
                CustomMessageControl.MessageBodyText = GlobalCustomResource.UserProfileFailed;
                CustomMessageControl.MessageType     = MessageTypes.Error;
                CustomMessageControl.ShowMessage();
                AuditLog.LogEvent(UserContext, SysEventType.INFO, "USERPROFILE UPDATE FAILED",
                                  GlobalCustomResource.UserProfileFailed, true);
            }
        }