Пример #1
0
        private void FormChonSanPham_Load(object sender, EventArgs e)
        {
            List <SanPhamDTO> sanPhamDTO = new List <SanPhamDTO>();

            sanPhamDTO = SanPhamBUS.SelectSanPhamAll();

            for (int i = 0; i < sanPhamDTO.Count; i++)
            {
                dataGridView_ChoSanPham.Rows.Add(i + 1, sanPhamDTO[i].MaSanPham, sanPhamDTO[i].TenSanPham, LoaiSanPhamBUS.SelectLoaiSanPhamById(sanPhamDTO[i].MaLoaiSanPham).TenLoaiSanPham, false);
            }


            List <LoaiSanPhamDTO> lstcbspDTO = LoaiSanPhamBUS.SelectLoaiSanPhamAll();

            LoaiSanPhamDTO all = new LoaiSanPhamDTO();

            all.MaLoaiSanPham  = "Tất cả";
            all.TenLoaiSanPham = "Tất cả";

            lstcbspDTO.Insert(0, all);

            comboBoxLoaiSanPham.DisplayMember = "TenLoaiSanPham";
            comboBoxLoaiSanPham.ValueMember   = "TenLoaiSanPham";
            comboBoxLoaiSanPham.DataSource    = lstcbspDTO;
            comboBoxLoaiSanPham.SelectedIndex = 0;
        }
Пример #2
0
        /*
         * Hàm KhoiTao
         * Tải toàn bộ danh sách tham số
         */
        private void KhoiTao()
        {
            List <SanPhamDTO>     listSanPhamDTO = SanPhamBUS.SelectSanPhamAll();
            List <LoaiSanPhamDTO> lstcbspDTO     = LoaiSanPhamBUS.SelectLoaiSanPhamAll();

            LoaiSanPhamDTO all = new LoaiSanPhamDTO();

            all.MaLoaiSanPham  = "";
            all.TenLoaiSanPham = "Tất cả";

            lstcbspDTO.Insert(0, all);

            cmbMaLoaiSanPham.DisplayMember = "TenLoaiSanPham";
            cmbMaLoaiSanPham.ValueMember   = "MaLoaiSanPham";
            cmbMaLoaiSanPham.DataSource    = lstcbspDTO;
            cmbMaLoaiSanPham.SelectedIndex = 0;

            List <LoaiSanPhamDTO> lstcbspDTO2 = LoaiSanPhamBUS.SelectLoaiSanPhamAll();

            ColLoaiSanPham.DisplayMember = "TenLoaiSanPham";
            ColLoaiSanPham.ValueMember   = "MaLoaiSanPham";
            ColLoaiSanPham.DataSource    = lstcbspDTO2;
            ColLoaiSanPham.DisplayStyle  = DataGridViewComboBoxDisplayStyle.Nothing;


            if (listSanPhamDTO != null)
            {
                SanPhamDTO item = new SanPhamDTO();
                dataGridView_QuanLySanPham.Rows.Clear();
                for (int i = 0; i < listSanPhamDTO.Count; i++)
                {
                    item = listSanPhamDTO[i];
                    dataGridView_QuanLySanPham.Rows.Add((i + 1).ToString(), item.MaSanPham, item.TenSanPham, item.CV.ToString(), item.DonGia.ToString(), item.DonGiaTV.ToString(), item.SoLuongTon.ToString(), item.MaLoaiSanPham);
                    dataGridView_QuanLySanPham.Rows[i].ReadOnly = true;
                }
                buttonLamLai.Enabled = true;
                buttonEnabled();
            }
            else
            {
                buttonLamLai.Enabled = false;
                buttonDisabled();
            }
        }
Пример #3
0
        /*
         * Hàm KhoiTao
         * Tải toàn bộ danh sách tham số
         */
        private void KhoiTao()
        {
            List <LoaiSanPhamDTO> listlspDTO = LoaiSanPhamBUS.SelectLoaiSanPhamAll();

            if (listlspDTO != null)
            {
                LoaiSanPhamDTO item = new LoaiSanPhamDTO();
                dataGridView_QuanLyLoaiSanPham.Rows.Clear();
                for (int i = 0; i < listlspDTO.Count; i++)
                {
                    item = listlspDTO[i];
                    dataGridView_QuanLyLoaiSanPham.Rows.Add((i + 1).ToString(), item.MaLoaiSanPham, item.TenLoaiSanPham);
                    dataGridView_QuanLyLoaiSanPham.Rows[i].ReadOnly = true;
                }
                buttonLamLai.Enabled = true;
                buttonEnabled();
            }
            else
            {
                buttonLamLai.Enabled = false;
                buttonDisabled();
            }
        }