/// <summary>
        /// 保存新增或修改用户信息
        /// </summary>
        public void Save()
        {
            //如果是新增
            if (SysUserEntity.ID == Guid.Empty && departmentId != Guid.Empty)
            {
                SysUserEntity.DepartmentID = DepartmentId == null ? SysUserEntity.DepartmentID : DepartmentId;
                SysUserEntity.CreateTime = DateTime.Now;
                SysUserEntity.CreateUserID = SessionManager.CurrentSysUser.ID;
                SysUserEntity.Status = (int)EnumUserStatus.已激活;
                SysUserEntity.Password = StringUtility.Encrypt(SysUserEntity.Password);
                bizSysUser.Save(SysUserEntity);
            }//修改
            else if (SysUserEntity.ID != Guid.Empty)
            {
                //取出源数据 进行修改
                SysUser sysUser = bizSysUser.GetFirst(x => x.ID == SysUserEntity.ID);
                sysUser.UserAccount = SysUserEntity.UserAccount;
                sysUser.UserName = SysUserEntity.UserName;
                sysUser.DepartmentID = SysUserEntity.DepartmentID;
                sysUser.Mobile = SysUserEntity.Mobile;
                sysUser.Email = SysUserEntity.Email;
                sysUser.Memo = SysUserEntity.Memo;
                sysUser.UpdateUser = SessionManager.CurrentSysUser.ID;

                SysUserEntity.UpdateDate = DateTime.Now;
                bizSysUser.Update(sysUser);
            }

            //查找该用户所属角色
            SysRoleMember sysRoleMember = bizSysRoleMember.GetFirst(x => x.UserID == SysUserEntity.ID);
            if (sysRoleMember == null)
                sysRoleMember = new SysRoleMember();

            //如果角色编号为NULL则返回
            if (SysRoleMemberEntity == null)
            {
                bizSysRoleMember.Delete(sysRoleMember);
                return;
            }
            sysRoleMember.RoleID = SysRoleMemberEntity.RoleID;
            sysRoleMember.UserID = SysUserEntity.ID;
            bizSysRoleMember.SaveOrUpdate(sysRoleMember);
        }
 public void RetriveData()
 {
     if (OperateType == EnumDirection.Left)
     {
         foreach (Guid guid in NonAssignedUserList)
         {
             SysRoleMember sysRoleMember = new SysRoleMember()
             {
                 RoleID = SysRoleID.Value,
                 UserID = guid
             };
             bizSysRoleMember.Save(sysRoleMember);
         }
     }
     else if (OperateType == EnumDirection.Right)
     {
         foreach (Guid guid in AssignedUserList)
         {
             SysRoleMember sysRoleMember = bizSysRoleMember.GetFirst(x => x.UserID == guid && x.RoleID == SysRoleID.Value);
             bizSysRoleMember.Delete(sysRoleMember);
         }
     }
 }