Ejemplo n.º 1
0
        /// <summary>
        /// 提交类型
        /// </summary>
        /// <param name="cate"></param
        /// <returns></returns>
        public bool PutArticleCategory(Model.ArticleCategory cate)
        {
            if (cate.AutoID != 0)
            {
                Model.ArticleCategory oldCate = GetArticleCategory(cate.AutoID);
                oldCate.CategoryName = cate.CategoryName;
                oldCate.Summary      = cate.Summary;
                oldCate.ImgSrc       = cate.ImgSrc;
                oldCate.CreateTime   = cate.CreateTime;
                oldCate.Sort         = cate.Sort;

                return(Update(oldCate));
            }
            else
            {
                return(Add(cate));
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取列表
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string GetNewsList(HttpContext context)
        {
            int           pageIndex    = int.Parse(context.Request["PageIndex"]);
            int           pageSize     = int.Parse(context.Request["PageSize"]);
            string        activityName = context.Request["ArticleName"];
            string        categoryId   = context.Request["CategoryId"];
            int           totalCount   = 0;
            StringBuilder sbWhere      = new StringBuilder(string.Format("WebsiteOwner='{0}' And ArticleType='article' And IsHide=0 And IsDelete=0", bllUser.WebsiteOwner));
            List <int>    listJieDu    = new List <int>();//市场解读

            //if (context.Request.Url.Host.Equals("xixinxian.comeoncloud.net"))
            //{
            //    ListJieDu.Add(169);
            //}
            //else
            //{
            //    ListJieDu.Add(240);
            //}
            listJieDu.Add(240);
            List <ZentCloud.BLLJIMP.Model.ArticleCategory> jieDuCategoryList = bllUser.GetList <ZentCloud.BLLJIMP.Model.ArticleCategory>(string.Format("PreID={0}", listJieDu[0].ToString()));

            for (int i = 0; i < jieDuCategoryList.Count; i++)
            {
                listJieDu.Add(jieDuCategoryList[i].AutoID);
            }

            if (!string.IsNullOrEmpty(activityName))
            {
                sbWhere.AppendFormat(" And ActivityName like '%{0}%'", activityName);
            }
            if (!string.IsNullOrEmpty(categoryId))
            {
                ZentCloud.BLLJIMP.Model.ArticleCategory category = bllUser.Get <ZentCloud.BLLJIMP.Model.ArticleCategory>(string.Format("AutoID={0} And WebsiteOwner='{1}'", categoryId, bllUser.WebsiteOwner));
                if ((category != null) && category.PreID.Equals(0))
                {
                    List <ZentCloud.BLLJIMP.Model.ArticleCategory> subCategoryList = bllUser.GetList <ZentCloud.BLLJIMP.Model.ArticleCategory>(string.Format("PreID={0}", categoryId));
                    if (subCategoryList.Count > 0)
                    {
                        string strCategoryIds = "";
                        for (int i = 0; i < subCategoryList.Count; i++)
                        {
                            strCategoryIds += subCategoryList[i].AutoID.ToString() + ",";
                        }
                        strCategoryIds += categoryId;
                        sbWhere.AppendFormat(" And CategoryId in({0})", strCategoryIds);
                    }
                    else
                    {
                        sbWhere.AppendFormat(" And CategoryId={0}", categoryId);
                    }
                }
                else
                {
                    sbWhere.AppendFormat(" And CategoryId={0}", categoryId);
                }
            }
            totalCount = bllUser.GetCount <ZentCloud.BLLJIMP.Model.JuActivityInfo>(sbWhere.ToString());
            List <ZentCloud.BLLJIMP.Model.JuActivityInfo> data = bllUser.GetLit <ZentCloud.BLLJIMP.Model.JuActivityInfo>(pageSize, pageIndex, sbWhere.ToString(), " Sort DESC,LastUpdateDate DESC,JuActivityID DESC");

            for (int i = 0; i < data.Count; i++)
            {
                BLLJIMP.Model.TutorInfo tutorInfo = bllUser.Get <BLLJIMP.Model.TutorInfo>(string.Format(" UserID='{0}'", data[i].UserID));
                if (tutorInfo != null)
                {
                    data[i].ThumbnailsPath = tutorInfo.TutorImg ?? data[i].ThumbnailsPath;
                }
                data[i].ActivityDescription = null;
            }


            resp.ExObj = data;
            resp.ExStr = "";
            int TotalPage = bllUser.GetTotalPage(totalCount, pageSize);

            if ((TotalPage > pageIndex) && (pageIndex.Equals(1)))
            {
                resp.ExStr = "1";//是否增加下一页按钮
            }
            return(Common.JSONHelper.ObjectToJson(resp));
        }