Пример #1
0
        public PhoneNumber(String thePhoneNumber, CountryEnum theCountry)
        {
            _raw         = thePhoneNumber;
            _country     = theCountry;
            _countryCode = new Char[16];
            _areaCode    = new Char[16];
            _lineNumber  = new Char[16];
            _extension   = new Char[16];
            _valid       = false;
            //_pattern = @"^(\d{3})\D?\d{3}\D?\d{4}$";//default to USA
            _pattern = "(^\\()(?<=\\()(\\d{3})(?=\\))(\\))(\\d{3})(-)(\\d{4})";//default to USA
            switch (theCountry)
            {
            case CountryEnum.United_States:
                _formatMsg = "(AAA)NNN-NNNN";
                _pattern   = "(^\\()(?<=\\()(\\d{3})(?=\\))(\\))(\\d{3})(-)(\\d{4})";
                Match match = Regex.Match(thePhoneNumber, _pattern, RegexOptions.IgnoreCase);
                _valid = !thePhoneNumber.StartsWith("(0") && match.Success;
                if (_valid)
                {
                    _countryCode = ("1").ToCharArray();    //get from DB?
                    _areaCode    = match.Groups[2].Value.ToCharArray();
                    _lineNumber  = (match.Groups[4].Value + match.Groups[6].Value).ToCharArray();
                }
                break;

            default:
                break;
            }
        }
 public VehicleCountryHelper(CountryEnum countryEnum, string name, string abbreviation)
 {
     Id = (int)countryEnum;
     CountryEnum = countryEnum;
     Name = name;
     Abbreviation = abbreviation;
 }
Пример #3
0
        public BaseResponse <ListAllCitiesPerStateResponse> ListAllCitiesPerState(CountryEnum country, string state)
        {
            var response = new BaseResponse <ListAllCitiesPerStateResponse>();

            var restRequest = new RestRequest("{country}/{state}/cities", Method.GET);

            restRequest.AddUrlSegment("country", country.ToString());
            restRequest.AddUrlSegment("state", state);
            restRequest.RequestFormat = DataFormat.Json;

            var restResponse = this.RestClient.Execute <List <string> >(restRequest);

            if (restResponse.ErrorException != null)
            {
                throw restResponse.ErrorException;
            }

            response.StatusCode = restResponse.StatusCode;
            if (restResponse.StatusCode == HttpStatusCode.OK)
            {
                response.IsSuccess   = true;
                response.Data        = new ListAllCitiesPerStateResponse();
                response.Data.Cities = restResponse.Data;
            }
            else
            {
                response.IsSuccess = false;
            }

            return(response);
        }
 private VehicleCountryHelper(CountryEnum countryEnum, string name, string abbreviation)
 {
     Id           = (int)countryEnum;
     CountryEnum  = countryEnum;
     Name         = name;
     Abbreviation = abbreviation;
 }
Пример #5
0
        private string BuildUrlByParams(GenderEnum gender, CountryEnum country, string url)
        {
            string genderValue = gender.ToString();

            return(string.Format("{0}/gender={1}&region={2}", url, genderValue, "portugal"));
            //return string.Format("{0}/gender={1}&region={2}", url, genderValue, "portugal");
        }
Пример #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BankInfo" /> class.
 /// </summary>
 /// <param name="bic">Business Identifier Code of account servicing institution according to ISO 9362. (required).</param>
 /// <param name="country">Country code according to ISO Alpha-2 (required).</param>
 /// <param name="name">Unit name (required).</param>
 public BankInfo(BicEnum bic = default(BicEnum), CountryEnum country = default(CountryEnum), string name = default(string))
 {
     // to ensure "bic" is required (not null)
     if (bic == null)
     {
         throw new InvalidDataException("bic is a required property for BankInfo and cannot be null");
     }
     else
     {
         this.Bic = bic;
     }
     // to ensure "country" is required (not null)
     if (country == null)
     {
         throw new InvalidDataException("country is a required property for BankInfo and cannot be null");
     }
     else
     {
         this.Country = country;
     }
     // to ensure "name" is required (not null)
     if (name == null)
     {
         throw new InvalidDataException("name is a required property for BankInfo and cannot be null");
     }
     else
     {
         this.Name = name;
     }
 }
Пример #7
0
        public static double GetRiskFreeRate(CountryEnum country)
        {
            // ReSharper disable once AsyncConverter.AsyncWait
            var allRates = PersistenceService.Instance.GetAllRiskFreeRates().Result;

            return((allRates.SingleOrDefault(r => r.Country == (int)country) ?? new RiskFreeRateDTO(country, 0d)).Rate);
        }
Пример #8
0
        public static List <Holiday> Holidays(int year, CountryEnum country)
        {
            var holidays = new List <Holiday>();

            var ed = EasterDate(year);

            switch (country)
            {
            case CountryEnum.fr:
                holidays.Add(new Holiday(new DateTime(year, 1, 1), "Jour de l'an"));
                holidays.Add(new Holiday(ed.AddDays(-2), "Vendredi Saint", "Alsace-Moselle"));
                holidays.Add(new Holiday(ed, "Dimanche de Pâques"));
                holidays.Add(new Holiday(ed.AddDays(1), "Lundi de Pâques"));
                holidays.Add(new Holiday(new DateTime(year, 5, 1), "Fête du travail"));
                holidays.Add(new Holiday(new DateTime(year, 5, 8), "Victoire des alliés 1945"));
                holidays.Add(new Holiday(ed.AddDays(39), "Jeudi de l'ascension"));
                holidays.Add(new Holiday(ed.AddDays(49), "Dimanche de Pentecôte"));
                holidays.Add(new Holiday(ed.AddDays(50), "Lundi de Pentecôte"));
                holidays.Add(new Holiday(new DateTime(year, 7, 14), "Fête Nationale"));
                holidays.Add(new Holiday(new DateTime(year, 8, 15), "Assomption"));
                holidays.Add(new Holiday(new DateTime(year, 11, 1), "Toussaint"));
                holidays.Add(new Holiday(new DateTime(year, 11, 11), "Armistice 1918"));
                holidays.Add(new Holiday(new DateTime(year, 12, 25), "Jour de Noël"));
                holidays.Add(new Holiday(new DateTime(year, 12, 26), "Saint Etienne", "Alsace"));
                break;
            }

            return(holidays);
        }
Пример #9
0
 public Promotion(String Promotion, String Owner, String PromotionName, PromotionStyles PromotionStyle, CountryEnum PromotionRegion)
 {
     promotionID = Promotion;
     ownerID     = Owner;
     name        = PromotionName;
     style       = PromotionStyle;
     region      = PromotionRegion;
 }
Пример #10
0
        public async Task <string> Generate(GenderEnum gender, CountryEnum country)
        {
            var response = this.httpClient.GetAsync(appSettings.NameGeneratorUrl);

            string nameGenerated = await response.Result.Content.ReadAsStringAsync();

            var result = Newtonsoft.Json.JsonConvert.DeserializeObject <dynamic>(nameGenerated);

            return(string.Format("{0} {1}", result.name, result.surname));
        }
Пример #11
0
        public IDelivery Get(CountryEnum country)
        {
            IDelivery result = null;

            if (deliveryDictionary.ContainsKey(country))
            {
                result = deliveryDictionary[country];
            }

            return(result);
        }
Пример #12
0
        public static string GetPrefix(CountryEnum countryEnum)
        {
            switch (countryEnum)
            {
            case CountryEnum.Singapore:
                return("XSES:");

            case CountryEnum.Portugal:
                return("XLIS:");

            default:
                return(string.Empty);
            }
        }
Пример #13
0
        /// <summary>
        /// Factory for Convert Value based on region
        /// </summary>
        /// <param name="eCountryEnum"></param>
        /// <param name="logger"></param>
        /// <returns></returns>
        public static IConverterProcessor GetProcessorFactory(CountryEnum eCountryEnum, ILogger logger)
        {
            switch (eCountryEnum)
            {
            case CountryEnum.British:
                return(new BritishConvertProcessor(logger));

            case CountryEnum.Asia:
                return(new AsiaConvertProcessor(logger));

            case CountryEnum.UnitedState:
                return(new AsiaConvertProcessor(logger));
            }

            return(new BritishConvertProcessor(logger));
        }
Пример #14
0
 public static String Get4Display_GovenmentID(CountryEnum country, String govIDTypeCode, String govID)
 {
     string retVal = govIDTypeCode + "-";
     switch(country)
     {
         case CountryEnum.United_States:
             govID = String.IsNullOrWhiteSpace(govID) ? "????" : govID;
             retVal += govID.Length < 4 ? string.Empty : govID.GetLast(4);
             break;
         case CountryEnum.Earth:
         default:
             retVal += govID;
             break;
     }
     return retVal;
 }
Пример #15
0
        public override ICountry CreateObject(CountryEnum objectType)
        {
            switch (objectType)
            {
            case CountryEnum.BR:
                return(new Brazil());

            case CountryEnum.USA:
                return(new UnitedStatesOfAmerica());

            case CountryEnum.FR:
                return(new France());

            default:
                throw new Exception("Type not found!");
            }
        }
Пример #16
0
        private CountryEnum GetCountry(string address)
        {
            string      result      = string.Empty;
            CountryEnum countryName = CountryEnum.NONE;

            string[] list = address.Split(',');
            list.Reverse();
            foreach (var item in list)
            {
                if (CountryEnum.IsDefined(typeof(CountryEnum), item.ToUpper()))
                {
                    countryName = (CountryEnum)Enum.Parse(typeof(CountryEnum), (string)item.ToUpper());
                    break;
                }
            }

            return(countryName);
        }
Пример #17
0
        public bool IsValidChecksum(string vatin)
        {
            if (string.IsNullOrEmpty(vatin))
            {
                return(false);
            }

            var clearedVatin = RemoveEmptyPieces(vatin);

            if (clearedVatin.Length < 3)
            {
                return(false);
            }

            var country = CountryEnum.GetByCode(vatin.Substring(0, 2));

            return(country.IsValidChecksum(vatin));
        }
Пример #18
0
        public int UpdateDictionaryVersion(string value, CountryEnum settingName, string email, string serviceCode)
        {
            var setting = GetDictionaryVersion(settingName, email, serviceCode);

            if (setting == null)
            {
                setting = new Settings
                {
                    Name        = settingName.ToString(),
                    Email       = email,
                    Value       = value,
                    ServiceCode = serviceCode
                };
                return(base.Insert <Settings>(base.MainDbPath, setting));
            }
            else
            {
                setting.Value = value;
                return(base.Update <Settings>(base.MainDbPath, setting));
            }
        }
Пример #19
0
        public PhoneNumberAREA(String theAreaCode, CountryEnum theCountry)
        {
            _raw      = theAreaCode;
            _country  = theCountry;
            _areaCode = new Char[16];
            _valid    = false;
            switch (theCountry)
            {
            case CountryEnum.United_States:
                _formatMsg  = "AAA";
                theAreaCode = Regex.Replace(theAreaCode, "[^0-9]", "");
                _valid      = !theAreaCode.StartsWith("0") && (theAreaCode.Length == 3);
                if (_valid)
                {
                    _areaCode = theAreaCode.ToCharArray();
                }
                break;

            default:
                break;
            }
        }
Пример #20
0
        public PhoneNumberLINE(String theLineNumber, CountryEnum theCountry)
        {
            _raw        = theLineNumber;
            _country    = theCountry;
            _lineNumber = new Char[16];
            _valid      = false;
            _pattern    = "(\\d{3})(-)(\\d{4})";//default to USA
            switch (theCountry)
            {
            case CountryEnum.United_States:
                _formatMsg = "NNN-NNNN";
                _pattern   = "(\\d{3})(-)(\\d{4})";
                Match match = Regex.Match(theLineNumber, _pattern, RegexOptions.IgnoreCase);
                _valid = theLineNumber.Length == 8 && match.Success;
                if (_valid)
                {
                    _lineNumber = match.Value.ToCharArray();
                }
                break;

            default:
                break;
            }
        }
Пример #21
0
 public Version(ApplicationEnum application, EditionEnum edition, CountryEnum country)
 {
     this.Applicagtion = application;
     this.Edition      = edition;
     this.Country      = country;
 }
Пример #22
0
        public static Valuation CalculateValuations(
            CountryEnum country,
            double coe,
            double dividend,
            double dividendGrowth,
            double earnings,
            double bookValue,
            double averageEarnings,
            double averagePE,
            double netIncome,
            double netIncomeGrowth,
            double shares)
        {
            var riskFreeRate       = GetRiskFreeRate(country) / 100d;
            var factorRiskFreeRate = 1d + riskFreeRate;

            netIncomeGrowth /= 100d;
            var terminalGrowth = netIncomeGrowth;

            if (terminalGrowth < 0)
            {
                terminalGrowth = 0d;
            }
            else
            {
                terminalGrowth /= 2d;
            }

            if (terminalGrowth < riskFreeRate)
            {
                terminalGrowth = riskFreeRate;
            }

            Valuation result = new Valuation
            {
                EarningsPower = new Range
                {
                    Min = earnings / Math.Max(coe, riskFreeRate),
                    Max = 1.1d * earnings / Math.Max(coe, riskFreeRate)
                },
                DD = new Range
                {
                    Min = dividend / (coe - dividendGrowth > 0 ? coe - dividendGrowth : riskFreeRate),
                    Max = dividend * factorRiskFreeRate / (coe - dividendGrowth > 0 ? coe - dividendGrowth : riskFreeRate),
                },
                SP = new Range
                {
                    Min = ((earnings * riskFreeRate) / (coe * coe)) + (dividend / coe),
                    Max = ((earnings * factorRiskFreeRate * (1.1d * riskFreeRate)) / (coe * coe)) + (dividend * factorRiskFreeRate / coe)
                },
                Graham = new Range
                {
                    Min = Math.Sqrt(22.5d * earnings * bookValue),
                    Max = Math.Sqrt(22.5d * 1.1d * earnings * bookValue),
                },
                PEBased = new Range
                {
                    Min = averageEarnings * averagePE,
                    Max = 1.1d * averageEarnings * averagePE,
                },
                Dfc = new Range
                {
                    Min = GetDcfTwoStages(shares, netIncome, netIncomeGrowth, 10, terminalGrowth, Math.Max(coe, riskFreeRate)),
                    Max = GetDcfTwoStages(shares, netIncome * factorRiskFreeRate, netIncomeGrowth, 10, terminalGrowth, Math.Max(coe, riskFreeRate)),
                }
            };

            result.Weighted = new Range
            {
                Min = new[] { result.Dfc.Min, result.EarningsPower.Min, result.DD.Min, result.SP.Min, result.Graham.Min, result.PEBased.Min }.Where(x => x > 0).Average(),
                Max = new[] { result.Dfc.Max, result.EarningsPower.Max, result.DD.Max, result.SP.Max, result.Graham.Max, result.PEBased.Max }.Where(x => x > 0).Average()
            };

            result.MarginSafety = new Range {
                Min = result.Weighted.Min * 0.80d, Max = result.Weighted.Max * 0.80d
            };

            return(result);
        }
Пример #23
0
        /// <summary>
        /// Converts a CountryEnum value to a corresponding string value
        /// </summary>
        /// <param name="enumValue">The CountryEnum value to convert</param>
        /// <returns>The representative string value</returns>
        public static string ToValue(CountryEnum enumValue)
        {
            switch (enumValue)
            {
            //only valid enum elements can be used
            //this is necessary to avoid errors
            case CountryEnum.UNDEFINED:
            case CountryEnum.AC:
            case CountryEnum.AD:
            case CountryEnum.AE:
            case CountryEnum.AF:
            case CountryEnum.AG:
            case CountryEnum.AI:
            case CountryEnum.AL:
            case CountryEnum.AM:
            case CountryEnum.AN:
            case CountryEnum.AO:
            case CountryEnum.AQ:
            case CountryEnum.AR:
            case CountryEnum.AS:
            case CountryEnum.AT:
            case CountryEnum.AU:
            case CountryEnum.AW:
            case CountryEnum.AX:
            case CountryEnum.AZ:
            case CountryEnum.BA:
            case CountryEnum.BB:
            case CountryEnum.BD:
            case CountryEnum.BE:
            case CountryEnum.BF:
            case CountryEnum.BG:
            case CountryEnum.BH:
            case CountryEnum.BI:
            case CountryEnum.BJ:
            case CountryEnum.BL:
            case CountryEnum.BM:
            case CountryEnum.BN:
            case CountryEnum.BO:
            case CountryEnum.BQ:
            case CountryEnum.BR:
            case CountryEnum.BS:
            case CountryEnum.BT:
            case CountryEnum.BU:
            case CountryEnum.BV:
            case CountryEnum.BW:
            case CountryEnum.BY:
            case CountryEnum.BZ:
            case CountryEnum.CA:
            case CountryEnum.CC:
            case CountryEnum.CD:
            case CountryEnum.CF:
            case CountryEnum.CG:
            case CountryEnum.CH:
            case CountryEnum.CI:
            case CountryEnum.CK:
            case CountryEnum.CL:
            case CountryEnum.CM:
            case CountryEnum.CN:
            case CountryEnum.CO:
            case CountryEnum.CP:
            case CountryEnum.CR:
            case CountryEnum.CS:
            case CountryEnum.CU:
            case CountryEnum.CV:
            case CountryEnum.CW:
            case CountryEnum.CX:
            case CountryEnum.CY:
            case CountryEnum.CZ:
            case CountryEnum.DE:
            case CountryEnum.DG:
            case CountryEnum.DJ:
            case CountryEnum.DK:
            case CountryEnum.DM:
            case CountryEnum.DO:
            case CountryEnum.DZ:
            case CountryEnum.EA:
            case CountryEnum.EC:
            case CountryEnum.EE:
            case CountryEnum.EG:
            case CountryEnum.EH:
            case CountryEnum.ER:
            case CountryEnum.ES:
            case CountryEnum.ET:
            case CountryEnum.EU:
            case CountryEnum.EZ:
            case CountryEnum.FI:
            case CountryEnum.FJ:
            case CountryEnum.FK:
            case CountryEnum.FM:
            case CountryEnum.FO:
            case CountryEnum.FR:
            case CountryEnum.FX:
            case CountryEnum.GA:
            case CountryEnum.GB:
            case CountryEnum.GD:
            case CountryEnum.GE:
            case CountryEnum.GF:
            case CountryEnum.GG:
            case CountryEnum.GH:
            case CountryEnum.GI:
            case CountryEnum.GL:
            case CountryEnum.GM:
            case CountryEnum.GN:
            case CountryEnum.GP:
            case CountryEnum.GQ:
            case CountryEnum.GR:
            case CountryEnum.GS:
            case CountryEnum.GT:
            case CountryEnum.GU:
            case CountryEnum.GW:
            case CountryEnum.GY:
            case CountryEnum.HK:
            case CountryEnum.HM:
            case CountryEnum.HN:
            case CountryEnum.HR:
            case CountryEnum.HT:
            case CountryEnum.HU:
            case CountryEnum.IC:
            case CountryEnum.ID:
            case CountryEnum.IE:
            case CountryEnum.IL:
            case CountryEnum.IM:
            case CountryEnum.IN:
            case CountryEnum.IO:
            case CountryEnum.IQ:
            case CountryEnum.IR:
            case CountryEnum.IS:
            case CountryEnum.IT:
            case CountryEnum.JE:
            case CountryEnum.JM:
            case CountryEnum.JO:
            case CountryEnum.JP:
            case CountryEnum.KE:
            case CountryEnum.KG:
            case CountryEnum.KH:
            case CountryEnum.KI:
            case CountryEnum.KM:
            case CountryEnum.KN:
            case CountryEnum.KP:
            case CountryEnum.KR:
            case CountryEnum.KW:
            case CountryEnum.KY:
            case CountryEnum.KZ:
            case CountryEnum.LA:
            case CountryEnum.LB:
            case CountryEnum.LC:
            case CountryEnum.LI:
            case CountryEnum.LK:
            case CountryEnum.LR:
            case CountryEnum.LS:
            case CountryEnum.LT:
            case CountryEnum.LU:
            case CountryEnum.LV:
            case CountryEnum.LY:
            case CountryEnum.MA:
            case CountryEnum.MC:
            case CountryEnum.MD:
            case CountryEnum.ME:
            case CountryEnum.MF:
            case CountryEnum.MG:
            case CountryEnum.MH:
            case CountryEnum.MK:
            case CountryEnum.ML:
            case CountryEnum.MM:
            case CountryEnum.MN:
            case CountryEnum.MO:
            case CountryEnum.MP:
            case CountryEnum.MQ:
            case CountryEnum.MR:
            case CountryEnum.MS:
            case CountryEnum.MT:
            case CountryEnum.MU:
            case CountryEnum.MV:
            case CountryEnum.MW:
            case CountryEnum.MX:
            case CountryEnum.MY:
            case CountryEnum.MZ:
            case CountryEnum.NA:
            case CountryEnum.NC:
            case CountryEnum.NE:
            case CountryEnum.NF:
            case CountryEnum.NG:
            case CountryEnum.NI:
            case CountryEnum.NL:
            case CountryEnum.NO:
            case CountryEnum.NP:
            case CountryEnum.NR:
            case CountryEnum.NT:
            case CountryEnum.NU:
            case CountryEnum.NZ:
            case CountryEnum.OM:
            case CountryEnum.PA:
            case CountryEnum.PE:
            case CountryEnum.PF:
            case CountryEnum.PG:
            case CountryEnum.PH:
            case CountryEnum.PK:
            case CountryEnum.PL:
            case CountryEnum.PM:
            case CountryEnum.PN:
            case CountryEnum.PR:
            case CountryEnum.PS:
            case CountryEnum.PT:
            case CountryEnum.PW:
            case CountryEnum.PY:
            case CountryEnum.QA:
            case CountryEnum.RE:
            case CountryEnum.RO:
            case CountryEnum.RS:
            case CountryEnum.RU:
            case CountryEnum.RW:
            case CountryEnum.SA:
            case CountryEnum.SB:
            case CountryEnum.SC:
            case CountryEnum.SD:
            case CountryEnum.SE:
            case CountryEnum.SF:
            case CountryEnum.SG:
            case CountryEnum.SH:
            case CountryEnum.SI:
            case CountryEnum.SJ:
            case CountryEnum.SK:
            case CountryEnum.SL:
            case CountryEnum.SM:
            case CountryEnum.SN:
            case CountryEnum.SO:
            case CountryEnum.SR:
            case CountryEnum.SS:
            case CountryEnum.ST:
            case CountryEnum.SU:
            case CountryEnum.SV:
            case CountryEnum.SX:
            case CountryEnum.SY:
            case CountryEnum.SZ:
            case CountryEnum.TA:
            case CountryEnum.TC:
            case CountryEnum.TD:
            case CountryEnum.TF:
            case CountryEnum.TG:
            case CountryEnum.TH:
            case CountryEnum.TJ:
            case CountryEnum.TK:
            case CountryEnum.TL:
            case CountryEnum.TM:
            case CountryEnum.TN:
            case CountryEnum.TO:
            case CountryEnum.TP:
            case CountryEnum.TR:
            case CountryEnum.TT:
            case CountryEnum.TV:
            case CountryEnum.TW:
            case CountryEnum.TZ:
            case CountryEnum.UA:
            case CountryEnum.UG:
            case CountryEnum.UK:
            case CountryEnum.UM:
            case CountryEnum.US:
            case CountryEnum.UY:
            case CountryEnum.UZ:
            case CountryEnum.VA:
            case CountryEnum.VC:
            case CountryEnum.VE:
            case CountryEnum.VG:
            case CountryEnum.VI:
            case CountryEnum.VN:
            case CountryEnum.VU:
            case CountryEnum.WF:
            case CountryEnum.WS:
            case CountryEnum.XK:
            case CountryEnum.YE:
            case CountryEnum.YT:
            case CountryEnum.YU:
            case CountryEnum.ZA:
            case CountryEnum.ZM:
            case CountryEnum.ZR:
            case CountryEnum.ZW:
                return(StringValues[(int)enumValue]);

            //an invalid enum value was requested
            default:
                return(null);
            }
        }
Пример #24
0
        private static EventData GetDataObjectFromReader(SqlDataReader dataReader)
        {
            EventData data = new EventData();

            if (dataReader.IsDBNull(dataReader.GetOrdinal("Event_Id")))
            {
                data.EventId = IdType.UNSET;
            }
            else
            {
                data.EventId = new IdType(dataReader.GetInt32(dataReader.GetOrdinal("Event_Id")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("Description")))
            {
                data.Description = StringType.UNSET;
            }
            else
            {
                data.Description = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("Description")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("Internal")))
            {
                data.InternalAccess = IntegerType.UNSET;
            }
            else
            {
                data.InternalAccess = new IntegerType(dataReader.GetInt32(dataReader.GetOrdinal("Internal")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("External")))
            {
                data.ExternalAccess = IntegerType.UNSET;
            }
            else
            {
                data.ExternalAccess = new IntegerType(dataReader.GetInt32(dataReader.GetOrdinal("External")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("CloseDate")))
            {
                data.CloseDate = DateType.UNSET;
            }
            else
            {
                data.CloseDate = new DateType(dataReader.GetDateTime(dataReader.GetOrdinal("CloseDate")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("StartDate")))
            {
                data.StartDate = DateType.UNSET;
            }
            else
            {
                data.StartDate = new DateType(dataReader.GetDateTime(dataReader.GetOrdinal("StartDate")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("DemoItemId")))
            {
                data.DemoItemId = StringType.UNSET;
            }
            else
            {
                data.DemoItemId = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("DemoItemId")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("GuestItemId")))
            {
                data.GuestItemId = StringType.UNSET;
            }
            else
            {
                data.GuestItemId = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("GuestItemId")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("MaxRegistrations")))
            {
                data.MaxRegistrations = IntegerType.UNSET;
            }
            else
            {
                data.MaxRegistrations = new IntegerType(dataReader.GetInt32(dataReader.GetOrdinal("MaxRegistrations")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("Warning")))
            {
                data.Warning = StringType.UNSET;
            }
            else
            {
                data.Warning = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("Warning")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("MinDemoLevel")))
            {
                data.MinDemoLevel = IntegerType.UNSET;
            }
            else
            {
                data.MinDemoLevel = new IntegerType(dataReader.GetInt32(dataReader.GetOrdinal("MinDemoLevel")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("SpouseOnly")))
            {
                data.SpouseOnly = IntegerType.UNSET;
            }
            else
            {
                data.SpouseOnly = new IntegerType(dataReader.GetInt32(dataReader.GetOrdinal("SpouseOnly")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("MaxGuests")))
            {
                data.MaxGuests = IntegerType.UNSET;
            }
            else
            {
                data.MaxGuests = new IntegerType(dataReader.GetInt32(dataReader.GetOrdinal("MaxGuests")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("AskTerms")))
            {
                data.AskTerms = StringType.UNSET;
            }
            else
            {
                data.AskTerms = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("AskTerms")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("AskColor")))
            {
                data.AskColor = StringType.UNSET;
            }
            else
            {
                data.AskColor = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("AskColor")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("DemoFirstNameOnly")))
            {
                data.DemoFirstNameOnly = StringType.UNSET;
            }
            else
            {
                data.DemoFirstNameOnly = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("DemoFirstNameOnly")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("AskDemoMobility")))
            {
                data.AskDemoMobility = StringType.UNSET;
            }
            else
            {
                data.AskDemoMobility = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("AskDemoMobility")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("AskDemoHearing")))
            {
                data.AskDemoHearing = StringType.UNSET;
            }
            else
            {
                data.AskDemoHearing = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("AskDemoHearing")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("JointDemoOnly")))
            {
                data.JointDemoOnly = StringType.UNSET;
            }
            else
            {
                data.JointDemoOnly = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("JointDemoOnly")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("ShowFinalSplash")))
            {
                data.ShowFinalSplash = StringType.UNSET;
            }
            else
            {
                data.ShowFinalSplash = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("ShowFinalSplash")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("NoGuestMeal")))
            {
                data.NoGuestMeal = StringType.UNSET;
            }
            else
            {
                data.NoGuestMeal = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("NoGuestMeal")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("DependentEvent")))
            {
                data.DependentEvent = IdType.UNSET;
            }
            else
            {
                data.DependentEvent = new IdType(dataReader.GetInt32(dataReader.GetOrdinal("DependentEvent")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("AllowCheckPayment")))
            {
                data.AllowCheckPayment = StringType.UNSET;
            }
            else
            {
                data.AllowCheckPayment = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("AllowCheckPayment")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("NoGuestPeriod")))
            {
                data.NoGuestPeriod = IntegerType.UNSET;
            }
            else
            {
                data.NoGuestPeriod = new IntegerType(dataReader.GetInt32(dataReader.GetOrdinal("NoGuestPeriod")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("CountryCode")))
            {
                data.CountryCode = CountryEnum.UNSET;
            }
            else
            {
                data.CountryCode = CountryEnum.GetInstance(dataReader.GetString(dataReader.GetOrdinal("CountryCode")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("EventType")))
            {
                data.EventType = StringType.UNSET;
            }
            else
            {
                data.EventType = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("EventType")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("EventDate")))
            {
                data.EventDate = DateType.UNSET;
            }
            else
            {
                data.EventDate = new DateType(dataReader.GetDateTime(dataReader.GetOrdinal("EventDate")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("GLPostedDate")))
            {
                data.GLPostedDate = DateType.UNSET;
            }
            else
            {
                data.GLPostedDate = new DateType(dataReader.GetDateTime(dataReader.GetOrdinal("GLPostedDate")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("CancelFeeItemId")))
            {
                data.CancelFeeItemId = StringType.UNSET;
            }
            else
            {
                data.CancelFeeItemId = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("CancelFeeItemId")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("GuestCancelFeeItemId")))
            {
                data.GuestCancelFeeItemId = StringType.UNSET;
            }
            else
            {
                data.GuestCancelFeeItemId = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("GuestCancelFeeItemId")));
            }

            return(data);
        }
Пример #25
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AccountValidationRequest" /> class.
 /// </summary>
 /// <param name="bankAccount">Account Number to query.</param>
 /// <param name="bankCode">Bank Code to query - same codes are used as for creating the transactions.</param>
 /// <param name="phoneNumber">Phone number to query.</param>
 /// <param name="mobileProvider">mobileProvider.</param>
 /// <param name="country">Country of account in 2-character alpha ISO 3166-2 country format (required).</param>
 /// <param name="currency">The currency the bank account is in (required).</param>
 /// <param name="method">The method of the payment. Currently bank and mobile are supported (required).</param>
 public AccountValidationRequest(string bankAccount = default(string), string bankCode = default(string), string phoneNumber = default(string), PayoutMethodMobileProviderEnum mobileProvider = default(PayoutMethodMobileProviderEnum), CountryEnum country = default(CountryEnum), CurrencyEnum currency = default(CurrencyEnum), MethodEnum method = default(MethodEnum))
 {
     this.Country        = country;
     this.Currency       = currency;
     this.Method         = method;
     this.BankAccount    = bankAccount;
     this.BankCode       = bankCode;
     this.PhoneNumber    = phoneNumber;
     this.MobileProvider = mobileProvider;
 }
Пример #26
0
 public Settings GetDictionaryVersion(CountryEnum countryName, string email, string serviceCode)
 {
     return(base.GetEntity <Settings>(base.MainDbPath, getSettingsByName, countryName.ToString(), email, serviceCode));
 }
Пример #27
0
        public void ProcessGroundForcesWikiHtmlFiles(ConcurrentDictionary <string, HtmlDocument> vehicleWikiPagesContent, ConcurrentDictionary <string, string> localFileChanges, Dictionary <string, GroundVehicle> vehicleDetails, List <HtmlNode> vehicleWikiEntryLinks, List <string> errorsList, int indexPosition, int expectedNumberOfLinks, bool createJsonFiles, bool createHtmlFiles, bool createExcelFile)
        {
            try
            {
                _consoleManager.WriteLineInColour(ConsoleColor.Yellow, "Press ENTER to begin extracting data from the vehicle pages.");
                _consoleManager.WaitUntilKeyIsPressed(ConsoleKey.Enter);

                foreach (string vehicleWikiPageLinkTitle in vehicleWikiPagesContent.Keys)
                {
                    // Page to traverse
                    HtmlDocument vehicleWikiPage = vehicleWikiPagesContent.Single(x => x.Key == vehicleWikiPageLinkTitle).Value;
                    // Get the header that holds the page title | document.getElementsByClassName('firstHeading')[0].firstChild.innerText
                    HtmlNode pageTitle = vehicleWikiPage.DocumentNode.Descendants().Single(d => d.Id == "firstHeading").FirstChild;
                    // Get the div that holds all of the content under the title section | document.getElementById('bodyContent')
                    HtmlNode wikiBody = vehicleWikiPage.DocumentNode.Descendants().Single(d => d.Id == "bodyContent");
                    // Get the div that holds the content on the RHS of the page where the information table is | document.getElementById('bodyContent').getElementsByClassName('right-area')
                    HtmlNode rightHandContent = wikiBody.Descendants("div").SingleOrDefault(d => d.Attributes["class"] != null && d.Attributes["class"].Value.Contains("right-area"));

                    // Get the able that holds all of the vehicle information | document.getElementsByClassName('flight-parameters')[0]
                    HtmlNode infoBox = rightHandContent?.Descendants("table").SingleOrDefault(d => d.Attributes["class"].Value.Contains("flight-parameters"));

                    // Name
                    string vehicleName = _stringHelper.RemoveInvalidCharacters(WebUtility.HtmlDecode(vehicleWikiPageLinkTitle));

                    // Link
                    HtmlNode urlNode                 = vehicleWikiEntryLinks.SingleOrDefault(v => v.InnerText.Equals(vehicleName));
                    string   relativeUrl             = urlNode?.Attributes["href"].Value ?? "";
                    string   vehicleWikiEntryFullUrl = new Uri(new Uri(ConfigurationManager.AppSettings["BaseWikiUrl"]), relativeUrl).ToString();

                    // Fail fast and create error if there is no info box
                    if (infoBox == null)
                    {
                        _consoleManager.WriteLineInColour(ConsoleColor.Red, $"Error processing item {indexPosition} of {expectedNumberOfLinks}", false);
                        _consoleManager.WriteBlankLine();

                        errorsList.Add($"No Information found for '{vehicleName}' - {vehicleWikiEntryFullUrl}");

                        _consoleManager.ResetConsoleTextColour();
                        indexPosition++;
                        continue;
                    }
                    else
                    {
                        // Setup local vars
                        Dictionary <string, string> vehicleAttributes = new Dictionary <string, string>();
                        HtmlNodeCollection          rows = infoBox.SelectNodes("tr");

                        _consoleManager.WriteTextLine($"The following values were found for {vehicleName}");

                        _webCrawler.GetAttributesFromInfoBox(vehicleAttributes, rows);

                        _consoleManager.ResetConsoleTextColour();

                        // Country
                        string      countryRawValue = vehicleAttributes.Single(k => k.Key == "Country").Value;
                        CountryEnum vehicleCountry  = _vehicleCountryHelper.GetVehicleCountryFromName(countryRawValue).CountryEnum;

                        // Weight
                        string weightRawValue                     = vehicleAttributes.Single(k => k.Key == "Weight").Value;
                        int    weightWithoutUnits                 = Int32.Parse(Regex.Match(weightRawValue, @"\d+").Value);
                        string weightUnitsAbbreviation            = (Regex.Matches(weightRawValue, @"\D+").Cast <Match>()).Last().Value.Trim();
                        VehicleWeightUnitHelper vehicleWeightUnit = _vehicleWeightUnitHelper.GetWeightUnitFromAbbreviation(weightUnitsAbbreviation);

                        // Vehicle class
                        string typeRawValue = vehicleAttributes.Single(k => k.Key == "Type").Value;
                        GroundVehicleTypeHelper vehicleType = _vehicleTypeHelper.GetGroundVehicleTypeFromName(typeRawValue);

                        // Rank
                        int rankRawValue = Int32.Parse(vehicleAttributes.Single(k => k.Key == "Rank").Value);
                        int vehicleRank  = rankRawValue;

                        // Battle rating
                        double ratingRawValue      = Double.Parse(vehicleAttributes.Single(k => k.Key == "Rating").Value);
                        double vehicleBattleRating = ratingRawValue;

                        // Engine power
                        string enginePowerRawValue                     = vehicleAttributes.Single(k => k.Key == "Engine power").Value;
                        int    enginePowerWithoutUnits                 = Int32.Parse(Regex.Match(enginePowerRawValue, @"\d+").Value);
                        string enginePowerUnitsAbbreviation            = (Regex.Matches(enginePowerRawValue, @"\D+").Cast <Match>()).Last().Value.Trim();
                        VehicleEnginePowerUnitHelper vehicleEngineUnit = _vehicleEnginePowerUnitHelper.GetEngineUnitFromAbbreviation(enginePowerUnitsAbbreviation);

                        // Max speed
                        string maxSpeedRawValue                 = vehicleAttributes.Single(k => k.Key == "Max speed").Value;
                        double maxSpeedWithoutUnits             = Double.Parse(Regex.Match(maxSpeedRawValue, @"\d+\.*\d*").Value);
                        string maxSpeedUnits                    = (Regex.Matches(maxSpeedRawValue, @"\D+").Cast <Match>()).Last().Value.Trim();
                        VehicleSpeedUnitHelper vehicleSpeedUnit = _vehicleSpeedUnitHelper.GetSpeedUnitFromAbbreviation(maxSpeedUnits);

                        // Hull armour
                        string hullArmourRawValue         = vehicleAttributes.Single(k => k.Key == "Hull armour thickness").Value;
                        string vehicleHullArmourThickness = hullArmourRawValue;

                        // Superstructure armour
                        string superstructureArmourRawValue         = vehicleAttributes.Single(k => k.Key == "Superstructure armour thickness").Value;
                        string vehicleSuperstructureArmourThickness = superstructureArmourRawValue;

                        // Repair time
                        string       freeRepairTimeRawValue = vehicleAttributes.Single(k => k.Key == "Time for free repair").Value;
                        List <Match> freeRepairTimeList     = (Regex.Matches(freeRepairTimeRawValue, @"\d+").Cast <Match>()).ToList();
                        int          freeRepairTimeHours    = Int32.Parse(freeRepairTimeList.First().Value);
                        int          freeRepairTimeMinutes  = Int32.Parse(freeRepairTimeList.Last().Value);
                        TimeSpan     vehicleFreeRepairTime  = new TimeSpan(freeRepairTimeHours, freeRepairTimeMinutes, 0);

                        // Max repair cost
                        string maxRepairCostRawValue                = vehicleAttributes.Single(k => k.Key == "Max repair cost*").Value;
                        string maxRepairCostWithoutUnits            = Regex.Match(maxRepairCostRawValue, @"\d+").Value;
                        string maxRepairCostUnits                   = (Regex.Matches(maxRepairCostRawValue, @"\D+").Cast <Match>()).Last().Value.Trim();
                        long   vehicleMaxRepairCost                 = Int64.Parse(maxRepairCostWithoutUnits);
                        VehicleCostUnitHelper vehicleRepairCostUnit = _vehicleCostUnitHelper.GetCostUnitFromAbbreviation(maxRepairCostUnits);

                        // Purchase cost
                        string purchaseCostRawValue     = vehicleAttributes.Single(k => k.Key == "Cost*").Value;
                        string purchaseCostWithoutUnits = Regex.Match(purchaseCostRawValue, @"\d+").Value;
                        string purchaseCostUnits        = (Regex.Matches(purchaseCostRawValue, @"\D+").Cast <Match>()).Last().Value.Trim();
                        long   vehiclePurchaseCost      = Int64.Parse(purchaseCostWithoutUnits);
                        VehicleCostUnitHelper vehiclePurchaseCostUnit = _vehicleCostUnitHelper.GetCostUnitFromAbbreviation(purchaseCostUnits);

                        // Last modified
                        HtmlNode lastModifiedSection = vehicleWikiPage.DocumentNode.Descendants().SingleOrDefault(x => x.Id == ConfigurationManager.AppSettings["LastModifiedSectionId"]);
                        string   lastModified        = lastModifiedSection?.InnerHtml;

                        // Populate objects
                        GroundVehicle groundVehicle = new GroundVehicle
                        {
                            Name                          = vehicleName,
                            Country                       = vehicleCountry,
                            Weight                        = weightWithoutUnits,
                            VehicleType                   = (VehicleTypeEnum)vehicleType.Id,
                            Rank                          = vehicleRank,
                            BattleRating                  = vehicleBattleRating,
                            EnginePower                   = enginePowerWithoutUnits,
                            MaxSpeed                      = maxSpeedWithoutUnits,
                            HullArmourThickness           = vehicleHullArmourThickness,
                            SuperstructureArmourThickness = vehicleSuperstructureArmourThickness,
                            TimeForFreeRepair             = vehicleFreeRepairTime,
                            MaxRepairCost                 = vehicleMaxRepairCost,
                            PurchaseCost                  = vehiclePurchaseCost,
                            PurchaseCostUnit              = vehiclePurchaseCostUnit,
                            MaxRepairCostUnit             = vehicleRepairCostUnit,
                            MaxSpeedUnit                  = vehicleSpeedUnit,
                            WeightUnit                    = vehicleWeightUnit,
                            EnginePowerUnit               = vehicleEngineUnit,
                            LastModified                  = lastModified
                        };

                        // Update the local storage if requested
                        if (createJsonFiles)
                        {
                            _logger.UpdateLocalStorageForOfflineUse(localFileChanges, vehicleWikiPage, vehicleName, LocalWikiFileTypeEnum.Json, groundVehicle);
                        }

                        if (createHtmlFiles)
                        {
                            _logger.UpdateLocalStorageForOfflineUse(localFileChanges, vehicleWikiPage, vehicleName, LocalWikiFileTypeEnum.Html);
                        }

                        //WikiEntry entry = new WikiEntry(vehicleName, vehicleWikiEntryFullUrl, VehicleTypeEnum.Ground, vehicleInfo);

                        // Add the found information to the master list
                        vehicleDetails.Add(vehicleName, groundVehicle);

                        _consoleManager.WriteLineInColour(ConsoleColor.Green, $"Processed item {indexPosition} of {expectedNumberOfLinks} successfully");
                        _consoleManager.WriteBlankLine();
                    }

                    indexPosition++;
                }

                if (createExcelFile)
                {
                    _excelLogger.CreateExcelFile(vehicleDetails);
                }
            }
            catch (Exception ex)
            {
                _consoleManager.WriteException(ex.Message);
            }
        }
Пример #28
0
 public RiskFreeRateDTO(CountryEnum country, double rate)
 {
     this.Id      = (int)country;
     this.Rate    = rate;
     this.Country = (int)country;
 }
Пример #29
0
 public static void SaveRiskFreeRate(CountryEnum country, double rate)
 {
     // ReSharper disable once AsyncConverter.AsyncWait
     PersistenceService.Instance.SaveRiskFreeRate(new RiskFreeRateDTO(country, rate)).Wait();
 }
Пример #30
0
 public Weekend(DateTimeOffset date, CountryEnum country = CountryEnum.fr) : base(date)
 {
     Country = country;
 }
Пример #31
0
        public BaseResponse <GetAddressPerCountryAndZipCodeResponse> GetAddressPerCountryAndZipCode(CountryEnum country, string zipCode)
        {
            var response = new BaseResponse <GetAddressPerCountryAndZipCodeResponse>();

            var restRequest = new RestRequest("{country}/{zipCode}", Method.GET);

            restRequest.AddUrlSegment("country", country.ToString());
            restRequest.AddUrlSegment("zipCode", zipCode);
            restRequest.RequestFormat = DataFormat.Json;

            var restResponse = this.RestClient.Execute <GetAddressPerCountryAndZipCodeResponse>(restRequest);

            if (restResponse.ErrorException != null)
            {
                throw restResponse.ErrorException;
            }

            response.StatusCode = restResponse.StatusCode;
            if (restResponse.StatusCode == HttpStatusCode.OK)
            {
                response.IsSuccess = true;
                response.Data      = restResponse.Data;
            }
            else
            {
                response.IsSuccess = false;
            }

            return(response);
        }