public List <NhaCungCap> GetNhaCungCap(string sql)
        {
            dp.connect();
            List <NhaCungCap> list = new List <NhaCungCap>();
            {
                string mancc, tencc, sdt, diachi, email;
                try
                {
                    SqlDataReader dr = dp.ExecuteReader(sql);
                    while (dr.Read())
                    {
                        mancc  = dr.GetString(0);
                        tencc  = dr.GetString(1);
                        sdt    = dr.GetString(2);
                        diachi = dr.GetString(3);
                        email  = dr.GetString(4);

                        NhaCungCap em = new NhaCungCap(mancc, tencc, sdt, diachi, email);
                        list.Add(em);
                    }
                    dr.Close();
                    return(list);
                }
                catch (SqlException ex)
                {
                    throw ex;
                }
                finally { dp.disconnect(); }
            }
        }
        public List <KhachHang> GetKhachHang(string sql)
        {
            dp.connect();
            List <KhachHang> list = new List <KhachHang>();
            {
                string makh, hokh, tenkh, gioitinh, sdt, diachi, email;
                try
                {
                    SqlDataReader dr = dp.ExecuteReader(sql);
                    while (dr.Read())
                    {
                        makh  = dr.GetString(0);
                        hokh  = dr.GetString(1);
                        tenkh = dr.GetString(2);
                        // ngaysinh = dr.GetString(3);
                        gioitinh = dr.GetString(4);
                        diachi   = dr.GetString(5);
                        sdt      = dr.GetString(6);
                        email    = dr.GetString(7);

                        KhachHang em = new KhachHang(makh, hokh, tenkh, gioitinh, sdt, diachi, email);
                        list.Add(em);
                    }
                    dr.Close();
                    return(list);
                }
                catch (SqlException ex)
                {
                    throw ex;
                }
                finally { dp.disconnect(); }
            }
        }
Example #3
0
        public List <HoaDonNhap> GetHoaDonNhap(string sql)
        {
            dp.connect();
            List <HoaDonNhap> list = new List <HoaDonNhap>();
            {
                int    soluong, dongia;
                string manhap, manv, mancc, tenxe;
                try
                {
                    SqlDataReader dr = dp.ExecuteReader(sql);
                    while (dr.Read())
                    {
                        manhap  = dr.GetString(0);
                        manv    = dr.GetString(1);
                        mancc   = dr.GetString(2);
                        tenxe   = dr.GetString(4);
                        soluong = dr.GetInt32(5);
                        dongia  = dr.GetInt32(6);

                        HoaDonNhap em = new HoaDonNhap(manhap, manv, mancc, tenxe, soluong, dongia);
                        list.Add(em);
                    }
                    dr.Close();
                    return(list);
                }
                catch (SqlException ex)
                {
                    throw ex;
                }
                finally { dp.disconnect(); }
            }
        }
        public List <ChiTietXe> GetChiTietXe(string sql)
        {
            dp.connect();
            List <ChiTietXe> list = new List <ChiTietXe>();
            {
                int    trongluong, hopso, dungtichbinhxang, dungtichxilanh;
                string sokhung, somay, mausac, maxe;
                try
                {
                    SqlDataReader dr = dp.ExecuteReader(sql);
                    while (dr.Read())
                    {
                        sokhung          = dr.GetString(0);
                        somay            = dr.GetString(1);
                        maxe             = dr.GetString(2);
                        mausac           = dr.GetString(3);
                        trongluong       = dr.GetInt32(4);
                        hopso            = dr.GetInt32(5);
                        dungtichbinhxang = dr.GetInt32(6);
                        dungtichxilanh   = dr.GetInt32(7);

                        ChiTietXe em = new ChiTietXe(sokhung, somay, maxe, mausac, trongluong, hopso, dungtichbinhxang, dungtichxilanh);
                        list.Add(em);
                    }
                    dr.Close();
                    return(list);
                }
                catch (SqlException ex)
                {
                    throw ex;
                }
                finally { dp.disconnect(); }
            }
        }
Example #5
0
        public List <XeTrongCuaHang> GetXeTrongCuaHang(string sql)
        {
            dp.connect();
            List <XeTrongCuaHang> list = new List <XeTrongCuaHang>();
            {
                string maxe, manhap, maxuat, tenxe;
                int    dongianhap, dongiaxuat;
                try
                {
                    SqlDataReader dr = dp.ExecuteReader(sql);
                    while (dr.Read())
                    {
                        maxe       = dr.GetString(0);
                        manhap     = dr.GetString(1);
                        maxuat     = dr.GetString(2);
                        tenxe      = dr.GetString(3);
                        dongianhap = dr.GetInt32(4);
                        dongiaxuat = dr.GetInt32(5);

                        XeTrongCuaHang em = new XeTrongCuaHang(maxe, manhap, maxuat, tenxe, dongianhap, dongiaxuat);
                        list.Add(em);
                    }
                    dr.Close();
                    return(list);
                }
                catch (SqlException ex)
                {
                    throw ex;
                }
                finally { dp.disconnect(); }
            }
        }
Example #6
0
        public List <HangTonKho> GetHangTonKho(string sql)
        {
            dp.connect();
            List <HangTonKho> list = new List <HangTonKho>();
            {
                int    thang, nam, thoigiantonkho;
                string maxe;
                try
                {
                    SqlDataReader dr = dp.ExecuteReader(sql);
                    while (dr.Read())
                    {
                        thang          = dr.GetInt32(0);
                        nam            = dr.GetInt32(1);
                        maxe           = dr.GetString(2);
                        thoigiantonkho = dr.GetInt32(3);

                        HangTonKho em = new HangTonKho(thang, nam, maxe, thoigiantonkho);
                        list.Add(em);
                    }
                    dr.Close();
                    return(list);
                }
                catch (SqlException ex)
                {
                    throw ex;
                }
                finally { dp.disconnect(); }
            }
        }
Example #7
0
        public List <Account> GetAccount(string sql)
        {
            dp.connect();
            List <Account> list = new List <Account>();
            {
                string user, pass;
                try
                {
                    SqlDataReader dr = dp.ExecuteReader(sql);
                    while (dr.Read())
                    {
                        user = dr.GetString(0);
                        pass = dr.GetString(1);

                        Account em = new Account(user, pass);
                        list.Add(em);
                    }
                    dr.Close();
                    return(list);
                }
                catch (SqlException ex)
                {
                    throw ex;
                }
                finally { dp.disconnect(); }
            }
        }
        public List <NhanVien> GetNhanVien(string sql)
        {
            dp.connect();
            List <NhanVien> list = new List <NhanVien>();
            {
                int    luong;
                string manv, honv, tennv, chucvu, sdt, diachi, email, gioitinh;
                try
                {
                    SqlDataReader dr = dp.ExecuteReader(sql);
                    while (dr.Read())
                    {
                        manv  = dr.GetString(0);
                        honv  = dr.GetString(1);
                        tennv = dr.GetString(2);
                        // ngaysinh = dr.GetString(3);
                        gioitinh = dr.GetString(4);
                        luong    = dr.GetInt32(5);
                        chucvu   = dr.GetString(6);
                        diachi   = dr.GetString(7);
                        sdt      = dr.GetString(8);
                        email    = dr.GetString(9);

                        NhanVien em = new NhanVien(manv, honv, tennv, gioitinh, luong, chucvu, diachi, sdt, email);
                        list.Add(em);
                    }
                    dr.Close();
                    return(list);
                }
                catch (SqlException ex)
                {
                    throw ex;
                }
                finally { dp.disconnect(); }
            }
        }