コード例 #1
0
        public DataTable LayDanhSachMatHang()
        {
            DataTable data = new DataTable();
            try
            {
                data = this._MatHangDAL.LayDanhSachMatHang();

                foreach (DataRow row in data.Rows)
                {
                    _loaiMHDAL = new LoaiMatHangDAL();
                    row["Loại mặt hàng"] = _loaiMHDAL.LayTenLoaiMatHang(row["Loại mặt hàng"].ToString());
                    _nhaSXDAL = new NhaSanXuatDAL();
                    row["Nhà sản xuất"] = _nhaSXDAL.LayTenNhaSanXuat(row["Nhà sản xuất"].ToString());

                }
                return data;
            }
            catch (System.Exception ex)
            {
                Console.WriteLine("Message= {1}", ex.Message);
            }
            return null;
        }
コード例 #2
0
        /*   public DataTable TimKiemMatHang(MatHang matHang, int kichThuoc, string heDieuHanh, string mauSac,
            int pin, int soSim, int ram, int boNho, string maCPU)
        {
            try
            {
                return this._MatHangDAL.TimKiemMatHang(matHang, kichThuoc, heDieuHanh,  mauSac,
                     pin, soSim, ram,boNho, maCPU);
            }
            catch (System.Exception ex)
            {
                Console.WriteLine("Message= {1}", ex.Message);
            }
            return null;
        }*/
        public DataTable TimKiemMatHang(MatHang matHang, decimal kichThuoc, string heDieuHanh, string mauSac,
           int pin, int soSim, int ram, int boNho, string maCPU)
        {
            DataTable data = new DataTable();
            try
            {
                data = this._MatHangDAL.TimKiemMatHang(matHang, kichThuoc, heDieuHanh, mauSac,
                     pin, soSim, ram, boNho, maCPU);

                foreach (DataRow row in data.Rows)
                {
                    _loaiMHDAL = new LoaiMatHangDAL();
                    string r2 = row[2].ToString();
                    row[2] = _loaiMHDAL.LayTenLoaiMatHang(r2);
                    _nhaSXDAL = new NhaSanXuatDAL();
                    row[3] = _nhaSXDAL.LayTenNhaSanXuat(row[3].ToString());

                }
                return data;
            }
            catch (System.Exception ex)
            {
                Console.WriteLine("Message= {1}", ex.Message);
            }
            return null;
        }