public frmThemHangHoa() { InitializeComponent(); txtMaHang.Text = HangHoaBUS.LayMaHH(); txtMaVach.Text = HangHoaBUS.LayMaHH(); gridlookupPhanLoaiHangHoa.Properties.DataSource = PhanLoaiHangHoaBUS.DanhSach(); gridlookupPhanLoaiHangHoa.Properties.DisplayMember = "TenPhanLoai"; gridlookupPhanLoaiHangHoa.Properties.ValueMember = "MaPhanLoai"; gridlookupKho.Properties.DataSource = KhoHangBUS.DanhSach(); gridlookupKho.Properties.DisplayMember = "Ten"; gridlookupKho.Properties.ValueMember = "MaKho"; gridlookupLoaiHangHoa.Properties.DataSource = NhomHangBUS.DanhSach(); gridlookupLoaiHangHoa.Properties.DisplayMember = "Ten"; gridlookupLoaiHangHoa.Properties.ValueMember = "MaNHH"; gridlookupNCC.Properties.DataSource = NhaCungCapBUS.DanhSach(); gridlookupNCC.Properties.DisplayMember = "TenNCC"; gridlookupNCC.Properties.ValueMember = "MaNCC"; gridlookupDonVi.Properties.DataSource = DonViBUS.DanhSach(); gridlookupDonVi.Properties.DisplayMember = "Ten"; gridlookupDonVi.Properties.ValueMember = "MaDV"; }
private void LoadGridHangHoa() { gridHangHoa.DataSource = HangHoaBUS.LayToanBoHangHoa(); repositoryItemLookUpEdit1.DataSource = HangHoaBUS.LayToanBoHangHoa(); repositoryItemLookUpEdit1.DisplayMember = "TenHangHoa"; repositoryItemLookUpEdit1.ValueMember = "MaHangHoa"; }
public FormHangHoa() { InitializeComponent(); themOrSua = 1; hangHoaBUS = new HangHoaBUS(); initBUS(); }
private void dataGridView1_SelectionChanged(object sender, EventArgs e) { if (!dataGridView1.Focused) { dataGridView1.ClearSelection(); tabNoHeader1.Visible = false; return; } if (tabNoHeader1.Visible && tabNoHeader1.SelectedIndex == 1) { return; } foreach (Control c in tabThem.Controls) { errorProvider1.SetError(c, string.Empty); } tabNoHeader1.SelectedIndex = 0; tabNoHeader1.Visible = true; btnThem.Text = @"Sửa"; using (HangHoaBUS bus = new HangHoaBUS()) { string tennhanghoa = dataGridView1.CurrentRow?.Cells[0].Value.ToString(); HangHoaDTO info = bus.LoadHangHoa(tennhanghoa); txtTenHangHoa.Text = info.TenHangHoa; txtGiaBan.Text = info.GiaBan.ToString(); txtDonViTinh.Text = info.DonViTinh; txtSoLuongTon.Text = info.SoLuongTon.ToString(); txtGhiChu.Text = info.GhiChu; } }
public void btnXoa_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { int[] l = GridView1.GetSelectedRows(); var index = l[0]; switch (MessageBox.Show("Bạn có chắc chắn muốn xóa hàng hóa này không?", "Hỏi Xóa", MessageBoxButtons.YesNo, MessageBoxIcon.Question)) { case DialogResult.Yes: HangHoaDTO hh = default(HangHoaDTO); hh = ((List <HangHoaDTO>)gridHangHoa.DataSource)[index]; bool test = HangHoaBUS.XoaKhoHang(hh); if (test == true) { LoadGridHangHoa(); Log_BUS.ThemNhatKy("Hàng hóa", "Xóa hàng hoá"); MessageBox.Show("Xóa thành công"); } else { MessageBox.Show("Xóa không thành công"); } break; case DialogResult.No: return; } }
public Form2() { InitializeComponent(); this.HangHoaBUS = HangHoaBUSImpl.Instance; fillcomboboxTenKH(); fillcomboboxTenSP(); }
private void simpleButton1_Click(object sender, EventArgs e) { frmThemHangHoa frm = new frmThemHangHoa(); frm.ShowDialog(); gridControl1.DataSource = HangHoaBUS.DanhSach(); }
public void GetData(string MaHang) { HangHoa h = HangHoaBUS.LayChiTiet(MaHang); txtMaHang.Text = h.MaHang; txtTenHang.Text = h.TenHang; txtGiaBanLe.Text = h.GiaBanLe.ToString(); txtGiaBanSi.Text = h.GiaBanSi.ToString(); txtGiaMua.Text = h.GiaMua.ToString(); txtMaVach.Text = h.MaVachNSX; txtTonHienTai.Text = h.TonHienTai.ToString(); txtTonKhoToiThieu.Text = h.TonKhoToiThieu.ToString(); txtXuatXu.Text = h.XuatXu; gridlookupKho.EditValue = h.MaKho; gridlookupLoaiHangHoa.EditValue = h.MaLoaiHangHoa; gridlookupNCC.EditValue = h.MaNCC; gridlookupPhanLoaiHangHoa.EditValue = h.MaPhanLoai; gridlookupDonVi.EditValue = h.MaDV; if (h.ConQuanLy == true) { checkBox1.Checked = true; } else { checkBox1.Checked = false; } }
private void listBox1_DoubleClick(object sender, EventArgs e) { if (listBox1.SelectedItem.ToString() == " Trực tiếp") { busHangHoa = new HangHoaBUS(); List <DonHang_HopDong_DTO> lshh2 = busHangHoa.selectDonHang_CaNhan(); Load_Datagridview1(lshh2); dataGridView1.Columns["TRANGTHAI"].Visible = false; } else if (listBox1.SelectedItem.ToString() == " Hợp đồng") { busHangHoa = new HangHoaBUS(); List <DonHang_HopDong_DTO> lshh2 = busHangHoa.selectDonHang(); Load_Datagridview1(lshh2); dataGridView1.Columns["TRANGTHAI"].Visible = false; } else { busHangHoa = new HangHoaBUS(); List <DonHang_HopDong_DTO> lshh = busHangHoa.selectDonHang(); List <DonHang_HopDong_DTO> lshh2 = busHangHoa.selectDonHang_CaNhan(); lshh.AddRange(lshh2); Load_Datagridview1(lshh); dataGridView1.Columns["TRANGTHAI"].Visible = false; } }
//Hàng hóa void LoadDsHangHoa() { HangHoaBUS hangBUS = new HangHoaBUS(); dtgvHangHoa.AutoGenerateColumns = false; dtgvHangHoa.DataSource = hangBUS.LoadDsHH(); }
private void QuanLyBan_Load(object sender, EventArgs e) { using (HangHoaBUS bus = new HangHoaBUS()) dataGridView2.DataSource = bus.ListHangHoa2(); using (KhuVucBUS bus = new KhuVucBUS()) { foreach (DataRow row in bus.ListKhuVuc().Rows) { var group = new ListViewGroup(row["TenKhuVuc"].ToString()); listView1.Groups.Add(group); foreach (DataRow r in bus.ListBan(row["TenKhuVuc"].ToString()).Rows) { listView1.Items.Add(new ListViewItem(r["TenBan"].ToString(), bus.IsAvailable(r["MaSoBan"].ToString()) ? 0 : 1, group)).Tag = r["MaSoBan"]; } listView1.Items[0].Selected = true; } } using (QuanLyBanBUS bus = new QuanLyBanBUS()) txtSoHoaDon.Text = bus.GetSoHoaDon().ToString(); }
private void btnThem_Click(object sender, EventArgs e) { HangHoaBUS hhBUS = new HangHoaBUS(); string tenhh = hhBUS.LoadTenhhTheoMaHH((int)cboTenHangHoa.SelectedValue); ListViewItem lvi = new ListViewItem(tenhh); lvi.SubItems.Add(nmrSoLuong.Value.ToString()); lvi.SubItems.Add(((int)cboTenHangHoa.SelectedValue).ToString()); if (lvwChiTietDDh.Items.Count != 0) { bool flag = true; foreach (ListViewItem item in lvwChiTietDDh.Items) { if (item.SubItems[2].Text == ((int)cboTenHangHoa.SelectedValue).ToString()) { MessageBox.Show("Hàng hóa đã được thêm gòi nha đừng thêm nữa, ahihi!", "Nhắc nhẹ", MessageBoxButtons.OK, MessageBoxIcon.Information); flag = false; } } if (flag == true) { lvwChiTietDDh.Items.Add(lvi); } } else { lvwChiTietDDh.Items.Add(lvi); } }
private void simpleButton3_Click(object sender, EventArgs e) { int vitri = gridView1.GetFocusedDataSourceRowIndex(); string MaHang = gridView1.GetRowCellValue(vitri, "MaHang").ToString(); HangHoaBUS.Xoa(MaHang); gridControl1.DataSource = HangHoaBUS.DanhSach(); }
void LoadComboboxTenHH() { HangHoaBUS hhBUS = new HangHoaBUS(); cboTenHangHoa.DataSource = hhBUS.LoadDsHH(); cboTenHangHoa.DisplayMember = "Tenhh"; cboTenHangHoa.ValueMember = "Mahh"; }
void initBUS() { hangHoaBUS = new HangHoaBUS(); khoBUS = new KhoBUS(); nhomHangBUS = new NhomHangBUS(); donViBUS = new DonViBUS(); nhaCungCapBUS = new NhaCungCapBUS(); HH = new HangHoaO(); }
public void QuanLyDonHang_Load(object sender, EventArgs e) { busHangHoa = new HangHoaBUS(); List <DonHang_HopDong_DTO> lshh = busHangHoa.selectDonHang(); List <DonHang_HopDong_DTO> lshh2 = busHangHoa.selectDonHang_CaNhan(); lshh.AddRange(lshh2); Load_Datagridview1(lshh); }
private void AddProduct_Load(object sender, EventArgs e) { hhbus = new HangHoaBUS(); List <HangHoaDTO> lshh = hhbus.selectAvailable(); Load_Datagridview1(lshh); dataGridView1.Columns["MANHASANXUAT"].Visible = false; dataGridView1.Columns["MALOAIHANG"].Visible = false; dataGridView1.Columns["THOIGIANBAOHANH"].Visible = false; }
public frmBill() { InitializeComponent(); hdBUS = new HoaDonBUS(); htttBUS = new HinhThucThanhToanBUS(); dvmhBUS = new DonViMuaHangBUS(); nvbBUS = new NhanVienBanBUS(); hhBUS = new HangHoaBUS(); nmBUS = new NguoiMuaBUS(); cthdBUS = new CTHoaDonBUS(); }
private void FormProduct_Load(object sender, EventArgs e) { hangHoaBUS = new HangHoaBUS(); dataTable = new DataTable(); dataTable.Columns.Add(new DataColumn("MaHang")); dataTable.Columns.Add(new DataColumn("TenHang")); dataTable.Columns.Add(new DataColumn("NoiChua")); dataTable.Columns.Add(new DataColumn("SoLuongBan")); dataTable.Columns.Add(new DataColumn("GiaHang")); GetAllToGridView(); }
private void simpleButton2_Click(object sender, EventArgs e) { int vitri = gridView1.GetFocusedDataSourceRowIndex(); string MaHang = gridView1.GetRowCellValue(vitri, "MaHang").ToString(); frmSuaHangHoa frm = new frmSuaHangHoa(); SendData s = new SendData(frm.GetData); s(MaHang); frm.ShowDialog(); gridControl1.DataSource = HangHoaBUS.DanhSach(); }
private void BaoGiaTrucTiep_Load(object sender, EventArgs e) { hhbus = new HangHoaBUS(); List <HangHoaDTO> lshh = hhbus.select(); this.Load_Datagridview(lshh); dataGridView1.Columns["TEN"].Visible = false; // dataGridView1.Columns["MANHASANXUAT"].Visible = false; //dataGridView1.Columns["MALOAIHANG"].Visible = false; dataGridView1.Columns["SOLUONG"].Visible = false; }
private void LoadGridHangHoa() { LoadCotDonVi(); LoadCotLoaiHang(); LoadCotPhanLoai(); gridHangHoa.DataSource = HangHoaBUS.LayToanBoHangHoa(); //ẩn một số cột không cần đùng gridHangHoa.Columns["KhoMacDinh"].Visible = false; gridHangHoa.Columns["XuatXu"].Visible = false; gridHangHoa.Columns["NhaCungCap"].Visible = false; }
private void xoa_btn_Click(object sender, EventArgs e) { dtoHangHoaDat.MAHANGHOADAT = busHangHoa.selectMaHangHoaDat(dtoDonHang); busHangHoa.xoaDonHang(dtoHangHoaDat); xoa_btn.Enabled = false; busHangHoa = new HangHoaBUS(); List <DonHang_HopDong_DTO> lshh = busHangHoa.selectDonHang(); List <DonHang_HopDong_DTO> lshh2 = busHangHoa.selectDonHang_CaNhan(); lshh.AddRange(lshh2); Load_Datagridview1(lshh); dataGridView1.Columns["TRANGTHAI"].Visible = false; }
private void btnThem_Click(object sender, EventArgs e) { foreach (var c in from MaterialSingleLineTextField c in tabThem.Controls.OfType <MaterialSingleLineTextField>() where c != txtGhiChu select c) { errorProvider1.SetError(c, string.IsNullOrWhiteSpace(c.Text) ? "Bạn không được để trống thông tin này" : string.Empty); } if (tabThem.Controls.OfType <MaterialSingleLineTextField>().Any(c => errorProvider1.GetError(c) != string.Empty)) { return; } try { using (HangHoaBUS bus = new HangHoaBUS()) { HangHoaDTO info = new HangHoaDTO { TenHangHoa = txtTenHangHoa.Text, GiaBan = Convert.ToInt32(txtGiaBan.Text), DonViTinh = txtDonViTinh.Text, SoLuongTon = Convert.ToInt32(txtSoLuongTon.Text), GhiChu = txtGhiChu.Text }; if (dataGridView1.SelectedRows.Count == 0) { bus.InsertHangHoa(info); } else { string tenhanghoa = dataGridView1.SelectedRows[0].Cells[0].Value.ToString(); bus.EditHangHoa(info, tenhanghoa); } } } catch (SqlException ex) { if (ex.Number == DbConnection.MssqlEng002627) { errorProvider1.SetError(txtTenHangHoa, "Hàng hóa đã tồn tại"); } else { throw; } } RefreshHangHoa(); }
void initObjectBUS() { CK = new ChuyenKhoO(); CTCK = new ChiTietChuyenKhoO(); HH = new HangHoaO(); DV = new DonViO(); TK = new TonKhoO(); chuyenKhoBUS = new ChuyenKhoBUS(); chiTietChuyenKhoBUS = new ChiTietChuyenKhoBUS(); nhanVienBUS = new NhanVienBUS(); khoBUS = new KhoBUS(); hangHoaBUS = new HangHoaBUS(); donViBUS = new DonViBUS(); tonKhoBUS = new TonKhoBUS(); }
private void XoaHangHoa() { DialogResult hopThoai = MessageBox.Show("Bạn chắc chắn muốn xóa những dòng bạn chọn?", "Xóa", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (hopThoai == DialogResult.Yes) { HangHoaBUS itemBUS = new HangHoaBUS(); for (int i = 0; i < gvDanhMucHangHoa.SelectedRowsCount; i++) { int ma = int.Parse(gvDanhMucHangHoa.GetRowCellValue(gvDanhMucHangHoa.GetSelectedRows()[i], gvDanhMucHangHoa.Columns["Id"]).ToString()); itemBUS.Xoa(ma); } } this.LayDanhSachHangHoa(); }
private void btnThem_Click(object sender, EventArgs e) { if (txtGia.Text == "") { MessageBox.Show("Bạn chưa nhập giá", "Nhắc nhẹ", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (!IsNumber(txtGia.Text)) { MessageBox.Show("Nhập giá chưa đúng định dạng, giá phải là số (số nguyên hoặc số thực)", "Nhắc nhẹ", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { HangHoaBUS hhBUS = new HangHoaBUS(); string tenhh = hhBUS.LoadTenhhTheoMaHH((int)cmbTenHangHoa.SelectedValue); ListViewItem lvi = new ListViewItem(tenhh); lvi.SubItems.Add(nmrSoLuong.Value.ToString()); lvi.SubItems.Add(txtGia.Text); double thanhTien = Convert.ToDouble(nmrSoLuong.Value.ToString()) * Convert.ToDouble(txtGia.Text); lvi.SubItems.Add(thanhTien.ToString()); lvi.SubItems.Add(((int)cmbTenHangHoa.SelectedValue).ToString()); if (lvwChiTietPhieuNhap.Items.Count != 0) { bool flag = true; foreach (ListViewItem item in lvwChiTietPhieuNhap.Items) { if (item.SubItems[3].Text == ((int)cmbTenHangHoa.SelectedValue).ToString()) { MessageBox.Show("Hàng hóa đã được thêm gòi nha đừng thêm nữa, ahihi!", "Nhắc nhẹ", MessageBoxButtons.OK, MessageBoxIcon.Information); flag = false; } } if (flag == true) { lvwChiTietPhieuNhap.Items.Add(lvi); } } else { lvwChiTietPhieuNhap.Items.Add(lvi); } } }
private void btnThem_Click(object sender, EventArgs e) { if (txtGia.Text == "") { MessageBox.Show(Instance.TBChuaNhapGia, Instance.CanhBao, MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (!IsNumber(txtGia.Text)) { MessageBox.Show(Instance.TBNhapGiaChuaDungDinhDang, Instance.CanhBao, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { HangHoaBUS hhBUS = new HangHoaBUS(); string tenhh = hhBUS.LoadTenhhTheoMaHH((int)cmbTenHangHoa.SelectedValue); ListViewItem lvi = new ListViewItem(tenhh); lvi.SubItems.Add(nmrSoLuong.Value.ToString()); lvi.SubItems.Add(txtGia.Text); double thanhTien = Convert.ToDouble(nmrSoLuong.Value.ToString()) * Convert.ToDouble(txtGia.Text); lvi.SubItems.Add(thanhTien.ToString()); lvi.SubItems.Add(((int)cmbTenHangHoa.SelectedValue).ToString()); if (lvwChiTietPhieuNhap.Items.Count != 0) { bool flag = true; foreach (ListViewItem item in lvwChiTietPhieuNhap.Items) { if (item.SubItems[4].Text == ((int)cmbTenHangHoa.SelectedValue).ToString()) { MessageBox.Show(Instance.TBHHDaTonTai, Instance.CanhBao, MessageBoxButtons.OK, MessageBoxIcon.Information); flag = false; } } if (flag == true) { lvwChiTietPhieuNhap.Items.Add(lvi); } } else { lvwChiTietPhieuNhap.Items.Add(lvi); } } }
void initObjectBUS() { MH = new MuaHangO(); NCC = new NhaCungCapO(); HH = new HangHoaO(); DV = new DonViO(); CTPMH = new ChiTietPhieuMuaHangO(); TK = new TonKhoO(); muaHangBUS = new MuaHangBUS(); nhaCungCapBUS = new NhaCungCapBUS(); nhanVienBUS = new NhanVienBUS(); khoBUS = new KhoBUS(); hangHoaBUS = new HangHoaBUS(); donViBUS = new DonViBUS(); tonKhoBUS = new TonKhoBUS(); chiTietPhieuMuaHangBUS = new ChiTietPhieuMuaHangBUS(); kieuThanhToanBUS = new KieuThanhToanBUS(); hinhThucThanhToanBUS = new HinhThucThanhToanBUS(); }
private void btnXoa_Click(object sender, EventArgs e) { if (dataGridView1.CurrentRow == null) { return; } using (HangHoaBUS bus = new HangHoaBUS()) { if (new XacNhan { Text = @"Bạn có chắc chắn muốn xóa hàng hóa " + dataGridView1.CurrentRow.Cells[0].Value }.ShowDialog() == DialogResult.Yes) { string tenhanghoa = dataGridView1.CurrentRow.Cells[0].Value.ToString(); bus.DeleteHangHoa(tenhanghoa); } } RefreshHangHoa(); }