Пример #1
0
        // 绑定技能、培训课件ListView(嵌套)
        protected void TabIndex1Box_ItemDataBound(object sender, ListViewItemEventArgs e)
        {
            Label     CategoryAliasLabel = (Label)e.Item.FindControl("SkillCategoryAlias");
            string    CategoryAlias      = CategoryAliasLabel.Text.ToString();
            DataTable ListDataTable      = new DataTable();
            string    CategoryGUID       = DataQuery.CategoryAliasToID(CategoryAlias);

            //ListDataTable = new DAL.Article().GetArticleListAll(CategoryGUID, false, "desc" , true, 16);  //ALL
            ListDataTable = new DAL.Article().GetArticleList(CategoryGUID, false, 16);
            if (ListDataTable.Rows.Count > 0)
            {
                var ListInfo = from row in ListDataTable.AsEnumerable()
                               select row;
                var       LeftInfoSrc   = ListInfo.Take(8);
                var       RightInfoSrc  = ListInfo.Skip(8).Take(8);
                DataTable LeftInfo      = LeftInfoSrc.CopyToDataTable <DataRow>();
                ListView  SkillListLeft = (ListView)e.Item.FindControl("TabUlLeft");
                SkillListLeft.DataSource = LeftInfo;
                SkillListLeft.DataBind();
                if (ListDataTable.Rows.Count > 8)
                {
                    DataTable RightInfo      = RightInfoSrc.CopyToDataTable <DataRow>();
                    ListView  SkillListRight = (ListView)e.Item.FindControl("TabUlRight");
                    SkillListRight.DataSource = RightInfo;
                    SkillListRight.DataBind();
                }
            }
        }
Пример #2
0
        public HomeChannelListBS(string Alias, int PicNumber)
        {
            string    guid      = DataQuery.CategoryAliasToID(Alias);
            DataTable ListTable = new DAL.Article().GetArticleList(guid, false, PicNumber);

            if (ListTable.Rows.Count > 0)
            {
                var ListInfo = from row in ListTable.AsEnumerable()
                               select row;
                var PicInfoSrc = ListInfo.Take(PicNumber);
                PicInfo = PicInfoSrc.CopyToDataTable <DataRow>();
            }
        }
Пример #3
0
        public CategoryLv2List(string Alias, int PicNumber, int TextNumber)
        {
            DataTable ListTable = new DataTable();
            string    Guid      = DataQuery.CategoryAliasToID(Alias);
            int       count     = PicNumber + TextNumber;

            ListTable = new DAL.Article().GetArticleList(Guid, false, count);
            if (ListTable.Rows.Count > 0)
            {
                var ListInfo = from row in ListTable.AsEnumerable()
                               select row;
                var PicInfoSrc = ListInfo.Take(PicNumber);
                PicInfo = PicInfoSrc.CopyToDataTable <DataRow>();
                if (TextNumber != 0)
                {
                    var TextInfoLSrc = ListInfo.Skip(PicNumber).Take(TextNumber);
                    TextInfo = TextInfoLSrc.CopyToDataTable <DataRow>();
                }
            }
        }
Пример #4
0
        public HomeChannelListB(string Alias, int PicNumber, int TextNumber)
        {
            Alias = DataQuery.GetChannelAliasByName(Alias, "栏目");
            DataTable ListTable = new DataTable();
            string    Guid      = DataQuery.CategoryAliasToID(Alias);

            ListTable = new DAL.Article().GetArticleList(Guid, false, 11);
            if (ListTable.Rows.Count > 0)
            {
                //PicInfo = from row in ListTable.AsEnumerable() where Convert.ToInt32(row["_RowNumber"]) > 0 && Convert.ToInt32(row["_RowNumber]"]) <= 5 select row;
                var ListInfo = from row in ListTable.AsEnumerable()
                               select row;
                var PicInfoSrc = ListInfo.Take(PicNumber);
                PicInfo = PicInfoSrc.CopyToDataTable <DataRow>();
                if (TextNumber != 0)
                {
                    var TextInfoLSrc = ListInfo.Skip(PicNumber).Take(TextNumber);
                    TextInfo = TextInfoLSrc.CopyToDataTable <DataRow>();
                }
            }
        }
Пример #5
0
        public HomeChannelListA(string Alias)
        {
            Alias        = DataQuery.GetChannelAliasByName(Alias, "栏目");
            SubSortTable = DataQuery.GetSubCategories(Alias, "4");
            DataTable ListTable = new DataTable();
            string    Guid      = DataQuery.CategoryAliasToID(Alias);

            //ListTable = DataQuery.GetArticleIndexList(Guid, "11", "desc");
            ListTable = new DAL.Article().GetArticleList(Guid, false, 11);
            if (ListTable.Rows.Count > 0)
            {
                //PicInfo = from row in ListTable.AsEnumerable() where Convert.ToInt32(row["_RowNumber"]) > 0 && Convert.ToInt32(row["_RowNumber]"]) <= 5 select row;
                var ListInfo = from row in ListTable.AsEnumerable()
                               select row;
                var PicInfoSrc   = ListInfo.Take(5);
                var TextInfoLSrc = ListInfo.Skip(5).Take(3);
                var TextInfoRSrc = ListInfo.Skip(8).Take(3);
                PicInfo   = PicInfoSrc.CopyToDataTable <DataRow>();
                TextInfoL = TextInfoLSrc.CopyToDataTable <DataRow>();
                TextInfoR = TextInfoRSrc.CopyToDataTable <DataRow>();
            }
        }
Пример #6
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            //context.Response.Write("Hello World");

            //Request
            StreamReader sr     = new StreamReader(HttpContext.Current.Request.InputStream);
            string       strReq = sr.ReadToEnd();

            //Test
            //JObject Req = new JObject(
            //          new JProperty("ChannelAlias", "gxchannel1")
            //         );
            //string strReq = Req.ToString();


            #region Level2FocusPic
            if (HttpContext.Current.Request["method"] == "level2focuspic")
            {
                string    PicPath      = "";
                JObject   o            = JObject.Parse(strReq);
                string    ChannelAlias = (string)o["ChannelAlias"];
                String    GuideAlias   = DataQuery.GetChannelAliasByName(ChannelAlias, "导视");
                String    GuideGuid    = DataQuery.CategoryAliasToID(GuideAlias);
                DataTable GuideCourses = new DAL.Article().GetArticleList(GuideGuid, true, 5);
                JObject   rss          = new JObject();
                rss = new JObject(
                    //new JProperty("method", "mytask")
                    );
                JObject JCourse =
                    new JObject(
                        new JProperty("Course",
                                      new JArray(
                                          from cc in GuideCourses.AsEnumerable()
                                          orderby cc["XIndexTime"] descending
                                          select new JObject(
                                              //new JProperty("CustomProjectId", oc.CustomProjectId),
                                              //new JProperty("CustomProjectNo", oc.No),
                                              //new JProperty("Title", oc.Title),
                                              //new JProperty("SendingDate", oc.SendingDate.ToString("D")),
                                              //new JProperty("Lecturer", oc.Lecturer),
                                              //new JProperty("ProgressText", oc.ProgressText)
                                              from col in cc.Table.Columns.Cast <DataColumn>()
                                              select new JProperty(
                                                  col.ColumnName, cc[col.Ordinal].ToString()
                                                  ),
                                              new JProperty("Url", GetUrl(cc["ArticleGUID"].ToString(), out PicPath)),
                                              new JProperty("PicPath", PicPath)
                                              )
                                          )
                                      )
                        );
                rss.Merge(JCourse, new JsonMergeSettings
                {
                    MergeArrayHandling = MergeArrayHandling.Concat
                }
                          );
                context.Response.Write(rss.ToString());
            }
            #endregion Level2FocusPic
        }