//string AutoTaoMaSP() //{ // List<SANPHAM> lstMaSP = SanPhamBUS.LayDanhSachSP(); // string ma = string.Empty; // if (lstMaSP.Count == 0) // { // ma = "SP1"; // return ma; // } // else // { // ma = lstMaSP.Select(p => p.MASP).LastOrDefault(); // int automa = Convert.ToInt32(ma.Remove(0, 2)) + 1; // ma = "SP" + automa; // for (int i = 0; i < lstMaSP.Count(); i++) // { // if (ma == lstMaSP[i].MASP) // { // automa = Convert.ToInt32(ma.Remove(0, 2)) + 1; // ma = "SP" + automa; // } // } // return ma; // } //} void AutoCompleteMaLoai() { lstLoaiSp = LoaiSanPhamBUS.LayDanhSachLoaiSanPham(); AutoCompleteStringCollection collection = new AutoCompleteStringCollection(); foreach (LOAISANPHAM item in lstLoaiSp) { collection.Add(item.MALOAI); } this.txtLoaiSanPham.AutoCompleteCustomSource = collection; this.txtLoaiSanPham.AutoCompleteMode = AutoCompleteMode.SuggestAppend; this.txtLoaiSanPham.AutoCompleteSource = AutoCompleteSource.CustomSource; }
void LoadComboBoxData() { this.cbDSLoaiSP.DataSource = LoaiSanPhamBUS.LayDanhSachLoaiSanPham(); this.cbDSLoaiSP.DisplayMember = "TENLOAI"; this.cbDSLoaiSP.ValueMember = "MALOAI"; this.cbDSNPP.DataSource = NhaPhanPhoiBUS.LayDanhSachNhaPhanPhoi(); this.cbDSNPP.DisplayMember = "TENNPP"; this.cbDSNPP.ValueMember = "MANPP"; this.cbQLTimKiemLoaiSP.DataSource = LoaiSanPhamBUS.LayDanhSachLoaiSanPham(); this.cbQLTimKiemLoaiSP.DisplayMember = "TENLOAI"; this.cbQLTimKiemLoaiSP.ValueMember = "MALOAI"; this.cbQLTimKiemNPP.DataSource = NhaPhanPhoiBUS.LayDanhSachNhaPhanPhoi(); this.cbQLTimKiemNPP.DisplayMember = "TENNPP"; this.cbQLTimKiemNPP.ValueMember = "MANPP"; }
/// <summary> /// Tab Quan ly san pham /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void LoadDataTabQLSP() { lstSanPham = SanPhamBUS.LayDanhSachSanPham(); lstNhaPP = NhaPhanPhoiBUS.LayDanhSachNhaPhanPhoi(); lstLoaiSp = LoaiSanPhamBUS.LayDanhSachLoaiSanPham(); lstAnhMinhHoa = AnhMinhHoaSPBUS.LayDanhSachAnhMinhHoa(); //var kq = from sp in lstSanPham // //join anhMH in lstAnhMinhHoa // //on sp.MASP equals anhMH.MASP // select new // { // sp.MASP, // sp.TENSP, // sp.SL_TON, // sp.GIABAN, // sp.DVT, // sp.LOAISANPHAM.TENLOAI, // sp.NHAPHANPHOI.TENNPP, // //anhMH.TENANHMINHHOA // }; var kq = from sp in lstSanPham join npp in lstNhaPP on sp.MANPP equals npp.MANPP join lsp in lstLoaiSp on sp.MALOAI equals lsp.MALOAI select new { sp.MASP, sp.TENSP, sp.SL_TON, sp.GIABAN, sp.DVT, lsp.TENLOAI, npp.TENNPP }; this.dgvDSSanPham.AutoGenerateColumns = false; this.dgvQLSanPham.DataSource = kq.ToList(); this.dgvQLSanPham.AutoSize = true; this.dgvQLSanPham.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; }
void LoadDataDSLoaiSP() { lstLoaiSp = LoaiSanPhamBUS.LayDanhSachLoaiSanPham(); this.dgvDsLoaiSP.AutoGenerateColumns = false; this.dgvDsLoaiSP.DataSource = lstLoaiSp; }