private void btnQuery_Click(object sender, EventArgs e)
        {
            try
            {
                Goods goods = new Goods();
                goods.St = ST.VALID;
                short subCatgID  = StringUtil.Obj2Short(cboxCatg.SelectedValue);
                int   supplierId = 0;
                if (cboxSupplier.SelectedIndex != -1)
                {
                    supplierId = StringUtil.Obj2Int(cboxSupplier.SelectedValue);
                }
                goods.SubCatgID = subCatgID;
                List <GoodsVO> data = goodsManager.LoadData(goods, page, supplierId);
                if (null != data && data.Count > 0)
                {
                    dtgvMGoods.DataSource = null;
                    dtgvMGoods.DataSource = data;
                }
                else
                {
                    dtgvMGoods.DataSource = null;
                }

                if (goodsMap.Count > 0)
                {
                    foreach (DataGridViewRow row in dtgvMGoods.Rows)
                    {
                        int gid = StringUtil.Obj2Int(row.Cells[colGId.Name].Value);
                        if (goodsMap.ContainsKey(gid))
                        {
                            row.Cells[colCkboxs.Name].Value = "true";
                        }
                    }
                }
            }
            catch
            {
                MainForm.Error("系统异常!");
            }
        }
Beispiel #2
0
 private void BindData()
 {
     try
     {
         if (cboxCatg.SelectedIndex == -1)
         {
             return;
         }
         Goods goods = new Goods();
         goods.GName = txtGName.Text.Trim();
         goods.St    = cboxSt.SelectedValue.ToString();
         short subCatgID = StringUtil.Obj2Short(cboxCatg.SelectedValue);
         goods.SubCatgID = subCatgID;
         if (string.Empty != txtGId.Text.Trim())
         {
             goods.GID__PK = int.Parse(txtGId.Text.Trim());
         }
         List <GoodsVO> data = manager.LoadData(goods, page);
         if (null != data && data.Count > 0)
         {
             dtgvMGoods.DataSource = null;
             dtgvMGoods.DataSource = data;
         }
         else
         {
             dtgvMGoods.DataSource = null;
         }
         dgvPager.TotalPageNum = page.TotalPage;
         dgvPager.TotalNum     = page.TotalNum;
         dgvPager.ShowPageInfo();
     }
     catch
     {
         MainForm.Error("系统异常!");
     }
 }