public static DataTable GetPosToWorldspanMapDataTable(TestDataBase testData) { try { DataTable dt = new DataTable(); SqlConnection conn = new SqlConnection(connectionString); SqlCommand cmd = conn.CreateCommand(); conn.Open(); cmd.CommandText = string.Format("SELECT * FROM PoSToWorldspanDefaultSegmentMap WHERE JurisdictionCode = '{0}' " + " and CompanyCode='{1}' and ManagementUnitCode = '{2}'", testData.JurisdictionCountryCode, testData.CompanyCode, testData.ManagementUnitCode); cmd.CommandTimeout = 0; SqlDataAdapter ad = new SqlDataAdapter(cmd); ad.Fill(dt); conn.Close(); return(dt); } catch (Exception ex) { throw new CarException(CarErrorMessage.readDBTableError + " -[PoSToWorldspanDefaultSegmentMap] ", ex); } }
public void setPickupCountryOneWayBool(TestDataBase searchConfigs) { // Support for IATA_GEO code [CDGT001] , handle the format. -- add by v-pxie 2013-5-9 String pickupAirport = searchConfigs.pickupAirport.Substring(0, 3); String dropoffAirport = searchConfigs.dropoffAirport == null ? pickupAirport : searchConfigs.dropoffAirport.Substring(0, 3); pickupCountryCode = CarsInventory.GetCountryCode(pickupAirport); if (pickupAirport.Equals(dropoffAirport)) { this.oneWayBool = 0; } else { this.oneWayBool = 1; } if (searchConfigs.BusinessModelID != CarCommonEnumManager.BusinessModel.Merchant) { this.pickupCountryCode = "'" + pickupCountryCode + "'" + ", ''"; } else { this.pickupCountryCode = "'" + pickupCountryCode + "'"; } }
public void setCarProductCatalogID(TestDataBase searchConfigs) { int tpid = int.Parse(searchConfigs.tpid); this.carProductCatalogID = CarsInventory.GetCarProductCatalogIDByTPID(tpid); //this.carProductCatalogID = CarProductCatalogID.GetByTPID_EAPID(tpid, 0); }
} //"1" or "2,3" --- "1" means on hotel, "2,3" means hotel included(Merchant, Agency hotel all should be included) public CarItemDBQueryInputsFromConfigs(TestDataBase searchConfigs) { setCarProductCatalogID(searchConfigs); setPickupCountryOneWayBool(searchConfigs); setStandaloneBoolFlightHotelOption(searchConfigs); setOnAirportBool(searchConfigs); }
public IActionResult PostResult(JSONWrappers.TestResult jsonResult) { try { if (ModelState.IsValid) { /* Fetching parameters from wrapper class */ ulong subjectID = Convert.ToUInt64(jsonResult.SubjectID); IEnumerable <JSONWrappers.Answer> jsonAnswers = jsonResult.Answers; List <Answer> answers = new List <Answer>(jsonAnswers.Count()); foreach (JSONWrappers.Answer jsonAnswer in jsonAnswers) { answers.Add(Answer.FromJSON(jsonAnswer)); } TestResult result = new TestResult(subjectID, answers); TestDataBase.SubmitTestResult(result); m_Logger.LogInformation($"Submitted test result for subject with ID {subjectID}"); /* Sanding calculated statistics in CSV string format as a response */ return(Ok(result.ToCSVString())); } return(BadRequest(ModelState)); } catch (Exception e) { m_Logger.LogError(e.Message); throw; } }
public IEnumerable <JSONWrappers.SubjectInfo> GetSubjectsInfos() { try { m_Logger.LogDebug("Request for subjects infos"); return(TestDataBase.GetSubjectsInfos()); } catch (Exception e) { m_Logger.LogError(e.Message); throw; } }
public IActionResult PostSubject(JSONWrappers.SubjectInfo jsonInfo) { try { if (ModelState.IsValid) { SubjectInfo info = SubjectInfo.FromJSON(jsonInfo); ulong subjectID = TestDataBase.CreateNewSubject(info); m_Logger.LogInformation($"New subject created with ID {subjectID}"); return(Ok(subjectID)); } return(BadRequest(ModelState)); } catch (Exception e) { m_Logger.LogError(e.Message); throw; } }
public IEnumerable <JSONWrappers.VideoInfo> GetVideoSampleForSubject(ulong id) { try { m_Logger.LogInformation($"Request for video sample by subject with ID {id}"); (EmotionType best, EmotionType worst) = TestDataBase.GetBestAndWorstRecognizedEmotionTypesForSubject(id); if ((best == EmotionType.Undefined) || (worst == EmotionType.Undefined)) { /* There is no subject with this ID */ m_Logger.LogDebug($"Attempt to access non-existent subject with ID {id}"); return(new List <JSONWrappers.VideoInfo>()); } return(VideosDataBase.GetVideoSample(best, worst)); } catch (Exception e) { m_Logger.LogError(e.Message); throw; } }
public void setStandaloneBoolFlightHotelOption(TestDataBase searchConfigs) { uint purchaseTypeMask = searchConfigs.PurchaseTypeMask == null ? 128 : uint.Parse(searchConfigs.PurchaseTypeMask); switch (purchaseTypeMask) { case 4: //HC package this.standaloneBool = 0; this.hotelOption = "2,3"; this.flightOption = 1; break; case 8: //FC package this.standaloneBool = 0; this.hotelOption = "1"; this.flightOption = 2; break; case 16: //FHC package this.standaloneBool = 0; this.hotelOption = "2,3"; this.flightOption = 2; break; case 128: //standalone car this.standaloneBool = 1; this.hotelOption = "1"; this.flightOption = 1; break; case 256: //TC package this.standaloneBool = 0; this.hotelOption = "1"; this.flightOption = 1; break; case 512: //FC bundle this.standaloneBool = 1; this.hotelOption = "1"; this.flightOption = 2; break; case 1024: // HC bundle this.standaloneBool = 1; this.hotelOption = "2,3"; this.flightOption = 1; break; case 4096: // THC package this.standaloneBool = 0; this.hotelOption = "2,3"; this.flightOption = 1; break; case 8192: // FHC bundle this.standaloneBool = 1; this.hotelOption = "2,3"; this.flightOption = 2; break; default: Assert.Fail("Configged purchasetypemask is not a valid value for car"); break; } }
public void setOnAirportBool(TestDataBase searchConfigs) { this.onAirportBool = searchConfigs.isOnAirPort == true ? 1 : 0; }