Ejemplo n.º 1
0
        public ActionResult ShopEditor()
        {
            UserResBody currResBody = new UserResBody();

            foreach (UserResBody item in base._userResBody)
            {
                if (item.res_path.Equals("0,1,101,199,"))
                {
                    currResBody = item;
                    break;
                }
            }

            ViewData["currResBody"] = currResBody;//当前菜单
            string position = "";

            ViewData["pageTitle"] = base.FormatPageTile(currResBody, ref position);
            ViewData["position"]  = position;//页面位置

            int      shopid = DoRequest.GetQueryInt("shopid");
            ShopInfo shop   = null;

            if (shopid == 0)
            {
                shop = new ShopInfo();
            }
            else
            {
                shop = GetShopDetail.Do(shopid).Body;
            }
            ViewData["shop"] = shop;

            return(View());
        }
Ejemplo n.º 2
0
        public ActionResult List()
        {
            UserResBody currResBody = new UserResBody();

            foreach (UserResBody item in base._userResBody)
            {
                if (item.res_path.Equals("0,1,105,144,202,"))
                {
                    currResBody = item;
                    break;
                }
            }

            HasPermission(currResBody.res_id);

            ViewData["currResBody"] = currResBody;//当前菜单
            string position = "";

            ViewData["pageTitle"] = base.FormatPageTile(currResBody, ref position);
            ViewData["position"]  = position;//页面位置

            int    pagesize  = 30;
            int    posId     = DoRequest.GetQueryInt("posid", -1);
            int    pageindex = DoRequest.GetQueryInt("page", 1);
            string q         = DoRequest.GetQueryString("q");
            int    useplat   = DoRequest.GetQueryInt("useplat");

            int dataCount = 0;
            int pageCount = 0;
            List <RecommendPositionList> infoList = null;
            var resp = QueryRecommendPositionList.Do(pagesize, pageindex
                                                     , posId, useplat
                                                     , q
                                                     , ref dataCount, ref pageCount);

            if (resp == null || resp.Body == null)
            {
                infoList = new List <RecommendPositionList>();
            }
            else
            {
                infoList = resp.Body.recommend_list;
            }
            ViewData["infoList"] = infoList;

            System.Text.StringBuilder currPageUrl = new System.Text.StringBuilder();//拼接当前页面URL
            currPageUrl.Append("/mpolymeric/list?");
            currPageUrl.Append("&posid=" + posId);
            currPageUrl.Append("&q=" + q);
            currPageUrl.Append("&page=" + pageindex);
            currPageUrl.Append("&useplat=" + useplat);
            ViewData["currPageUrl"]    = currPageUrl;//当前页面的URL
            ViewData["pagesize"]       = pagesize;
            ViewData["pageindex"]      = pageindex;
            ViewData["dataCount"]      = dataCount;
            ViewData["pageIndexLink"]  = this.FormatPageIndex(dataCount, pagesize, pageindex, currPageUrl.ToString());
            ViewData["pageIndexLink2"] = this.FormatPageIndex(dataCount, pagesize, pageindex, currPageUrl.ToString());

            return(View());
        }
Ejemplo n.º 3
0
        public ActionResult RoleAccess()
        {
            UserResBody currResBody = new UserResBody();

            foreach (UserResBody item in base._userResBody)
            {
                if (item.res_path.Equals("0,1,107,240,241,"))
                {
                    currResBody = item;
                    break;
                }
            }

            HasPermission(currResBody.res_id);

            ViewData["currResBody"] = currResBody;//当前菜单
            string position = "";

            ViewData["pageTitle"] = base.FormatPageTile(currResBody, ref position);
            ViewData["position"]  = position;//页面位置

            List <AccessInfo> list = new List <AccessInfo>();
            var res = QueryAccessList.Do();

            if (res != null && res.Body != null && res.Body.access_list != null)
            {
                list = res.Body.access_list;
            }
            ViewData["infolist"] = list;

            return(View());
        }
Ejemplo n.º 4
0
        public ActionResult RoleList()
        {
            UserResBody currResBody = new UserResBody();

            foreach (UserResBody item in base._userResBody)
            {
                if (item.res_path.Equals("0,1,107,240,241,"))
                {
                    currResBody = item;
                    break;
                }
            }

            HasPermission(currResBody.res_id);

            ViewData["currResBody"] = currResBody;//当前菜单
            string position = "";

            ViewData["pageTitle"] = base.FormatPageTile(currResBody, ref position);
            ViewData["position"]  = position;//页面位置

            // string q = DoRequest.GetQueryString("q");

            List <RoleInfo> infoList = new List <RoleInfo>();
            var             resp     = QueryRoleList.Do();

            if (resp != null && resp.Body != null && resp.Body.role_list != null)
            {
                infoList = resp.Body.role_list;
            }

            ViewData["infoList"] = infoList;//数据列表

            return(View());
        }
Ejemplo n.º 5
0
        public ActionResult QuerySql()
        {
            UserResBody currResBody = new UserResBody();

            foreach (UserResBody item in base._userResBody)
            {
                if (item.res_path.Equals("0,1,108,238,239,"))
                {
                    currResBody = item;
                    break;
                }
            }

            HasPermission(currResBody.res_id);

            ViewData["currResBody"] = currResBody;//当前菜单
            string position = "";

            ViewData["pageTitle"] = base.FormatPageTile(currResBody, ref position);
            ViewData["position"]  = position;//页面位置

            string q = DoRequest.GetFormString("q", false);

            string state = DoRequest.GetFormString("database");

            List <string> colname  = new List <string>();
            DataTable     infoList = new DataTable();

            if (!q.Equals("") && q != null)
            {
                var resp = QueryDataBySql.Do(state, q);

                infoList = resp;

                if (infoList == null)
                {
                    infoList = new DataTable();
                }

                for (int i = 0; i < infoList.Columns.Count; i++)
                {
                    colname.Add(infoList.Columns[i].ColumnName);
                }
            }

            ViewData["colname"]  = colname;
            Session["colname"]   = colname;
            ViewData["infoList"] = infoList;//数据列表
            Session["infoList"]  = infoList;

            ViewData["sql"]  = q;
            ViewData["type"] = state;

            System.Text.StringBuilder currPageUrl = new System.Text.StringBuilder();//拼接当前页面URL
            currPageUrl.Append("/home/querysql");

            return(View());
        }
Ejemplo n.º 6
0
        public ActionResult List()
        {
            UserResBody currResBody = new UserResBody();

            foreach (UserResBody item in base._userResBody)
            {
                if (item.res_path.Equals("0,1,104,226,227,"))
                {
                    currResBody = item;
                    break;
                }
            }

            HasPermission(currResBody.res_id);
            ViewData["currResBody"] = currResBody;//当前菜单
            string position = "";

            ViewData["pageTitle"] = base.FormatPageTile(currResBody, ref position);
            ViewData["position"]  = position;//页面位置

            int pagesize  = DoRequest.GetQueryInt("size", 100);
            int pageindex = DoRequest.GetQueryInt("page", 1);
            int classid   = DoRequest.GetQueryInt("classid", -1);

            string q    = DoRequest.GetQueryString("q");
            string sKey = q;

            #region 文章列表
            int dataCount = 0;
            int pageCount = 0;
            List <ShortArticleInfo> _table = new List <ShortArticleInfo>();
            var res = QueryArticleList.Do(pagesize, pageindex
                                          , classid
                                          , sKey, ref dataCount, ref pageCount);
            if (res != null && res.Body != null && res.Body.article_list != null)
            {
                _table = res.Body.article_list;
            }
            ViewData["infoList"] = _table;                                           //文章列表

            System.Text.StringBuilder currPageUrl = new System.Text.StringBuilder(); //拼接当前页面URL
            currPageUrl.Append("/marticle/list?");
            currPageUrl.Append("&size=" + pagesize);
            currPageUrl.Append("&classid=" + classid);

            currPageUrl.Append("&q=" + DoRequest.UrlEncode(q));
            currPageUrl.Append("&page=" + pageindex);
            ViewData["currPageUrl"] = currPageUrl;//当前页面的URL
            ViewData["pagesize"]    = pagesize;
            ViewData["pageindex"]   = pageindex;
            ViewData["dataCount"]   = dataCount;

            ViewData["pageIndexLink"]  = this.FormatPageIndex(dataCount, pagesize, pageindex, currPageUrl.ToString());
            ViewData["pageIndexLink2"] = this.FormatPageIndex(dataCount, pagesize, pageindex, currPageUrl.ToString());
            #endregion

            return(View());
        }
Ejemplo n.º 7
0
        public ActionResult ShopList()
        {
            UserResBody currResBody = new UserResBody();

            foreach (UserResBody item in base._userResBody)
            {
                if (item.res_path.Equals("0,1,107,119,123,"))
                {
                    currResBody = item;
                    break;
                }
            }

            HasPermission(currResBody.res_id);

            ViewData["currResBody"] = currResBody;//当前菜单
            string position = "";

            ViewData["pageTitle"] = base.FormatPageTile(currResBody, ref position);
            ViewData["position"]  = position;//页面位置

            int    pagesize  = DoRequest.GetQueryInt("size", 60);
            int    pageindex = DoRequest.GetQueryInt("page", 1);
            string q         = DoRequest.GetQueryString("q");
            int    dataCount = 0;
            int    pageCount = 0;
            List <ShortShopInfo> infoList = null;
            var resp = QueryShopList.Do(pagesize, pageindex, q, ref dataCount, ref pageCount);

            if (resp == null || resp.Body == null || resp.Body.shop_list == null)
            {
                infoList = new List <ShortShopInfo>();
            }
            else
            {
                infoList = resp.Body.shop_list;
            }

            ViewData["infoList"] = infoList;                                         //数据列表

            System.Text.StringBuilder currPageUrl = new System.Text.StringBuilder(); //拼接当前页面URL
            currPageUrl.Append("/musers/shoplist?");
            currPageUrl.Append("&size=" + pagesize);
            currPageUrl.Append("&page=" + pageindex);
            currPageUrl.Append("&q=" + DoRequest.UrlEncode(q));
            ViewData["currPageUrl"] = currPageUrl;//当前页面的URL
            ViewData["pagesize"]    = pagesize;
            ViewData["pageindex"]   = pageindex;
            ViewData["dataCount"]   = dataCount;

            ViewData["pageIndexLink"]  = this.FormatPageIndex(dataCount, pagesize, pageindex, currPageUrl.ToString());
            ViewData["pageIndexLink2"] = this.FormatPageIndex(dataCount, pagesize, pageindex, currPageUrl.ToString());

            return(View());
        }
Ejemplo n.º 8
0
        public ActionResult TypeList()
        {
            UserResBody currResBody = new UserResBody();

            foreach (UserResBody item in base._userResBody)
            {
                if (item.res_path.Equals("0,1,611,612,613,"))
                {
                    currResBody = item;
                    break;
                }
            }
            HasPermission(currResBody.res_id);

            ViewData["currResBody"] = currResBody;//当前菜单
            string position = "";

            ViewData["pageTitle"] = base.FormatPageTile(currResBody, ref position);
            ViewData["position"]  = position;//页面位置
            int insurancetype = DoRequest.GetQueryInt("insurancetype", 0);
            int pagesize      = DoRequest.GetQueryInt("size", 4);
            int pageindex     = DoRequest.GetQueryInt("page", 1);

            //string q = DoRequest.GetQueryString("q");
            //string sKey = q;

            #region 商保列表
            int dataCount = 0;
            int pageCount = 0;
            List <InsurancetypeInfo> _table = new List <InsurancetypeInfo>();
            var res = QueryInsuranceTypeList.Do(pagesize, pageindex, insurancetype, ref dataCount, ref pageCount);
            if (res != null && res.Body != null && res.Body.insusertype_list != null)
            {
                _table = res.Body.insusertype_list;
            }
            ViewData["infoList"] = _table;                                           //商保用户类别列表

            System.Text.StringBuilder currPageUrl = new System.Text.StringBuilder(); //拼接当前页面URL
            currPageUrl.Append("/minsurance/Typelist?");
            currPageUrl.Append("insurance_id=" + insurancetype);
            currPageUrl.Append("&size=" + pagesize);
            currPageUrl.Append("&page=" + pageindex);
            ViewData["currPageUrl"] = currPageUrl;//当前页面的URL
            ViewData["pagesize"]    = pagesize;
            ViewData["pageindex"]   = pageindex;
            ViewData["dataCount"]   = dataCount;

            ViewData["pageIndexLink"]  = this.FormatPageIndex(dataCount, pagesize, pageindex, currPageUrl.ToString());
            ViewData["pageIndexLink2"] = this.FormatPageIndex(dataCount, pagesize, pageindex, currPageUrl.ToString());
            #endregion

            return(View());
        }
Ejemplo n.º 9
0
        //public ConfigInfo _config = ConnStringConfig.GetConfig;


        #region 处理PageTitle
        public string FormatPageTile(UserResBody currNode, ref string position)
        {
            string returnValue = "";

            position = "";
            if (currNode.parent_id < 2)
            {
                return(returnValue);
            }

            #region 处理Path
            int _currParentId = currNode.parent_id;
            returnValue = currNode.res_name;
            if (string.IsNullOrEmpty(currNode.res_src))
            {
                position = "<span>" + currNode.res_name + "</span>";
            }
            else
            {
                position = "<span><a href=\"" + currNode.res_src + "\">" + currNode.res_name + "</a></span>";
            }
            while (_currParentId > 2)
            {
                UserResBody _currParentNode = this._userResBody.FindLast(delegate(UserResBody item) { return(item.res_id == _currParentId); });
                if (_currParentNode == null)
                {
                    _currParentId = 0; break;
                }
                if (_currParentNode.res_id > 0)
                {
                    returnValue += "/" + _currParentNode.res_name;
                    if (!string.IsNullOrEmpty(_currParentNode.res_src))
                    {
                        position = "<a href=\"" + _currParentNode.res_src + "\">" + _currParentNode.res_name + "</a> &gt;&gt; " + position;
                    }
                    else
                    {
                        position = _currParentNode.res_name + " &gt;&gt; " + position;
                    }
                }
                _currParentId = _currParentNode.parent_id;
            }
            #endregion

            return(returnValue);
        }
Ejemplo n.º 10
0
        public ActionResult Editor()
        {
            UserResBody currResBody = new UserResBody();

            foreach (UserResBody item in base._userResBody)
            {
                if (item.res_path.Equals("0,1,107,118,121,"))
                {
                    currResBody = item;
                    break;
                }
            }

            HasPermission(currResBody.res_id);

            ViewData["currResBody"] = currResBody;//当前菜单
            string position = "";

            ViewData["pageTitle"] = base.FormatPageTile(currResBody, ref position);
            ViewData["position"]  = position;//页面位置

            int      userid = DoRequest.GetQueryInt("uid");
            UserInfo user   = null;

            if (userid == 0)
            {
                user = new UserInfo();
            }
            else
            {
                user = new UserInfo();
                var resuser = GetUserDetail.Do(userid);
                if (resuser != null && resuser.Body != null)
                {
                    user = resuser.Body;
                }
            }
            ViewData["userinfo"] = user;

            return(View());
        }
Ejemplo n.º 11
0
        /*
         * public ActionResult Add()
         * {
         *  UserResBody currResBody = new UserResBody();
         *  foreach (UserResBody item in base._userResBody)
         *  {
         *      if (item.res_path.Equals("0,1,101,192,"))
         *      {
         *          currResBody = item;
         *          break;
         *      }
         *  }
         *
         *  ViewData["currResBody"] = currResBody;//当前菜单
         *  string position = "";
         *  ViewData["pageTitle"] = base.FormatPageTile(currResBody, ref position);
         *  ViewData["position"] = position;//页面位置
         *
         *  return View();
         * }
         * */
        #endregion

        #region Items
        public ActionResult Items()
        {
            UserResBody currResBody = new UserResBody();

            foreach (UserResBody item in base._userResBody)
            {
                if (item.res_path.Equals("0,1,105,144,202,"))
                {
                    currResBody = item;
                    break;
                }
            }

            HasPermission(currResBody.res_id);

            ViewData["currResBody"] = currResBody;//当前菜单
            string position = "";

            ViewData["pageTitle"] = base.FormatPageTile(currResBody, ref position);
            ViewData["position"]  = position;//页面位置

            int    posId = DoRequest.GetQueryInt("posid");
            string q     = DoRequest.GetQueryString("q");

            List <RecommendListInfo> infoList = null;
            var resp = GetRecommendItemByRpId.Do(posId);

            if (resp == null || resp.Body == null)
            {
                infoList = new List <RecommendListInfo>();
            }
            else
            {
                infoList = resp.Body.item_list;
            }

            ViewData["infoList"] = infoList;

            return(View());
        }
Ejemplo n.º 12
0
        public ActionResult Categ()
        {
            UserResBody currResBody = new UserResBody();

            foreach (UserResBody item in base._userResBody)
            {
                if (item.res_path.Equals("0,1,104,226,225,"))
                {
                    currResBody = item;
                    break;
                }
            }
            HasPermission(currResBody.res_id);

            ViewData["currResBody"] = currResBody;//当前菜单
            string position = "";

            ViewData["pageTitle"] = base.FormatPageTile(currResBody, ref position);
            ViewData["position"]  = position;//页面位置

            return(View());
        }
Ejemplo n.º 13
0
        public ActionResult ResetNodeStatus()
        {
            int         returnValue = -1;
            int         id          = DoRequest.GetFormInt("id");
            int         status      = DoRequest.GetFormInt("status");
            UserResBody user        = userResBody.Find(delegate(UserResBody item) { return(item.res_id == id); });

            user.res_state = status;
            var res = OpResource.Do(user);

            if (res != null && res.Header != null && res.Header.Result != null && res.Header.Result.Code != null)
            {
                returnValue = Utils.StrToInt(res.Header.Result.Code, -1);
            }

            if (returnValue == 0)
            {
                return(Json(new { error = false, message = "操作成功" }));
            }

            return(Json(new { error = true, message = "操作失败" }));
        }
Ejemplo n.º 14
0
        public ActionResult Receive()
        {
            UserResBody currResBody = new UserResBody();

            foreach (UserResBody item in base._userResBody)
            {
                if (item.res_path.Equals("0,1,107,234,235,"))
                {
                    currResBody = item;
                    break;
                }
            }
            HasPermission(currResBody.res_id);

            ViewData["currResBody"] = currResBody;//当前菜单
            string position = "";

            ViewData["pageTitle"] = base.FormatPageTile(currResBody, ref position);
            ViewData["position"]  = position;//页面位置

            string phone = DoRequest.GetQueryString("q");

            List <AdressInfo> adress = new List <AdressInfo>();

            if (phone != null && !phone.Equals(""))
            {
                var res = GetReceiveAddrByMobileNo.Do(phone);
                if (res != null && res.Body != null && res.Body.addr_list != null)
                {
                    adress = res.Body.addr_list;
                }
            }
            ViewData["adressinfo"] = adress;

            return(View());
        }
Ejemplo n.º 15
0
        public ActionResult UserList()
        {
            UserResBody currResBody = new UserResBody();

            foreach (UserResBody item in base._userResBody)
            {
                if (item.res_path.Equals("0,1,107,118,121,"))
                {
                    currResBody = item;
                    break;
                }
            }

            HasPermission(currResBody.res_id);

            ViewData["currResBody"] = currResBody;//当前菜单
            string position = "";

            ViewData["pageTitle"] = base.FormatPageTile(currResBody, ref position);
            ViewData["position"]  = position;//页面位置

            int                  pagesize  = DoRequest.GetQueryInt("size", 60);
            int                  pageindex = DoRequest.GetQueryInt("page", 1);
            string               q         = DoRequest.GetQueryString("q");
            int                  state     = DoRequest.GetQueryInt("state", -1);
            int                  usertype  = DoRequest.GetQueryInt("usertype", -1);
            DateTime             date      = DateTime.Now.AddYears(-3);
            DateTime             sDate     = DoRequest.GetQueryDate("sDate", date);
            DateTime             eDate     = DoRequest.GetQueryDate("eDate", DateTime.Now);
            int                  dataCount = 0;
            int                  pageCount = 0;
            List <ShortUserInfo> infoList  = new List <ShortUserInfo>();
            DoCache              cache     = new DoCache();
            string               cachekey  = "user-QueryUserListindex=" + pageindex + "state=" + state + "type=" + usertype + "sdate=" + sDate.ToString("yyyy-MM-dd") + "edate=" + eDate.ToString("yyyy-MM-dd") + "q=" + q;

            if (cache.GetCache(cachekey) == null)
            {
                var resp = QueryUserList.Do(pagesize, pageindex, state, usertype, sDate.ToString("yyyy-MM-dd 00:00:00"), eDate.ToString("yyyy-MM-dd 23:59:59"), q, ref dataCount, ref pageCount);
                if (resp != null && resp.Body != null && resp.Body.user_list != null)
                {
                    infoList = resp.Body.user_list;
                    cache.SetCache(cachekey, infoList, 300);
                    cache.SetCache("userdatacount", dataCount, 300);
                    if (infoList.Count == 0)
                    {
                        cache.RemoveCache(cachekey);
                    }
                }
            }
            else
            {
                infoList  = (List <ShortUserInfo>)cache.GetCache(cachekey);
                dataCount = (int)cache.GetCache("userdatacount");
            }

            ViewData["infoList"] = infoList;                                         //数据列表

            System.Text.StringBuilder currPageUrl = new System.Text.StringBuilder(); //拼接当前页面URL
            currPageUrl.Append("/musers/userlist?");
            currPageUrl.Append("&size=" + pagesize);
            currPageUrl.Append("&page=" + pageindex);
            currPageUrl.Append("&q=" + DoRequest.UrlEncode(q));
            currPageUrl.Append("&state=" + state);
            currPageUrl.Append("&usertype=" + usertype);
            currPageUrl.Append("&sdate=" + sDate.ToString("yyyy-MM-dd"));
            currPageUrl.Append("&edate=" + eDate.ToString("yyyy-MM-dd"));
            ViewData["currPageUrl"] = currPageUrl;//当前页面的URL
            ViewData["pagesize"]    = pagesize;
            ViewData["pageindex"]   = pageindex;
            ViewData["dataCount"]   = dataCount;

            ViewData["pageIndexLink"]  = this.FormatPageIndex(dataCount, pagesize, pageindex, currPageUrl.ToString());
            ViewData["pageIndexLink2"] = this.FormatPageIndex(dataCount, pagesize, pageindex, currPageUrl.ToString());

            return(View());
        }
Ejemplo n.º 16
0
        public ActionResult ImgRecycleList()
        {
            UserResBody currResBody = new UserResBody();

            foreach (UserResBody item in base._userResBody)
            {
                if (item.res_path.Equals("0,1,105,139,143,"))
                {
                    currResBody = item;
                    break;
                }
            }

            HasPermission(currResBody.res_id);

            ViewData["currResBody"] = currResBody;//当前菜单
            string position = "";

            ViewData["pageTitle"] = base.FormatPageTile(currResBody, ref position);
            ViewData["position"]  = position;//页面位置


            int size    = 60;
            int page    = DoRequest.GetQueryInt("page", 1);
            int classid = DoRequest.GetQueryInt("classid", 3);


            int dataCount = 0;
            int pageCount = 0;

            DateTime sDate = DoRequest.GetQueryDate("st", DateTime.Now.AddYears(-3));
            DateTime eDate = DoRequest.GetQueryDate("et", DateTime.Now);


            string q = DoRequest.GetQueryString("q");
            //bool isImage = true;
            List <SysFiles> infoList = new List <SysFiles>();
            var             res      = QuerySysFile.Do(size, page, classid, 0
                                                       , sDate.ToString()
                                                       , eDate.ToString()
                                                       , q
                                                       , ref dataCount, ref pageCount);

            if (res != null && res.Body != null && res.Body.file_list != null)
            {
                infoList = res.Body.file_list;
            }

            ViewData["infoList"] = infoList;

            #region 分页链接
            System.Text.StringBuilder currPageUrl = new System.Text.StringBuilder();//拼接当前页面URL
            currPageUrl.Append("/mspace/imgrecycleList");
            currPageUrl.Append("?classid=" + classid);
            currPageUrl.Append("&st=" + sDate);
            currPageUrl.Append("&et=" + eDate);
            currPageUrl.Append("&page=" + page);
            currPageUrl.Append("&q=" + DoRequest.UrlEncode(q));
            ViewData["currPageUrl"] = currPageUrl;//当前页面的URL
            ViewData["pagesize"]    = size;
            ViewData["pageindex"]   = page;
            ViewData["dataCount"]   = dataCount;

            ViewData["pageIndexLink"]  = this.FormatPageIndex(dataCount, size, page, currPageUrl.ToString());
            ViewData["pageIndexLink2"] = this.FormatPageIndex(dataCount, size, page, currPageUrl.ToString());
            #endregion

            return(View());
        }
Ejemplo n.º 17
0
        //[HttpPost]
        public ActionResult GetNode()
        {
            int parentId = DoRequest.RequestInt("parentId");
            int nodeId   = DoRequest.RequestInt("nodeId");

            UserResBody pInfo = userResBody.FindLast(delegate(UserResBody item) { return(item.res_id == parentId); });
            UserResBody tInfo = userResBody.FindLast(delegate(UserResBody item) { return(item.res_id == nodeId); });

            if (pInfo == null)
            {
                pInfo = new UserResBody();
            }
            if (tInfo == null)
            {
                tInfo = new UserResBody();
            }
            if (tInfo.res_id < 1)
            {
                List <UserResBody> temList = userResBody.FindAll(delegate(UserResBody item) { return(item.parent_id == parentId); });
                tInfo.sort_no = 1;
                foreach (UserResBody node in temList)
                {
                    if (tInfo.sort_no <= node.sort_no)
                    {
                        tInfo.sort_no += 1;
                    }
                }
            }

            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            string[] arr = null;
            sb.Append("根");
            try
            {
                arr = pInfo.res_path.Split(',');
                foreach (string s in arr)
                {
                    if (string.IsNullOrEmpty(s))
                    {
                        continue;
                    }
                    int val = Utils.StrToInt(s.Trim());
                    if (val == 0 || val == 1 || val == 2)
                    {
                        continue;
                    }
                    List <UserResBody> list = userResBody.FindAll(
                        delegate(UserResBody item)
                    {
                        return(item.res_id == val);
                    });
                    if (list.Count > 0)
                    {
                        sb.Append(" >> " + list[0].res_name);
                    }
                }
            }
            catch (Exception)
            {
            }
            return(Json(new { parent = pInfo, type = tInfo, parentName = sb.ToString() }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 18
0
        public ActionResult PostNodeData()
        {
            int    parentId = DoRequest.GetFormInt("parentId");
            int    nodeId   = DoRequest.GetFormInt("nodeId");
            string name     = DoRequest.GetFormString("name").Trim();
            int    sort     = DoRequest.GetFormInt("sort");
            string url      = DoRequest.GetFormString("url").Trim();
            int    restype  = DoRequest.GetFormInt("restype");
            string rescode  = DoRequest.GetFormString("rescode").Trim();

            #region 验证
            if (string.IsNullOrEmpty(name))
            {
                return(Json(new { error = true, message = "名称不能为空" }));
            }

            if (rescode.Equals("") || rescode == null)
            {
                return(Json(new { error = true, message = "编码不能为空" }));
            }

            if (HasChinese(url))
            {
                return(Json(new { error = true, message = "URL不能含中文!" }));
            }
            #endregion

            UserResBody pNode = userResBody.FindLast(delegate(UserResBody item) { return(item.res_id == parentId); });
            UserResBody cNode = userResBody.FindLast(delegate(UserResBody item) { return(item.res_id == nodeId); });
            if (pNode == null)
            {
                pNode = new UserResBody();
            }
            if (cNode == null)
            {
                cNode = new UserResBody();
            }

            #region 初始化参数
            if (pNode.res_id == 0 && cNode.res_id == 0)
            {
                cNode.parent_id = 1;
            }
            else
            {
                cNode.parent_id = pNode.res_id;
            }
            cNode.res_name = name;
            cNode.sort_no  = sort;
            cNode.res_src  = url;
            cNode.res_type = restype;
            cNode.res_code = rescode;
            #endregion

            int  returnValue = -1;
            bool isAdd       = false;
            if (cNode.res_id == 0)
            {
                //新增
                cNode.res_id    = 0;
                cNode.res_state = 0;
                cNode.add_time  = DateTime.Now.ToString();
                isAdd           = true;
                var resResp = OpResource.Do(cNode);
                if (resResp != null && resResp.Header != null && resResp.Header.Result != null && resResp.Header.Result.Code != null)
                {
                    returnValue = Utils.StrToInt(resResp.Header.Result.Code, -1);
                }
            }
            else
            {
                //更新
                var resResp = OpResource.Do(cNode);
                if (resResp != null && resResp.Header != null && resResp.Header.Result != null && resResp.Header.Result.Code != null)
                {
                    returnValue = Utils.StrToInt(resResp.Header.Result.Code, -1);
                }
            }
            bool   isError = true;
            string message = "操作失败";


            if (returnValue == 0)
            {
                isError = false;
                message = "操作成功";
            }

            return(Json(new { error = isError, message = message, isadd = isAdd }));
        }