Ejemplo n.º 1
0
        // GET: Home
        public ActionResult Index()
        {
            HXD.MS.Entity.User user = (HXD.MS.Entity.User)SessionHelper.Get("User");
            if (user == null)
            {
                return(RedirectToAction("/Login", "Account"));
            }

            ViewBag.NickName = user.NickName;
            ViewBag.TimeView = DateTime.Now.ToLongDateString();
            ViewBag.DayDate  = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.GetDayName(DateTime.Now.DayOfWeek);
            return(View());
        }
Ejemplo n.º 2
0
 public bool CheckUser(string userName, string userPass)
 {
     HXD.MS.Entity.User user = userBll.GetUserByUserName(userName);
     if (user != null)
     {
         //用户存在,比较密码
         if (user.UserPass.Equals((userPass)))
         {
             return(true);
         }
         return(false);
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 3
0
        public ContentResult GetTree()
        {
            //Result<List<ParentNode>> returnResult = null;
            List <ParentNode> tree       = new List <ParentNode>();
            ParentNode        parentNode = null;
            SubNode           subNode    = null;

            HXD.MS.Entity.User user = (HXD.MS.Entity.User)SessionHelper.Get("User");
            if (user != null)
            {
                DataTable parents = menuBll.GetUserMenuData(user.Id, 0);
                foreach (DataRow dr in parents.Rows)
                {
                    int menuId   = Convert.ToInt32(dr["Id"]);
                    int parentId = Convert.ToInt32(dr["ParentId"]);
                    parentNode = new ParentNode(menuId, dr["Name"].ToString(), dr["Icon"].ToString());
                    DataTable subNodes = menuBll.GetUserMenuData(user.Id, menuId);
                    if (subNodes.Rows.Count > 0)
                    {
                        parentNode.State = "closed";
                    }
                    else
                    {
                        parentNode.State = "open";
                    }
                    foreach (DataRow subMenu in subNodes.Rows)
                    {
                        menuId   = Convert.ToInt32(subMenu["Id"]);
                        parentId = Convert.ToInt32(subMenu["ParentId"]);
                        subNode  = new SubNode(menuId, subMenu["Name"].ToString(), subMenu["Link"].ToString(), subMenu["Icon"].ToString());
                        parentNode.children.Add(subNode);
                    }
                    tree.Add(parentNode);
                }
            }
            return(Content(AjaxMsgHelper.AjaxMsg(CodeType.Ok, "ok", tree)));
        }