Ejemplo n.º 1
0
 public void DanhSachMonAnBanChay()
 {
     tblTableMonAn.Controls.Clear();
     if (txtTimKiem.Text == "")
     {
         DataTable db = BUS_HangHoa.DSHangHoa_Full(frmDangNhap.NguoiDung.Idchinhanh);
         if (db.Rows.Count > 0)
         {
             foreach (DataRow dr in db.Rows)
             {
                 SimpleButton btn = new SimpleButton();
                 btn.Width  = 108;
                 btn.Height = 60;
                 btn.Appearance.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap;
                 btn.Text            = dr["TenHangHoa"].ToString();
                 btn.Click          += btn_Click;
                 btn.KeyDown        += btn_KeyDown;
                 btn.Tag             = dr["ID"].ToString();
                 btn.Appearance.Font = new Font("Tahoma", 11);
                 btn.ForeColor       = Color.Black;
                 btn.StyleController = null;
                 btn.LookAndFeel.UseDefaultLookAndFeel = false;
                 tblTableMonAn.Controls.Add(btn);
             }
         }
     }
     else
     {
         DataTable db = BUS_HangHoa.DSHangHoaTimKiem(txtTimKiem.Text.ToString(), frmDangNhap.NguoiDung.Idchinhanh);
         if (db.Rows.Count > 0)
         {
             foreach (DataRow dr in db.Rows)
             {
                 SimpleButton btn = new SimpleButton();
                 btn.Width  = 108;
                 btn.Height = 60;
                 btn.Appearance.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap;
                 btn.Text            = dr["TenHangHoa"].ToString();
                 btn.Click          += btn_Click;
                 btn.KeyDown        += btn_KeyDown;
                 btn.Tag             = dr["ID"].ToString();
                 btn.Appearance.Font = new Font("Tahoma", 11);
                 btn.ForeColor       = Color.Black;
                 btn.StyleController = null;
                 btn.LookAndFeel.UseDefaultLookAndFeel = false;
                 tblTableMonAn.Controls.Add(btn);
             }
         }
     }
 }