示例#1
0
        public ActionResult Login(SYS_User info)
        {
            SYS_User user = new SYS_UserManager().Login(info);

            if (user != null)
            {
                Session["SYSUSER"] = user;
                Controller_EX.BindSession(Session);
                return(Json(true, JsonRequestBehavior.AllowGet));
                //return Redirect("/Base/Home/Index");
            }
            //return JavaScript("<script>alert('登录失败!');location.href='/Base/Home/Login'</script>");
            return(Json(false, JsonRequestBehavior.AllowGet));
        }
示例#2
0
        public ActionResult EditRight(int roleId, string json)
        {
            List <int> list = new List <int>();
            var        c    = Newtonsoft.Json.JsonConvert.DeserializeObject <dynamic>(json);

            foreach (var item in c)
            {
                int id = item.id;
                list.Add(id);
            }
            var result = new SYS_RoleManager().EditRight(new SYS_RoleManager().GetByPK(roleId), list);

            Controller_EX.BindSession(Session);
            //JObject jo = JObject.Parse(json);
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
示例#3
0
        /// <summary>
        /// 从服务器更新标签集合
        /// </summary>
        /// <returns></returns>
        public List <WX_UserTag> GetTagList()
        {
            WX_UserTagManager manager = new WX_UserTagManager();
            TagService        ser     = new TagService(WXAPP.AppId, WXAPP.AppSecret);
            List <WX_UserTag> list    = new List <WX_UserTag>();
            JToken            jo      = JObject.Parse(ser.GetList())["tags"];

            foreach (var i in jo.Children())
            {
                var tag = new WX_UserTag()
                {
                    TagId   = (int)i["id"],
                    TagName = i["name"].ToString(),
                    AppId   = WXAPP.AppId
                };
                var info = manager.GetAll().Where(t => t.TagId == Convert.ToInt32(i["id"]) && t.AppId.Equals(WXAPP.AppId));
                if (info.Count() > 0)
                {
                    //info.TagName = tag.TagName;
                    manager.Update(tag);
                }
                else
                {
                    manager.Add(tag);
                }
                list.Add(tag);
            }

            var idList = new List <int>();

            foreach (var i in manager.GetAll())
            {
                if (list.Where(t => t.TagId.Equals(i.TagId)).Count() == 0)
                {
                    idList.Add(i.TagId);
                }
            }
            foreach (var id in idList)
            {
                manager.Delete(id, WXAPP.AppId);
            }

            Controller_EX.BindSession(Session);
            return(list);
        }