Example #1
0
 private void cbb_NCC_HH_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyData == Keys.Enter)
     {
         string _cbbName = ((ComboBox)sender).Name;
         if (_cbbName.Contains("HangHoa"))
         {
             DataTable _table = GoodsDAO.Instance.TimHangHoaTheoTen(cbbHangHoa.Text);
             if (_table.Rows.Count == 1)
             {
                 Goods _hangHoa = new Goods(_table.Rows[0]);
                 cbbHangHoa.SelectedValue = _hangHoa.MaHH;
                 this.ActiveControl       = txtSoLuong;
             }
             else
             {
                 FFind _fFind = new FFind(cbbHangHoa.Text, null, this);
                 _fFind.Text = "TÌM HÀNG HÓA";
                 _fFind.ShowDialog();
             }
         }
         else if (_cbbName.Contains("NhaCungCap"))
         {
             DataTable _table = SupplierDAO.Instance.TimNhaCungCapTheoTen(cbbNhaCungCap.Text);
             if (_table.Rows.Count == 1)
             {
                 Supplier _nhaCungCap = new Supplier(_table.Rows[0]);
                 cbbNhaCungCap.SelectedValue = _nhaCungCap.MaNCC;
             }
             else
             {
                 FFind _fFind = new FFind(cbbNhaCungCap.Text, null, this);
                 _fFind.Text = "TÌM NHÀ CUNG CẤP";
                 _fFind.ShowDialog();
             }
         }
     }
 }
Example #2
0
 private void cbb_KH_HH_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyData == Keys.Enter)
     {
         string _cbbName = ((ComboBox)sender).Name;
         if (_cbbName.Contains("HangHoa"))
         {
             DataTable _table = GoodsDAO.Instance.TimHangHoaTheoTen(cbbHangHoa.Text);
             if (_table.Rows.Count == 1)
             {
                 Goods _hangHoa = new Goods(_table.Rows[0]);
                 cbbHangHoa.SelectedValue = _hangHoa.MaHH;
                 this.ActiveControl       = txtSoLuong;
             }
             else
             {
                 FFind _fFind = new FFind(cbbHangHoa.Text, this, null);
                 _fFind.Text = "TÌM HÀNG HÓA";
                 _fFind.ShowDialog();
             }
         }
         else if (_cbbName.Contains("KhachHang"))
         {
             DataTable _table = ClientDAO.Instance.TimKhachHangTheoTen(cbbKhachHang.Text);
             if (_table.Rows.Count == 1)
             {
                 Client _khachHang = new Client(_table.Rows[0]);
                 cbbKhachHang.SelectedValue = _khachHang.MaKH;
             }
             else
             {
                 FFind _fFind = new FFind(cbbKhachHang.Text, this, null);
                 _fFind.Text = "TÌM KHÁCH HÀNG";
                 _fFind.ShowDialog();
             }
         }
     }
 }