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] // }; }
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); }
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; }
public void SaveToDB(tblVehicle vehicle) { var ctx = new seleniumScrapeEntities(); ctx.tblVehicles.AddObject(vehicle); ctx.SaveChanges(); }
public int InsertSearchSession(tblSearchSession searchSession) { // Create database context. var ctx = new seleniumScrapeEntities(); ctx.tblSearchSessions.AddObject(searchSession); ctx.SaveChanges(); return(searchSession.Search_Session_ID_PK); }
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; }
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); }
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); }
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; }
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; }
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. } } }
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); }
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); }
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(); }
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(); }
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(); }
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); }
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); }
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); }
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); }
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; }
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);; }
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; }
// Constructor. Pass in the entity context. public Repo(seleniumScrapeEntities ctx) { this._ctx = ctx; }