private void trviewDoUong_Click(object sender, EventArgs e)
        {
            List <DoUong>       ds   = new List <DoUong>();
            TreeViewHitTestInfo info = trviewDoUong.HitTest(trviewDoUong.PointToClient(Cursor.Position));

            if (info != null)
            {
                //   MessageBox.Show(info.Node.Text);
                try
                {
                    using (var k = new AppCode.QuanCafe())
                    {
                        foreach (var item in k.DSDoUong)
                        {
                            if (k.TimLoaiDU(item.IDLoai).TenLoai.ToUpper() == info.Node.Text.ToUpper())
                            {
                                ds.Add(item);
                            }
                        }
                        grvDSDoUongF.DataSource = ds;
                    }
                }
                catch
                {
                }
            }
        }
 private void btnTimLoai_Click(object sender, EventArgs e)
 {
     try
     {
         using (var k = new AppCode.QuanCafe())
         {
             var kq = k.TimLoaiDU(int.Parse(txt2MaLoai.Text));
             if (kq == null)
             {
                 MessageBox.Show("Không tìm thấy", "Thông báo ", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                 return;
             }
             else
             {
                 txtMaLoai.Text  = kq.IDLoai.ToString();
                 txtTenLoai.Text = kq.TenLoai;
                 return;
             }
         }
     }
     catch
     {
         return;
     }
 }
 private void LoadThongTinDoUong(int vitri)
 {
     try
     {
         using (var k = new AppCode.QuanCafe())
         {
             txt2MaDU.Text      = grvDSDoUong.Rows[vitri].Cells[1].Value.ToString().Trim();
             txtTenDU.Text      = grvDSDoUong.Rows[vitri].Cells[2].Value.ToString();
             cbbLoaiDU.Text     = k.TimLoaiDU((int.Parse(grvDSDoUong.Rows[vitri].Cells[3].Value.ToString()))).TenLoai;
             txtSoLuong.Text    = grvDSDoUong.Rows[vitri].Cells[4].Value.ToString();
             txtGiaGoc.Text     = grvDSDoUong.Rows[vitri].Cells[5].Value.ToString();
             txtGiaBan.Text     = grvDSDoUong.Rows[vitri].Cells[6].Value.ToString();
             dtpkNgayNhap.Value = Convert.ToDateTime(grvDSDoUong.Rows[vitri].Cells[7].Value.ToString());
             cbbDVT.Text        = grvDSDoUong.Rows[vitri].Cells[8].Value.ToString();
         }
     }
     catch (Exception e)
     {
         //clear text box
     }
 }