public static string GetCurrencyCodeByPOS(string JurisdictionCode, string companyCode, string managementUnitCode)
        {
            String countryCode = "";
            string databaseConfigurationMaster = CarsInventory.GetDatabaseFromConnectionString(connectionString);
            string databaseCarsInventory       = CarsInventory.GetDatabaseFromConnectionString(ConfigurationManager.ConnectionStrings["CarsInventory"].ConnectionString);

            using (SqlConnection conn = new SqlConnection(connectionString))
            {
                SqlCommand cmd = conn.CreateCommand();
                conn.Open();
                cmd.CommandText = String.Format("select b.CurrencyCodeDefault as CountryCode from {3}..TravelProductDomain a " +
                                                "join {3}..Country b on a.CountryCode = b.CountryCode " +
                                                "join {4}..TPIDToPoSAttributeMap c on c.TravelProductID = a.TravelProductID " +
                                                "where c.CompanyCode = '{0}' and c.JurisdictionCode = '{1}' and c.ManagementUnitCode = '{2}'  and c.PartnerID = '0' ",
                                                companyCode, JurisdictionCode, managementUnitCode, databaseConfigurationMaster, databaseCarsInventory);


                cmd.CommandTimeout = 0;

                DataTable      dt = new DataTable();
                SqlDataAdapter ad = new SqlDataAdapter(cmd);
                ad.Fill(dt);
                conn.Close();
                foreach (DataRow dr in dt.Rows)
                {
                    countryCode = dr["CountryCode"].ToString();
                }
            }

            return(countryCode);
        }
        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);
        }
Пример #4
0
        // ASCS table - suppierConfig
        public static void CheckSupplierConfigFeatureEnable(string configSettingName, string expectedvalue, TestDataReserve testData, bool isUpdateIfNotMatch = false)
        {
            string enableValue = null;
            //create a configuration request data instance
            ConfigSettingRequestData configSettingRequestData = new ConfigSettingRequestData("CarBSUri", ConfigSettingType.Supplier);

            configSettingRequestData.TUID = testData.tuid;
            // get the feature turned value from DB
            string envKey     = ConfigurationManager.AppSettings["EnvironmentName"];
            uint   supplierID = CarsInventory.GetSupplyIDByVendorCode(testData.vendorCode);
            ConfigurationDBHelper configDb = new ConfigurationDBHelper(CarCommonEnumManager.ServieProvider.Amadeus, ConfigSettingType.Supplier);

            ///1. mach as EnviromentName and POS's 3 values
            enableValue = configDb.SettingValueSupplierGet(configSettingName, envKey, supplierID.ToString());
            if (enableValue != null)
            {
                // set configuration data by expectedValue where configName/envKey/supplierID have values
                configSettingRequestData.ConfigSettingDataAdd(new ConfigurationSettingData(env: envKey, sName: configSettingName, sValue: expectedvalue
                                                                                           , jCode: null, cCode: null, mUnitCode: null, cID: null, sID: supplierID.ToString()));
                //mach value
                MachExpectedValueinDB(expectedvalue, enableValue, configSettingName, testData.tuid, isUpdateIfNotMatch, configSettingRequestData);
            }
            else
            {
                ///2. if 1 is null, mach withthout EnviromentName
                enableValue = configDb.SettingValueSupplierGet(configSettingName, null, supplierID.ToString());
                if (enableValue != null)
                {
                    // set configuration data by expectedValue where configName/supplierID have values
                    configSettingRequestData.ConfigSettingDataAdd(new ConfigurationSettingData(env: null, sName: configSettingName, sValue: expectedvalue
                                                                                               , jCode: null, cCode: null, mUnitCode: null, cID: null, sID: supplierID.ToString()));
                    //mach value
                    MachExpectedValueinDB(expectedvalue, enableValue, configSettingName, testData.tuid, isUpdateIfNotMatch, configSettingRequestData);
                }
                else
                {
                    ///2. if 1 is null, mach withthout EnviromentName
                    enableValue = configDb.SettingValueSupplierGet(configSettingName, null, null);
                    if (enableValue != null)
                    {
                        // set configuration data by expectedValue where configName have values
                        configSettingRequestData.ConfigSettingDataAdd(new ConfigurationSettingData(env: null, sName: configSettingName, sValue: expectedvalue
                                                                                                   , jCode: null, cCode: null, mUnitCode: null, cID: null, sID: null));
                        //mach value
                        MachExpectedValueinDB(expectedvalue, enableValue, configSettingName, testData.tuid, isUpdateIfNotMatch, configSettingRequestData);
                    }
                    else
                    {
                        Assert.Fail("No enable feature value  for " + configSettingName + "in DB,please check the DB.");
                    }
                }
            }
        }
        public GetCarCostAndAvailGetInputs(CarProduct car, bool myOnAirportSearchBool)
        {
            CarInventoryKey key = car.CarInventoryKey;

            pCarAgreementID         = key.CarRate.CarAgreementID;
            pAirportCode            = key.CarCatalogKey.CarPickupLocationKey.LocationCode;
            pPickUpDate             = key.CarPickUpDateTime;
            pDropOffDate            = key.CarDropOffDateTime;
            pCarCategoryID          = key.CarCatalogKey.CarVehicle.CarCategoryCode;
            pCarTypeID              = key.CarCatalogKey.CarVehicle.CarTypeCode;
            pCarTransmissionDriveID = key.CarCatalogKey.CarVehicle.CarTransmissionDriveCode;
            pCarFuelAirConditionID  = key.CarCatalogKey.CarVehicle.CarFuelACCode;
            pCarVendorCode          = CarsInventory.GetVendorCodeFromCarVendor(key.CarCatalogKey.VendorSupplierID);
            pCarVendorLocationCode  = key.CarCatalogKey.CarPickupLocationKey.CarLocationCategoryCode + key.CarCatalogKey.CarPickupLocationKey.SupplierRawText;
            pOnAirportSearchBool    = myOnAirportSearchBool;
        }
Пример #6
0
        //We need to get the correct connect string to support Int testing - different TravServer in EU and NA
        public static string getConnectString(int tpid)
        {
            string connString = "";

            //Get TravServer config if exist
            if (null != ConfigurationManager.ConnectionStrings["TravServer"])
            {
                connString = ConfigurationManager.ConnectionStrings["TravServer"].ConnectionString;
            }

            //Get POS from tpid
            List <PointOfSaleKey> poses = CarsInventory.getPointOfSaleRecord(tpid);
            //Get travServer beanName based on POS
            string travSBeanName = ServiceConfigUtil.getCarBSConfig(ServiceConfigSettingName.TravServe_BeanName, poses[0]);

            //Get travServer name based on bean name
            if (travSBeanName.Contains("US"))
            {
                //Get TravServerUS config if exist
                if (null != ConfigurationManager.ConnectionStrings["TravServerUS"])
                {
                    connString = ConfigurationManager.ConnectionStrings["TravServerUS"].ConnectionString;
                }
                //If no TravServerUS and TravServer configed, throw an exception
                if (connString.Length == 0)
                {
                    throw new Exception("Please make sure TravServer or TravServerUS is congied for NA POS!");
                }
            }
            else if (travSBeanName.Contains("EU"))
            {
                if (null != ConfigurationManager.ConnectionStrings["TravServerEU"])
                {
                    connString = ConfigurationManager.ConnectionStrings["TravServerEU"].ConnectionString;
                }
                //If no TravServerEU and TravServer configed, throw an exception
                if (connString.Length == 0)
                {
                    throw new Exception("Please make sure TravServer or TravServerEU is congied for EU POS!");
                }
            }

            return(connString);
        }