コード例 #1
0
ファイル: UCGroups.cs プロジェクト: mogh64/SecurityManagement
        private void btnAddUser_Click(object sender, EventArgs e)
        {
            if (this.iGridEXGroup.CurrentRow != null)
            {
                var group = (SecurityGroupDto)this.iGridEXGroup.CurrentRow.DataRow;
                SecurityUserPresenter presenter = new SecurityUserPresenter();
                var       users = presenter.GetAll().UserDtoList;
                var       tbl   = DataTableHelper.ConvertToDatatable <UserDto>(users);
                ILov      lovActionOrder;
                LovFields lfActionOrder;
                lfActionOrder = new LovFields();
                lfActionOrder.AddItem(AssemblyReflector.GetMemberName((UserDto m) => m.FirstName), "نام", 100, true);
                lfActionOrder.AddItem(AssemblyReflector.GetMemberName((UserDto m) => m.LastName), "نام خانوادگی", 100, true);
                lfActionOrder.AddItem(AssemblyReflector.GetMemberName((UserDto m) => m.PersonelCode), "کد پرسنلی", 100, true);
                lfActionOrder.AddItem(AssemblyReflector.GetMemberName((UserDto m) => m.NationalNo), "کد ملی", 100, true);

                lovActionOrder = new ILov(this.btnAddUser, "ليست کاربران", tbl, lfActionOrder);
                var row = lovActionOrder.ShowDialog() as DataRow;
                if (row != null)
                {
                    var    userId       = row.Field <long>(AssemblyReflector.GetMemberName((UserDto m) => m.UserId));
                    var    selectedUser = users.Where(it => it.UserId == userId).FirstOrDefault();
                    string message      = string.Format("آیا از انتساب گروه {0} به {1} مطمئن هستید؟", group.DisplayName, selectedUser.FullName);
                    if (ISE.Framework.Client.Win.Viewer.MessageViewer.ShowAlert(message) != DialogResult.OK)
                    {
                        return;
                    }
                    view.AssignUser(group, selectedUser);
                }
            }
        }
コード例 #2
0
 private void gridUsers_SelectionChanged(object sender, EventArgs e)
 {
     if (this.gridUsers.CurrentRow != null)
     {
         var user = (UserDto)this.gridUsers.CurrentRow.DataRow;
         if (user != null)
         {
             SecurityUserPresenter presenter = new SecurityUserPresenter();
             if (user.RoleIdList == null || user.RoleIdList.Count == 0)
             {
                 user.RoleIdList = presenter.GetUserRoleIds(user.UserId);
             }
             if (user.GroupIdList == null || user.GroupIdList.Count == 0)
             {
                 user.GroupIdList = presenter.GetUserGroupIds(user.UserId);
             }
             groupBS.DataSource          = view.BindGroups(user.GroupIdList);
             roleBS.DataSource           = view.BindRoles(user.RoleIdList);
             this.iGridEXGrp.DataSource  = groupBS;
             this.iGridEXRole.DataSource = roleBS;
             LoadAccounts();
             //time consum
             ReloadTree();
         }
     }
 }
コード例 #3
0
ファイル: RoleView.cs プロジェクト: mogh64/SecurityManagement
        public void DeAssignUser(RoleDto role, UserDto user)
        {
            SecurityUserPresenter userPresenter = new SecurityUserPresenter();

            if (userPresenter.DeAssignUserToRole(user, role.RoleId))
            {
                SecurityUserBindingList.Remove(user);
            }
        }