Exemplo n.º 1
0
 /// <summary>
 /// 根据账号密码获取信息
 /// </summary>
 /// <param name="loginname">账号</param>
 /// <param name="pwd">密码</param>
 /// <returns></returns>
 public static M_Users GetM_UserByUserName(string loginname, string pwd, string operateip)
 {
     pwd = CloudSalesTool.Encrypt.GetEncryptPwd(pwd, loginname);
     DataTable dt = new M_UsersDAL().GetM_UserByUserName(loginname, pwd);
     M_Users model = null;
     if (dt.Rows.Count > 0)
     {
         model = new M_Users();
         model.FillData(dt.Rows[0]);
         if (!string.IsNullOrEmpty(model.RoleID))
         {
             model.Role = ManageSystemBusiness.GetRoleByID(model.RoleID);
             //ManageSystemBusiness.GetRoleByIDCache(model.RoleID);
         }
         //权限
         if (model.Role != null && model.Role.IsDefault == 1)
         {
             model.Menus = CommonBusiness.ManageMenus;
         }
         else if (model.IsAdmin == 1)
         {
             model.Menus = CommonBusiness.ManageMenus;
         }
         else
         {
             model.Menus = model.Role.Menus;
         }
     }
     return model;
 }
Exemplo n.º 2
0
        public JsonResult ConfirmAdminPwd(string pwd)
        {
            IntFactoryEntity.Manage.M_Users model = IntFactoryBusiness.M_UsersBusiness.GetM_UserByUserName(CurrentUser.LoginName, pwd, string.Empty);
            JsonDictionary.Add("Result", model != null?1:0);

            return(new JsonResult()
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Exemplo n.º 3
0
 /// <summary>
 /// 是否有权限
 /// </summary>
 public static string IsLimits(HttpContext httpContext, string menucode)
 {
     if (httpContext.Session["Manager"] != null)
     {
         IntFactoryEntity.Manage.M_Users model = (IntFactoryEntity.Manage.M_Users)httpContext.Session["Manager"];
         if (model.Menus.Where(m => m.MenuCode == menucode).Count() > 0)
         {
             return("");
         }
     }
     return("nolimits");
 }
Exemplo n.º 4
0
        /// <summary>
        /// 根据账号密码获取信息(登录)
        /// </summary>
        /// <param name="loginname"></param>
        /// <param name="pwd"></param>
        /// <param name="operateip"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public static M_Users GetM_UserByProUserName(string loginname, string pwd, string operateip, out int result)
        {
            pwd = CloudSalesTool.Encrypt.GetEncryptPwd(pwd, loginname);
            DataSet ds = new M_UsersDAL().GetM_UserByProUserName(loginname, pwd, out result);
            M_Users model = null;
            if (ds.Tables.Contains("M_User") && ds.Tables["M_User"].Rows.Count > 0)
            {
                model = new M_Users();
                model.FillData(ds.Tables["M_User"].Rows[0]);
                if (!string.IsNullOrEmpty(model.RoleID))
                    model.Role = ManageSystemBusiness.GetRoleByIDCache(model.RoleID);
                //权限
                if (model.Role != null && model.Role.IsDefault == 1)
                {
                    model.Menus = CommonBusiness.ManageMenus;
                }
                else if (model.IsAdmin == 1)
                {
                    model.Menus = CommonBusiness.ManageMenus;
                }
                else
                {
                    model.Menus = new List<Menu>();
                    foreach (DataRow dr in ds.Tables["Permission"].Rows)
                    {
                        Menu menu = new Menu();
                        menu.FillData(dr);
                        model.Menus.Add(menu);
                    }
                }
            }
            //记录登录日志
            LogBusiness.AddLoginLog(loginname, model != null, IntFactoryEnum.EnumSystemType.Manage, operateip, "", "", "");

            return model;
        }
Exemplo n.º 5
0
        /// <summary>
        /// 新增或修改用户信息
        /// </summary>
        public string CreateM_User(M_Users musers)
        {
            string userid = Guid.NewGuid().ToString();
            musers.LoginPWD = CloudSalesTool.Encrypt.GetEncryptPwd(musers.LoginPWD, musers.LoginName);
            bool bl = M_UsersDAL.BaseProvider.CreateM_User(userid, musers.LoginName, musers.LoginPWD,musers.Name,musers.IsAdmin,musers.RoleID,musers.Email,musers.MobilePhone,musers.OfficePhone,musers.Jobs,musers.Avatar,musers.Description,musers.CreateUserID);
            if (bl)
            {
                return userid;
            }

            return "";
        }
Exemplo n.º 6
0
        public static M_Users GetUserDetail(string userID)
        {
            DataTable dt = M_UsersDAL.BaseProvider.GetUserDetail(userID);

            M_Users model=null;
            if (dt.Rows.Count == 1)
            {
                model = new M_Users();
                model.FillData(dt.Rows[0]);
            }

            return model;
        }
Exemplo n.º 7
0
        public static List<M_Users> GetUsers(string keyWords, string roleID, int pageSize, int pageIndex, ref int totalCount, ref int pageCount)
        {
            string whereSql = " Status<>9";

            if (!string.IsNullOrEmpty(keyWords))
                whereSql += " and ( Name like '%" + keyWords + "%' or MobilePhone like '%" + keyWords + "%' or Email like '%" + keyWords + "%')";


            if (!string.IsNullOrEmpty(roleID))
                whereSql += " and RoleID='" + roleID + "'";

            DataTable dt = CommonBusiness.GetPagerData("M_Users", "*", whereSql, "AutoID", pageSize, pageIndex, out totalCount, out pageCount);
            List<M_Users> list = new List<M_Users>();
            M_Users model;
            foreach (DataRow item in dt.Rows)
            {
                model = new M_Users();
                model.FillData(item);

                if (!string.IsNullOrEmpty(model.RoleID))
                    model.Role = ManageSystemBusiness.GetRoleByIDCache(model.RoleID);

                list.Add(model);
            }

            return list;
        }