Exemplo n.º 1
0
        public ActionResult List(string articleTitle, string Keyword, string sortColumn, string sortDirection, int?articleClassId1, int pageSize = 10, int pageNumber = 1)
        {
            pageSize = WorkContext.SiteConfig.pageSize;
            int articleClassId = 0;

            if (articleClassId1 == null)
            {
                articleClassId = 233;
            }
            else
            {
                articleClassId = (int)articleClassId1;
            }

            ArticleClassInfo classInfo = ArticleClass.AdminGetModelById(articleClassId);

            //if (classInfo == null)
            //    return PromptView("文章分类不存在");

            ////管理菜单
            //if ((classInfo.ClassType.Equals(-1)) || (classInfo.ClassType.Equals(0)))
            //    Response.Redirect(classInfo.AdminUrl);
            ////单页
            //if (classInfo.ClassType.Equals(1))
            //    return RedirectToAction("Page", new { articleClassId = articleClassId });
            string condition = Article.AdminGetArticleListCondition(articleClassId, articleTitle);
            //string condition = " [Keyword] = 1 ";
            string    condition1 = condition + @" or [Keyword] = 1  ";
            string    sort       = Article.AdminGetArticleListSort(sortColumn, sortDirection);
            PageModel pageModel  = new PageModel(pageSize, pageNumber, Article.AdminGetArticleCount(condition1));
            //
            ArticleListModel model = new ArticleListModel()
            {
                DataList       = Article.AdminGetArticleList(pageModel.PageSize, pageModel.PageNumber, condition1, sort),
                PageModel      = pageModel,
                SortColumn     = sortColumn,
                SortDirection  = sortDirection,
                ArticleClassID = articleClassId,
                ArticleTitle   = articleTitle,
                ClassInfo      = classInfo
            };
            List <ArticleClassInfo> classPath = ArticleClass.GetArticleClassPath(articleClassId);

            ViewData["classPath"] = classPath;
            SiteUtils.SetAdminRefererCookie(string.Format("{0}?pageNumber={1}&pageSize={2}&sortColumn={3}&sortDirection={4}&articleClassId={5}&newsTitle={6}",
                                                          Url.Action("List"),
                                                          pageModel.PageNumber,
                                                          pageModel.PageSize,
                                                          sortColumn,
                                                          sortDirection,
                                                          articleClassId,
                                                          articleTitle));
            return(View(model));
        }
Exemplo n.º 2
0
        public ActionResult List(string articleTitle, string Keyword, string sortColumn, string sortDirection, int?articleClassId1, int pageSize = 15, int pageNumber = 1)
        {
            pageSize = WorkContext.SiteConfig.pageSize;
            int articleClassId = 0;

            if (articleClassId1 == null)
            {
                articleClassId = 243;
            }
            else
            {
                articleClassId = (int)articleClassId1;
            }

            ArticleClassInfo classInfo = ArticleClass.AdminGetModelById(articleClassId);

            int userID = WorkContext.Uid;

            string condition = Article.AdminGetArticleListCondition(articleClassId, articleTitle);

            string    condition1 = @" ( " + condition + @" or [Keyword] = 4 ) " + " and [AdminID] = " + userID;
            string    sort       = Article.AdminGetArticleListSort(sortColumn, sortDirection);
            PageModel pageModel  = new PageModel(pageSize, pageNumber, Article.AdminGetArticleCount(condition1));

            ArticleListModel model = new ArticleListModel()
            {
                DataList       = Article.AdminGetArticleList(pageModel.PageSize, pageModel.PageNumber, condition1, sort),
                PageModel      = pageModel,
                SortColumn     = sortColumn,
                SortDirection  = sortDirection,
                ArticleClassID = articleClassId,
                ArticleTitle   = articleTitle,
                ClassInfo      = classInfo
            };

            SiteUtils.SetAdminRefererCookie(string.Format("{0}?pageNumber={1}&pageSize={2}&sortColumn={3}&sortDirection={4}&articleClassId={5}&newsTitle={6}",
                                                          Url.Action("List"),
                                                          pageModel.PageNumber,
                                                          pageModel.PageSize,
                                                          sortColumn,
                                                          sortDirection,
                                                          articleClassId,
                                                          articleTitle));
            List <ArticleClassInfo> classPath = ArticleClass.GetArticleClassPath(articleClassId);

            ViewData["classPath"] = classPath;
            return(View(model));
        }
Exemplo n.º 3
0
        /// <summary>
        /// 列表
        /// </summary>
        /// <param name="articleTitle"></param>
        /// <param name="sortColumn"></param>
        /// <param name="sortDirection"></param>
        /// <param name="articleClassId"></param>
        /// <param name="pageSize"></param>
        /// <param name="pageNumber"></param>
        /// <returns></returns>
        public ActionResult List(string productTitle, string sortColumn, string sortDirection, int productClassId, int pageSize = 15, int pageNumber = 1)
        {
            pageSize = WorkContext.SiteConfig.pageSize;
            ArticleClassInfo classInfo = ArticleClass.AdminGetModelById(productClassId);

            if (classInfo == null)
            {
                return(PromptView("文章分类不存在"));
            }


            string    condition = Product.AdminGetProductListCondition(productClassId, productTitle);
            string    sort      = Product.AdminGetProductListSort(sortColumn, sortDirection);
            PageModel pageModel = new PageModel(pageSize, pageNumber, Product.AdminGetProductCount(condition));

            ProductListModel model = new ProductListModel()
            {
                DataList       = Product.AdminGetProductList(pageModel.PageSize, pageModel.PageNumber, condition, sort),
                PageModel      = pageModel,
                SortColumn     = sortColumn,
                SortDirection  = sortDirection,
                ProductClassID = productClassId,
                ProductTitle   = productTitle,
                ClassInfo      = classInfo
            };

            SiteUtils.SetAdminRefererCookie(string.Format("{0}?pageNumber={1}&pageSize={2}&sortColumn={3}&sortDirection={4}&productClassId={5}&productTitle={6}",
                                                          Url.Action("List"),
                                                          pageModel.PageNumber,
                                                          pageModel.PageSize,
                                                          sortColumn,
                                                          sortDirection,
                                                          productClassId,
                                                          productTitle));

            //List<SelectListItem> list = new List<SelectListItem>();
            //list.Add(new SelectListItem() { Text = "全部类型", Value = "0" });
            //foreach (NewsTypeInfo newsTypeInfo in AdminNews.GetNewsTypeList())
            //{
            //    list.Add(new SelectListItem() { Text = newsTypeInfo.Name, Value = newsTypeInfo.NewsTypeId.ToString() });
            //}
            //ViewData["newsTypeList"] = list;
            List <ArticleClassInfo> classPath = ArticleClass.GetArticleClassPath(productClassId);

            ViewData["classPath"] = classPath;
            return(View(model));
        }
Exemplo n.º 4
0
        /// <summary>
        /// 删除栏目
        /// </summary>
        public ActionResult Del(int id = -1)
        {
            ArticleClassInfo info = ArticleClass.AdminGetModelById(id);

            if (!ArticleClass.HaveChild(id))
            {
                ArticleClass.Delete(id);
                if (info != null)
                {
                    AddLog(info, "栏目删除成功");
                }
                //AddAdminOperateLog("删除广告位置", "删除广告位置,广告位置ID为:" + adPosId);
                return(PromptView("栏目删除成功"));
            }
            else
            {
                return(PromptView("本分类下还有子分类,请先删除小分类后再删除大分类"));
            }
        }
Exemplo n.º 5
0
        public ActionResult Edit(int id)
        {
            ArticleClassInfo classinfo = ArticleClass.AdminGetModelById(id);

            if (classinfo == null)
            {
                return(PromptView("分类不存在"));
            }

            ArticleClassModel model = new ArticleClassModel();

            model.ArticleClassID       = classinfo.ArticleClassID;
            model.ClassName            = classinfo.ClassName;
            model.ClassType            = classinfo.ClassType;
            model.ParentArticleClassID = classinfo.ParentArticleClassID;
            model.Target       = classinfo.Target;
            model.IsNav        = classinfo.IsNav;
            model.IsWeb        = classinfo.IsWeb;
            model.WebUrl       = classinfo.WebUrl;
            model.IsAdmin      = classinfo.IsAdmin;
            model.AdminUrl     = classinfo.AdminUrl;
            model.DisplayOrder = classinfo.DisplayOrder;
            model.IsOpen       = classinfo.IsOpen;
            model.ListView     = classinfo.ListView;
            model.ContentView  = classinfo.ContentView;
            model.Code         = classinfo.Code;
            model.ImgUrl       = classinfo.ImgUrl;
            model.Keyword      = classinfo.Keyword;
            model.Description  = classinfo.Description;
            model.IsClassBrand = classinfo.IsClassBrand;
            model.Subhead      = classinfo.Subhead;
            model.IsShowNews   = classinfo.IsShowNews;

            Load();
            Loads();
            ViewData["referer"] = SiteUtils.GetAdminRefererCookie();

            return(View(model));
        }
Exemplo n.º 6
0
        public ActionResult Edit(ArticleClassModel model, int id = -1)
        {
            ArticleClassInfo info = ArticleClass.AdminGetModelById(id);
            //获取当前登录用户信息
            string       ck           = WebHelper.GetCookie("bs", "uname");
            PartUserInfo partUserInfo = Users.GetPartUserByName(ck);

            if (ModelState.IsValid)
            {
                info.ClassName            = model.ClassName;
                info.ParentArticleClassID = model.ParentArticleClassID;
                info.ClassType            = model.ClassType;
                info.Target       = model.Target;
                info.IsWeb        = model.IsWeb;
                info.IsNav        = model.IsNav;
                info.WebUrl       = model.WebUrl == null ? "" : model.WebUrl;
                info.IsAdmin      = model.IsAdmin;
                info.AdminUrl     = model.AdminUrl == null ? "" : model.AdminUrl;
                info.DisplayOrder = model.DisplayOrder;
                info.IsOpen       = model.IsOpen;
                info.ListView     = model.ListView;
                info.ContentView  = model.ContentView;
                info.Code         = model.Code;
                info.ImgUrl       = model.ImgUrl;
                info.Keyword      = model.Keyword == null ? "" : model.Keyword;
                info.Description  = model.Description == null ? "" : model.Description;
                info.IsClassBrand = model.IsClassBrand;
                info.Subhead      = model.Subhead;
                info.Auditor      = ck;
                info.IsShowNews   = model.IsShowNews;
                ArticleClass.Update(info);
                AddLog(info, "分类编辑成功");
                //AddAdminOperateLog
                return(PromptView("分类编辑成功"));
            }
            Loads();
            return(View(model));
        }
Exemplo n.º 7
0
        public ActionResult List(string articleTitle, string Keywords, string sortColumn, string sortDirection, string dayTime, string status, string setArticleClassId, int?articleClassId1, int pageSize = 10, int pageNumber = 1)
        {
            if (setArticleClassId == null)
            {
                setArticleClassId = "";
            }
            //查询条件
            string condition = " [DisplayType] in (0,2,4) ";

            //审核状态 选中状态
            string[] statusArray = new string[3];
            if (!string.IsNullOrEmpty(status) && !status.Equals("4"))
            {
                statusArray[Convert.ToInt32(status)] = "selected";
                condition = condition + " and ApprovalStatus=" + status;
            }
            ViewData["statusArray"] = statusArray;
            if (!string.IsNullOrEmpty(setArticleClassId) && Convert.ToInt32(setArticleClassId) > 0)
            {
                DataTable articleClassDt = Article.GetArtClaIdByParentArticleClassIDs(Convert.ToInt32(setArticleClassId));
                if (articleClassDt != null && articleClassDt.Rows.Count > 0)
                {
                    string articleClasss = "";
                    for (int i = 0; i < articleClassDt.Rows.Count; i++)
                    {
                        DataTable articleClassDt2 = Article.GetArtClaIdByParentArticleClassIDs(Convert.ToInt32(articleClassDt.Rows[i]["ArticleClassID"].ToString()));
                        if (articleClassDt2 != null && articleClassDt2.Rows.Count > 0)
                        {
                            for (int j = 0; j < articleClassDt2.Rows.Count; j++)
                            {
                                articleClasss += Convert.ToInt32(articleClassDt2.Rows[j]["ArticleClassID"].ToString()) + ",";
                            }
                        }
                        else
                        {
                            articleClasss += Convert.ToInt32(articleClassDt.Rows[i]["ArticleClassID"].ToString()) + ",";
                        }
                    }
                    articleClasss = articleClasss.Substring(0, articleClasss.Length - 1);
                    condition     = condition + "  and ArticleClassID in " + "(" + articleClasss + ")";
                }
                else
                {
                    //没有下级菜单
                    condition = condition + " and ArticleClassID=" + Convert.ToInt32(setArticleClassId);
                }
            }
            ViewData["setArticleClassId"] = setArticleClassId;
            MenuModel menuModel = new MenuModel();

            menuModel.MenuList   = BonSite.Services.ArticleClass.AdminGetArticleClassTreeList();
            ViewData["MenuList"] = menuModel.MenuList;
            //时间选择状态
            if (!string.IsNullOrEmpty(dayTime))
            {
                DateTime dtStart = TypeHelper.StringToDateTime(dayTime);
                DateTime dtEnd   = dtStart.AddDays(1);
                condition = condition + " and AddTime > '" + dtStart + "' and AddTime < '" + dtEnd + "'";
            }
            ViewData["dayTime"] = dayTime;
            //标题关键字
            if (Keywords != null && !string.IsNullOrEmpty(Keywords))
            {
                ViewData["Keywords"] = Keywords;
                condition            = condition + " and Title like '%" + Keywords + "%'";
            }



            pageSize = WorkContext.SiteConfig.pageSize;
            int articleClassId = 0;

            if (articleClassId1 == null)
            {
                articleClassId = 299;
            }
            else
            {
                articleClassId = (int)articleClassId1;
            }

            ArticleClassInfo classInfo = ArticleClass.AdminGetModelById(articleClassId);
            //string condition = Article.AdminGetArticleListCondition(articleClassId, articleTitle);
            //string condition1 = condition + @" or [Keyword] = 1  ";
            string    sort      = Article.AdminGetArticleListSort(sortColumn, sortDirection);
            PageModel pageModel = new PageModel(pageSize, pageNumber, Article.AdminGetArticleCount(condition));
            //
            ArticleListModel model = new ArticleListModel()
            {
                DataList       = Article.AdminGetArticleList(pageModel.PageSize, pageModel.PageNumber, condition, sort),
                PageModel      = pageModel,
                SortColumn     = sortColumn,
                SortDirection  = sortDirection,
                ArticleClassID = articleClassId,
                ArticleTitle   = articleTitle,
                ClassInfo      = classInfo
            };
            //foreach (DataRow item in model.DataList.Rows)
            //{
            //    //获取一级分类
            //    int ParentArticleClassID = 0;
            //    int ArticleClassID = Convert.ToInt32(item["ArticleClassID"].ToString());
            //    ParentArticleClassID = Article.GetNameByArticleClassID2(ArticleClassID);
            //    if (ParentArticleClassID > 0)
            //    {
            //        ArticleClassID = Article.GetNameByArticleClassID2(ParentArticleClassID);
            //        if (ArticleClassID > 0)
            //        {
            //            ParentArticleClassID = Article.GetNameByArticleClassID2(ArticleClassID);
            //            if (ParentArticleClassID > 0)
            //            {
            //                ArticleClassID = Article.GetNameByArticleClassID2(ParentArticleClassID);
            //                if (ArticleClassID > 0)
            //                {
            //                    ParentArticleClassID = Article.GetNameByArticleClassID2(ArticleClassID);
            //                    if (ParentArticleClassID > 0)
            //                    {

            //                    }
            //                    else
            //                    {
            //                        //如果没有上级菜单,则取当前栏目
            //                        ParentArticleClassID = ArticleClassID;
            //                    }
            //                }
            //            }
            //            else
            //            {
            //                //如果没有上级菜单,则取当前栏目
            //                ParentArticleClassID = ArticleClassID;
            //            }
            //        }
            //    }
            //    else
            //    {
            //        //如果没有上级菜单,则取当前栏目
            //        ParentArticleClassID = ArticleClassID;
            //    }
            //    item["ArticleClassID"] = ParentArticleClassID;
            //}
            List <ArticleClassInfo> classPath = ArticleClass.GetArticleClassPath(articleClassId);

            ViewData["classPath"] = classPath;
            SiteUtils.SetAdminRefererCookie(string.Format("{0}?pageNumber={1}&pageSize={2}&sortColumn={3}&sortDirection={4}&articleClassId={5}&newsTitle={6}",
                                                          Url.Action("List"),
                                                          pageModel.PageNumber,
                                                          pageModel.PageSize,
                                                          sortColumn,
                                                          sortDirection,
                                                          articleClassId,
                                                          articleTitle));
            return(View(model));
        }