public void LoadData()
        {
            DataTable dt = new DataTable();



            dgvDonHang1.DataSource = dh.LayDonHang();
            dgvDSDH1.DataSource    = dh.LayDonHang();
            txtDiaChi.ResetText();
            deNgayChuyen.ResetText();
            btnThem.Enabled          = true;
            btnSua.Enabled           = true;
            btnXoa.Enabled           = true;
            btnThemKhachHang.Enabled = true;

            btnThemPhiShip.Enabled = true;
            btnLuu.Enabled         = false;
            tam = 2;
            //Do len combobox
            dt = tt.LayNhanVien1();

            dt = new DataTable();
            dt = kh.LayKhachHang();
            cbMaKH.DataSource    = dt;
            cbMaKH.DisplayMember = "TenKhachHang";
            cbMaKH.ValueMember   = "MaKH";
            //Hien ten nhan vien
            LayTenNhanVien();
            DayLenToolStrips();
        }
Beispiel #2
0
 public void LoadData()
 {
     try
     {
         dt = hd.LayMatHang();
         cbMaHang.DataSource    = dt;
         cbMaHang.DisplayMember = "TenHang";
         cbMaHang.ValueMember   = "MaHang";
         dt = new DataTable();
         dt = dh.LayDonHang();
         cbMaDon.DataSource    = dt;
         cbMaDon.DisplayMember = "MaDonHang";
         cbMaDon.ValueMember   = "MaDonHang";
         if (MaDonHang.ToString() != "0")
         {
             cbMaDon.SelectedValue = MaDonHang.ToString();
             dgvDSHTD.DataSource   = hd.LayHoaDonTheoMaDonHang(MaDonHang);
         }
         else
         {
             dgvDSHTD.DataSource = hd.LayHoaDon();
         }
     }
     catch
     {
         MessageBox.Show("Chưa có mặt hàng nào. Vui lòng thêm mặt hàng!!!");
     }
     KH();
     LayTenNhanVien();
     DayLenToolStrips();
 }
        public void LoadData()
        {
            try
            {
                dt = new DataTable();
                dt = dh.LayDonHang();
                cbMaDon.DataSource    = dt;
                cbMaDon.DisplayMember = "MaDonHang";
                cbMaDon.ValueMember   = "MaDonHang";

                DataTable dt1 = new DataTable();
                dt1 = mh.LayQua();
                comboBox1.DataSource    = dt1;
                comboBox1.DisplayMember = "TenHang";
                comboBox1.ValueMember   = "MaHang";

                DataTable dt2 = new DataTable();
                dt2 = mh.LayMatHang();

                cbMaQua.DataSource    = dt2;
                cbMaQua.DisplayMember = "TenHang";
                cbMaQua.ValueMember   = "MaHang";
                if (MaDonHang != 0)
                {
                    dgvTQ.DataSource      = tq.LayTangQuaTheoMa(Int32.Parse(MaDonHang.ToString()), MaHang.ToString());
                    cbMaDon.SelectedValue = MaDonHang;
                    cbMaQua.SelectedValue = MaHang;
                    int SLQua = SoLuong / 2;
                    txtSL.Text = SLQua.ToString();
                }
                else
                {
                    dgvTQ.DataSource = tq.LayTangQua();
                }
                //dgvTQ.DataSource = mh.LayMatHang();
                btnLuu.Enabled  = false;
                btnThem.Enabled = true;
                btnSua.Enabled  = true;
                btnXoa.Enabled  = true;
                tam             = -1;
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
            LayTenNhanVien();
            DayLenToolStrips();
        }