Beispiel #1
0
        protected void btndel_Click(object sender, EventArgs e)
        {
            int    i     = 0;
            string sysID = string.Empty;

            NCPEP.Bll.T_XMGG bll = new NCPEP.Bll.T_XMGG();

            foreach (RepeaterItem row in this.rep.Items)
            {
                if (row.ItemType == ListItemType.Item || row.ItemType == ListItemType.AlternatingItem)
                {
                    CheckBox chk  = (CheckBox)row.FindControl("cbx");
                    Label    lbid = (Label)row.FindControl("lbid");
                    if (chk.Checked)
                    {
                        i++;
                        sysID = lbid.Text;
                        bll.Delete(int.Parse(sysID));
                    }
                }
            }
            if (i == 0)
            {
                MessageBox.Show(this, "请选择需要删除的项!");
            }
            else
            {
                MessageBox.Show(this, "已成功删除所选项!");
                BindDate();
            }
        }
Beispiel #2
0
        protected void btnquxiao_Click(object sender, EventArgs e)
        {
            int    i     = 0;
            string sysID = string.Empty;

            foreach (RepeaterItem row in this.rep.Items)
            {
                if (row.ItemType == ListItemType.Item || row.ItemType == ListItemType.AlternatingItem)
                {
                    CheckBox chk  = (CheckBox)row.FindControl("cbx");
                    Label    lbid = (Label)row.FindControl("lbid");
                    if (chk.Checked)
                    {
                        i++;
                        sysID = lbid.Text;
                    }
                }
            }
            if (i == 0)
            {
                MessageBox.Show(this, "请选择需要查看的项!");
            }
            else if (i > 1)
            {
                MessageBox.Show(this, "只能选择一项进行操作");
            }
            else
            {
                NCPEP.Bll.T_XMGG   bll   = new NCPEP.Bll.T_XMGG();
                NCPEP.Model.T_XMGG model = new NCPEP.Model.T_XMGG();
                model = bll.GetModel(int.Parse(sysID));
                if (model != null)
                {
                    model.xmby = "0";


                    if (bll.Update(model))
                    {
                        MessageBox.Show(this, "取消成功!");
                        BindDate();
                    }
                }
            }
        }
Beispiel #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Request.QueryString["id"] != null)
         {
             NCPEP.Model.T_XMGG model = new NCPEP.Model.T_XMGG();
             NCPEP.Bll.T_XMGG   bll   = new NCPEP.Bll.T_XMGG();
             model = bll.GetModel(int.Parse(Request.QueryString["id"]));
             if (model != null)
             {
                 this.lbxmmc.Text = model.bid.ToString();
                 NCPEP.Model.T_Bid modelb = new NCPEP.Model.T_Bid();
                 NCPEP.Bll.T_Bid   bllb   = new NCPEP.Bll.T_Bid();
                 modelb                 = bllb.GetModel(model.bid);
                 this.lbxmmc.Text       = modelb.BidName;
                 this.txtNewsTitle.Text = model.xmtitle;
                 this.txtsj.Text        = model.xmsj;
                 this.lbconten.Text     = model.xmneirong;
             }
         }
     }
 }
Beispiel #4
0
        //protected void BindDll()
        //{
        //    NCPEP.Bll.T_NewsType bll = new NCPEP.Bll.T_NewsType();
        //    DataTable dt = bll.GetAllList().Tables[0];
        //    this.ddlxwlx.DataSource = dt;
        //    this.ddlxwlx.DataTextField = "NewsTypeName";
        //    this.ddlxwlx.DataValueField = "Id";
        //    this.ddlxwlx.DataBind();
        //    this.ddlxwlx.Items.Insert(0, new ListItem("请选择"));
        //}
        /// <summary>
        /// 初始绑定数据
        /// </summary>
        private void BindDate()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(" 1=1");
            //if (this.ddlxwlx.SelectedValue != "请选择")
            //{
            //    sb.Append(" and NewsTypeId='" + this.ddlxwlx.SelectedValue + "'");
            //}
            if (!string.IsNullOrEmpty(this.TextBox1.Text))
            {
                sb.Append(" and NewsTitle like '%" + this.TextBox1.Text + "%'");
            }
            //if (this.DropDownList2.SelectedValue != "全部")
            //{
            //    sb.Append(" and IsCheck='" + this.DropDownList2.SelectedValue + "'");
            //}

            NCPEP.Bll.T_XMGG bll = new NCPEP.Bll.T_XMGG();

            this.pg.RecordCount      = bll.GetRecordCount(sb.ToString());
            this.pg.PageSize         = 10;
            this.pg.UrlPageIndexName = "pg";
            if (!string.IsNullOrEmpty(hdpage.Value) && hdpage.Value != "1")
            {
                pg.CurrentPageIndex = int.Parse(hdpage.Value);
            }

            int sindex = (this.pg.CurrentPageIndex - 1) * this.pg.PageSize + 1;
            int eindex = this.pg.CurrentPageIndex * this.pg.PageSize;

            DataSet ds = bll.GetListByPage(sb.ToString(), "id desc", sindex, eindex);

            //DataSet ds = bll.GetList(this.AspNetPager1.PageSize, this.AspNetPager1.CurrentPageIndex, sb.ToString());
            this.rep.DataSource = ds;
            this.rep.DataBind();
        }