Esempio n. 1
0
        public JsonResult pagedetail(int id)
        {
            var aboutEntity = ArticleBLL.Read(id);

            ArticleBLL.ChangeArticleStatus(id, "ViewCount", aboutEntity.ViewCount);
            return(Json(new { my = aboutEntity }, JsonRequestBehavior.AllowGet));
        }
        public ActionResult UnLike(Guid articleId)
        {
            IArticleBLL articleBLL = new ArticleBLL();

            articleBLL.UnLike(articleId);
            return(RedirectToAction("ArticleDetails", new { id = articleId }));
        }
Esempio n. 3
0
        protected override void PageLoad()
        {
            base.PageLoad();
            ArticleSearchInfo article = new ArticleSearchInfo();

            article.ClassID = "|" + 1 + "|";
            article.IsTop   = 1;
            int count = -2147483648;

            this.topArticleList = ArticleBLL.SearchArticleList(1, 15, article, ref count);
            int queryString = RequestHelper.GetQueryString <int>("Page");

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

            count            = 0;
            article.ClassID  = "|" + 1 + "|";
            this.articleList = ArticleBLL.SearchArticleList(queryString, pageSize, article, ref count);
            this.commonPagerClass.CurrentPage = queryString;
            this.commonPagerClass.PageSize    = pageSize;
            this.commonPagerClass.Count       = count;
            base.Title = "ÐÂÎÅ×ÊѶ";
        }
Esempio n. 4
0
        protected override void PageLoad()
        {
            base.PageLoad();

            id = RequestHelper.GetQueryString <int>("id");
            if (id < 1)
            {
                id = ArticleClass.About;
            }

            int count = 0;

            article = ArticleBLL.SearchArticleList(1, 1, new ArticleSearchInfo {
                ClassID = "|" + id + "|"
            }, ref count).FirstOrDefault() ?? new ArticleInfo();
            articleClassList = ArticleClassBLL.ReadArticleClassChildList(ArticleClass.About);

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

            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;
        }
Esempio n. 5
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;
        }
Esempio n. 6
0
        /// <summary>
        /// 页面加载
        /// </summary>
        protected override void PageLoad()
        {
            base.PageLoad();
            int articleID = RequestHelper.GetQueryString <int>("ID");

            article = ArticleBLL.Read(articleID);
            if (article.ClassId != string.Empty)
            {
                article.ClassId = article.ClassId.Substring(1);
                articleClassID  = Convert.ToInt32(article.ClassId.Substring(0, article.ClassId.IndexOf('|')));
            }

            newsClassList = ArticleClassBLL.ReadChilds(38);

            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>();
            ArticleInfo        thisArtInfo = ArticleBLL.SearchListRowNumber(" Id =" + article.Id + "")[0];

            nextPreList = ArticleBLL.SearchListRowNumber(" ClassId Like'%" + article.ClassId + "%' and RowNumber>" + thisArtInfo.RowNumber + " Order by RowNumber asc");


            if (nextPreList.Count > 0)
            {
                NextNews = "<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)
            {
                PreNews = "<a href=\"/NewsDetail.html?ID=" + nextPreList[0].Id + "\" title=\"" + nextPreList[0].Title + "\">" + StringHelper.Substring(nextPreList[0].Title, 20) + "</a>";
            }
        }
Esempio n. 7
0
        protected override void PageLoad()
        {
            base.Title = "°ïÖúÖÐÐÄ";
            base.PageLoad();

            if (string.IsNullOrEmpty(searchKey))
            {
                this.id = RequestHelper.GetQueryString <int>("ID");
                if ((this.id == -2147483648) && (base.helpClassList.Count > 0))
                {
                    this.id = ArticleClassBLL.ReadArticleClassChildList(base.helpClassList[0].ID)[0].ID;
                }
                if (this.id > 0)
                {
                    ArticleSearchInfo articleSearch = new ArticleSearchInfo();
                    articleSearch.ClassID = "|" + this.id.ToString() + "|";
                    this.articleList      = ArticleBLL.SearchArticleList(articleSearch);
                }
            }
            else
            {
                ArticleSearchInfo articleSearch = new ArticleSearchInfo();
                articleSearch.Condition = "([Keywords] like '%" + searchKey + "%' Or [Title] like '%" + searchKey + "%')";
                this.articleList        = ArticleBLL.SearchArticleList(articleSearch);
            }
        }
Esempio n. 8
0
        public string Create(ArticleEntity article)
        {
            if (ModelState.IsValid)
            {
                ArticleBLL articleBLL = new ArticleBLL();
                article.ArticleTitle      = article.ArticleTitle.UrlDecode();   //文章标题
                article.ArticleTitleAlias = article.ArticleTitleAlias.UrlDecode();
                article.ArticleContent    = article.ArticleContent.UrlDecode(); //文章内容
                article.CreateTime        = DateTime.Now;
                articleBLL.AddArticleEntity(article);
                //Step2 维护文章和期刊的关系
                if (article.JournalId.HasValue)
                {
                    JournalArticleRelationEntity journalArticleRelationEntity = new JournalArticleRelationEntity();
                    journalArticleRelationEntity.JournalId = article.JournalId;//期刊Id
                    journalArticleRelationEntity.ArticleId = article.Id;
                    JournalArticleRelationBLL journalArticleRelationBLL = new JournalArticleRelationBLL();
                    journalArticleRelationBLL.AddJournalArticleRelationEntity(journalArticleRelationEntity);
                    articleBLL.UpdateArticlePropertyIdByID(journalArticleRelationEntity.Id, article.Id);
                }
                //Step3 维护照片关系
                this.ArticleImageSave(article);

                //if (article.ImgFileList != null)
                //{
                //    ArticleImageBLL articleImageBLL = new ArticleImageBLL();
                //    int j = 1;
                //    for (int i = 0; i < article.ImgFileList.Count; i++)
                //    {
                //        string savePath = System.Web.HttpContext.Current.Server.MapPath("~");
                //        string fromPath = savePath + ConfigurationManager.AppSettings["UploadTmp"] + article.ImgFileList[i].ImgFileName;
                //        string fileExtension = Path.GetExtension(fromPath); // 文件扩展名

                //        string categoryFix = "other";
                //        //根据文件类别+分类下序数命名新图片名
                //        var firstKey = Constants.ChannelToCategory.FirstOrDefault(q => q.Value == article.CategoryId.Value).Key;
                //        if (!string.IsNullOrEmpty(firstKey))
                //        {
                //            categoryFix = firstKey;
                //        }
                //        string newFileName = categoryFix + article.NoOfCategory.ToString().PadLeft(2, '0') + "_" + j + fileExtension; // 文件扩展名  //jt01_1.jpg
                //        ++j;
                //        string toPath = savePath + ConfigurationManager.AppSettings["AriticleImagePath"] + newFileName;
                //        if (!Directory.Exists(savePath + ConfigurationManager.AppSettings["AriticleImagePath"]))
                //        {
                //            Directory.CreateDirectory(savePath + ConfigurationManager.AppSettings["AriticleImagePath"]);
                //        }
                //        System.IO.File.Copy(fromPath, toPath);
                //        //TODO Insert ArticleImage
                //        ArticleImageEntity articleImage = new ArticleImageEntity();
                //        articleImage.ArticleId = article.Id;
                //        articleImage.ImageFileName = newFileName;
                //        articleImageBLL.AddArticleImageEntity(articleImage);
                //    }
                //}

                return(JsonConvert.SerializeObject(new { result = true, message = "", returnUrl = "/Admin/Article/Index?JournalId=" + article.JournalId }));
            }
            return(JsonConvert.SerializeObject(new { result = false, message = "" }));
        }
Esempio n. 9
0
        /// <summary>
        /// 文章预览
        /// </summary>
        /// <param name="id">文章Id</param>
        /// <returns></returns>
        public ActionResult Perview(int id)
        {
            ArticleBLL    articleBLL    = new ArticleBLL();
            ArticleEntity articleEntity = articleBLL.GetArticleEntityById(id);
            string        staticURL     = "/";

            //生成文章静态URL
            ArticleCategoryBLL    articleCategoryBLL = new ArticleCategoryBLL();
            ArticleCategoryEntity categoryEntity     = articleCategoryBLL.GetArticleCategoryEntityById(articleEntity.CategoryId);

            //TODO 判断文章没有任何分类的情况
            articleEntity.HrefTpl = categoryEntity != null ? categoryEntity.HrefTpl : "nocategory{0}.html";//文章没有类别时,详细页URL

            if (!string.IsNullOrEmpty(articleEntity.HrefTpl))
            {
                //查文章对应的期刊
                if (articleEntity.ArticlePropertyId.HasValue)
                {
                    JournalArticleRelationBLL    journalArticleRelationBLL    = new JournalArticleRelationBLL();
                    JournalArticleRelationEntity journalArticleRelationEntity = journalArticleRelationBLL.GetJournalArticleRelationEntityById(articleEntity.ArticlePropertyId);
                    ArticleJournalBLL            articleJournalBLL            = new ArticleJournalBLL();
                    ArticleJournalEntity         articleJournalEntity         = articleJournalBLL.GetArticleJournalEntityById(journalArticleRelationEntity.JournalId);
                    articleEntity.JournalId    = articleJournalEntity.JournalId;    //期刊Id
                    articleEntity.JournalName  = articleJournalEntity.JournalName;  //期刊名
                    articleEntity.PropertyName = articleJournalEntity.PropertyName; //期刊总序号
                    staticURL += articleEntity.Href + "?JournalId=" + articleEntity.JournalId;
                    return(Redirect(staticURL));
                }
                staticURL += articleEntity.Href;
                return(Redirect(staticURL));
            }
            return(new EmptyResult());
        }
Esempio n. 10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.Page.IsPostBack)
     {
         foreach (ArticleClassInfo info in ArticleClassBLL.ReadArticleClassNamedList())
         {
             this.ClassID.Items.Add(new ListItem(info.ClassName, info.ID.ToString()));
         }
         int queryString = RequestHelper.GetQueryString <int>("ID");
         if (queryString != -2147483648)
         {
             base.CheckAdminPower("ReadArticle", PowerCheckType.Single);
             ArticleInfo info2 = ArticleBLL.ReadArticle(queryString);
             this.Title.Text = info2.Title;
             string classID = info2.ClassID;
             if (classID != string.Empty)
             {
                 classID = classID.Substring(1, classID.Length - 2);
                 if (classID.IndexOf('|') > -1)
                 {
                     classID = classID.Substring(classID.LastIndexOf('|') + 1);
                 }
             }
             this.ClassID.Text  = classID;
             this.IsTop.Text    = info2.IsTop.ToString();
             this.Author.Text   = info2.Author;
             this.Resource.Text = info2.Resource;
             this.Keywords.Text = info2.Keywords;
             this.Url.Text      = info2.Url;
             this.Photo.Text    = info2.Photo;
             this.Summary.Text  = info2.Summary;
             this.Content.Value = info2.Content;
         }
     }
 }
Esempio n. 11
0
        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            ArticleInfo article = new ArticleInfo();

            article.ID       = RequestHelper.GetQueryString <int>("ID");
            article.Title    = this.Title.Text;
            article.ClassID  = ArticleClassBLL.ReadArticleClassFullFatherID(Convert.ToInt32(this.ClassID.Text));
            article.IsTop    = Convert.ToInt32(this.IsTop.Text);
            article.Author   = this.Author.Text;
            article.Resource = this.Resource.Text;
            article.Keywords = this.Keywords.Text;
            article.Url      = this.Url.Text;
            article.Photo    = this.Photo.Text;
            article.Summary  = this.Summary.Text;
            article.Content  = this.Content.Value;
            article.Date     = RequestHelper.DateNow;
            string alertMessage = ShopLanguage.ReadLanguage("AddOK");

            if (article.ID == -2147483648)
            {
                base.CheckAdminPower("AddArticle", PowerCheckType.Single);
                int id = ArticleBLL.AddArticle(article);
                AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("AddRecord"), ShopLanguage.ReadLanguage("Article"), id);
            }
            else
            {
                base.CheckAdminPower("UpdateArticle", PowerCheckType.Single);
                ArticleBLL.UpdateArticle(article);
                AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("UpdateRecord"), ShopLanguage.ReadLanguage("Article"), article.ID);
                alertMessage = ShopLanguage.ReadLanguage("UpdateOK");
            }
            AdminBasePage.Alert(alertMessage, RequestHelper.RawUrl);
        }
Esempio n. 12
0
        protected override void PageLoad()
        {
            base.PageLoad();
            topNav = 8;

            helpClassList = ArticleClassBLL.ReadChilds(ArticleClass.Help);

            id = RequestHelper.GetQueryString <int>("id");


            if (id == int.MinValue && helpClassList.Count > 0)
            {
                id = helpClassList[0].Id;
            }

            if (id > 0)
            {
                if (ArticleClassBLL.Read(id).ParentId == 2)
                {
                    fatherID = id;
                    artId    = ArticleClassBLL.ReadChilds(id)[0].Id;
                }
                else
                {
                    fatherID = ArticleClassBLL.Read(id).ParentId;
                    artId    = id;
                }
                ArticleSearchInfo articleSearch = new ArticleSearchInfo();
                articleSearch.ClassId = "|" + artId.ToString() + "|";
                articleList           = ArticleBLL.SearchList(articleSearch);
            }

            Title = "帮助中心";
        }
Esempio n. 13
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.Page.IsPostBack)
     {
         base.CheckAdminPower("ReadArticle", PowerCheckType.Single);
         foreach (ArticleClassInfo info in ArticleClassBLL.ReadArticleClassNamedList())
         {
             this.ArticleClassID.Items.Add(new ListItem(info.ClassName, "|" + info.ID + "|"));
         }
         this.ArticleClassID.Items.Insert(0, new ListItem("ËùÓзÖÀà", string.Empty));
         this.Title.Text          = RequestHelper.GetQueryString <string>("Title");
         this.ArticleClassID.Text = RequestHelper.GetQueryString <string>("ClassID");
         this.IsTop.Text          = RequestHelper.GetQueryString <string>("IsTop");
         this.classID             = RequestHelper.GetQueryString <string>("ClassID");
         if (this.classID != string.Empty)
         {
             this.classID = ArticleClassBLL.ReadArticleClassFullFatherID(Convert.ToInt32(this.classID.Replace("|", string.Empty)));
             this.classID = this.classID.Substring(1, this.classID.Length - 2);
             if (this.classID.IndexOf('|') > -1)
             {
                 this.classID = this.classID.Substring(0, this.classID.IndexOf('|'));
             }
         }
         ArticleSearchInfo article = new ArticleSearchInfo();
         article.Title   = RequestHelper.GetQueryString <string>("Title");
         article.ClassID = RequestHelper.GetQueryString <string>("ClassID");
         article.IsTop   = RequestHelper.GetQueryString <int>("IsTop");
         base.BindControl(ArticleBLL.SearchArticleList(base.CurrentPage, base.PageSize, article, ref this.Count), this.RecordList, this.MyPager);
     }
 }
Esempio n. 14
0
        /// <summary>
        /// 半决赛数据自动评选
        /// </summary>
        /// <returns></returns>
        public ApiResult UpdateSemifinalsData()
        {
            ApiResult apiResult = new ApiResult();
            //开启的赛区
            BaseBLL <competition_notice> notice_bll = new BaseBLL <competition_notice>();
            var notice = notice_bll.Find(o => o.is_delete == 0 && o.is_open == 1);

            if (notice?.competition_season_id > 0)
            {
                if (Util.isNotNull(notice.semifinals_end_date))
                {
                    //时间是否是今天
                    if (notice.semifinals_end_date.Date == DateTime.Now.Date)
                    {
                        //找出前几百名作品,更新作品状态(必须是审核通过的)
                        ArticleBLL bll = new ArticleBLL();
                        apiResult = bll.GetSemifinalsAndUpdate(notice.competition_season_id, 200);
                        LogHelper.Info("同步更新半决赛作品时间:" + DateTime.Now + ",结果:" + Newtonsoft.Json.JsonConvert.SerializeObject(apiResult));
                    }
                }
                else
                {
                    LogHelper.Error(DateTime.Now + ":半决赛数据自动评选,没有找到半决赛结束时间");
                    apiResult.success = false;
                    apiResult.message = "没有找到半决赛结束时间";
                }
            }
            else
            {
                LogHelper.Error(DateTime.Now + ":初赛数据自动评选,没有找到开启的赛季");
                apiResult.success = false;
                apiResult.message = "没有找到开启的赛季";
            }
            return(apiResult);
        }
Esempio n. 15
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         ColumnsBind();
         string ArticleID = Request["ArticleID"] + "";
         hidArticleID.Value = ArticleID;
         if (ArticleID.Length > 0)
         {
             ActionsType = ActionType.Update;
             ArticleBLL articleBLL = new ArticleBLL();
             CurrentArticle  = new Article();
             CurrentArticle  = articleBLL.GetOneByID(CurrentArticle, int.Parse(ArticleID));
             txtTitle.Text   = CurrentArticle.Title;
             TxtContent.Text = CurrentArticle.Body;
         }
         else
         {
             ActionsType     = ActionType.Insert;
             CurrentArticle  = new Article();
             txtTitle.Text   = "";
             TxtContent.Text = "";
         }
     }
 }
Esempio n. 16
0
        /// <summary>
        /// 后台的文章静态处理
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult StaticHtml(int id)
        {
            ArticleBLL    articleBLL    = new ArticleBLL();
            ArticleEntity articleEntity = articleBLL.GetArticleEntityById(id);
            string        staticURL     = "/";

            //生成文章静态URL
            ArticleCategoryBLL    articleCategoryBLL = new ArticleCategoryBLL();
            ArticleCategoryEntity categoryEntity     = articleCategoryBLL.GetArticleCategoryEntityById(articleEntity.CategoryId);

            articleEntity.HrefTpl = categoryEntity.HrefTpl;

            if (!string.IsNullOrEmpty(categoryEntity.HrefTpl))
            {
                //查文章对应的期刊
                if (articleEntity.ArticlePropertyId.HasValue)
                {
                    JournalArticleRelationBLL    journalArticleRelationBLL    = new JournalArticleRelationBLL();
                    JournalArticleRelationEntity journalArticleRelationEntity = journalArticleRelationBLL.GetJournalArticleRelationEntityById(articleEntity.ArticlePropertyId);
                    ArticleJournalBLL            articleJournalBLL            = new ArticleJournalBLL();
                    ArticleJournalEntity         articleJournalEntity         = articleJournalBLL.GetArticleJournalEntityById(journalArticleRelationEntity.JournalId);
                    articleEntity.JournalId    = articleJournalEntity.JournalId;    //期刊Id
                    articleEntity.JournalName  = articleJournalEntity.JournalName;  //期刊名
                    articleEntity.PropertyName = articleJournalEntity.PropertyName; //期刊总序号
                    staticURL += articleEntity.Href + "?JournalId=" + articleEntity.JournalId + "&static=1";
                    return(Redirect(staticURL));
                }
                staticURL += articleEntity.Href + "&static=1";
                return(Redirect(staticURL));
            }
            return(new EmptyResult());
        }
Esempio n. 17
0
        // GET: Page
        public ActionResult Index(string id)
        {
            int     iID = Convert.ToInt32(id);
            Article obj = new ArticleBLL().GetObjByAsId(iID);

            return(View(obj));
        }
Esempio n. 18
0
        /// <summary>
        /// 页面加载
        /// </summary>
        protected override void PageLoad()
        {
            base.PageLoad();
            int articleID = RequestHelper.GetQueryString <int>("ID");

            if (articleID == 1)
            {
                topNav = 6;
            }
            article = ArticleBLL.Read(articleID);

            if (article.ClassId != string.Empty)
            {
                article.ClassId = article.ClassId.Substring(1);
                articleClassID  = Convert.ToInt32(article.ClassId.Substring(0, article.ClassId.IndexOf('|')));

                ArticleSearchInfo aSearch = new ArticleSearchInfo();
                aSearch.ClassId = "|" + articleClassID + "|";
                articleList     = ArticleBLL.SearchList(aSearch);
            }

            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;
        }
Esempio n. 19
0
        public ResultModel <List <dynamic> > GetFollowMessage([FromUri] PageModel pm)
        {
            ResultModel <List <dynamic> > msg = new ResultModel <List <dynamic> >();

            msg = new ArticleBLL().GetFollowMessage(pm);
            return(msg);
        }
Esempio n. 20
0
 /// <summary>
 /// 绑定关联产品,配件,文章
 /// </summary>
 /// <param name="product"></param>
 protected void BindRelation(ProductInfo product)
 {
     if (product.RelationArticle != string.Empty)
     {
         ArticleSearchInfo articleSearch = new ArticleSearchInfo();
         articleSearch.InArticleId = product.RelationArticle;
         Article.DataSource        = ArticleBLL.SearchList(articleSearch);
         Article.DataTextField     = "Title";
         Article.DataValueField    = "ID";
         Article.DataBind();
     }
     if (product.RelationProduct != string.Empty)
     {
         ProductSearchInfo productSearch = new ProductSearchInfo();
         productSearch.InProductId = product.RelationProduct;
         Product.DataSource        = ProductBLL.SearchList(productSearch);
         Product.DataTextField     = "Name";
         Product.DataValueField    = "ID";
         Product.DataBind();
     }
     if (product.Accessory != string.Empty)
     {
         ProductSearchInfo productSearch = new ProductSearchInfo();
         productSearch.InProductId = product.Accessory;
         Accessory.DataSource      = ProductBLL.SearchList(productSearch);
         Accessory.DataTextField   = "Name";
         Accessory.DataValueField  = "ID";
         Accessory.DataBind();
     }
 }
Esempio n. 21
0
        public ActionResult AddArticle()
        {
            var result = ArticleBLL.SelectCateToAricle();

            ViewBag.author = Session["username"].ToString();;
            return(View(result));
        }
Esempio n. 22
0
        public ActionResult _ArtCList(string acPName)
        {
            List <Article> list = new ArticleBLL().GetCListByPName(acPName);

            ViewBag.list = list;
            return(PartialView("_ArtCList"));
        }
Esempio n. 23
0
        /// <summary>
        /// 获取作品内容并获取上一篇,下一篇的id
        /// </summary>
        /// <param name="state">2初赛,3半决赛,4决赛</param>
        /// <param name="article_id"></param>
        /// <returns></returns>
        public ApiResult GetArticleInfoByAdmin(int state, int article_id)
        {
            ApiPageResult apiResult   = new ApiPageResult();
            var           checkResult = Util.CheckParameters(
                new Parameter {
                Value = state.ToString(), Msg = "state 不能为空值"
            },
                new Parameter {
                Value = state.ToString(), Msg = "state 必须是数字类型", Regex = @"^[1-9]\d*$"
            },
                new Parameter {
                Value = article_id.ToString(), Msg = "article_id 不能为空值"
            },
                new Parameter {
                Value = article_id.ToString(), Msg = "article_id 必须是数字类型", Regex = @"^[1-9]\d*$"
            }
                );

            if (!checkResult.OK)
            {
                apiResult.success = false;
                apiResult.status  = ApiStatusCode.InvalidParam;
                apiResult.message = checkResult.Msg;
                return(apiResult);
            }
            ArticleBLL bll = new ArticleBLL();

            return(bll.GetArticleInfoByAdmin(state, article_id));
        }
Esempio n. 24
0
        protected void BindRelation(ProductInfo product)
        {
            ProductSearchInfo info2;

            if (product.RelationArticle != string.Empty)
            {
                ArticleSearchInfo articleSearch = new ArticleSearchInfo();
                articleSearch.InArticleID   = product.RelationArticle;
                this.Article.DataSource     = ArticleBLL.SearchArticleList(articleSearch);
                this.Article.DataTextField  = "Title";
                this.Article.DataValueField = "ID";
                this.Article.DataBind();
            }
            if (product.RelationProduct != string.Empty)
            {
                info2                       = new ProductSearchInfo();
                info2.InProductID           = product.RelationProduct;
                this.Product.DataSource     = ProductBLL.SearchProductList(info2);
                this.Product.DataTextField  = "Name";
                this.Product.DataValueField = "ID";
                this.Product.DataBind();
            }
            if (product.Accessory != string.Empty)
            {
                info2                         = new ProductSearchInfo();
                info2.InProductID             = product.Accessory;
                this.Accessory.DataSource     = ProductBLL.SearchProductList(info2);
                this.Accessory.DataTextField  = "Name";
                this.Accessory.DataValueField = "ID";
                this.Accessory.DataBind();
            }
        }
Esempio n. 25
0
        public ActionResult ArticleSEdit(int id, string info)
        {
            Article obj = new ArticleBLL().GetObjByAsId(id);

            ViewBag.info = info;
            return(View(obj));
        }
Esempio n. 26
0
        public ActionResult Register(RegisterViewModel registerViewModel)
        {
            if (ModelState.IsValid)
            {
                IUserBLL userBLL = new UserBLL();
                if (userBLL.Register(registerViewModel.Email, registerViewModel.Password))
                {
                    Guid userId;
                    userBLL.Login(registerViewModel.Email, registerViewModel.Password, out userId);

                    // create default category and article in the account

                    IArticleBLL articleBLL = new ArticleBLL();
                    articleBLL.CreateCategory("default", userId);

                    List <Guid> categoryIds = new List <Guid>();
                    foreach (CategoryDTO categoryDTO in articleBLL.GetAllCategories(userId))
                    {
                        categoryIds.Add(categoryDTO.Id);
                    }
                    articleBLL.CreateArticle("default title", "default content", categoryIds.ToArray(), userId);


                    return(RedirectToAction(nameof(Login)));
                }
                return(View(registerViewModel));
            }
            return(View(registerViewModel));
        }
Esempio n. 27
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                CheckAdminPower("ReadArticle", PowerCheckType.Single);
                foreach (ArticleClassInfo articleClass in ArticleClassBLL.ReadNamedList())
                {
                    ArticleClassID.Items.Add(new ListItem(articleClass.Name, "|" + articleClass.Id + "|"));
                }
                ArticleClassID.Items.Insert(0, new ListItem("所有分类", string.Empty));
                Title.Text          = RequestHelper.GetQueryString <string>("Title");
                ArticleClassID.Text = RequestHelper.GetQueryString <string>("ClassID");
                IsTop.Text          = RequestHelper.GetQueryString <string>("IsTop");
                //页签的判断
                classID = RequestHelper.GetQueryString <string>("ClassID");
                if (classID != string.Empty)
                {
                    classID = ArticleClassBLL.ReadFullParentId(Convert.ToInt32(classID.Replace("|", string.Empty)));
                    classID = classID.Substring(1, classID.Length - 2);
                    if (classID.IndexOf('|') > -1)
                    {
                        classID = classID.Substring(0, classID.IndexOf('|'));
                    }
                }

                ArticleSearchInfo articleSearch = new ArticleSearchInfo();
                articleSearch.Title   = RequestHelper.GetQueryString <string>("Title");
                articleSearch.ClassId = RequestHelper.GetQueryString <string>("ClassID");
                articleSearch.IsTop   = RequestHelper.GetQueryString <int>("IsTop");

                BindControl(ArticleBLL.SearchList(CurrentPage, PageSize, articleSearch, ref Count), RecordList, MyPager);
            }
        }
Esempio n. 28
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;
                }
            }
        }
Esempio n. 29
0
        void BindArticleList()
        {
            var bll  = new ArticleBLL();
            var list = bll.GetAll(new Article(), "enabled=1 and Author=" + LoginUser.ID);

            ArticleReapter.DataSource = list;
            ArticleReapter.DataBind();
        }
Esempio n. 30
0
        // GET: Article/Edit/5
        public ActionResult Edit(int id)
        {
            SystemFail error   = new SystemFail();
            Article    article = ArticleBLL.GetArticleById(id, error);


            return(View(article));
        }