/// <summary> /// 绑定Grid /// </summary> protected void BindGrid() { BCheckBillBB checkBillBB = new BCheckBillBB(); DataSet ds = new DataSet(); try { string strWhere = this.StrWhere; #region 组合查询条件 //状态 if (this.ddlType.SelectedValue != "") { strWhere += " and instantState='" + this.ddlType.SelectedValue + "' "; } //1、判断是否有下达日期限制 if (this.ucStartDt.Text != "") { strWhere += " and isrtDt>='" + this.ucStartDt.Text.Replace("'", "''") + "'"; } if (this.ucEndDt.Text != "") { strWhere += " and isrtDt-1<'" + this.ucEndDt.Text.Replace("'", "''") + "'"; } //2、检测单 if (this.checkBillNo.Text.Trim() != "") { strWhere += " and checkBillNo like '%" + this.checkBillNo.Text.Trim().Replace("'", "''") + "%'"; } //3、到货单 if (this.arriveBillNo.Text.Trim() != "") { strWhere += " and arriveBillNo like '%" + this.arriveBillNo.Text.Trim().Replace("'", "''") + "%'"; } //4、采购单 if (this.financeBillNo.Text.Trim() != "") { strWhere += " and financeBillNo like '%" + this.financeBillNo.Text.Trim().Replace("'", "''") + "%'"; } //5、物料 if (this.materialNo.Text.Trim() != "") { strWhere += " and (materialNo like '%" + this.materialNo.Text.Trim().Replace("'", "''") + "%' or materialDesc like '%" + this.materialNo.Text.Trim().Replace("'", "''") + "%')"; } #endregion 组合查询条件 ds = checkBillBB.GetVList(strWhere); //2015-11-04 董利特修改 //因为有重复的数据,不修改接口,增加Distinct功能,进行重复数据的去除 DataTable distinctTable = ds.Tables[0].DefaultView.ToTable(true, "id", "checkBillNo", "arriveBillNo", "financeBillNo", "materialNo", "materialDesc", "checkResult", "isrtDt", "commitDt", "instantStateNm"); this.grid.DataSource = distinctTable; this.grid.DataBind(); //赋值记录条数、页面总数 this.Label3.Text = ds.Tables[0].Rows.Count.ToString(); this.Label2.Text = this.grid.PageCount.ToString(); this.currPage.Text = (this.grid.PageIndex + 1).ToString(); } finally { checkBillBB.Dispose(); } }
/// <summary> /// 绑定Grid /// </summary> protected void BindGrid() { BCheckBillBB checkBillBB = new BCheckBillBB(); DataSet ds = new DataSet(); try { string strWhere = this.StrWhere; #region 组合查询条件 if (this.ddlType.SelectedValue == "") { strWhere += " and (instantState='04' or instantState='05' or instantState='06')"; } else { strWhere += " and instantState='"+this.ddlType.SelectedValue+"' "; } //1、判断是否有下达日期限制 if (this.ucStartDt.Text != "") { strWhere += " and isrtDt>='" + this.ucStartDt.Text.Replace("'", "''") + "'"; } if (this.ucEndDt.Text != "") { strWhere += " and isrtDt-1<'" + this.ucEndDt.Text.Replace("'", "''") + "'"; } //2、检测单 if (this.checkBillNo.Text.Trim() != "") { strWhere += " and checkBillNo like '%" + this.checkBillNo.Text.Trim().Replace("'", "''") + "%'"; } //3、到货单 if (this.arriveBillNo.Text.Trim() != "") { strWhere += " and arriveBillNo like '%" + this.arriveBillNo.Text.Trim().Replace("'", "''") + "%'"; } //4、采购单 if (this.financeBillNo.Text.Trim() != "") { strWhere += " and financeBillNo like '%" + this.financeBillNo.Text.Trim().Replace("'", "''") + "%'"; } //5、物料号 if (this.materialNo.Text.Trim() != "") { strWhere += " and (materialNo like '%" + this.materialNo.Text.Trim().Replace("'", "''") + "%' or materialDesc like '%" + this.materialNo.Text.Trim().Replace("'", "''") + "%')"; } #endregion ds = checkBillBB.GetVList(strWhere); this.grid.DataSource = ds.Tables[0]; this.grid.DataBind(); //赋值记录条数、页面总数 this.Label3.Text = ds.Tables[0].Rows.Count.ToString(); this.Label2.Text = this.grid.PageCount.ToString(); this.currPage.Text = (this.grid.PageIndex + 1).ToString(); } finally { checkBillBB.Dispose(); } }
public DataTable GetCheckBillList() { BCheckBillBB checkBillBB = new BCheckBillBB(); try { DataTable dt = new DataTable(); dt = checkBillBB.GetVList("instantState in ('02','03')").Tables[0]; return dt; } finally { checkBillBB.Dispose(); } }