Ejemplo n.º 1
0
        /// <summary>
        /// 加载最新公告节点
        /// </summary>
        /// <returns></returns>
        public ActionResult Announcement([DataSourceRequest] DataSourceRequest request)
        {
            if (request.Page <= 0)
            {
                request.Page = 1;
            }

            if (request.PageSize == 0)
            {
                request.PageSize = 10;
            }
            try
            {
                var condition = "[Type]=2";
                int pageCount;
                int totalCount;
                this.configPageService = new ConfigPageService();
                var paging = new Paging("[Config_Page]", null, "ID", condition, request.Page, request.PageSize, "CreateTime", 1);
                var list = this.configPageService.Paging(paging, out pageCount, out totalCount);

                var data = new DataSource
                {
                    Data = list,
                    Total = totalCount
                };
                return Json(data);
            }
            catch (Exception exception)
            {
                TextLogger.Instance.Log("查询出错", Category.Error, exception);
            }
            return this.Json(string.Empty, JsonRequestBehavior.AllowGet);
        }
Ejemplo n.º 2
0
        public ActionResult Article(int id)
        {
            Config_Page result = new ConfigPageService().QueryByID(id);
            if (result == null)
            {
                Response.StatusCode = 404;
                return this.Content(Utils.ReadFile("Error/404.htm"));
            }

            Response.Cache.SetOmitVaryStar(true);
            return this.View(result);
        }
Ejemplo n.º 3
0
 public ActionResult AddContent(string name)
 {
     var model = new Config_Page
     {
         PID = 0,
         Content = "一级节点",
         Name = name,
         Source = "source",
         Type = 1
     };
     var configService = new ConfigPageService();
     if (configService.Insert(model) > 0)
     {
         return Json(new AjaxResponse { State = 1, Message = "添加目录成功" });
     }
     return Json(new AjaxResponse { State = 0, Message = "添加止录失败" });
 }
        public ActionResult Destroy([DataSourceRequest] DataSourceRequest request, Config_Page product)
        {
            try
            {
                if (product != null)
                {
                    this.configPageService = new ConfigPageService();
                    if (this.configPageService.DeleteRow(product.ID) > 0)
                    {
                        return Json(new[] { product }.ToDataSourceResult(request, ModelState));

                    }
                }

            }
            catch (Exception exception)
            {

                throw new Exception(exception.Message, exception);
            }

            return Json(string.Empty);
        }
        /// <summary>
        /// 获取链接的值
        /// </summary>
        /// <param name="request"></param>
        /// <param name="brandId"></param>
        /// <returns></returns>
        public ActionResult QueryBrandLinkSource([DataSourceRequest] DataSourceRequest request, int brandId)
        {
            try
            {
                string condidtion = "Type=4 And PID=" + brandId.ToString() + "";
                var paging = new Paging("Config_Page", null, "ID", condidtion, request.Page, request.PageSize);
                int pageCount;
                int totalCount;
                this.configPageService = new ConfigPageService();
                var list = this.configPageService.Paging(paging, out pageCount, out totalCount);
                var data = new DataSource
                {
                    Data = list,
                    Total = totalCount,
                    TotalPages = pageCount
                };
                return Json(data, JsonRequestBehavior.AllowGet);
            }
            catch (Exception exception)
            {

                throw new Exception(exception.Message, exception);
            }
        }
 public ActionResult ModifyLink([DataSourceRequest] DataSourceRequest request, Config_Page config)
 {
     if (config != null && ModelState.IsValid)
     {
         this.configPageService = new ConfigPageService();
         this.configPageService.UpdateLink(config);
     }
     return Json(new[] { config }.ToDataSourceResult(request, ModelState));
 }
        public ActionResult InsertLink(int brandId, string Source, string Name)
        {
            var model = new Config_Page
            {
                PID = brandId,
                Name = Name,
                Source = Source,
                Type = 4,
                Content = "content"
            };
            try
            {
                this.configPageService = new ConfigPageService();
                var returnVaue = this.configPageService.Insert(model);
                if (returnVaue > 0)
                {
                    return Json("添加成功");
                }
            }
            catch (Exception exception)
            {

                throw new Exception(exception.Message, exception);
            }

            return Json(string.Empty);
        }
Ejemplo n.º 8
0
 public ActionResult QueryContentById(int id)
 {
     this.configPageService = new ConfigPageService();
     var list = configPageService.QueryByID(id);
     if (list != null)
     {
         return Json(list);
     }
     return Json(string.Empty);
 }
Ejemplo n.º 9
0
        public ActionResult ModifyContent(int ID, string Name, int pid, string Content)
        {
            this.configPageService = new ConfigPageService();

            if (ID == -1)
            {
                var model = new Config_Page
                {
                    Name = Name,
                    Content = Content,
                    Type = 1,
                    PID = pid,
                    Source = "default"
                };
                if (configPageService.Insert(model) > 0)
                {
                    return Json(new AjaxResponse { Data = 1, Message = "添加成功" });
                }
            }
            var received = this.configPageService.UpdateContent(ID, Content, Name);
            if (received > 0)
            {
                // todo : 需要类型参数
                return Json(new AjaxResponse { Data = 1, Message = "修改成功" });
            }
            return Json(string.Empty);
        }
Ejemplo n.º 10
0
 public ActionResult InsertPromoteMessage(string Name, string Content)
 {
     var model = new Config_Page
     {
         PID = 31,
         Type = 3,
         Name = Name,
         Content = Content,
         Source = "default"
     };
     this.configPageService = new ConfigPageService();
     var recevieId = this.configPageService.Insert(model);
     if (recevieId > 0)
     {
         return Json(new AjaxResponse { Data = 1, Message = "添加成功" });
     }
     return Json(new AjaxResponse { Data = 0, Message = "操作失败" });
 }
Ejemplo n.º 11
0
 /// <summary>
 /// 加载帮助节点
 /// </summary>
 /// <returns></returns>
 public JsonResult HelperTree()
 {
     this.configPageService = new ConfigPageService();
     var list = configPageService.Query(1);
     var modelList = new List<dynamic>();
     foreach (var item in list)
     {
         var model = new { ID = item.ID, PID = item.PID, Type = item.Type, Name = item.Name, isParent = (item.PID == 0 ? true : false) };
         modelList.Add(model);
     }
     return Json(modelList);
 }
Ejemplo n.º 12
0
 /// <summary>
 /// 帮助内容
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public JsonResult helperContent(int id)
 {
     this.configPageService = new ConfigPageService();
     var list = configPageService.QueryByID(id);
     return Json(list);
 }
Ejemplo n.º 13
0
 /// <summary>
 /// 执行删除操作
 /// </summary>
 /// <param name="ID"></param>
 public ActionResult DeleteRow(int ID)
 {
     this.configPageService = new ConfigPageService();
     var receiveId = this.configPageService.DeleteRow(ID);
     if (receiveId > 0)
     {
         return Json(new AjaxResponse { Data = 1, Message = "删除成功" });
     }
     return Json(string.Empty);
 }
Ejemplo n.º 14
0
        /// <summary>
        /// 获取帮助列表
        /// </summary>
        /// <returns></returns>
        public string GetHelpNavHtml()
        {
            var list = new ConfigPageService().Query(1);
            var append = new StringBuilder();

            foreach (var configPage in list)
            {
                if (configPage.PID == 0)
                {
                    append.Append("<dd class=\"uc_left_item\"><dl>");
                    append.Append("<dt><em></em>" + configPage.Name + "</dt>");
                }
                var pageList = list.Where(l => l.PID == configPage.ID);
                foreach (var page in pageList)
                {
                    append.Append("<dd> <em></em><a href=\"/Home/Help/" + page.ID + ".html\">" + page.Name + "</a></dd>");
                }
                append.Append("</dd>");
            }

            return append.ToString();
        }
Ejemplo n.º 15
0
        /// <summary>
        /// 获取文章列表
        /// </summary>
        /// <param name="count"></param>
        /// <param name="condition"></param>
        /// <returns></returns>
        public string GetArticleList(int count, string condition)
        {
            var paging = new Paging("[Config_Page]", new List<string> { "ID", "Name" }, "ID", condition, 1, count, "ID", 1);
            int pageCount, totalCount;
            List<Config_Page> list = new ConfigPageService().Paging(paging, out pageCount, out totalCount);
            if (list == null || list.Count == 0) return "";

            StringBuilder sb = new StringBuilder();
            foreach (Config_Page page in list)
            {
                sb.Append("<li><i></i><a href=\"/Home/Article/" + page.ID.ToString() + ".html\" target=\"_blank\">" + page.Name + "</a></li>");
            }
            return sb.ToString();
        }