示例#1
0
        private IList <HelpCategoryInfo> GetDataSource()
        {
            IList <HelpCategoryInfo> list = new List <HelpCategoryInfo>();

            list = CommentBrowser.GetHelpCategorys();
            if (this.MaxNum > 0 && this.MaxNum < list.Count)
            {
                for (int i = list.Count - 1; i >= this.MaxNum; i--)
                {
                    list.RemoveAt(i);
                }
            }
            return(list);
        }
示例#2
0
        IList <HelpCategoryInfo> GetDataSource()
        {
            IList <HelpCategoryInfo> helpCategorys = new List <HelpCategoryInfo>();

            helpCategorys = CommentBrowser.GetHelpCategorys();
            if ((this.MaxNum > 0) && (this.MaxNum < helpCategorys.Count))
            {
                for (int i = helpCategorys.Count - 1; i >= this.MaxNum; i--)
                {
                    helpCategorys.RemoveAt(i);
                }
            }
            return(helpCategorys);
        }
示例#3
0
        public IHttpActionResult HelpCategory(string accessToken, int channel, int platform, string ver)
        {
            Logger.WriterLogger("Common.HelpCategory, Params: " + string.Format("accessToken={0}&channel={1}&platform={2}&ver={3}", accessToken, channel, platform, ver), LoggerType.Info);

            // 保存访问信息
            base.SaveVisitInfo("", channel, platform, ver);

            // 验证令牌
            int accessTookenCode = VerifyAccessToken(accessToken);

            if (accessTookenCode > 0)
            {
                return(base.JsonFaultResult(new CommonException(accessTookenCode).GetMessage(), "Common.HelpCategory"));
            }

            List <HelpCategoryListItem> items = new List <HelpCategoryListItem>();

            IList <HelpCategoryInfo> categories = CommentBrowser.GetHelpCategorys();

            if (categories != null)
            {
                HelpCategoryListItem item = null;

                foreach (var current in categories)
                {
                    item = new HelpCategoryListItem();

                    item.Id              = current.CategoryId ?? 0;
                    item.Name            = current.Name;
                    item.Description     = current.Description;
                    item.IconUrl         = Util.AppendImageHost(current.IconUrl);
                    item.DisplaySequence = current.DisplaySequence;

                    items.Add(item);
                }
            }

            return(base.JsonActionResult(new StandardResult <ListResult <HelpCategoryListItem> >()
            {
                code = 0,
                msg = "",
                data = new ListResult <HelpCategoryListItem>()
                {
                    TotalNumOfRecords = items.Count,
                    Results = items
                }
            }));
        }
示例#4
0
        public IHttpActionResult HelpByCategory(int categoryId, string accessToken, int channel, int platform, string ver)
        {
            Logger.WriterLogger("Common.HelpByCategory, Params: " + string.Format("accessToken={0}&channel={1}&platform={2}&ver={3}&categoryId={4}", accessToken, channel, platform, ver, categoryId), LoggerType.Info);

            // 保存访问信息
            base.SaveVisitInfo("", channel, platform, ver);

            // 验证令牌
            int accessTookenCode = VerifyAccessToken(accessToken);

            if (accessTookenCode > 0)
            {
                return(base.JsonFaultResult(new CommonException(accessTookenCode).GetMessage(), "Common.HelpByCategory"));
            }

            IList <HelpCategoryInfo> categories = CommentBrowser.GetHelpCategorys();

            HelpQuery helpQuery = new HelpQuery();

            if (categoryId > 0)
            {
                helpQuery.CategoryId = categoryId;
            }
            helpQuery.PageIndex = 1;
            helpQuery.PageSize  = int.MaxValue;
            helpQuery.SortBy    = "AddedDate";
            helpQuery.SortOrder = EcShop.Core.Enums.SortAction.Desc;

            List <HelpListItem> items = new List <HelpListItem>();

            DbQueryResult dbQueryResult = CommentBrowser.GetHelpList(helpQuery);

            DataTable dt = dbQueryResult.Data as DataTable;

            if (dt != null)
            {
                HelpListItem item = null;

                foreach (DataRow row in dt.Rows)
                {
                    item = new HelpListItem();

                    item.CategoryId  = (int)row["CategoryId"];
                    item.Id          = (int)row["HelpId"];
                    item.Title       = (string)row["Title"];
                    item.Description = "";
                    if (row["Description"] != DBNull.Value)
                    {
                        item.Description = (string)row["Description"];
                    }
                    item.AddedDate = "";
                    if (row["AddedDate"] != DBNull.Value)
                    {
                        item.AddedDate = ((DateTime)row["AddedDate"]).ToString("yyyy-MM-dd HH:mm:ss");
                    }

                    items.Add(item);
                }
            }

            return(base.JsonActionResult(new StandardResult <ListResult <HelpListItem> >()
            {
                code = 0,
                msg = "",
                data = new ListResult <HelpListItem>()
                {
                    TotalNumOfRecords = items.Count,
                    Results = items
                }
            }));
        }
示例#5
0
        protected override void Render(HtmlTextWriter writer)
        {
            string strHelps = HiCache.Get("DataCache-Helps") as string;

            if (string.IsNullOrEmpty(strHelps))
            {
                DataTable dtHelps = CommentBrowser.GetFooterHelps();
                IList <HelpCategoryInfo> helpCategorys = CommentBrowser.GetHelpCategorys();
                StringBuilder            stringBuiler  = new StringBuilder();
                stringBuiler.Append("<ul class=\"g-cf\">");

                if (dtHelps != null && dtHelps.Rows.Count > 0)
                {
                    int count = dtHelps.Rows.Count;

                    for (int j = 0; j < 4; j++)
                    {
                        stringBuiler.AppendFormat("<li class=\"rookie\">");
                        stringBuiler.Append(" <h3>");
                        stringBuiler.AppendFormat(" <span class=\"g-dib\"><img src=\"{0}\"/></span>{1}", helpCategorys[j].IconUrl, helpCategorys[j].Name);
                        stringBuiler.Append("</h3>");
                        stringBuiler.Append("<div>");
                        //int z = 0;
                        for (int i = 0; i < count; i++)
                        {
                            if (dtHelps.Rows[i]["CategoryId"].ToString() == (helpCategorys[j].CategoryId.ToString()))
                            {
                                //z++;
                                //stringBuiler.AppendFormat("<a href=\"{0}\">{1}</a>", Globals.GetSiteUrls().UrlData.FormatUrl("HelpDetails", dtHelps.Rows[i]["HelpId"]), dtHelps.Rows[i]["Title"]);

                                stringBuiler.AppendFormat("<a href=\"{0}\">{1}</a>", ResolveUrl("/helpItem.aspx?helpid=" + dtHelps.Rows[i]["HelpId"]), dtHelps.Rows[i]["Title"]);
                                //if(z%3==0)
                                //{
                                //    stringBuiler.Append("<br>");
                                //}
                            }
                        }

                        stringBuiler.Append("</div>");
                        stringBuiler.Append("</li>");
                    }

                    //for (int i = 0; i < count; i++)
                    //{
                    //    if (i == 0)
                    //    {
                    //        categoryId = dtHelps.Rows[i]["CategoryId"];
                    //    }
                    //    if (categoryId != dtHelps.Rows[i]["CategoryId"])
                    //    {
                    //        if (i != 0)
                    //        {
                    //            stringBuiler.Append("</div>");
                    //            stringBuiler.Append("</li>");
                    //        }
                    //        if (i == 0)
                    //        {
                    //            stringBuiler.AppendFormat("<li class=\"rookie\">");
                    //        }
                    //        else if (i == 1)
                    //        {
                    //            stringBuiler.AppendFormat("<li class=\"buyers\">");
                    //        }
                    //        else if (i == 2)
                    //        {
                    //            stringBuiler.AppendFormat("<li class=\"clause\">");
                    //        }
                    //        else if (i == 3)
                    //        {
                    //            stringBuiler.AppendFormat("<li class=\"safe\">");
                    //        }
                    //        else if (i == 4)
                    //        {
                    //            stringBuiler.AppendFormat("<li class=\"wechat\">");
                    //        }
                    //        stringBuiler.Append(" <h3>");
                    //        stringBuiler.AppendFormat(" <span class=\"g-dib\"><img src=\"{0}\"/></span>{1}", dtHelps.Rows[i]["IconUrl"], dtHelps.Rows[i]["Name"]);
                    //        stringBuiler.Append("</h3>");
                    //        stringBuiler.Append("<div>");
                    //    }
                    //    stringBuiler.AppendFormat("<a href=\"{0}\">{1}</a>",Globals.GetSiteUrls().UrlData.FormatUrl("HelpDetails",dtHelps.Rows[i]["HelpId"]), dtHelps.Rows[i]["Title"]);
                    //     ;
                    //    if ((count - 1) == i)
                    //    {
                    //        stringBuiler.Append("</div>");
                    //        stringBuiler.Append("</li>");
                    //    }
                    //}
                }

                stringBuiler.Append("<li class=\"wechat\"><h3>微信公众号</h3><div><img align=\"left\" src=\"/templates/master/haimei/images/qc.jpg\" width=\"75\" height=\"75\"> 微信公众号<br>海美生活</div><div style='clear:both'><a href='http://weibo.com/haimylife?refer_flag=1005050010_&is_hot=1' target='_blank' rel='no-follow'><img src=\"/templates/master/haimei/images/weibo.png\" style='width:70px;margin-left:0px;height:auto;'></a></div></li>");//固定
                stringBuiler.Append("</ul>");

                strHelps = stringBuiler.ToString();
            }
            writer.Write(strHelps);
        }