Пример #1
0
        private void LoadFrom()
        {
            HoaDon_BUS hd = new HoaDon_BUS();

            listhd = hd.LayDanhSachHoaDonChoTN();

            dataGridView1.SelectionMode       = DataGridViewSelectionMode.FullRowSelect;
            dataGridView1.RowHeadersVisible   = false;
            dataGridView1.AutoGenerateColumns = false;
            dataGridView1.DataSource          = hd.LayDanhSachHoaDonChoQl();

            CTHoaDon_BUS cthd = new CTHoaDon_BUS();

            listCTHD = cthd.LayDanhSachCTHoaDon();
            dataGridView2.SelectionMode       = DataGridViewSelectionMode.FullRowSelect;
            dataGridView2.RowHeadersVisible   = false;
            dataGridView2.AutoGenerateColumns = false;
            dataGridView2.DataSource          = listCTHD;

            SanPham_BUS sp = new SanPham_BUS();

            listsp = sp.LayDanhSachSanPham();

            ilsLagre            = new ImageList();
            ilsLagre.ColorDepth = ColorDepth.Depth24Bit;
            ilsLagre.ImageSize  = new Size(100, 100);
            lvSP.LargeImageList = ilsLagre;

            ilsSmall            = new ImageList();
            ilsSmall.ColorDepth = ColorDepth.Depth8Bit;
            ilsSmall.ImageSize  = new Size(30, 30);
            lvSP.SmallImageList = ilsSmall;

            foreach (SanPham_DTO mySPTemp in listsp)
            {
                ListViewItem lvi = new ListViewItem(mySPTemp.TenSP.ToString());
                lvi.SubItems.Add(mySPTemp.MaSP.ToString());
                lvi.SubItems.Add(mySPTemp.LoaiSP.ToString());
                lvi.SubItems.Add(mySPTemp.DonGia.ToString());

                string strFileName = "data/hinhanh/" + mySPTemp.IconUrl;
                Bitmap bm          = new Bitmap(strFileName);
                ilsLagre.Images.Add(strFileName, bm);
                ilsSmall.Images.Add(strFileName, bm);
                lvi.ImageKey = strFileName;
                lvSP.Items.Add(lvi);
                lvSP.FullRowSelect = true;
            }
            if (listhd.Count == 0)
            {
                txtMaHD.Text = "501";
            }
            else
            {
                txtMaHD.Text = (int.Parse(listhd[listhd.Count - 1].MaHD.ToString()) + 1).ToString();
            }
        }
Пример #2
0
        private void LoadDSSP()
        {
            SanPham_BUS        sp   = new SanPham_BUS();
            List <SanPham_DTO> dssp = sp.LayDanhSachSanPham();

            dataGridViewQlSanPham.MultiSelect         = false;
            dataGridViewQlSanPham.AutoGenerateColumns = false;
            dataGridViewQlSanPham.DataSource          = dssp;
            dataGridViewQlSanPham.SelectionMode       = DataGridViewSelectionMode.FullRowSelect;
            //dataGridViewQlSanPham.ReadOnly = true;
            dataGridViewQlSanPham.RowHeadersVisible = false;
        }