// 使用多线程读取产品列表,以防止读取产品列表的速度影响窗口显示的速度 private void BindGoodsList() { this.dgvGoodsList.Rows.Clear(); VipSoft.BLL.Goods goods = new VipSoft.BLL.Goods(); DataSet dtGoods = goods.GetList(" GoodsType=0 and ShopID="+PublicState.Master.ShopID + condtion); foreach (DataRow dr in dtGoods.Tables[0].Rows) { this.dgvGoodsList.Rows.Add(dr["ID"], dr["GoodsCode"], dr["Name"], dr["Unit"], dr["BuyPrice"], dr["Number"]); } this.label_Tree_load.Visible = false; condtion = ""; }
/// <summary> /// 绑定商品树 /// </summary> private void BindGoodsTreeThread() { Thread.Sleep(50); //延时100毫秒 VipSoft.BLL.GoodsClass goodsC = new VipSoft.BLL.GoodsClass(); VipSoft.BLL.Goods goods = new VipSoft.BLL.Goods(); string where = "ShopID="+PublicState.Master.ID; DataTable dtClass = goodsC.GetList(where).Tables[0]; DataTable dtGoods = goods.GetList(where).Tables[0]; ExpenseGoodsTreeShowHandler goodsTreeHandler = new ExpenseGoodsTreeShowHandler(BindGoodsTreeInvoke); this.BeginInvoke(goodsTreeHandler, dtClass, dtGoods); }