private void InitVal() { lstHD = NhaCungCap_DAL.getAll_NhaCungCap(); gridControl1.DataSource = lstHD; gridThaoTac = new GridHelper <NhaCungCap_View>(gridControl1); count_row = 0; }
public static void Run(NhaCungCap_DAL NhaCungCap_DAL, NhaCungCap_BLL NhaCungCap_BLL, ArrayList arrayList) { NhaCungCap_DAL.DocFile(arrayList); int chon; while (true) { Menu(); //chọn chức năng chon = int.Parse(Console.ReadLine()); //nếu nhập = 0 thì dừng chương trình if (chon == 0) { break; } switch (chon) { case 1: NhaCungCap_BLL.Nhap(arrayList); Console.WriteLine("Nhập phím bất kì để tiếp tục"); NhaCungCap_DAL.GhiFile(arrayList); Console.ReadLine(); Console.Clear(); break; case 2: NhaCungCap_BLL.Hien(arrayList); Console.WriteLine("Nhập phím bất kì để tiếp tục"); Console.ReadLine(); Console.Clear(); break; case 3: NhaCungCap_BLL.Sua(arrayList); Console.WriteLine("Nhập phím bất kì để tiếp tục"); NhaCungCap_DAL.GhiFile(arrayList); Console.ReadLine(); Console.Clear(); break; case 4: NhaCungCap_BLL.Xoa(arrayList); Console.WriteLine("Nhập phím bất kì để tiếp tục"); NhaCungCap_DAL.GhiFile(arrayList); Console.ReadLine(); Console.Clear(); break; case 5: NhaCungCap_BLL.TimKiem(arrayList); Console.WriteLine("Nhập phím bất kì để tiếp tục"); Console.ReadLine(); Console.Clear(); break; default: break; } } }
private void btn_Luu_Click(object sender, EventArgs e) { NhaCungCap_View ncc = new NhaCungCap_View(); ncc.MaNhaCungCap = txt_maNCC.Text.Trim(); ncc.TenNhaCungCap = txt_TenNCC.Text.Trim(); ncc.DiaChi = txt_DiaChi.Text.Trim(); ncc.MoTa = txt_Ghichu.Text.Trim(); ncc.SoDienThoai = txt_SoDT.Text.Trim(); ncc.TrangThai = 1; var result = MessageBox.Show("Bạn có muốn lưu sự thay đổi xuống cơ sở dữ liệu hay không?", "Lưu thông tin", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { if (NhaCungCap_DAL.add(ncc)) { MessageBox.Show("Lưu thông tin thành công!"); maNCC_Return = txt_maNCC.Text.Trim(); this.DialogResult = DialogResult.OK; this.Close(); } else { MessageBox.Show("Đã có lỗi xảy ra, vui lòng kiểm tra dữ liệu!"); } } }
private void InitVal() { gridControl1.DataSource = LinhKien_DAL.getAll_LinhKien(); gridThaoTac = new GridHelper <LinhKien_View>(gridControl1); gridThaoTac.Mapping("MaThuongHieu", ThuongHieu_DAL.getAll_ThuongHieu()); gridThaoTac.Mapping("MaNhaCungCap", NhaCungCap_DAL.getAll_NhaCungCap()); gridThaoTac.Mapping("MaDonViTinh", DonViTinh_DAL.getAll_DonViTinh()); count_row = 0; }
private void setGroupBox_NCC() { setCbxNCC(""); if (!isNew) { NhaCungCap_View ncc_v = NhaCungCap_DAL.get_NCC_By_MaNCC(hoadonnhap.MaNhaCungCap); cbxTenNCC.Text = ncc_v.TenNhaCungCap; txtSoDienThoai.Text = ncc_v.SoDienThoai; txtDiaChi.Text = ncc_v.DiaChi; hoadonnhap.MaNhaCungCap = ncc_v.MaNhaCungCap; } }
private void cbTenNCC_SelectedIndexChanged(object sender, EventArgs e) { string maCNN = cbxTenNCC.SelectedValue.ToString().Trim(); NhaCungCap_View ncc = NhaCungCap_DAL.get_NCC_By_MaNCC(maCNN); txtSoDienThoai.Text = ncc.SoDienThoai; txtDiaChi.Text = ncc.DiaChi; setGridCtrl_LinhKien(); ls_cthd.Clear(); gridControl1.DataSource = ls_cthd; gridControl1.RefreshDataSource(); hoadonnhap.MaNhaCungCap = maCNN; }
private void btnLuu_Click(object sender, EventArgs e) { var result = MessageBox.Show("Bạn có muốn lưu sự thay đổi xuống cơ sở dữ liệu hay không?", "Lưu thông tin", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { DataUpdate <NhaCungCap_View> listUpdate = gridThaoTac.update(); if (NhaCungCap_DAL.saves(listUpdate)) { MessageBox.Show("Lưu thông tin thành công!"); InitVal(); } else { MessageBox.Show("Lưu thông tin thất bại!"); } } }
private void setCbxNCC(string maNCC_WantSelected) { int selected_Index = 0; cbxTenNCC.AutoCompleteMode = AutoCompleteMode.SuggestAppend; cbxTenNCC.AutoCompleteSource = AutoCompleteSource.ListItems; cbxTenNCC.DisplayMember = "TenNhaCungCap"; cbxTenNCC.ValueMember = "MaNhaCungCap"; List <NhaCungCap_View> list_NCC = NhaCungCap_DAL.getAll_NhaCungCap(); for (int i = 0; i < list_NCC.Count; i++) { if (maNCC_WantSelected.Equals(list_NCC[i].MaNhaCungCap)) { selected_Index = i - 1; break; } } cbxTenNCC.DataSource = list_NCC; cbxTenNCC.SelectedIndex = selected_Index; hoadonnhap.MaNhaCungCap = cbxTenNCC.SelectedValue.ToString().Trim(); }
public NhaCungCap_View(int c) : base() { MaNhaCungCap = NhaCungCap_DAL.get_NCCMax(c); }
private void AddNhaCungCap_Load(object sender, EventArgs e) { this.FormBorderStyle = FormBorderStyle.FixedSingle; txt_maNCC.ReadOnly = true; txt_maNCC.Text = NhaCungCap_DAL.get_NCCMax(0); }