コード例 #1
0
        private void fCTHang_Load(object sender, EventArgs e)
        {
            txtMaCTHang.Enabled = false;
            btnLuu.Enabled      = false;
            btnBoQua.Enabled    = false;
            //   txtGhiChu.Enabled = false;


            // lấy dữ liệu size
            DataTable size = DAO_Bill.GetData("SELECT idSize, Ten FROM tblSize");

            cbbSize.DataSource    = size;
            cbbSize.DisplayMember = "Ten";
            cbbSize.ValueMember   = "idSize";

            // lấy dữ liệu chất liệu
            DataTable chatlieu = DAO_Bill.GetData("SELECT idChatLieu, tenChatLieu FROM tblChatlieu");

            cbbChatLieu.DataSource    = chatlieu;
            cbbChatLieu.DisplayMember = "tenChatLieu";
            cbbChatLieu.ValueMember   = "idChatLieu";



            LoadDataGridView();

            ResetValues();
        }
コード例 #2
0
        private void fBill_Load(object sender, EventArgs e)
        {
            string sql;

            try
            {
                // tạo ngẫu nhiên khóa chính
                CreateKey();

                // lấy dữ liệu nhân viên
                DataTable nv = DAO_Bill.GetData("SELECT idNhanVien, TenNV FROM tblNhanVien WHERE USERS!= 'ADMIN'");
                cbbMaNhanVien.DataSource    = nv;
                cbbMaNhanVien.DisplayMember = "TenNV";
                cbbMaNhanVien.ValueMember   = "idNhanVien";

                //lấy dữ liệu hàng
                DataTable hang = DAO_Bill.GetData("SELECT ct.idCTHang, ct.ten, s.Ten,ct.kieudang,cl.tenChatLieu,ct.ghichu,ct.anh,ct.Soluong,ct.DonGiaNhap,ct.DonGiaBan FROM dbo.tblChatLieu cl JOIN dbo.tblCT_Hang ct ON ct.idChatLieu = cl.idChatLieu JOIN dbo.tblSize s ON s.idSize = ct.idSize WHERE (MONTH(GETDATE()) = MONTH(ct.NgayNhap))");
                cbbMaSP.DataSource    = hang;
                cbbMaSP.DisplayMember = "idCTHang";
                cbbMaSP.ValueMember   = "idCTHang";

                // lấy dữ liệu Khách hàng
                LoadDataKh();

                LoadDataGridView();
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            clearsp();
        }
コード例 #3
0
        private void LoadDataKh()
        {
            DataTable kh = DAO_Bill.GetData("SELECT idKhachHang, dienthoai FROM tblKhachHang");

            cbbSDTKH.DataSource    = kh;
            cbbSDTKH.DisplayMember = "dienthoai";
            cbbSDTKH.ValueMember   = "idKhachHang";
        }
コード例 #4
0
        private void cbbMaHoaDon_DropDown(object sender, EventArgs e)
        {
            DataTable kh = DAO_Bill.GetData("SELECT idHoaDon FROM tblHoaDon");

            cbbMaHoaDon.DataSource    = kh;
            cbbMaHoaDon.DisplayMember = "idHoaDon";
            cbbMaHoaDon.ValueMember   = "idHoaDon";

            cbbMaHoaDon.SelectedIndex = -1;
        }