private void Load_timCTBanHang() { CTHoaDon_BUS cthdBUS = new CTHoaDon_BUS(); List <CTHoaDon_DTO> listcthd = new List <CTHoaDon_DTO>(); listcthd = cthdBUS.TimCTHoaDon(int.Parse(txtMaHoaDonQL.Text)); dataGridViewCTHoaDonQL.DataSource = listcthd; }
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(); } }
private void Load_fromCTBanHang() { CTHoaDon_BUS cthd = new CTHoaDon_BUS(); List <CTHoaDon_DTO> listcthd = null; listcthd = cthd.LayDanhSachCTHoaDon(); dataGridViewCTHoaDonQL.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dataGridViewCTHoaDonQL.RowHeadersVisible = false; dataGridViewCTHoaDonQL.AutoGenerateColumns = false; dataGridViewCTHoaDonQL.DataSource = listcthd; }
private void TaoCTHD() { for (int i = 0; i < lvOrder.Items.Count; i++) { CTHoaDon_DTO cthdThem = new CTHoaDon_DTO(); cthdThem.MaHoaDon = int.Parse(txtMaHD.Text); cthdThem.MaSanPham = int.Parse(lvOrder.Items[i].SubItems[0].Text); cthdThem.SoLuongCTHD = int.Parse(lvOrder.Items[i].SubItems[3].Text); CTHoaDon_BUS cthdBus = new CTHoaDon_BUS(); cthdBus.ThemDanhSachCTHoaDon(cthdThem, 1); } lvSP.Items.Clear(); LoadFrom(); }
private void btnXoaCTHoaDon_Click(object sender, EventArgs e) { if (dataGridViewCTHoaDonQL.SelectedRows.Count > 0) { CTHoaDon_DTO cthd = (CTHoaDon_DTO)dataGridViewCTHoaDonQL.SelectedRows[0].DataBoundItem; if (MessageBox.Show("Bạn có chắc muốn xóa Sản Phẩm trong Hóa Đơn " + cthd.MaHoaDon + " không?", "Cảnh báo", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) { CTHoaDon_BUS cthd1 = new CTHoaDon_BUS(); cthd1.XoaDanhSachCTHoaDon(cthd); MessageBox.Show("Đã xóa thành công Sản Phẩm trong Hóa Đơn"); Load_fromCTBanHang(); } } }