コード例 #1
0
        public static void setCurrentVehicle(int vehicleID)
        {
            //Get vehicle make / model

            var context = new seleniumScrapeEntities();

            globalMake = (from v in context.tblVehicles
                          where v.Vehicle_ID_Pk == vehicleID
                          select v.Vehicle_Make).First();

            globalModel = (from db in context.tblVehicles
                           where db.Vehicle_ID_Pk == vehicleID
                           select db.Vehicle_Model).First();

            //var makeList = makeQuery.ToList();



            // IQueryable<string> modelQuery = from db in context.tblVehicles
            //                where db.Vehicle_ID_Pk == vehicleID
            //              select db.Vehicle_Model;



            //var modelList = modelQuery.ToList();



            //   var vehicleData = new Vehicle()
            //                        {
            //                            vehicleMake = makeList[0],
            //                            vehicleModel = modelList[0]
            //                       };
        }
コード例 #2
0
        public static Vehicle GetVehicleData(int vehicleId)
        {
//Get vehicle make / model

            var context = new seleniumScrapeEntities();

            IQueryable <string> makeQuery = from v in context.tblVehicles
                                            where v.Vehicle_ID_Pk == vehicleId
                                            select v.Vehicle_Make;

            var makeList = makeQuery.ToList();



            IQueryable <string> modelQuery = from db in context.tblVehicles
                                             where db.Vehicle_ID_Pk == vehicleId
                                             select db.Vehicle_Model;

            var modelList = modelQuery.ToList();

            var vehicleData = new Vehicle()
            {
                vehicleMake  = makeList[0],
                vehicleModel = modelList[0]
            };

            return(vehicleData);
        }
コード例 #3
0
        public static Vehicle GetVehicleData(int vehicleId)
        {
            //Get vehicle make / model

            var context = new seleniumScrapeEntities();

            IQueryable<string> makeQuery = from v in context.tblVehicles
                            where v.Vehicle_ID_Pk == vehicleId
                            select v.Vehicle_Make;

            var makeList = makeQuery.ToList();

            IQueryable<string> modelQuery = from db in context.tblVehicles
                             where db.Vehicle_ID_Pk == vehicleId
                             select db.Vehicle_Model;

            var modelList = modelQuery.ToList();

            var vehicleData = new Vehicle()
                                  {
                                      vehicleMake = makeList[0],
                                      vehicleModel = modelList[0]
                                  };

            return vehicleData;
        }
コード例 #4
0
        public void SaveToDB(tblVehicle vehicle)
        {
            var ctx = new seleniumScrapeEntities();

            ctx.tblVehicles.AddObject(vehicle);

            ctx.SaveChanges();
        }
コード例 #5
0
        public int InsertSearchSession(tblSearchSession searchSession)
        {
            // Create database context.
            var ctx = new seleniumScrapeEntities();

            ctx.tblSearchSessions.AddObject(searchSession);
            ctx.SaveChanges();

            return(searchSession.Search_Session_ID_PK);
        }
コード例 #6
0
        public IQueryable<tblSearchSession> GetAllHTMLbySearchSession(int searchSessionID)
        {
            var db = new seleniumScrapeEntities();

               var html = from s in db.tblSearchSessions
                      from h in db.tblHtmls
                      where s.Search_Session_ID_PK == 3
                      select s;

               return html;
        }
コード例 #7
0
        private int GetHtmlTableId()
        {
            var ctx = new seleniumScrapeEntities();

            var htmlTableId = (from h in ctx.tblHtmls
                               where h.html_id_pk > 0
                               orderby h.html_id_pk descending
                               select h.html_id_pk).FirstOrDefault();

            return(htmlTableId);
        }
コード例 #8
0
        public IQueryable <tblSearchSession> GetAllHTMLbySearchSession(int searchSessionID)
        {
            var db = new seleniumScrapeEntities();

            var html = from s in db.tblSearchSessions
                       from h in db.tblHtmls
                       where s.Search_Session_ID_PK == 3
                       select s;


            return(html);
        }
コード例 #9
0
        public List<tblVehicle> readSearchVehicles()
        {
            var db = new seleniumScrapeEntities();

               var vehicles = from v in db.tblVehicles
                          where v.Vehicle_WillBeSearched == true
                          select v;

               var vehicleList = vehicles.ToList();

               return vehicleList;
        }
コード例 #10
0
        public List<tblVehicle> GetSingleSearchVehicle(string vehicleModelToSearch)
        {
            var db = new seleniumScrapeEntities();

            var vehicles = from v in db.tblVehicles
                           where v.Vehicle_Model == vehicleModelToSearch
                          select v;

               var vehicleList = vehicles.ToList();

               return vehicleList;
        }
コード例 #11
0
        public void AddNewVehicle()
        {
            string vehicleMake  = "TOYOTA";
            string vehicleModel = "HIACE VAN";

            string country = "Japanese";
            string defined = "Super Robinson";
            string general = "campertronic";



            if (!CheckVehicleExists(vehicleMake, vehicleModel))
            {
                bool countryExists = CheckCountryExists(country);
                bool definedExists = CheckDefinedTypeExists(defined);
                bool generalExists = CheckGeneralTypeExists(general);
                // Create new vehicle object.
                var vehicle = new tblVehicle();
                vehicle.Vehicle_Make  = "Toyota";
                vehicle.Vehicle_Model = "Camroad";


                if (countryExists)
                {
                    SelectExistingCountry(vehicle, "Japanese");
                }
                else
                {
                    // Create new country
                }

                if (generalExists)
                {
                    var db2 = new seleniumScrapeEntities();

                    // Set the Vehicle Defined Type FK (in vehicle table)
                    SelectExistingGeneralType(vehicle, "Camper");
                }
                else
                {
                    // Create new Defined Type.
                }
                if (definedExists)
                {
                    SelectExistingDefinedType(vehicle, "MonsterCar");
                }
                else
                {
                    // Create new general type.
                }
            }
        }
コード例 #12
0
        public List <tblVehicle> readSearchVehicles()
        {
            var db = new seleniumScrapeEntities();

            var vehicles = from v in db.tblVehicles
                           where v.Vehicle_WillBeSearched == true
                           select v;

            var vehicleList = vehicles.ToList();


            return(vehicleList);
        }
コード例 #13
0
        public List <tblVehicle> GetSingleSearchVehicle(string vehicleModelToSearch)
        {
            var db = new seleniumScrapeEntities();

            var vehicles = from v in db.tblVehicles
                           where v.Vehicle_Model == vehicleModelToSearch
                           select v;

            var vehicleList = vehicles.ToList();


            return(vehicleList);
        }
コード例 #14
0
        private void SelectExistingGeneralType(tblVehicle vehicle, string generalType)
        {
            var db2 = new seleniumScrapeEntities();



            // Set the Vehicle Country of Origin FK (in vehicle table)
            vehicle.Vehicle_Type_General_id_fk =
                db2.tblVehicleTypeGenerals.Where(x => x.VehicleTypeGeneral == generalType).Select(
                    x => x.VehicleTypeGeneral_pk).SingleOrDefault();

            db2.Dispose();
        }
コード例 #15
0
        private void SelectExistingDefinedType(tblVehicle vehicle, string definedType)
        {
            var db2 = new seleniumScrapeEntities();



            // Set the Vehicle Country of Origin FK (in vehicle table)
            vehicle.Vehicle_Type_Defined_fk =
                db2.tblVehicleTypeDefineds.Where(x => x.VehicleTypeDefined == definedType).Select(
                    x => x.VehicleTypeDefined_id_pk).SingleOrDefault();

            db2.Dispose();
        }
コード例 #16
0
        private void SelectExistingCountry(tblVehicle vehicle, string country)
        {
            var db2 = new seleniumScrapeEntities();



            // Set the Vehicle Country of Origin FK (in vehicle table)
            vehicle.Vehicle_Type_ID_fk =
                db2.tblVehicleTypeCountries.Where(x => x.Vehicle_Type_Country == country).Select(
                    x => x.Vehicle_Type_Country_ID_pk).SingleOrDefault();

            db2.Dispose();
        }
コード例 #17
0
        public IQueryable <DataRow> getRow()
        {
            var ctx = new seleniumScrapeEntities();


            var query = from hr in ctx.tblHtmlRows
                        where hr.Search_Session_ID_fk == 500
                        select new DataRow()
            {
                id          = hr.html_row_id_PK,
                dataRowHtml = hr.html_row_data
            };

            return(query);
        }
コード例 #18
0
        private bool CheckCountryExists(string p)
        {
            var db = new seleniumScrapeEntities();

            var query = db.tblVehicleTypeCountries.Where(x => x.Vehicle_Type_Country == p);

            if (query.Count() > 0)
            {
                return(false);
            }



            return(true);
        }
コード例 #19
0
        private bool CheckDefinedTypeExists(string defined)
        {
            var db = new seleniumScrapeEntities();

            var query = db.tblVehicleTypeDefineds.Where(x => x.VehicleTypeDefined == defined);

            if (query.Count() > 0)
            {
                return(false);
            }



            return(true);
        }
コード例 #20
0
        private bool CheckGeneralTypeExists(string general)
        {
            var db = new seleniumScrapeEntities();

            var query = db.tblVehicleTypeGenerals.Where(x => x.VehicleTypeGeneral == general);

            if (query.Count() > 0)
            {
                return(false);
            }



            return(true);
        }
コード例 #21
0
        public void TestQuery()
        {
            var db = new seleniumScrapeEntities();

               var sessionCount = (from s in db.tblSearchSessions
                               select s).Count();

               var sessionData = from h in db.tblSearchSessions
                             from s in h.tblHtmls
                             where s.Search_Session_ID_fk == sessionCount
                             select s;

               var filterVehicle = from s in sessionData

                               where s.Vehicle_id_fk == 7
                               select s;
        }
コード例 #22
0
        private bool CheckVehicleExists(string vehicleMake, string vehicleModel)
        {
            var db = new seleniumScrapeEntities();

            //var query = db.tblVehicleTypeCountries.Where(x => x.Vehicle_Type == p);
            var query = db.tblVehicles.Where(x => x.Vehicle_Make == vehicleMake);

            query = db.tblVehicles.Where(x => x.Vehicle_Model == vehicleModel);


            if (query.Count() > 0)
            {
                return(false);
            }



            return(true);;
        }
コード例 #23
0
        public void TestQuery()
        {
            var db = new seleniumScrapeEntities();

            var sessionCount = (from s in db.tblSearchSessions
                                select s).Count();



            var sessionData = from h in db.tblSearchSessions
                              from s in h.tblHtmls
                              where s.Search_Session_ID_fk == sessionCount
                              select s;


            var filterVehicle = from s in sessionData

                                where s.Vehicle_id_fk == 7
                                select s;
        }
コード例 #24
0
 // Constructor.  Pass in the entity context.
 public Repo(seleniumScrapeEntities ctx)
 {
     this._ctx = ctx;
 }