private void buttonThem_Click(object sender, EventArgs e) { string ma = textBoxMaKho.Text; string ten = textBoxTenKho.Text; string makhuvuc = comboBoxMaKhuVuc.Text; //co hieu int k = 0; //xu ly for (int i = 0; i < kh.Count; i++) { if (ma == kh[i].MaKho) { MessageBox.Show("Mã Kho bạn nhập trùng xin nhập mã khác !"); k = 1; break; } } if (ten != "" && k == 0 && ma != "" && makhuvuc != "") { bool them = XL_KhoHang.ThemKhoHang(ma, ten, makhuvuc); if (them) { MessageBox.Show("Thêm kho hàng thành công !"); this.Close(); } else { MessageBox.Show("Thêm kho hàng thất bại !"); this.Close(); } } }
private void FormKhoHang_Load(object sender, EventArgs e) { //lay khu vuc kv = XL_KhuVuc.ChuyenDoiDTOKhuVuc(XL_KhuVuc.LayDuLieuKhuVuc()); // var bangKhoHang = XL_KhoHang.LayDuLieuKhoHang(); gridControl1.DataSource = bangKhoHang; kh = XL_KhoHang.ChuyenDoiDTOKhoHang(bangKhoHang); //phan quyen button for (int i = 0; i < vtcn.Count; i++) { if (vtcn[i].TenTrongHeThong == this.Tag.ToString()) { if (vtcn[i].Them == true) { simpleButtonThem.Enabled = true; } if (vtcn[i].Xoa == true) { simpleButtonXoa.Enabled = true; } if (vtcn[i].Sua == true) { simpleButtonSua.Enabled = true; } break; } } //phan quyen contextMenuStrip for (int i = 0; i < vtcn.Count; i++) { if (vtcn[i].TenTrongHeThong == this.Tag.ToString()) { for (int j = 0; j < contextMenuStrip1.Items.Count; j++) { if (contextMenuStrip1.Items[j].Text == "Thêm" && vtcn[i].Them == true) { contextMenuStrip1.Items[j].Enabled = true; } if (contextMenuStrip1.Items[j].Text == "Xóa" && vtcn[i].Xoa == true) { contextMenuStrip1.Items[j].Enabled = true; } if (contextMenuStrip1.Items[j].Text == "Sửa" && vtcn[i].Sua == true) { contextMenuStrip1.Items[j].Enabled = true; } } break; } } }
private void simpleButtonThem_Click(object sender, EventArgs e) { load(XL_KhoHang.LayDuLieuKhoHang()); // FormKhoHangThem them = new FormKhoHangThem(kh, kv); them.ShowDialog(); // var bangKhoHang = XL_KhoHang.LayDuLieuKhoHang(); gridControl1.DataSource = bangKhoHang; }
void load(DataTable bang) { if (kh.Count != 0) { for (int i = 0; i < kh.Count; i++) { kh.RemoveAt(i); } var bangKhoHang = bang; kh = XL_KhoHang.ChuyenDoiDTOKhoHang(bangKhoHang); } }
private void ToolStripMenuItemSua_Click(object sender, EventArgs e) { load(XL_KhoHang.LayDuLieuKhoHang()); // FormKhoHangSua sua = new FormKhoHangSua(kh, kv); sua.ShowDialog(); // var bangKhoHang = XL_KhoHang.LayDuLieuKhoHang(); gridControl1.DataSource = bangKhoHang; }
private void simpleButtonXoa_Click(object sender, EventArgs e) { load(XL_KhoHang.LayDuLieuKhoHang()); // FormKhoHangXoa xoa = new FormKhoHangXoa(kh); xoa.ShowDialog(); // var bangKhoHang = XL_KhoHang.LayDuLieuKhoHang(); gridControl1.DataSource = bangKhoHang; }
private void buttonXoa_Click(object sender, EventArgs e) { string ma = comboBoxMaKho.Text; if (ma != "") { bool Xoa = XL_KhoHang.XoaKhoHang(ma); if (Xoa) { MessageBox.Show("Xóa thành công !"); this.Close(); } else { MessageBox.Show("Xóa thất bại !"); this.Close(); } } }
private void buttonSua_Click(object sender, EventArgs e) { string ma = comboBoxMaKho.Text; string ten = textBoxTenKho.Text; string makhuvuc = comboBoxMaKhuVuc.Text; if (ma != "" && ten != "" && makhuvuc != "") { bool Sua = XL_KhoHang.SuaKhoHang(ma, ten, makhuvuc); if (Sua) { MessageBox.Show("Cập nhật khách hàng thành công !"); this.Close(); } else { MessageBox.Show("Cập nhật khách hàng thất bại !"); this.Close(); } } }
private void FormMuaHangPhieu_Load(object sender, EventArgs e) { //hinhthucthanhtoan gridLookUpEditHinhThucThanhToan.Properties.DataSource = XL_HinhThucThanhToan.LayDuLieuHinhThucThanhToan(); gridLookUpEditHinhThucThanhToan.Properties.DisplayMember = "MaHinhThuc"; //nhanvien gridLookUpEditNhanVien.Properties.DataSource = XL_NhanVien.LayDuLieuNhanVien(); gridLookUpEditNhanVien.Properties.DisplayMember = "MaNV"; //kho gridLookUpEditKho.Properties.DataSource = XL_KhoHang.LayDuLieuKhoHang(); gridLookUpEditKho.Properties.DisplayMember = "MaKho"; //dieu khoan gridLookUpEditDieuKhoanThanhToan.Properties.DataSource = XL_DieuKhoan.LayDuLieuDieuKhoan(); gridLookUpEditDieuKhoanThanhToan.Properties.DisplayMember = "MaDieuKhoan"; //ncc gridLookUpEditNCC.Properties.DataSource = XL_NhaCungCap.LayDuLieuNhaCungCap(); gridLookUpEditNCC.Properties.DisplayMember = "MaNhaCungCap"; //datagridn sp MaSP.DataSource = XL_SanPham.LayDuLieuSanPham(); MaSP.DisplayMember = "MaSP"; sp = XL_SanPham.ChuyenDoiDTOSanPham(XL_SanPham.LayDuLieuSanPham()); // ct phieu nhap ctpn = XL_CTPhieuNhap.ChuyenDoiDTOCTPhieuNhap(XL_CTPhieuNhap.LayCTPhieuNhap()); }