Exemplo n.º 1
0
        public JsonResult AddorEditContent(jmp_Help_Content mod)
        {
            // mod.Content = mod.Content.RemoveStyles();
            JMP.BLL.jmp_Help_Content bll = new JMP.BLL.jmp_Help_Content();
            object retJson = new { success = 0, msg = "操作失败" };

            if (mod.ID > 0)
            {
                JMP.MDL.jmp_Help_Content mo = new jmp_Help_Content();
                mo              = bll.GetModel(mod.ID);
                mo.ISOverhead   = mod.ISOverhead;
                mo.Title        = mod.Title;
                mo.UpdateById   = UserInfo.Uid;
                mo.UpdateByName = UserInfo.UserName;
                mo.UpdateOn     = DateTime.Now;
                mo.Type         = mod.Type;
                mo.Content      = mod.Content;
                mo.PrentID      = mod.PrentID;
                mo.ClassId      = mod.ClassId;
                if (bll.Update(mo))
                {
                    Logger.ModifyLog("修改内容", mo, mod);
                    bll.UpdateClassCount(mod.PrentID, 0);
                    bll.UpdateClassCount(mod.ClassId, 1);
                    retJson = new { success = 1, msg = "修改成功" };
                }
                else
                {
                    retJson = new { success = 0, msg = "修改失败" };
                }
            }
            else
            {
                mod.State        = 0;
                mod.CreateById   = UserInfo.Uid;
                mod.CreateByName = UserInfo.UserName;
                mod.CreateOn     = DateTime.Now;
                mod.UpdateOn     = DateTime.Now;
                int cg = bll.Add(mod);
                if (cg > 0)
                {
                    Logger.CreateLog("添加内容", model);
                    bll.UpdateClassCount(mod.PrentID, 0);
                    bll.UpdateClassCount(mod.ClassId, 1);
                    retJson = new { success = 1, msg = "添加成功" };
                }
                else
                {
                    retJson = new { success = 0, msg = "添加失败" };
                }
            }

            return(Json(retJson));
        }
Exemplo n.º 2
0
        public ActionResult ContentList()
        {
            List <JMP.MDL.jmp_Help_Content> list = new List <JMP.MDL.jmp_Help_Content>();

            JMP.BLL.jmp_Help_Content        bll      = new JMP.BLL.jmp_Help_Content();
            JMP.BLL.jmp_Help_Classification classbll = new JMP.BLL.jmp_Help_Classification();
            int       pageCount  = 0;
            int       pageIndexs = string.IsNullOrEmpty(Request["pageIndexs"]) ? 1 : Int32.Parse(Request["pageIndexs"]); //当前页
            int       PageSize   = string.IsNullOrEmpty(Request["PageSize"]) ? 20 : Int32.Parse(Request["PageSize"]);    //每页显示数量
            string    Type       = string.IsNullOrEmpty(Request["Type"]) ? "" : Request["Type"];
            string    sea_name   = string.IsNullOrEmpty(Request["sea_name"]) ? "" : Request["sea_name"];
            int       State      = string.IsNullOrEmpty(Request["State"]) ? -1 : int.Parse(Request["State"]);
            int       PrentID    = string.IsNullOrEmpty(Request["PrentID"]) ? 0 : int.Parse(Request["PrentID"]);
            int       ClassId    = string.IsNullOrEmpty(Request["ClassId"]) ? 0 : int.Parse(Request["ClassId"]);
            int       sType      = string.IsNullOrEmpty(Request["sType"]) ? -1 : int.Parse(Request["sType"]);
            DataTable tablelist  = classbll.GetList(" 1=1 and ParentID=0 and State=0  ").Tables[0];
            List <JMP.MDL.jmp_Help_Classification> parentlist = JMP.TOOL.MdlList.ToList <JMP.MDL.jmp_Help_Classification>(tablelist);

            ViewBag.parentlist = parentlist;
            list = bll.SelectList(sType, Type, sea_name, State, PrentID, ClassId, pageIndexs, PageSize, out pageCount);
            ViewBag.pageIndexs = pageIndexs;
            ViewBag.PageSize   = PageSize;
            ViewBag.pageCount  = pageCount;
            ViewBag.list       = list;
            ViewBag.sea_name   = sea_name;
            ViewBag.PrentID    = PrentID;
            ViewBag.ClassId    = ClassId;
            ViewBag.type       = Type;
            ViewBag.State      = State;
            ViewBag.sType      = sType;
            string locUrl        = "";
            bool   getlocuserAdd = bll_limit.GetLocUserLimitVoids("/Help/AddContent", UserInfo.UserId.ToString(), int.Parse(UserInfo.UserRoleId.ToString()));//添加

            if (getlocuserAdd)
            {
                locUrl += "<li onclick=\"AddContent()\"><i class='fa fa-plus'></i>添加内容</li>";
            }
            bool getUidT = bll_limit.GetLocUserLimitVoids("/Help/UpdateStateContent", UserInfo.UserId.ToString(), int.Parse(UserInfo.UserRoleId.ToString()));//本地管理员一键启用

            if (getUidT)
            {
                locUrl += "<li onclick=\"javascript:UpdatestateContent(0)\"><i class='fa fa-check-square-o'></i>一键启用</li>";
            }
            bool getUidF = bll_limit.GetLocUserLimitVoids("/Help/UpdateStateContent", UserInfo.UserId.ToString(), int.Parse(UserInfo.UserRoleId.ToString()));//本地管理员一键禁用

            if (getUidF)
            {
                locUrl += "<li onclick=\"javascript:UpdatestateContent(1);\"><i class='fa fa-check-square-o'></i>一键禁用</li>";
            }
            ViewBag.locUrl = locUrl;

            return(View());
        }
Exemplo n.º 3
0
        public PartialViewResult SideBarHotQuestion()
        {
            var bll          = new JMP.BLL.jmp_Help_Content();
            var hotQuestions = bll.FindHotQuestionList();
            var model        = hotQuestions.Select(x => new SimpleArticleViewModel
            {
                Id    = x.ID,
                Title = x.Title
            }).ToList();

            return(PartialView("~/views/shared/sidebar_hot_question.cshtml", model));
        }
Exemplo n.º 4
0
        public ActionResult AddContent()
        {
            JMP.MDL.jmp_Help_Content model   = new jmp_Help_Content();
            JMP.BLL.jmp_Help_Content bllmode = new JMP.BLL.jmp_Help_Content();
            int Id = string.IsNullOrEmpty(Request["Id"]) ? 0 : Int32.Parse(Request["Id"]);

            if (Id > 0)
            {
                model = bllmode.GetModel(Id);
            }
            ViewBag.model = model;
            DataTable tablelist = bll.GetList(" 1=1 and ParentID=0 and State=0  ").Tables[0];
            List <JMP.MDL.jmp_Help_Classification> list = JMP.TOOL.MdlList.ToList <JMP.MDL.jmp_Help_Classification>(tablelist);

            ViewBag.list = list;
            return(View());
        }
Exemplo n.º 5
0
        public ActionResult Catalog(int?id)
        {
            //id:主分类ID
            var helpArticleBll = new JMP.BLL.jmp_Help_Content();
            var articles       = helpArticleBll.FindTopArticleListGroupBySubCatalog((int)id);
            var model          = articles.Select(x => new ArticleWithTotalCountViewModel
            {
                Id                     = x.Id,
                Title                  = x.Title,
                MainCatalogId          = x.MainCatalogId,
                SubCatalogId           = x.SubCatalogId,
                SubCatalogArticleCount = x.SubCatalogArticleCount,
                SubCatalogName         = x.SubCatalogName
            }).ToList();

            return(View(model));
        }
Exemplo n.º 6
0
        public ActionResult List(int?id)
        {
            //id:子分类ID
            var helpArticleBll = new JMP.BLL.jmp_Help_Content();
            var articles       = helpArticleBll.FindListByCatalogId((int)id);
            var model          = articles.Select(x => new ArticleListViewModel
            {
                Id        = x.ID,
                Summary   = x.Content.CleanHtml().CutStrLength(200),
                Title     = x.Title,
                CreatedOn = x.CreateOn.ToString("yyyy年MM月dd日 HH:mm"),
                UpdatedOn = x.UpdateOn == null
                    ? ""
                    : Convert.ToDateTime(x.UpdateOn).ToString("yyyy年MM月dd日 HH:mm")
            }).ToList();

            return(View(model));
        }
Exemplo n.º 7
0
        public JsonResult UpdateStateContent()
        {
            object retJson = new { success = 0, msg = "操作失败" };
            int    state   = string.IsNullOrEmpty(Request["state"]) ? 0 : Int32.Parse(Request["state"].ToString());
            string str     = Request["ids"];
            string xgzfc   = ""; //组装说明
            string tsmsg   = ""; //提示

            JMP.BLL.jmp_Help_Content bll = new JMP.BLL.jmp_Help_Content();
            if (str.CompareTo("On") > 0)
            {
                str = str.Substring(3);
            }
            if (bll.UpdateState(str, state))
            {
                if (state == 1)
                {
                    xgzfc = "一键禁用ID为:" + str;
                    tsmsg = "禁用成功";
                }
                else
                {
                    tsmsg = "启用成功";
                    xgzfc = "一键启用ID为:" + str;
                }

                Logger.OperateLog("应用一键禁用或启用", xgzfc);

                retJson = new { success = 1, msg = tsmsg };
            }
            else
            {
                if (state == 1)
                {
                    tsmsg = "禁用失败";
                }
                else
                {
                    tsmsg = "启用失败";
                }
                retJson = new { success = 0, msg = tsmsg };
            }
            return(Json(retJson));
        }
Exemplo n.º 8
0
        public ActionResult Details(int?id)
        {
            var model          = new ArticleDetailsViewModel();
            var helpArticleBll = new JMP.BLL.jmp_Help_Content();
            var article        = helpArticleBll.GetModel((int)id);

            model.Id        = article.ID;
            model.Content   = article.Content;
            model.CreatedOn = article.CreateOn.ToString("yyyy年MM月dd日 HH:mm");
            model.Title     = article.Title;
            model.UpdatedOn = article.UpdateOn == null
                ? ""
                : Convert.ToDateTime(article.UpdateOn).ToString("yyyy年MM月dd日 HH:mm");
            model.CreatedByUserName = article.CreateByName;
            model.UpdatedByUserName = article.UpdateByName;
            model.SubCatalogId      = article.ClassId;

            var viewCount = article.Count + 1;

            helpArticleBll.ArticleViewed(article.ID, viewCount);
            return(View(model));
        }
Exemplo n.º 9
0
        public ActionResult Search()
        {
            var q = Request.QueryString["q"] ?? "";

            if (string.IsNullOrEmpty(q))
            {
                return(View(new List <ArticleListViewModel>()));
            }
            var helpArticleBll = new JMP.BLL.jmp_Help_Content();
            var keywords       = q.Split(' ');
            var articles       = helpArticleBll.Search(keywords);
            var model          = articles.Select(x => new ArticleListViewModel
            {
                Id        = x.ID,
                Summary   = x.Content.CleanHtml().CutStrLength(200),
                Title     = x.Title,
                CreatedOn = x.CreateOn.ToString("yyyy年MM月dd日 HH:mm"),
                UpdatedOn = x.UpdateOn == null
                    ? ""
                    : Convert.ToDateTime(x.UpdateOn).ToString("yyyy年MM月dd日 HH:mm")
            }).ToList();

            return(View(model));
        }