IList <ArticleCategoryInfo> GetDataSource()
        {
            IList <ArticleCategoryInfo> articleMainCategories = CommentBrowser.GetArticleMainCategories();

            if ((this.MaxNum > 0) && (this.MaxNum < articleMainCategories.Count))
            {
                for (int i = articleMainCategories.Count - 1; i >= this.MaxNum; i--)
                {
                    articleMainCategories.RemoveAt(i);
                }
            }
            return(articleMainCategories);
        }
        private IList <ArticleCategoryInfo> GetDataSource()
        {
            IList <ArticleCategoryInfo> articleMainCategories = CommentBrowser.GetArticleMainCategories();

            if (this.MaxNum > 0 && this.MaxNum < articleMainCategories.Count)
            {
                for (int num = articleMainCategories.Count - 1; num >= this.MaxNum; num--)
                {
                    articleMainCategories.RemoveAt(num);
                }
            }
            return(articleMainCategories);
        }
Exemplo n.º 3
0
        protected void Restore()
        {
            TplCfgInfo tplCfgById = VShopHelper.GetTplCfgById(this.id);

            this.txtBannerDesc.Text    = tplCfgById.ShortDesc;
            this.ddlType.SelectedValue = tplCfgById.LocationType.ToString();
            this.littlepic.Src         = tplCfgById.ImageUrl;
            this.fmSrc.Value           = tplCfgById.ImageUrl;
            switch (tplCfgById.LocationType)
            {
            case LocationType.Topic:
                this.ddlSubType.Attributes.CssStyle.Remove("display");
                this.ddlSubType.DataSource     = VShopHelper.Gettopics();
                this.ddlSubType.DataTextField  = "Title";
                this.ddlSubType.DataValueField = "TopicId";
                this.ddlSubType.DataBind();
                this.ddlSubType.SelectedValue = tplCfgById.Url;
                break;

            case (LocationType)1:
            case LocationType.Home:
            case LocationType.ShoppingCart:
            case LocationType.OrderCenter:
            case LocationType.VipCard:
            case LocationType.GroupBuy:
                break;

            case LocationType.Brand:
                int BrandId = 0;
                if (tplCfgById != null && !string.IsNullOrEmpty(tplCfgById.Url))
                {
                    int.TryParse(tplCfgById.Url, out BrandId);
                }
                this.dropBrandTypes.Attributes.CssStyle.Remove("display");
                this.dropBrandTypes.DataSource     = ControlProvider.Instance().GetBrandCategories();
                this.dropBrandTypes.DataTextField  = "BrandName";
                this.dropBrandTypes.DataValueField = "BrandId";
                this.dropBrandTypes.DataBind();
                if (BrandId > 0)
                {
                    dropBrandTypes.SelectedValue = BrandId;
                }
                break;

            case LocationType.Category:
                int categoryId = 0;
                if (tplCfgById != null && !string.IsNullOrEmpty(tplCfgById.Url))
                {
                    //string[] str = tplCfgById.Url.Split('?');
                    //if (str.Length > 0)
                    //{
                    //    string[] str1 = (tplCfgById.Url.Split('?')[1]).Split('=');
                    //    int.TryParse(str1[1].ToString(), out categoryId);
                    //}
                    int.TryParse(tplCfgById.Url, out categoryId);
                }
                this.dropCategories.Attributes.CssStyle.Remove("display");
                this.dropCategories.DataSource     = CatalogHelper.GetMainCategories();
                this.dropCategories.DataTextField  = "Name";
                this.dropCategories.DataValueField = "CategoryId";
                this.dropCategories.DataBind();
                if (categoryId > 0)
                {
                    dropCategories.SelectedValue = categoryId;
                }
                break;

            case LocationType.ImportSourceType:
                int importSourceId = 0;
                if (tplCfgById != null && !string.IsNullOrEmpty(tplCfgById.Url))
                {
                    //string[] str = tplCfgById.Url.Split('?');
                    //if (str.Length > 0)
                    //{
                    //    string[] str1 = (tplCfgById.Url.Split('?')[1]).Split('=');
                    //    int.TryParse(str1[1].ToString(), out importSourceId);
                    //}
                    int.TryParse(tplCfgById.Url, out importSourceId);
                }
                this.dropImportSourceType.Attributes.CssStyle.Remove("display");
                this.dropImportSourceType.DataSource     = ImportSourceTypeHelper.GetAllImportSourceTypes();
                this.dropImportSourceType.DataTextField  = "CnArea";
                this.dropImportSourceType.DataValueField = "ImportSourceId";
                this.dropImportSourceType.DataBind();
                if (importSourceId > 0)
                {
                    dropImportSourceType.SelectedValue = importSourceId;
                }
                break;

            case LocationType.Activity:
            {
                this.ddlSubType.Attributes.CssStyle.Remove("display");
                this.ddlSubType.BindEnum <EcShop.Entities.VShop.LocationType>("");       //修改1
                this.ddlSubType.SelectedValue = tplCfgById.Url.Split(new char[]
                    {
                        ','
                    })[0];
                this.ddlThridType.Attributes.CssStyle.Remove("display");
                LotteryActivityType lotteryActivityType = (LotteryActivityType)System.Enum.Parse(typeof(LotteryActivityType), tplCfgById.Url.Split(new char[]
                    {
                        ','
                    })[0]);
                if (lotteryActivityType == LotteryActivityType.SignUp)
                {
                    this.ddlThridType.DataSource =
                        from item in VShopHelper.GetAllActivity()
                        select new
                    {
                        ActivityId   = item.ActivityId,
                        ActivityName = item.Name
                    };
                }
                else
                {
                    this.ddlThridType.DataSource = VShopHelper.GetLotteryActivityByType(lotteryActivityType);
                }
                this.ddlThridType.DataTextField  = "ActivityName";
                this.ddlThridType.DataValueField = "Activityid";
                this.ddlThridType.DataBind();
                this.ddlThridType.SelectedValue = tplCfgById.Url.Split(new char[]
                    {
                        ','
                    })[1];
                return;
            }

            case LocationType.Link:
                this.Tburl.Text = tplCfgById.Url;
                this.Tburl.Attributes.CssStyle.Remove("display");
                return;

            case LocationType.Phone:
                this.Tburl.Text = tplCfgById.Url;
                this.Tburl.Attributes.CssStyle.Remove("display");
                return;

            case LocationType.Address:
                this.Tburl.Attributes.CssStyle.Remove("display");
                this.navigateDesc.Attributes.CssStyle.Remove("display");
                this.Tburl.Text = tplCfgById.Url;
                return;

            case LocationType.Article:
            {
                this.ddlSubType.Attributes.CssStyle.Remove("display");
                System.Collections.Generic.IList <ArticleCategoryInfo> articleMainCategories = CommentBrowser.GetArticleMainCategories();
                this.ddlSubType.Items.Clear();
                int num  = 0;
                int num2 = 0;
                if (!string.IsNullOrEmpty(tplCfgById.Url))
                {
                    int num3 = tplCfgById.Url.LastIndexOf('=');
                    int.TryParse(tplCfgById.Url.Substring(num3 + 1), out num);
                }
                if (num > 0)
                {
                    ArticleInfo article = CommentBrowser.GetArticle(num);
                    if (article != null)
                    {
                        num2 = article.CategoryId;
                    }
                }
                if (articleMainCategories != null && articleMainCategories.Count > 0)
                {
                    foreach (ArticleCategoryInfo current in articleMainCategories)
                    {
                        this.ddlSubType.Items.Add(new System.Web.UI.WebControls.ListItem(current.Name, current.CategoryId.ToString()));
                    }
                    if (num2 > 0)
                    {
                        this.ddlSubType.SelectedValue = num2.ToString();
                    }
                }
                if (num > 0)
                {
                    this.ddlThridType.Attributes.CssStyle.Remove("display");
                    System.Collections.Generic.IList <ArticleInfo> articleList = CommentBrowser.GetArticleList(num2, 1000);
                    foreach (ArticleInfo current2 in articleList)
                    {
                        this.ddlThridType.Items.Add(new System.Web.UI.WebControls.ListItem(current2.Title, current2.ArticleId.ToString()));
                    }
                    this.ddlThridType.SelectedValue = num.ToString();
                    return;
                }
                break;
            }

            case LocationType.Product:

                this.linkSelectProduct.Attributes.CssStyle.Remove("display");
                this.productName.Attributes.CssStyle.Remove("display");
                this.productid.Value = tplCfgById.Url;
                int result;
                if (int.TryParse(tplCfgById.Url, out result))
                {
                    this.productName.InnerText = ProductHelper.GetProductDetails(result).ProductName;
                }


                break;

            default:
                return;
            }
        }
Exemplo n.º 4
0
 private IList <ArticleCategoryInfo> GetDataSource()
 {
     return(CommentBrowser.GetArticleMainCategories());
 }
Exemplo n.º 5
0
        protected void Restore()
        {
            TplCfgInfo tplCfgById = VShopHelper.GetTplCfgById(this.id);

            this.txtNavigateDesc.Text  = tplCfgById.ShortDesc;
            this.ddlType.SelectedValue = tplCfgById.LocationType.ToString();
            if (!tplCfgById.ImageUrl.ToLower().Contains("storage/master/navigate"))
            {
                this.iconpath = tplCfgById.ImageUrl;
            }
            this.littlepic.Src = tplCfgById.ImageUrl;
            this.fmSrc.Value   = tplCfgById.ImageUrl;
            switch (tplCfgById.LocationType)
            {
            case EcShop.Entities.VShop.LocationType.Topic:
                this.ddlSubType.Attributes.CssStyle.Remove("display");
                this.ddlSubType.DataSource     = VShopHelper.Gettopics();
                this.ddlSubType.DataTextField  = "Title";
                this.ddlSubType.DataValueField = "TopicId";
                this.ddlSubType.DataBind();
                this.ddlSubType.SelectedValue = tplCfgById.Url;
                break;

            case (EcShop.Entities.VShop.LocationType) 1:
            case EcShop.Entities.VShop.LocationType.Home:
            case EcShop.Entities.VShop.LocationType.Category:
            case EcShop.Entities.VShop.LocationType.ShoppingCart:
            case EcShop.Entities.VShop.LocationType.OrderCenter:
            case EcShop.Entities.VShop.LocationType.VipCard:
            case EcShop.Entities.VShop.LocationType.GroupBuy:
            case EcShop.Entities.VShop.LocationType.Brand:
                break;

            case EcShop.Entities.VShop.LocationType.Activity:
            {
                this.ddlSubType.Attributes.CssStyle.Remove("display");
                this.ddlSubType.BindEnum <EcShop.Entities.AliOH.LocationType>("");//修改1
                this.ddlSubType.SelectedValue = tplCfgById.Url.Split(new char[]
                    {
                        ','
                    })[0];
                this.ddlThridType.Attributes.CssStyle.Remove("display");
                LotteryActivityType lotteryActivityType = (LotteryActivityType)System.Enum.Parse(typeof(LotteryActivityType), tplCfgById.Url.Split(new char[]
                    {
                        ','
                    })[0]);
                if (lotteryActivityType == LotteryActivityType.SignUp)
                {
                    this.ddlThridType.DataSource =
                        from item in VShopHelper.GetAllActivity()
                        select new
                    {
                        ActivityId   = item.ActivityId,
                        ActivityName = item.Name
                    };
                }
                else
                {
                    this.ddlThridType.DataSource = VShopHelper.GetLotteryActivityByType(lotteryActivityType);
                }
                this.ddlThridType.DataTextField  = "ActivityName";
                this.ddlThridType.DataValueField = "Activityid";
                this.ddlThridType.DataBind();
                this.ddlThridType.SelectedValue = tplCfgById.Url.Split(new char[]
                    {
                        ','
                    })[1];
                return;
            }

            case EcShop.Entities.VShop.LocationType.Link:
                this.Tburl.Text = tplCfgById.Url;
                this.Tburl.Attributes.CssStyle.Remove("display");
                return;

            case EcShop.Entities.VShop.LocationType.Phone:
                this.Tburl.Text = tplCfgById.Url;
                this.Tburl.Attributes.CssStyle.Remove("display");
                return;

            case EcShop.Entities.VShop.LocationType.Address:
                this.Tburl.Attributes.CssStyle.Remove("display");
                this.navigateDesc.Attributes.CssStyle.Remove("display");
                this.Tburl.Text = tplCfgById.Url;
                return;

            case EcShop.Entities.VShop.LocationType.Article:
            {
                this.ddlSubType.Attributes.CssStyle.Remove("display");
                System.Collections.Generic.IList <ArticleCategoryInfo> articleMainCategories = CommentBrowser.GetArticleMainCategories();
                this.ddlSubType.Items.Clear();
                int num  = 0;
                int num2 = 0;
                if (!string.IsNullOrEmpty(tplCfgById.Url))
                {
                    int num3 = tplCfgById.Url.LastIndexOf('=');
                    int.TryParse(tplCfgById.Url.Substring(num3 + 1), out num);
                }
                if (num > 0)
                {
                    ArticleInfo article = CommentBrowser.GetArticle(num);
                    if (article != null)
                    {
                        num2 = article.CategoryId;
                    }
                }
                if (articleMainCategories != null && articleMainCategories.Count > 0)
                {
                    foreach (ArticleCategoryInfo current in articleMainCategories)
                    {
                        this.ddlSubType.Items.Add(new System.Web.UI.WebControls.ListItem(current.Name, current.CategoryId.ToString()));
                    }
                    if (num2 > 0)
                    {
                        this.ddlSubType.SelectedValue = num2.ToString();
                    }
                }
                if (num > 0)
                {
                    this.ddlThridType.Attributes.CssStyle.Remove("display");
                    System.Collections.Generic.IList <ArticleInfo> articleList = CommentBrowser.GetArticleList(num2, 1000);
                    foreach (ArticleInfo current2 in articleList)
                    {
                        this.ddlThridType.Items.Add(new System.Web.UI.WebControls.ListItem(current2.Title, current2.ArticleId.ToString()));
                    }
                    this.ddlThridType.SelectedValue = num.ToString();
                    return;
                }
                break;
            }

            default:
                return;
            }
        }
Exemplo n.º 6
0
 private string GetMainArticleCategories()
 {
     System.Collections.Generic.IList <ArticleCategoryInfo> articleMainCategories = CommentBrowser.GetArticleMainCategories();
     return(JsonConvert.SerializeObject(articleMainCategories));
 }
Exemplo n.º 7
0
        public void ProcessRequest(System.Web.HttpContext context)
        {
            string text = context.Request.Form["actionName"];
            string s    = string.Empty;
            string key;

            switch (key = text)
            {
            case "Topic":
            {
                System.Collections.Generic.IList <TopicInfo> value = VShopHelper.Gettopics();
                s = JsonConvert.SerializeObject(value);
                break;
            }

            case "Vote":
            {
                System.Data.DataSet votes = StoreHelper.GetVotes();
                s = JsonConvert.SerializeObject(votes);
                break;
            }

            case "Category":
            {
                var value2 =
                    from item in CatalogHelper.GetMainCategories()
                    select new
                {
                    CateId   = item.CategoryId,
                    CateName = item.Name
                };
                s = JsonConvert.SerializeObject(value2);
                break;
            }

            case "Activity":
            {
                System.Array values = System.Enum.GetValues(typeof(LotteryActivityType));
                System.Collections.Generic.List <VsiteHandler.EnumJson> list = new System.Collections.Generic.List <VsiteHandler.EnumJson>();
                foreach (System.Enum @enum in values)
                {
                    list.Add(new VsiteHandler.EnumJson
                        {
                            Name  = @enum.ToShowText(),
                            Value = @enum.ToString()
                        });
                }
                s = JsonConvert.SerializeObject(list);
                break;
            }

            case "ActivityList":
            {
                string value3 = context.Request.Form["acttype"];
                LotteryActivityType lotteryActivityType = (LotteryActivityType)System.Enum.Parse(typeof(LotteryActivityType), value3);
                if (lotteryActivityType == LotteryActivityType.SignUp)
                {
                    var value4 =
                        from item in VShopHelper.GetAllActivity()
                        select new
                    {
                        ActivityId   = item.ActivityId,
                        ActivityName = item.Name
                    };
                    s = JsonConvert.SerializeObject(value4);
                }
                else
                {
                    System.Collections.Generic.IList <LotteryActivityInfo> lotteryActivityByType = VShopHelper.GetLotteryActivityByType(lotteryActivityType);
                    s = JsonConvert.SerializeObject(lotteryActivityByType);
                }
                break;
            }

            case "ArticleCategory":
            {
                System.Collections.Generic.IList <ArticleCategoryInfo> articleMainCategories = CommentBrowser.GetArticleMainCategories();
                if (articleMainCategories != null && articleMainCategories.Count > 0)
                {
                    System.Collections.Generic.List <VsiteHandler.EnumJson> list2 = new System.Collections.Generic.List <VsiteHandler.EnumJson>();
                    foreach (ArticleCategoryInfo current in articleMainCategories)
                    {
                        list2.Add(new VsiteHandler.EnumJson
                            {
                                Name  = current.Name,
                                Value = current.CategoryId.ToString()
                            });
                    }
                    s = JsonConvert.SerializeObject(list2);
                }
                break;
            }

            case "ArticleList":
            {
                int categoryId = 0;
                if (context.Request.Form["categoryId"] != null)
                {
                    int.TryParse(context.Request.Form["categoryId"].ToString(), out categoryId);
                }
                System.Collections.Generic.IList <ArticleInfo>          articleList = CommentBrowser.GetArticleList(categoryId, 1000);
                System.Collections.Generic.List <VsiteHandler.EnumJson> list3       = new System.Collections.Generic.List <VsiteHandler.EnumJson>();
                foreach (ArticleInfo current2 in articleList)
                {
                    list3.Add(new VsiteHandler.EnumJson
                        {
                            Name  = current2.Title,
                            Value = current2.ArticleId.ToString()
                        });
                }
                s = JsonConvert.SerializeObject(list3);
                break;
            }
            }
            context.Response.Write(s);
        }
Exemplo n.º 8
0
 private string GetMainArticleCategories()
 {
     return(JavaScriptConvert.SerializeObject(CommentBrowser.GetArticleMainCategories()));
 }
Exemplo n.º 9
0
        protected override void AttachChildControls()
        {
            this.rptArticleCategorys = (WapTemplatedRepeater)this.FindControl("rpt_ArticleCategory");
            this.hdAppId             = (HtmlInputHidden)this.FindControl("hdAppId");
            this.hdTitle             = (HtmlInputHidden)this.FindControl("hdTitle");
            this.hdDesc   = (HtmlInputHidden)this.FindControl("hdDesc");
            this.hdImgUrl = (HtmlInputHidden)this.FindControl("hdImgUrl");
            this.hdLink   = (HtmlInputHidden)this.FindControl("hdLink");
            int.TryParse(this.Page.Request.QueryString["categoryId"], out this.categoryId);
            this.txtCategoryName = (HtmlInputHidden)this.FindControl("txtCategoryName");
            this.txtCategoryId   = (HtmlInputHidden)this.FindControl("txtCategoryId");
            this.keyWord         = this.Page.Request.QueryString["keyWord"].ToNullString();
            if (!string.IsNullOrWhiteSpace(this.keyWord))
            {
                this.keyWord = HttpUtility.UrlDecode(HttpUtility.UrlDecode(this.keyWord)).Trim();
            }
            this.rptArticles   = (WapTemplatedRepeater)this.FindControl("rptArticles");
            this.txtTotalPages = (HtmlInputHidden)this.FindControl("txtTotal");
            int pageIndex = default(int);

            if (!int.TryParse(this.Page.Request.QueryString["page"], out pageIndex))
            {
                pageIndex = 1;
            }
            int pageSize = default(int);

            if (!int.TryParse(this.Page.Request.QueryString["size"], out pageSize))
            {
                pageSize = 20;
            }
            SiteSettings siteSettings = HiContext.Current.SiteSettings;

            this.hdAppId.Value = siteSettings.WeixinAppId;
            ArticleQuery articleQuery = new ArticleQuery();

            this.hdDesc.Value   = siteSettings.SiteDescription;
            this.hdTitle.Value  = siteSettings.SiteName;
            this.hdLink.Value   = Globals.FullPath(HttpContext.Current.Request.Url.ToString());
            this.hdImgUrl.Value = Globals.FullPath(siteSettings.LogoUrl);
            if (!string.IsNullOrEmpty(this.Page.Request.QueryString["CategoryId"]))
            {
                int value = 0;
                if (int.TryParse(this.Page.Request.QueryString["CategoryId"], out value))
                {
                    ArticleCategoryInfo articleCategory = CommentBrowser.GetArticleCategory(value);
                    if (articleCategory != null)
                    {
                        this.hdDesc.Value   = (string.IsNullOrEmpty(articleCategory.Description) ? articleCategory.Description : articleCategory.Name);
                        this.hdImgUrl.Value = (string.IsNullOrEmpty(articleCategory.IconUrl) ? Globals.FullPath(siteSettings.DefaultProductImage) : (articleCategory.IconUrl.Contains("http://") ? articleCategory.IconUrl : ("http://" + HttpContext.Current.Request.Url.Host + articleCategory.IconUrl)));
                        this.hdTitle.Value  = articleCategory.Name;
                        PageTitle.AddSiteNameTitle(articleCategory.Name + "-文章列表");
                        articleQuery.CategoryId    = value;
                        this.txtCategoryId.Value   = value.ToString();
                        this.txtCategoryName.Value = articleCategory.Name;
                    }
                    else
                    {
                        PageTitle.AddSiteNameTitle("文章列表");
                    }
                }
            }
            articleQuery.Keywords  = this.keyWord;
            articleQuery.PageIndex = pageIndex;
            articleQuery.PageSize  = pageSize;
            articleQuery.SortBy    = "AddedDate";
            articleQuery.SortOrder = SortAction.Desc;
            articleQuery.IsRelease = true;
            int           num         = 0;
            DbQueryResult articleList = CommentBrowser.GetArticleList(articleQuery);

            this.rptArticles.DataSource = articleList.Data;
            this.rptArticles.DataBind();
            num = articleList.TotalRecords;
            this.txtTotalPages.SetWhenIsNotNull(num.ToString());
            IList <ArticleCategoryInfo> articleMainCategories = CommentBrowser.GetArticleMainCategories();

            this.rptArticleCategorys.DataSource = articleMainCategories;
            this.rptArticleCategorys.DataBind();
        }
Exemplo n.º 10
0
        protected void Restore()
        {
            TplCfgInfo tplCfgById = VShopHelper.GetTplCfgById(this.id);

            this.txtBannerDesc.Text    = tplCfgById.ShortDesc;
            this.ddlType.SelectedValue = tplCfgById.LocationType.ToString();
            this.littlepic.Src         = tplCfgById.ImageUrl;
            this.fmSrc.Value           = tplCfgById.ImageUrl;
            switch (tplCfgById.LocationType)
            {
            case EcShop.Entities.VShop.LocationType.Home:
            case EcShop.Entities.VShop.LocationType.Category:
            case EcShop.Entities.VShop.LocationType.ShoppingCart:
            case EcShop.Entities.VShop.LocationType.OrderCenter:
            case EcShop.Entities.VShop.LocationType.VipCard:
            case EcShop.Entities.VShop.LocationType.GroupBuy:
            case EcShop.Entities.VShop.LocationType.Brand:
                break;

            case EcShop.Entities.VShop.LocationType.Link:
                this.Tburl.Text = tplCfgById.Url;
                this.Tburl.Attributes.CssStyle.Remove("display");
                return;

            case EcShop.Entities.VShop.LocationType.Phone:
                this.Tburl.Text = tplCfgById.Url;
                this.Tburl.Attributes.CssStyle.Remove("display");
                return;

            case EcShop.Entities.VShop.LocationType.Address:
                this.Tburl.Attributes.CssStyle.Remove("display");
                this.navigateDesc.Attributes.CssStyle.Remove("display");
                this.Tburl.Text = tplCfgById.Url;
                return;

            case EcShop.Entities.VShop.LocationType.Article:
            {
                this.ddlSubType.Attributes.CssStyle.Remove("display");
                System.Collections.Generic.IList <ArticleCategoryInfo> articleMainCategories = CommentBrowser.GetArticleMainCategories();
                this.ddlSubType.Items.Clear();
                int num  = 0;
                int num2 = 0;
                if (!string.IsNullOrEmpty(tplCfgById.Url))
                {
                    int num3 = tplCfgById.Url.LastIndexOf('=');
                    int.TryParse(tplCfgById.Url.Substring(num3 + 1), out num);
                }
                if (num > 0)
                {
                    ArticleInfo article = CommentBrowser.GetArticle(num);
                    if (article != null)
                    {
                        num2 = article.CategoryId;
                    }
                }
                if (articleMainCategories != null && articleMainCategories.Count > 0)
                {
                    foreach (ArticleCategoryInfo current in articleMainCategories)
                    {
                        this.ddlSubType.Items.Add(new System.Web.UI.WebControls.ListItem(current.Name, current.CategoryId.ToString()));
                    }
                    if (num2 > 0)
                    {
                        this.ddlSubType.SelectedValue = num2.ToString();
                    }
                }
                if (num > 0)
                {
                    this.ddlThridType.Attributes.CssStyle.Remove("display");
                    System.Collections.Generic.IList <ArticleInfo> articleList = CommentBrowser.GetArticleList(num2, 1000);
                    foreach (ArticleInfo current2 in articleList)
                    {
                        this.ddlThridType.Items.Add(new System.Web.UI.WebControls.ListItem(current2.Title, current2.ArticleId.ToString()));
                    }
                    this.ddlThridType.SelectedValue = num.ToString();
                }
                break;
            }

            default:
                return;
            }
        }
Exemplo n.º 11
0
 private System.Collections.Generic.IList <ArticleCategoryInfo> GetDataSource()
 {
     return(CommentBrowser.GetArticleMainCategories());
 }
Exemplo n.º 12
0
        protected override void AttachChildControls()
        {
            this.rptArticleCategorys = (AppshopTemplatedRepeater)this.FindControl("rpt_ArticleCategory");
            int.TryParse(this.Page.Request.QueryString["categoryId"], out this.categoryId);
            this.txtCategoryName = (HtmlInputHidden)this.FindControl("txtCategoryName");
            this.txtCategoryId   = (HtmlInputHidden)this.FindControl("txtCategoryId");
            this.keyWord         = this.Page.Request.QueryString["keyWord"];
            if (!string.IsNullOrWhiteSpace(this.keyWord))
            {
                this.keyWord = this.keyWord.Trim();
            }
            this.rptArticles   = (AppshopTemplatedRepeater)this.FindControl("rptArticles");
            this.txtTotalPages = (HtmlInputHidden)this.FindControl("txtTotal");
            int pageIndex = default(int);

            if (!int.TryParse(this.Page.Request.QueryString["page"], out pageIndex))
            {
                pageIndex = 1;
            }
            int pageSize = default(int);

            if (!int.TryParse(this.Page.Request.QueryString["size"], out pageSize))
            {
                pageSize = 20;
            }
            ArticleQuery articleQuery = new ArticleQuery();

            if (!string.IsNullOrEmpty(this.Page.Request.QueryString["CategoryId"]))
            {
                int value = 0;
                if (int.TryParse(this.Page.Request.QueryString["CategoryId"], out value))
                {
                    ArticleCategoryInfo articleCategory = CommentBrowser.GetArticleCategory(value);
                    if (articleCategory != null)
                    {
                        PageTitle.AddSiteNameTitle(articleCategory.Name);
                        articleQuery.CategoryId    = value;
                        this.txtCategoryId.Value   = value.ToString();
                        this.txtCategoryName.Value = articleCategory.Name;
                    }
                    else
                    {
                        PageTitle.AddSiteNameTitle("文章分类搜索页");
                    }
                }
            }
            articleQuery.Keywords  = this.keyWord;
            articleQuery.PageIndex = pageIndex;
            articleQuery.PageSize  = pageSize;
            articleQuery.SortBy    = "AddedDate";
            articleQuery.SortOrder = SortAction.Desc;
            articleQuery.IsRelease = true;
            int           num         = 0;
            DbQueryResult articleList = CommentBrowser.GetArticleList(articleQuery);

            this.rptArticles.DataSource = articleList.Data;
            this.rptArticles.DataBind();
            num = articleList.TotalRecords;
            this.txtTotalPages.SetWhenIsNotNull(num.ToString());
            IList <ArticleCategoryInfo> articleMainCategories = CommentBrowser.GetArticleMainCategories();

            this.rptArticleCategorys.DataSource = articleMainCategories;
            this.rptArticleCategorys.DataBind();
        }
Exemplo n.º 13
0
        public void ProcessRequest(HttpContext context)
        {
            string text = context.Request["actionName"];
            string s    = string.Empty;
            int    num;

            switch (text)
            {
            case "Topic":
            {
                IList <TopicInfo> appTopics = VShopHelper.GetAppTopics();
                s = JsonConvert.SerializeObject(appTopics);
                break;
            }

            case "Vote":
            {
                DataTable value4 = VshopBrowser.GetVoteByIsShowWX().Tables[0];
                s = JsonConvert.SerializeObject(value4);
                break;
            }

            case "Category":
            {
                var value = from item in CatalogHelper.GetMainCategories()
                            select new
                {
                    CateId   = item.CategoryId,
                    CateName = item.Name
                };
                s = JsonConvert.SerializeObject(value);
                break;
            }

            case "Activity":
            {
                string a      = context.Request["client"].ToNullString().ToLower();
                Array  values = Enum.GetValues(typeof(LotteryActivityType));
                if (a == "app")
                {
                    values = Enum.GetValues(typeof(AppLotteryActivityType));
                }
                List <EnumJson> list2 = new List <EnumJson>();
                foreach (Enum item in values)
                {
                    EnumJson enumJson3 = new EnumJson();
                    enumJson3.Name  = item.ToShowText();
                    enumJson3.Value = item.ToString();
                    list2.Add(enumJson3);
                }
                s = JsonConvert.SerializeObject(list2);
                break;
            }

            case "ActivityList":
            {
                string value2 = context.Request.Form["acttype"];
                LotteryActivityType lotteryActivityType = (LotteryActivityType)Enum.Parse(typeof(LotteryActivityType), value2);
                if (lotteryActivityType == LotteryActivityType.SignUp)
                {
                    var value3 = from item in VShopHelper.GetAllActivity()
                                 select new
                    {
                        ActivityId   = item.ActivityId,
                        ActivityName = item.Name
                    };
                    s = JsonConvert.SerializeObject(value3);
                }
                else
                {
                    IList <LotteryActivityInfo> lotteryActivityByType = VShopHelper.GetLotteryActivityByType(lotteryActivityType);
                    s = JsonConvert.SerializeObject(lotteryActivityByType);
                }
                break;
            }

            case "ArticleCategory":
            {
                IList <ArticleCategoryInfo> articleMainCategories = CommentBrowser.GetArticleMainCategories();
                if (articleMainCategories != null && articleMainCategories.Count > 0)
                {
                    List <EnumJson> list3 = new List <EnumJson>();
                    foreach (ArticleCategoryInfo item2 in articleMainCategories)
                    {
                        EnumJson enumJson4 = new EnumJson();
                        enumJson4.Name = item2.Name;
                        EnumJson enumJson5 = enumJson4;
                        num             = item2.CategoryId;
                        enumJson5.Value = num.ToString();
                        list3.Add(enumJson4);
                    }
                    s = JsonConvert.SerializeObject(list3);
                }
                break;
            }

            case "ArticleList":
            {
                int categoryId = 0;
                if (context.Request.Form["categoryId"] != null)
                {
                    int.TryParse(context.Request.Form["categoryId"].ToString(), out categoryId);
                }
                IList <ArticleInfo> articleList = CommentBrowser.GetArticleList(categoryId, 1000);
                List <EnumJson>     list        = new List <EnumJson>();
                foreach (ArticleInfo item3 in articleList)
                {
                    EnumJson enumJson = new EnumJson();
                    enumJson.Name = item3.Title;
                    EnumJson enumJson2 = enumJson;
                    num             = item3.ArticleId;
                    enumJson2.Value = num.ToString();
                    list.Add(enumJson);
                }
                s = JsonConvert.SerializeObject(list);
                break;
            }
            }
            context.Response.Write(s);
        }