Example #1
0
 public bool SaveUer(OM_User user)
 {
     if (DbRepository.Add(user) > 0)
     {
         return(true);
     }
     return(false);
 }
Example #2
0
 public bool UpdateUer(OM_User user)
 {
     if (user != null)
     {
         user.UpdateDatetime = DateTime.Now;
     }
     if (DbRepository.Update(user) > 0)
     {
         return(true);
     }
     return(false);
 }
Example #3
0
        /// <summary>
        /// 获取当前区域用户下属的经销商、用户
        /// </summary>
        /// <param name="userGuid"></param>
        /// <returns></returns>
        public List <OM_User> GetCurrentUserByCardCode(string userGuid)
        {
            OM_UserRole userRole = GetUserRole(c => c.User_Guid == userGuid);

            OM_User currentUser = GetUser(u => u.Guid == userGuid && u.IsDel == false);

            if (currentUser == null)
            {
                return(null);
            }
            List <OM_User> listUsers = new List <OM_User>();

            listUsers.Add(currentUser);
            OM_Role role = GetRole(c => c.Guid == userRole.Role_Guid);

            List <OM_Role> roles = GetRoles(r => r.IsDel == false).ToList();

            List <OM_AreaRoles> listRoles = new List <OM_AreaRoles>();

            GetRolesTree(role.ID, listRoles, roles);
            List <OM_User> listNewUsers = null;

            if (listRoles != null)
            {
                List <string> listUserGuid = new List <string>();

                GetListUserGuid(listUserGuid, listRoles);
                if (currentUser.Account == currentUser.ParentCode)
                {
                    listUsers.AddRange(GetUserList(u => listUserGuid.Contains(u.Guid) && u.Area_Guid == currentUser.Area_Guid && u.IsDel == false).ToList());
                }
                else
                {
                    listUsers.AddRange(GetUserList(u => listUserGuid.Contains(u.Guid) && u.Area_Guid == currentUser.Area_Guid && u.IsDel == false && u.ParentCode == currentUser.Account).ToList());
                }
                List <OM_UserRole> listUserRoles = GetUserRoleList(u => (u.Role_Guid == "AA196056-70EE-45BF-A56A-A90070DA1425" || u.Role_Guid == "57BE06DB-BA09-49B7-A1D8-795EFA25F392")).ToList();
                listNewUsers = new List <OM_User>();
                foreach (var item in listUsers)
                {
                    foreach (var cardCode in listUserRoles)
                    {
                        if (item.Guid == cardCode.User_Guid)
                        {
                            if (!listNewUsers.Contains(item))
                            {
                                listNewUsers.Add(item);
                            }
                        }
                    }
                }
            }
            return(listNewUsers);
        }
Example #4
0
        /// <summary>
        /// 获取当前用户登陆信息以及其管理的其它用户
        /// </summary>
        /// <param name="guid"></param>
        /// <returns></returns>
        public List <OM_User> GetAreaRoles(string userId)
        {
            OM_UserRole userRole = GetUserRole(c => c.User_Guid == userId);

            OM_User currentUser = GetUser(u => u.Guid == userId && u.IsDel == false);

            if (currentUser == null)
            {
                return(null);
            }
            List <OM_User> listUsers = new List <OM_User>();

            listUsers.Add(currentUser);
            OM_Role role = GetRole(c => c.Guid == userRole.Role_Guid);

            List <OM_Role> roles = GetRoles(r => r.IsDel == false).ToList();

            List <OM_AreaRoles> listRoles = new List <OM_AreaRoles>();

            GetRolesTree(role.ID, listRoles, roles);
            if (listRoles != null)
            {
                List <string> listUserGuid = new List <string>();

                GetListUserGuid(listUserGuid, listRoles);
                if (currentUser.Account == currentUser.ParentCode)
                {
                    listUsers.AddRange(GetUserList(u => listUserGuid.Contains(u.Guid) && u.Area_Guid == currentUser.Area_Guid && u.IsDel == false).ToList());
                }
                else
                {
                    listUsers.AddRange(GetUserList(u => listUserGuid.Contains(u.Guid) && u.Area_Guid == currentUser.Area_Guid && u.IsDel == false && u.ParentCode == currentUser.Account).ToList());
                }
            }
            return(listUsers);
        }
Example #5
0
        public ViewResult ResetPassword(string UserGuid)
        {
            OM_User model = UserService.GetUser(Cipher, UserGuid);

            return(View("~/Views/user/resetpassword.cshtml", model));
        }