Exemplo n.º 1
0
        protected override void PageLoad()
        {
            base.PageLoad();

            articleClassList = ArticleClassBLL.ReadArticleClassChildList(classID);
            if (string.IsNullOrEmpty(searchKey))
            {
                this.id = RequestHelper.GetQueryString <int>("ID");
                if (articleClassList.Count > 0)
                {
                    if (this.id <= 0)
                    {
                        this.id = articleClassList[0].ID;
                        title   = base.Title = articleClassList[0].ClassName;
                    }
                    else
                    {
                        ArticleClassInfo article = articleClassList.Find(delegate(ArticleClassInfo articleClass) { return(articleClass.ID == this.id); });
                        if (article != null)
                        {
                            title = base.Title = article.ClassName;
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            ArticleClassInfo articleClass = new ArticleClassInfo();

            articleClass.ID          = RequestHelper.GetQueryString <int>("ID");
            articleClass.FatherID    = Convert.ToInt32(this.FatherID.Text);
            articleClass.OrderID     = Convert.ToInt32(this.OrderID.Text);
            articleClass.ClassName   = this.ClassName.Text;
            articleClass.IsSystem    = 0;
            articleClass.Description = this.Description.Text;
            string alertMessage = ShopLanguage.ReadLanguage("AddOK");

            if (articleClass.ID == -2147483648)
            {
                base.CheckAdminPower("AddArticleClass", PowerCheckType.Single);
                int id = ArticleClassBLL.AddArticleClass(articleClass);
                AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("AddRecord"), ShopLanguage.ReadLanguage("ArticleClass"), id);
            }
            else
            {
                base.CheckAdminPower("UpdateArticleClass", PowerCheckType.Single);
                ArticleClassBLL.UpdateArticleClass(articleClass);
                AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("UpdateRecord"), ShopLanguage.ReadLanguage("ArticleClass"), articleClass.ID);
                alertMessage = ShopLanguage.ReadLanguage("UpdateOK");
            }
            AdminBasePage.Alert(alertMessage, RequestHelper.RawUrl);
        }
Exemplo n.º 3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         FatherID.DataSource     = ArticleClassBLL.ReadNamedList();
         FatherID.DataTextField  = "Name";
         FatherID.DataValueField = "Id";
         FatherID.DataBind();
         FatherID.Items.Insert(0, new ListItem("作为最大类", "0"));
         int ArticleClassID = RequestHelper.GetQueryString <int>("ID");
         int fatherID       = RequestHelper.GetQueryString <int>("FatherID");
         if (ArticleClassID != int.MinValue)
         {
             CheckAdminPower("ReadArticleClass", PowerCheckType.Single);
             ArticleClassInfo articleClass = ArticleClassBLL.Read(ArticleClassID);
             FatherID.Text     = articleClass.ParentId.ToString();
             OrderID.Text      = articleClass.OrderId.ToString();
             ClassName.Text    = articleClass.Name;
             Description.Text  = articleClass.Description;
             AddCol2.InnerText = articleClass.AddCol2;
             Photo.Text        = articleClass.Photo;
             EnClassName.Text  = articleClass.EnName;
             ShowType.Text     = articleClass.ShowType.ToString();
             ShowTerminal.Text = articleClass.ShowTerminal.ToString();
             ImageWidth.Text   = articleClass.ImageWidth.ToString();
             ImageHeight.Text  = articleClass.ImageHeight.ToString();
         }
         else
         {
             FatherID.Text = fatherID.ToString();
         }
     }
 }
Exemplo n.º 4
0
        protected override void PageLoad()
        {
            base.PageLoad();

            id = RequestHelper.GetQueryString <int>("id");
            if (id <= 0)
            {
                id = 63;         //关于我们
            }
            int count = 0;

            article = ArticleBLL.SearchList(1, 1, new ArticleSearchInfo {
                ClassId = "|" + id + "|"
            }, ref count).FirstOrDefault() ?? new ArticleInfo();
            articleClassList = ArticleClassBLL.ReadChilds(63);

            if (id == 63)
            {
                id = int.Parse(article.ClassId.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries).Last());
            }

            thisClass = ArticleClassBLL.Read(id);

            int topClassID = 0;

            ArticleClassBLL.GetTopClassID(id, ref topClassID);

            topClass = ArticleClassBLL.Read(topClassID);

            Title       = article.Title;
            Keywords    = string.IsNullOrEmpty(article.Keywords) ? article.Title : article.Keywords;
            Description = string.IsNullOrEmpty(article.Summary) ? StringHelper.Substring(StringHelper.KillHTML(article.Content), 200) : article.Summary;
        }
Exemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            #region 获取当前分类
            if (RequestHelper.GetQueryString <string>("Action") == "GetThisClass")
            {
                GetthisClass();
            }
            #endregion


            if (!Page.IsPostBack)
            {
                foreach (ArticleClassInfo articleClass in ArticleClassBLL.ReadNamedList())
                {
                    ClassID.Items.Add(new ListItem(articleClass.Name, articleClass.Id.ToString()));
                }
                RealDate.Text = DateTime.Now.ToString("yyyy-MM-dd");
                int articleID = RequestHelper.GetQueryString <int>("ID");
                if (articleID != int.MinValue)
                {
                    productPhotoList = ProductPhotoBLL.ReadList(articleID, 1);
                    CheckAdminPower("ReadArticle", PowerCheckType.Single);
                    ArticleInfo article = ArticleBLL.Read(articleID);
                    Title.Text = article.Title;
                    string classID = article.ClassId;
                    if (classID != string.Empty)
                    {
                        classID = classID.Substring(1, classID.Length - 2);
                        if (classID.IndexOf('|') > -1)
                        {
                            classID = classID.Substring(classID.LastIndexOf('|') + 1);
                        }
                    }
                    ClassID.Text = classID;

                    int thisClassID = 0;
                    int.TryParse(classID, out thisClassID);
                    thisClass = ArticleClassBLL.Read(thisClassID);

                    IsTop.Text           = article.IsTop.ToString();
                    Author.Text          = article.Author;
                    Resource.Text        = article.Resource;
                    Keywords.Text        = article.Keywords;
                    Url.Text             = article.Url;
                    Photo.Text           = article.Photo;
                    Summary.Text         = article.Summary;
                    Content.Value        = article.Content;
                    MobileContent.Value  = article.AddCol2;
                    RealDate.Text        = article.RealDate.ToString();
                    OrderID.Text         = article.OrderId.ToString();
                    FilePath.Text        = article.FilePath;
                    Content1.Value       = article.Content1;
                    MobileContent1.Value = article.Mobilecontent1;
                    Content2.Value       = article.Content2;
                    MobileContent2.Value = article.Mobilecontent2;
                    //Content3.Value = article.AddCol3;
                }
            }
        }
Exemplo n.º 6
0
        //预览
        public ActionResult Preview(int id = -1)
        {
            ArticleInfo      articleInfo      = Article.GetModelByArticleID(id);
            ArticleClassInfo articleClassInfo = ArticleClass.GetModelById(articleInfo.ArticleClassID);
            ArticleModel     model            = new ArticleModel()
            {
                ArticleClassID = articleInfo.ArticleClassID,
                Title          = articleInfo.Title,
                SpecialID      = articleInfo.SpecialID,
                DisplayType    = articleInfo.DisplayType,
                Url            = articleInfo.Url,
                Digest         = articleInfo.Digest,
                ImgUrl         = articleInfo.ImgUrl,
                Body           = articleInfo.Body,
                Author         = articleInfo.Author,
                ComeForm       = articleInfo.ComeForm,
                IsShow         = articleInfo.IsShow,
                IsHome         = articleInfo.IsHome,
                IsBest         = articleInfo.IsBest,
                IsTop          = articleInfo.IsTop,
                AddTime        = articleInfo.AddTime,
                Keyword        = articleInfo.Keyword,
                Description    = articleInfo.Description,
                InformType     = articleInfo.InformType,
                EndTime        = articleInfo.EndTime,
                InformGroup    = articleInfo.InformGroup,
                MicroVideo     = articleInfo.MicroVideo
            };

            if (articleInfo != null)
            {
                if (articleInfo.DisplayType.Equals(4))
                {
                    ViewData["actlcle"]    = "display:none";
                    ViewData["video"]      = "";
                    ViewData["ArticleImg"] = "display:none";
                }
                else
                {
                    ViewData["actlcle"]    = "";
                    ViewData["video"]      = "display:none";
                    ViewData["ArticleImg"] = "display:none";
                }
                if (articleClassInfo.ClassType.Equals(3))
                {
                    ViewData["actlcle"]    = "";
                    ViewData["video"]      = "display:none";
                    ViewData["ArticleImg"] = "";
                }
                //外部链接转向
                if (articleInfo.DisplayType.Equals(1))
                {
                    return(Redirect(articleInfo.Url));
                }
            }
            return(View(model));
        }
Exemplo n.º 7
0
 public void ChangeArticleClassOrder(int id, int orderId)
 {
     if (id > 0 && orderId >= 0)
     {
         ArticleClassInfo tempProClass = Read(id);
         tempProClass.OrderId = orderId;
         Update(tempProClass);
     }
 }
Exemplo n.º 8
0
        /// <summary>
        /// 帮助中心面包屑导航
        /// </summary>
        /// <param name="idList"></param>
        /// <param name="targetUrl"></param>
        /// <returns></returns>
        public static string HelpArticleClassNavigationList(string idList)
        {
            string content = string.Empty;

            if (idList != string.Empty)
            {
                idList = idList.Substring(1, idList.Length - 2);
            }
            idList = idList.Replace("||", "#");
            if (idList.Length > 0)
            {
                foreach (string temp in idList.Split(new char[] { '#' }, StringSplitOptions.RemoveEmptyEntries))
                {
                    string tempArticleClassName = string.Empty;
                    int    linkCount            = 1;
                    foreach (string id in temp.Split('|'))
                    {
                        ArticleClassInfo tmpClass = Read(int.Parse(id));
                        if (tempArticleClassName == string.Empty)
                        {
                            if (linkCount < temp.Split('|').Length)
                            {
                                tempArticleClassName = "<a href=" + GetHelpClassUrl(tmpClass) + " >" + Read(Convert.ToInt32(id)).Name + "</a>";
                            }
                            else
                            {
                                tempArticleClassName = Read(Convert.ToInt32(id)).Name;
                            }
                        }
                        else
                        {
                            if (linkCount < temp.Split('|').Length)
                            {
                                tempArticleClassName += " > <a href=" + GetHelpClassUrl(tmpClass) + " >" + Read(Convert.ToInt32(id)).Name + "</a>";
                            }
                            else
                            {
                                tempArticleClassName += " > " + Read(Convert.ToInt32(id)).Name + "";
                            }
                        }
                        linkCount++;
                    }
                    if (tempArticleClassName != string.Empty)
                    {
                        if (content == string.Empty)
                        {
                            content = tempArticleClassName;
                        }
                        else
                        {
                            content += "," + tempArticleClassName;
                        }
                    }
                }
            }
            return(content);
        }
Exemplo n.º 9
0
        /// <summary>
        /// 根据帮助分类类型获取URL
        /// </summary>
        /// <param name="articleClass"></param>
        /// <returns></returns>
        public static string GetHelpClassUrl(ArticleClassInfo articleClass)
        {
            string           url      = "";
            ArticleClassInfo tmpCLass = new ArticleClassInfo();

            if (ArticleClassBLL.ReadChilds(articleClass.Id).Count > 0 && Read(articleClass.Id).ShowType != 5)
            {
                tmpCLass = ArticleClassBLL.ReadChilds(articleClass.Id)[0]; //如果是父级分类则取第一个子分类的URL
            }
            else
            {
                tmpCLass = articleClass;//如果不是父级分类则取当前分类的URL
            }
            switch (tmpCLass.ShowType)
            {
            case 5:    //链接URL
                url = string.IsNullOrEmpty(tmpCLass.Description) ? "/" : tmpCLass.Description;
                break;

            case 4:    //父级分类
            {
                List <ArticleClassInfo> childlist = ReadChilds(articleClass.Id);
                if (childlist.Count > 0)
                {
                    url = GetHelpClassUrl(childlist[0]);
                }
                else
                {
                    url = "/";
                }
            }
            break;

            case 2:    //文章列表
                url = "/Help-C" + tmpCLass.Id + ".html";
                break;

            case 1:    //单文章
            default:
            {
                ArticleSearchInfo articleSearch = new ArticleSearchInfo();
                articleSearch.ClassId = "|" + tmpCLass.Id + "|";
                List <ArticleInfo> articleList = ArticleBLL.SearchList(articleSearch);
                if (articleList.Count > 0)
                {
                    url = "/HelpDetail-I" + articleList[0].Id + ".html";
                }
                else
                {
                    url = "/Help-C" + tmpCLass.Id + ".html";
                }
            }
            break;
            }
            return(url);
        }
Exemplo n.º 10
0
 public void UpdateArticleClass(ArticleClassInfo articleClass)
 {
     SqlParameter[] pt = new SqlParameter[] { new SqlParameter("@id", SqlDbType.Int), new SqlParameter("@fatherID", SqlDbType.Int), new SqlParameter("@orderID", SqlDbType.Int), new SqlParameter("@className", SqlDbType.NVarChar), new SqlParameter("@description", SqlDbType.NText) };
     pt[0].Value = articleClass.ID;
     pt[1].Value = articleClass.FatherID;
     pt[2].Value = articleClass.OrderID;
     pt[3].Value = articleClass.ClassName;
     pt[4].Value = articleClass.Description;
     ShopMssqlHelper.ExecuteNonQuery(ShopMssqlHelper.TablePrefix + "UpdateArticleClass", pt);
 }
Exemplo n.º 11
0
 public int AddArticleClass(ArticleClassInfo articleClass)
 {
     SqlParameter[] pt = new SqlParameter[] { new SqlParameter("@fatherID", SqlDbType.Int), new SqlParameter("@orderID", SqlDbType.Int), new SqlParameter("@className", SqlDbType.NVarChar), new SqlParameter("@description", SqlDbType.NText), new SqlParameter("@isSystem", SqlDbType.Int) };
     pt[0].Value = articleClass.FatherID;
     pt[1].Value = articleClass.OrderID;
     pt[2].Value = articleClass.ClassName;
     pt[3].Value = articleClass.Description;
     pt[4].Value = articleClass.IsSystem;
     return(Convert.ToInt32(ShopMssqlHelper.ExecuteScalar(ShopMssqlHelper.TablePrefix + "AddArticleClass", pt)));
 }
Exemplo n.º 12
0
        public void Update(ArticleClassInfo entity)
        {
            using (var conn = new SqlConnection(connectString))
            {
                string sql = @"UPDATE ArticleClass SET ParentId = @ParentId, OrderId = @OrderId, Name = @Name, EnName = @EnName, Description = @Description, Photo = @Photo, ShowType = @ShowType, ShowTerminal = @ShowTerminal, IsSystem = @IsSystem,ImageWidth=@ImageWidth,ImageHeight=@ImageHeight, AddCol1 = @AddCol1, AddCol2 = @AddCol2
                            where Id=@Id";

                conn.Execute(sql, entity);
            }
        }
Exemplo n.º 13
0
        public int Add(ArticleClassInfo entity)
        {
            using (var conn = new SqlConnection(connectString))
            {
                string sql = @"INSERT INTO ArticleClass( ParentId,OrderId,Name,EnName,Description,Photo,ShowType,ShowTerminal,IsSystem,ImageWidth,ImageHeight,AddCol1,AddCol2) VALUES(@ParentId,@OrderId,@Name,@EnName,@Description,@Photo,@ShowType,@ShowTerminal,@IsSystem,@ImageWidth,@ImageHeight,@AddCol1,@AddCol2);
                            select SCOPE_IDENTITY()";

                return(conn.Query <int>(sql, entity).Single());
            }
        }
Exemplo n.º 14
0
        protected override void PageLoad()
        {
            base.PageLoad();
            articleClassID = RequestHelper.GetQueryString <int>("ID");
            keywords       = RequestHelper.GetQueryString <string>("Keywords");
            if (articleClassID <= 0)
            {
                articleClassID = 64;                   //默认竞网快报
            }
            thisClass = ArticleClassBLL.Read(articleClassID);

            int topClassID = 0;

            ArticleClassBLL.GetTopClassID(articleClassID, ref topClassID);
            topNav = topClassID;

            topClass = ArticleClassBLL.Read(topClassID);


            int currentPage = RequestHelper.GetQueryString <int>("Page");

            if (currentPage < 1)
            {
                currentPage = 1;
            }

            int count = int.MinValue;
            ArticleSearchInfo articleSearch = new ArticleSearchInfo();

            if (string.IsNullOrEmpty(keywords))
            {
                articleSearch.ClassId = "|" + articleClassID + "|";
            }
            else
            {
                //articleSearch.Key = keywords;
                articleSearch.Title = keywords;
                //articleSearch.Keywords = keywords;
                //articleSearch.InClassId = "38,44,47";//只搜索 指定的分类
            }
            articleList = ArticleBLL.SearchList(1, pageSize, articleSearch, ref count);


            //SEO
            if (string.IsNullOrEmpty(keywords))
            {
                Title = thisClass.Name;
            }
            else
            {
                Title = "搜索结果";
            }
            Keywords    = thisClass.Name;
            Description = thisClass.Description;
        }
Exemplo n.º 15
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.º 16
0
        /// <summary>
        /// 添加日志---分类模块
        /// </summary>
        /// <param name="articleInfo"></param>
        /// <param name="title"></param>
        public static void AddArticleClassLog(ArticleClassInfo articleClassInfo, string title, string ip)
        {
            //添加日志
            LogInfo logInfo = new LogInfo();

            logInfo.Title      = title;
            logInfo.CreateTime = DateTime.Now;
            logInfo.UserName   = articleClassInfo.Auditor;
            logInfo.Content    = title + "-" + articleClassInfo.ClassName;
            logInfo.Ip         = ip;
            Log.Add(logInfo);
        }
Exemplo n.º 17
0
        /// <summary>
        /// 获取文章类型列表
        /// </summary>
        /// <returns></returns>
        public static List <ArticleClassInfo> GetList()
        {
            List <ArticleClassInfo> list   = new List <ArticleClassInfo>();
            IDataReader             reader = BonSite.Core.BSData.RDBS.GetArticleClassList();

            while (reader.Read())
            {
                ArticleClassInfo model = BuildFromReader(reader);
                list.Add(model);
            }
            reader.Close();
            return(list);
        }
Exemplo n.º 18
0
        public static ArticleClassInfo ReadArticleClassCache(int id)
        {
            ArticleClassInfo        info = new ArticleClassInfo();
            List <ArticleClassInfo> list = ReadArticleClassCacheList();

            foreach (ArticleClassInfo info2 in list)
            {
                if (info2.ID == id)
                {
                    return(info2);
                }
            }
            return(info);
        }
Exemplo n.º 19
0
 public void PrepareArticleClassModel(SqlDataReader dr, List <ArticleClassInfo> articleClassList)
 {
     while (dr.Read())
     {
         ArticleClassInfo item = new ArticleClassInfo();
         item.ID          = dr.GetInt32(0);
         item.FatherID    = dr.GetInt32(1);
         item.OrderID     = dr.GetInt32(2);
         item.ClassName   = dr[3].ToString();
         item.Description = dr[4].ToString();
         item.IsSystem    = dr.GetInt32(5);
         articleClassList.Add(item);
     }
 }
Exemplo n.º 20
0
        /// <summary>
        /// 递归创建分类路径Path
        /// </summary>
        protected static void CreateArticleClassPath(int articleClassID, List <ArticleClassInfo> resultList)
        {
            ArticleClassInfo model = GetModelById(articleClassID);

            if (model != null)
            {
                resultList.Insert(0, model);

                if (model.ParentArticleClassID != 0)
                {
                    CreateArticleClassPath(model.ParentArticleClassID, resultList);
                }
            }
        }
Exemplo n.º 21
0
        /// <summary>
        /// 页面加载
        /// </summary>
        protected override void PageLoad()
        {
            base.PageLoad();

            ArticleSearchInfo articleSearch = new ArticleSearchInfo();

            id = RequestHelper.GetQueryString <int>("ID");
            if (id <= 0)
            {
                id = 64;
            }
            curArticleClass = ArticleClassBLL.Read(id);

            articleSearch.ClassId = "|" + curArticleClass.Id + "|";
            //articleSearch.IsTop = (int)BoolType.True;
            int count = int.MinValue;

            topArticleList = ArticleBLL.SearchList(1, 15, articleSearch, ref count);

            int currentPage = RequestHelper.GetQueryString <int>("Page");

            if (currentPage < 1)
            {
                currentPage = 1;
            }
            int pageSize = 20;

            count = 0;
            if (id > 0)
            {
                articleSearch.ClassId = "|" + id + "|";
            }
            articleList = ArticleBLL.SearchList(currentPage, pageSize, articleSearch, ref count);

            //commonPagerClass.Init(currentPage, pageSize, count, !string.IsNullOrEmpty(isMobile));

            commonPagerClass.CurrentPage = currentPage;
            commonPagerClass.PageSize    = pageSize;
            commonPagerClass.Count       = count;
            commonPagerClass.FirstPage   = "<<首页";
            commonPagerClass.PreviewPage = "<<上一页";
            commonPagerClass.NextPage    = "下一页>>";
            commonPagerClass.LastPage    = "末页>>";
            commonPagerClass.ListType    = false;
            commonPagerClass.DisCount    = false;
            commonPagerClass.PrenextType = true;

            //Title = "新闻资讯";
        }
Exemplo n.º 22
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.º 23
0
        /// <summary>
        /// 页面加载
        /// </summary>
        protected override void PageLoad()
        {
            base.PageLoad();
            id = RequestHelper.GetQueryString <int>("ID");
            if (id <= 0)
            {
                id = 38;
            }
            thisClass = ArticleClassBLL.Read(id);

            newsClassList = ArticleClassBLL.ReadChilds(id);

            Title       = thisClass.Name;
            Keywords    = thisClass.Name;
            Description = thisClass.Description;
        }
Exemplo n.º 24
0
        /// <summary>
        /// 产品列表
        /// </summary>
        /// <returns></returns>
        public ActionResult List()
        {
            int classid = GetRouteInt("classid");

            if (classid == 0)
            {
                classid = WebHelper.GetQueryInt("classid");
            }
            int page = GetRouteInt("page");

            if (page == 0)
            {
                page = WebHelper.GetQueryInt("page");
            }

            ArticleClassInfo info = ArticleClass.GetModelById(classid);

            if (info == null)
            {
                return(PromptView("/", "您访问的页面不存在"));
            }

            string condition = Product.GetProductListCondition(classid, "");
            string sort      = Product.GetProductListSort("", "");

            PageModel pageModel = new PageModel(20, page, Product.GetProductCount(condition));



            ProductListModel model = new ProductListModel
            {
                ArticleClassID   = classid,
                ArticleClassInfo = info,
                ClassPath        = ProductClass.GetProductClassPath(classid),
                ProductList      = Product.GetProductList(pageModel.PageSize, pageModel.PageNumber, condition, sort),
                PageModel        = pageModel
            };

            if (info.ListView.Length > 0)
            {
                return(View("List." + info.ListView, model));
            }
            else
            {
                return(View(model));
            }
        }
Exemplo n.º 25
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.º 26
0
        /// <summary>
        /// 页面加载
        /// </summary>
        protected override void PageLoad()
        {
            base.PageLoad();
            int articleID = RequestHelper.GetQueryString <int>("ID");

            article = ArticleBLL.Read(articleID);

            thisClass = ArticleClassBLL.Read(ArticleClassBLL.GetLastClassID(article.ClassId));

            topNav = topClassID;



            if (article.ClassId != string.Empty)
            {
                articleClassID = ArticleClassBLL.GetLastClassID(article.ClassId);
                topClassID     = ArticleClassBLL.GetTopClassID(article.ClassId);
                topClass       = ArticleClassBLL.Read(topClassID);
            }

            newsClassList = ArticleClassBLL.ReadChilds(64);

            Title       = article.Title;
            Keywords    = (article.Keywords == string.Empty) ? article.Title : article.Keywords;
            Description = (article.Summary == string.Empty) ? StringHelper.Substring(StringHelper.KillHTML(article.Content), 200) : article.Summary;

            List <ArticleInfo> nextPreList = new List <ArticleInfo>();
            var arlist = ArticleBLL.SearchListRowNumber(" Id =" + article.Id + "");

            if (arlist.Count > 0)
            {
                ArticleInfo thisArtInfo = arlist[0];
                nextPreList = ArticleBLL.SearchListRowNumber(" ClassId Like'%" + article.ClassId + "%' and RowNumber>" + thisArtInfo.RowNumber + " Order by RowNumber asc");


                if (nextPreList.Count > 0)
                {
                    PreNews = "<a href=\"/NewsDetail.html?ID=" + nextPreList[0].Id + "\" title=\"" + nextPreList[0].Title + "\">" + StringHelper.Substring(nextPreList[0].Title, 20) + "</a>";
                }

                nextPreList = ArticleBLL.SearchListRowNumber(" ClassId Like'%" + article.ClassId + "%' and RowNumber<" + thisArtInfo.RowNumber + " Order by RowNumber desc");
                if (nextPreList.Count > 0)
                {
                    NextNews = "<a href=\"/NewsDetail.html?ID=" + nextPreList[0].Id + "\" title=\"" + nextPreList[0].Title + "\">" + StringHelper.Substring(nextPreList[0].Title, 20) + "</a>";
                }
            }
        }
Exemplo n.º 27
0
        protected override void PageLoad()
        {
            base.PageLoad();
            articleClassID = RequestHelper.GetQueryString <int>("ID");

            if (articleClassID <= 0)
            {
                articleClassID = 46;                     //默认企业动态
            }
            thisClass = ArticleClassBLL.Read(articleClassID);

            int topClassID = 0;

            ArticleClassBLL.GetTopClassID(articleClassID, ref topClassID);
            topNav = topClassID;

            topClass = ArticleClassBLL.Read(topClassID);


            navList = ArticleClassBLL.ReadArticleClassFullFatherID(articleClassID);


            int count = int.MinValue;
            ArticleSearchInfo articleSearch = new ArticleSearchInfo();

            //if (string.IsNullOrEmpty(keywords))
            articleSearch.ClassId = "|" + articleClassID + "|";
            //else
            //{
            //    //articleSearch.Key = keywords;
            //    articleSearch.Title = keywords;
            //    //articleSearch.Keywords = keywords;
            //    articleSearch.InClassId = "38,44,46,47";
            //}
            articleList = ArticleBLL.SearchList(1, 4, articleSearch, ref count);

            //if (string.IsNullOrEmpty(keywords)) commonPagerClass.URL = "/article-C" + articleClassID + "-P$Page.html";
            //else commonPagerClass.URL = "/article/Keyword/" + keywords + "-P$Page.html";


            //SEO
            Title       = thisClass.Name;
            Keywords    = thisClass.Name;
            Description = thisClass.Description;
        }
Exemplo n.º 28
0
        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            ArticleClassInfo articleClass = new ArticleClassInfo();

            articleClass.Id = RequestHelper.GetQueryString <int>("ID");
            if (FatherID.Text.Trim() == RequestHelper.GetQueryString <string>("ID"))
            {
                ScriptHelper.Alert("不能将上级分类设置成自己", RequestHelper.RawUrl);
                Response.End();
            }
            articleClass.ParentId = Convert.ToInt32(FatherID.Text);
            articleClass.OrderId  = Convert.ToInt32(OrderID.Text);
            articleClass.Name     = ClassName.Text;

            articleClass.Description = Description.Text;

            articleClass.EnName       = EnClassName.Text;
            articleClass.Photo        = Photo.Text;
            articleClass.ShowType     = Convert.ToInt32(ShowType.Text);
            articleClass.ShowTerminal = Convert.ToInt32(ShowTerminal.Text);
            articleClass.ImageWidth   = Convert.ToInt32(ImageWidth.Text) < 0 ? 0 : Convert.ToInt32(ImageWidth.Text);
            articleClass.ImageHeight  = Convert.ToInt32(ImageHeight.Text) < 0 ? 0 : Convert.ToInt32(ImageHeight.Text);

            articleClass.AddCol1 = 0;
            articleClass.AddCol2 = AddCol2.InnerText;

            string alertMessage = ShopLanguage.ReadLanguage("AddOK");

            if (articleClass.Id == int.MinValue)
            {
                articleClass.IsSystem = 0;
                CheckAdminPower("AddArticleClass", PowerCheckType.Single);
                int id = ArticleClassBLL.Add(articleClass);
                AdminLogBLL.Add(ShopLanguage.ReadLanguage("AddRecord"), ShopLanguage.ReadLanguage("ArticleClass"), id);
            }
            else
            {//修改时保持系统分类不变
                articleClass.IsSystem = ArticleClassBLL.Read(RequestHelper.GetQueryString <int>("ID")).IsSystem;
                CheckAdminPower("UpdateArticleClass", PowerCheckType.Single);
                ArticleClassBLL.Update(articleClass);
                AdminLogBLL.Add(ShopLanguage.ReadLanguage("UpdateRecord"), ShopLanguage.ReadLanguage("ArticleClass"), articleClass.Id);
                alertMessage = ShopLanguage.ReadLanguage("UpdateOK");
            }
            ScriptHelper.Alert(alertMessage, RequestHelper.RawUrl);
        }
Exemplo n.º 29
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.º 30
0
        /// <summary>
        /// 通过IDataReader创建ArticleClassInfo
        /// </summary>
        public static ArticleClassInfo BuildFromReader(IDataReader reader)
        {
            ArticleClassInfo model = new ArticleClassInfo();

            model.ArticleClassID       = TypeHelper.ObjectToInt(reader["ArticleClassID"]);
            model.ClassName            = reader["ClassName"].ToString();
            model.ParentArticleClassID = TypeHelper.ObjectToInt(reader["ParentArticleClassID"]);
            model.ClassType            = TypeHelper.ObjectToInt(reader["ClassType"]);
            model.Target       = TypeHelper.ObjectToInt(reader["Target"]);
            model.IsNav        = TypeHelper.ObjectToInt(reader["IsNav"]);
            model.IsWeb        = TypeHelper.ObjectToInt(reader["IsWeb"]);
            model.WebUrl       = reader["WebUrl"].ToString();
            model.IsAdmin      = TypeHelper.ObjectToInt(reader["IsAdmin"]);
            model.AdminUrl     = reader["AdminUrl"].ToString();
            model.DisplayOrder = TypeHelper.ObjectToInt(reader["DisplayOrder"]);
            model.ListView     = reader["ListView"].ToString();
            model.ContentView  = reader["ContentView"].ToString();
            model.Code         = reader["code"].ToString();
            model.ImgUrl       = reader["ImgUrl"].ToString();
            if (reader["Keyword"] != null)
            {
                model.Keyword = reader["Keyword"].ToString();
            }
            else
            {
                model.Keyword = "";
            }

            if (reader["Description"] != null)
            {
                model.Description = reader["Description"].ToString();
            }
            else
            {
                model.Description = "";
            }
            model.IsClassBrand = TypeHelper.ObjectToInt(reader["IsClassBrand"]);
            model.Subhead      = reader["Subhead"].ToString();
            model.Auditor      = reader["Auditor"].ToString();
            return(model);
        }