Пример #1
0
        public ActionResult PostHomeType()
        {
            int posId = DoRequest.GetFormInt("posid");

            CategSetInfo categ    = new CategSetInfo();
            var          rescateg = GetHomeTypeById.Do(posId);

            if (rescateg != null && rescateg.Body != null)
            {
                categ = rescateg.Body;
            }

            if (categ == null)
            {
                categ.home_pt_id = 0;
            }
            else
            {
                categ.home_pt_id = posId;
            }

            categ.parent_id  = DoRequest.GetFormInt("pid");
            categ.type_name  = DoRequest.GetFormString("name");
            categ.type_url   = DoRequest.GetFormString("url");
            categ.sort_no    = DoRequest.GetFormInt("sort");
            categ.is_black   = DoRequest.GetFormInt("Isb") > 0 ? 1 : 0;
            categ.is_color   = DoRequest.GetFormInt("Iscolor") > 0 ? 1 : 0;
            categ.is_newline = DoRequest.GetFormInt("IsBr") > 0 ? 1 : 0;
            categ.pos_type   = DoRequest.GetFormInt("position1");

            if (categ.type_name.Length <= 0)
            {
                return(Json(new { error = true, message = "菜单名称不能为空" }));
            }
            if (categ.type_url.Length <= 0)
            {
                return(Json(new { error = true, message = "URL不能为空" }));
            }
            if (HasChinese(categ.type_url))
            {
                return(Json(new { error = true, message = "URL不能含中文!" }));
            }

            int rVal = -1;
            var res  = OpHomeType.Do(categ);

            if (res != null && res.Header != null && res.Header.Result != null && res.Header.Result.Code != null)
            {
                rVal = Utils.StrToInt(res.Header.Result.Code, -1);
            }
            if (rVal == 0)
            {
                return(Json(new { error = false, message = "操作成功" }));
            }

            return(Json(new { error = true, message = "操作失败" }));
        }
Пример #2
0
        public ActionResult GetCategSet()
        {
            int id = DoRequest.GetFormInt("ID");

            CategSetInfo info = new CategSetInfo();
            var          res  = GetHomeTypeById.Do(id);

            if (res != null && res.Body != null)
            {
                info = res.Body;
                return(Json(new { error = false, categ = info, message = "操作成功!" }));
            }
            return(Json(new { error = true, message = "获取信息失败!" }));
        }