コード例 #1
0
        //赋值
        private void ShowInfo()
        {
            BLL.channel bll = new BLL.channel();
            DataTable   dt  = bll.GetList(0, "", "sort_id asc,id desc").Tables[0];

            if (dt.Rows.Count > 0)
            {
                BLL.luceneconfig xml = new BLL.luceneconfig();
                foreach (DataRow dr in dt.Rows)
                {
                    CheckBox cbControl   = FindControl("control_checkbox_" + dr["id"].ToString()) as CheckBox;
                    TextBox  txtLastId   = FindControl("control_lastid_" + dr["id"].ToString()) as TextBox;
                    TextBox  txtLastTime = FindControl("control_lasttime_" + dr["id"].ToString()) as TextBox;
                    if (null != cbControl && null != txtLastId && null != txtLastTime)
                    {
                        string status = xml.GetText("Lucene/" + dr["name"].ToString() + "/status");

                        if (status == "1")
                        {
                            cbControl.Checked = true;

                            txtLastId.Text   = xml.GetText("Lucene/" + dr["name"].ToString() + "/lastid");
                            txtLastTime.Text = xml.GetText("Lucene/" + dr["name"].ToString() + "/lasttime");
                        }
                    }
                }
            }
        }
コード例 #2
0
ファイル: channel.cs プロジェクト: yi724926089/MyWx
 /// <summary>
 /// 返回频道列表
 /// </summary>
 /// <param name="category_id">频道类别ID</param>
 /// <returns>DataTable</returns>
 protected DataTable get_channel_list(int categoryid)
 {
     DataTable dt = new DataTable();
     BLL.channel bll = new BLL.channel();
     dt = bll.GetList(0, "category_id=" + categoryid, "sort_id asc,id desc").Tables[0];
     return dt;
 }
コード例 #3
0
        //
        private List <Model.luceneconfig> GetDicValues()
        {
            List <Model.luceneconfig> list = new List <Model.luceneconfig>();

            BLL.channel bll = new BLL.channel();
            DataTable   dt  = bll.GetList(0, "", "sort_id asc,id desc").Tables[0];

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    HiddenField hidControl  = FindControl("control_hide_" + dr["id"].ToString()) as HiddenField;
                    CheckBox    cbControl   = FindControl("control_checkbox_" + dr["id"].ToString()) as CheckBox;
                    TextBox     txtLastId   = FindControl("control_lastid_" + dr["id"].ToString()) as TextBox;
                    TextBox     txtLastTime = FindControl("control_lasttime_" + dr["id"].ToString()) as TextBox;
                    //添加
                    Model.luceneconfig model = new Model.luceneconfig();
                    model.id     = Utils.StrToInt(txtLastId.Text.Trim(), 0);
                    model.name   = hidControl.Value;
                    model.status = cbControl.Checked == true ? 1 : 0;
                    string time = txtLastTime.Text.Trim();
                    if (null != time && time.Length > 0)
                    {
                        DateTime t;
                        if (DateTime.TryParse(time, out t))
                        {
                            model.update = t;
                        }
                    }
                    list.Add(model);
                }
            }
            return(list);
        }
コード例 #4
0
        //绑定频道
        private void CreateChannelBind()
        {
            BLL.channel bll = new BLL.channel();
            DataTable   dt  = bll.GetList(0, "", "sort_id asc,id desc").Tables[0];

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    //创建行
                    HtmlGenericControl htmlTR = new HtmlGenericControl("tr");

                    //创建单元格1
                    HtmlGenericControl htmlTD1 = new HtmlGenericControl("td");
                    htmlTD1.InnerHtml = dr["title"].ToString();
                    htmlTR.Controls.Add(htmlTD1);

                    //创建单元格2
                    HtmlGenericControl htmlTD2 = new HtmlGenericControl("td");

                    //Name
                    HiddenField hidControl1 = new HiddenField();
                    hidControl1.ID    = "control_hide_" + dr["id"].ToString();
                    hidControl1.Value = dr["name"].ToString();
                    htmlTD2.Controls.Add(hidControl1);
                    htmlTR.Controls.Add(htmlTD2);

                    CheckBox cbControl = new CheckBox();
                    cbControl.ID = "control_checkbox_" + dr["id"].ToString();
                    HtmlGenericControl htmlDiv1 = new HtmlGenericControl("div");
                    htmlDiv1.Attributes.Add("class", "rule-single-checkbox");
                    htmlDiv1.Controls.Add(cbControl);
                    htmlTD2.Controls.Add(htmlDiv1);
                    htmlTR.Controls.Add(htmlTD2);

                    //创建单元格3
                    HtmlGenericControl htmlTD3    = new HtmlGenericControl("td");
                    TextBox            txtControl = new TextBox();
                    txtControl.ID       = "control_lastid_" + dr["id"].ToString();
                    txtControl.CssClass = "input small";
                    txtControl.Text     = "0";
                    txtControl.ReadOnly = true;
                    htmlTD3.Controls.Add(txtControl);
                    htmlTR.Controls.Add(htmlTD3);

                    //创建单元格4
                    HtmlGenericControl htmlTD4     = new HtmlGenericControl("td");
                    TextBox            txtControl2 = new TextBox();
                    txtControl2.ID       = "control_lasttime_" + dr["id"].ToString();
                    txtControl2.CssClass = "input normal";
                    txtControl2.ReadOnly = true;
                    htmlTD4.Controls.Add(txtControl2);
                    htmlTR.Controls.Add(htmlTD4);

                    //将TR到TABLE
                    ChannelPannel.Controls.Add(htmlTR);
                }
            }
        }
コード例 #5
0
        /// <summary>
        /// 返回频道列表
        /// </summary>
        /// <param name="category_id">频道类别ID</param>
        /// <returns>DataTable</returns>
        protected DataTable get_channel_list(int categoryid)
        {
            DataTable dt = new DataTable();

            BLL.channel bll = new BLL.channel();
            dt = bll.GetList(0, "category_id=" + categoryid, "sort_id asc,id desc").Tables[0];
            return(dt);
        }
コード例 #6
0
        private void RptBind(int _site_id)
        {
            BLL.channel bll = new BLL.channel();
            DataTable   dt  = bll.GetList(0, "site_id=" + _site_id, "sort_id asc,id desc").Tables[0];

            this.rptList.DataSource = dt;
            this.rptList.DataBind();
        }
コード例 #7
0
        private void BindItemChannel()
        {
            BLL.channel bll = new BLL.channel();
            DataTable   dt  = bll.GetList(0, "", "sort_id asc,id desc").Tables[0];

            this.rblItemChannel.Items.Clear();
            foreach (DataRow dr in dt.Rows)
            {
                this.rblItemChannel.Items.Add(new ListItem(dr["title"].ToString(), dr["id"].ToString()));
            }
        }
コード例 #8
0
        private void TreeBind()
        {
            BLL.channel bll = new BLL.channel();
            DataTable dt = bll.GetList(0, "", "sort_id asc,id desc").Tables[0];

            this.ddlChannel.Items.Clear();
            this.ddlChannel.Items.Add(new ListItem("不属于频道", ""));
            foreach (DataRow dr in dt.Rows)
            {
                this.ddlChannel.Items.Add(new ListItem(dr["title"].ToString(), dr["name"].ToString()));
            }
        }
コード例 #9
0
        private void RptBind(string _strWhere, string _orderby)
        {
            this.page = MXRequest.GetQueryInt("page", 1);
            ddlCategoryId.SelectedValue = this.category_id.ToString();
            txtKeywords.Text = this.keywords;
            BLL.channel bll = new BLL.channel();
            this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);
            this.rptList.DataBind();

            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("channel_list.aspx", "category_id={0}&keywords={1}&page={2}", this.category_id.ToString(), this.keywords, "__id__");
            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
コード例 #10
0
ファイル: builder_html.aspx.cs プロジェクト: zhanglg40/SANKE
 //嵌套绑定
 protected void rptList_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     BLL.channel bll = new BLL.channel();
     if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
     {
         Repeater rptChannel = (Repeater)e.Item.FindControl("rptChannel");
         //找到分类Repeater关联的数据项
         DataRowView drv = (DataRowView)e.Item.DataItem;
         //提取分类ID
         int categoryId = Convert.ToInt32(drv["id"]);
         //根据分类ID查询并绑定所属频道
         rptChannel.DataSource = bll.GetList(0, "category_id=" + categoryId, "sort_id asc,id desc");
         rptChannel.DataBind();
     }
 }
コード例 #11
0
        private void RptBind(string _strWhere, string _orderby)
        {
            this.page = PLRequest.GetQueryInt("page", 1);
            ddlSiteId.SelectedValue = this.site_id.ToString();
            txtKeywords.Text        = this.keywords;
            BLL.channel bll = new BLL.channel();
            this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);
            this.rptList.DataBind();

            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("channel_list.aspx", "site_id={0}&keywords={1}&page={2}", this.site_id.ToString(), this.keywords, "__id__");

            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
コード例 #12
0
ファイル: builder_html.aspx.cs プロジェクト: yi724926089/MyWx
 //嵌套绑定
 protected void rptList_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     BLL.channel bll = new BLL.channel();
     if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
     {
         Repeater rptChannel = (Repeater)e.Item.FindControl("rptChannel");
         //找到分类Repeater关联的数据项
         DataRowView drv = (DataRowView)e.Item.DataItem;
         //提取分类ID
         int categoryId = Convert.ToInt32(drv["id"]);
         //根据分类ID查询并绑定所属频道
         rptChannel.DataSource = bll.GetList(0, "category_id=" + categoryId, "sort_id asc,id desc");
         rptChannel.DataBind();
     }
 }