コード例 #1
0
        public static bool IsValidNorthAmericanNumber(string number)
        {
            bool isValid = false;

            try {
                string numbersOnly = StripNonNumericCharacters(number);

                //dnw: 2402164320
                //Regex regexObj = new Regex(@"(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]‌​)\s*)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)([2-9]1[02-9]‌​|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})");
                //http://www.asiteaboutnothing.net/regex/regex-quickstart.html
                Regex regexObj = new Regex(@"^1?([0-9]{3})([0-9]{3})([0-9]{4})$");
                if (regexObj.IsMatch(numbersOnly))
                {
                    string formattedPhoneNumber = regexObj.Replace(numbersOnly, "($1) $2-$3");
                    isValid = true;
                }
                else
                {
                    // Invalid phone number
                }
            } catch (Exception ex) {
                LogIt.E(ex);
            }
            return(isValid);
        }
コード例 #2
0
ファイル: Upload.cs プロジェクト: DejanMilicic/MoarUtils
        public static bool Execute(
            string AWSAccessKey,
            string AWSSecretKey,
            string bucketName,
            byte[] ba,
            string toPath,
            out string url,
            RegionEndpoint re,
            S3CannedACL s3ca
            )
        {
            url = "";
            try {
                using (var ms = new MemoryStream(ba)) {
                    var uploadMultipartRequest = new TransferUtilityUploadRequest {
                        BucketName  = bucketName,
                        Key         = toPath,
                        CannedACL   = s3ca,
                        InputStream = ms,
                        //PartSize = 123?
                    };

                    using (var tu = new TransferUtility(AWSAccessKey, AWSSecretKey, re)) {
                        tu.Upload(uploadMultipartRequest);
                    }
                    url = S3_BASE + bucketName + "/" + toPath;
                    return(true);
                }
            } catch (Exception ex) {
                LogIt.E(ex);
                return(false);
            }
        }
コード例 #3
0
        /// <summary>
        /// account for possbility of ELB sheilding the public ip
        /// </summary>
        /// <returns></returns>
        public static string Execute(bool elbIsInUse = true)
        {
            try {
#if DEBUG
#else
#endif
                //LogIt.D(string.Join("|", new List<object> { HttpContext.Current.Request.UserHostAddress, HttpContext.Current.Request.Headers["X-Forwarded-For"], HttpContext.Current.Request.Headers["REMOTE_ADDR"] }));
                if ((HttpContext.Current == null) || (HttpContext.Current.Request == null))
                {
                    return(null);
                }

                var ip = HttpContext.Current.Request.UserHostAddress;
                if (HttpContext.Current.Request.Headers["X-Forwarded-For"] != null)
                {
                    ip = HttpContext.Current.Request.Headers["X-Forwarded-For"];
                    //LogIt.D(ip + "|X-Forwarded-For");
                }
                else if (HttpContext.Current.Request.Headers["REMOTE_ADDR"] != null)
                {
                    ip = HttpContext.Current.Request.Headers["REMOTE_ADDR"];
                    //LogIt.D(ip + "|REMOTE_ADDR");
                }

                //ip = string.IsNullOrEmpty(ip) ? ip : ip.Split()
                return(ip);
            } catch (Exception ex) {
                LogIt.E(ex);
            }
            return(null);
        }
コード例 #4
0
ファイル: Upload.cs プロジェクト: DejanMilicic/MoarUtils
 public static bool Execute(
     string AWSAccessKey,
     string AWSSecretKey,
     string bucketName,
     string filePath,
     string toPath,
     RegionEndpoint re,
     out string url,
     S3CannedACL s3ca
     )
 {
     url = "";
     try {
         using (var tu = new TransferUtility(AWSAccessKey, AWSSecretKey, re)) {
             var tuur = new TransferUtilityUploadRequest {
                 FilePath   = filePath,
                 BucketName = bucketName,
                 Key        = toPath,
                 CannedACL  = s3ca
             };
             tu.Upload(tuur);
             url = S3_BASE + bucketName + "/" + toPath;
         }
         return(true);
     } catch (Exception ex) {
         LogIt.E(ex);
         return(false);
     }
 }
コード例 #5
0
ファイル: Upload.cs プロジェクト: DejanMilicic/MoarUtils
        //TODO: do i really want all these to be public read?! are we locking down elsewhre w/ cors or bucket policy?
        public static bool Execute(
            string AWSAccessKey,
            string AWSSecretKey,
            string bucketName,
            MemoryStream ms,
            string key,
            RegionEndpoint re,
            out string url
            )
        {
            url = "";
            try {
                var uploadMultipartRequest = new TransferUtilityUploadRequest {
                    BucketName  = bucketName,
                    Key         = key,
                    CannedACL   = S3CannedACL.PublicRead,
                    InputStream = ms,
                };

                using (var tu = new TransferUtility(AWSAccessKey, AWSSecretKey, re)) {
                    tu.Upload(uploadMultipartRequest);
                }
                url = S3_BASE + bucketName + "/" + key;
                return(true);
            } catch (Exception ex) {
                LogIt.E(ex);
                return(false);
            }
        }
コード例 #6
0
        public static bool IsDisposable(string email, string apiKey)
        {
            try {
                var response = new RestClient {
                    BaseUrl = new Uri("http://check.block-disposable-email.com/"),
                    Timeout = 5000
                }.Execute(new RestRequest {
                    Resource = "easyapi/json/" + apiKey + "/" + email,
                    Method   = Method.GET,
                    //RequestFormat = RestSharp.DataFormat.Json
                });
                var     content = response.Content;
                dynamic json    = Newtonsoft.Json.Linq.JObject.Parse(content);

                //{"request_status":"success","domain_status":"block","version":"0.1","servertime":"2013-01-14 22:37:39","server_id":"mirror2_chicago"}
                var request_status = json.request_status.Value;
                var domain_status  = json.domain_status.Value;

                var disposable = (request_status == "success") && (domain_status == "block");

                //consider fallback plan if/when we run out of queries... ie use the static list.

                return(disposable);
            } catch (Exception ex) {
                LogIt.E(ex);
                return(false);
            }
        }
コード例 #7
0
 static void Main(string[] args)
 {
     LogIt.LogInfo("Program starting");
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     Application.Run(new Form1());
 }
コード例 #8
0
        /// <summary>
        /// verify valid job
        /// </summary>
        /// <param name="jobID"></param>
        /// <param name="connectionString"></param>
        /// <returns>boolean indicating job exists in database</returns>
        private static bool valid_job(int jobID, string connectionString)
        {
            bool isValid = false;

            try
            {
                using (SqlConnection conn = new SqlConnection(connectionString))
                {
                    LogIt.LogInfo($"Validating job ID {jobID}");
                    string cmdText = "SELECT COUNT(JobID) FROM MLG.POL.tblJobs WHERE JobID = @jobID";
                    using (SqlCommand cmd = new SqlCommand(cmdText, conn))
                    {
                        cmd.Parameters.AddWithValue("@jobID", jobID);
                        conn.Open();
                        int rows = (int)cmd.ExecuteScalar();
                        isValid = (rows > 0);
                    }
                }
            }
            catch (Exception ex)
            {
                LogIt.LogError($"Error validating job ID {jobID}: {ex.Message}");
            }

            return(isValid);
        }
コード例 #9
0
ファイル: ViaApi.cs プロジェクト: DejanMilicic/MoarUtils
 public static string GetCountryCode(string ip, MaxmindSource mms = MaxmindSource.LocalDb, bool throwOnError = false, bool doNotWarnOnNotInDb = false)
 {
     try {
         using (WebServiceClient wsc = new MaxMind.GeoIP2.WebServiceClient(MAXMIND_WS_USER_ID, MAXMIND_WS_KEY)) {
             var ir = wsc.Insights(ip);
             LogIt.D(ir.Country.IsoCode + "|" + ir.City.Name);
             return(ir.Country.IsoCode);
         }
     } catch (Exception ex) {
         if (doNotWarnOnNotInDb && ex.Message.Contains("is not in the database"))
         {
             //LogIt.W(ip + "|" + ex.Message);
         }
         else
         {
             LogIt.W(ip + "|" + ex.Message);
         }
         if (throwOnError)
         {
             throw ex;
         }
         else
         {
             return(null);
         }
     }
 }
コード例 #10
0
        private static string StringToCSVCell(string str)
        {
            try {
                bool mustQuote = (str.Contains(",") || str.Contains("\"") || str.Contains("\r") || str.Contains("\n"));
                if (mustQuote)
                {
                    var sb = new StringBuilder();
                    sb.Append("\"");
                    foreach (char nextChar in str)
                    {
                        sb.Append(nextChar);
                        if (nextChar == '"')
                        {
                            sb.Append("\"");
                        }
                    }
                    sb.Append("\"");
                    return(sb.ToString());
                }

                return(str);
            } catch (Exception ex) {
                LogIt.E(ex);
                throw ex;
            }
        }
コード例 #11
0
        public static string Execute <T>(List <T> data, bool addHeaderRow = false)
        {
            try {
                var properties = typeof(T).GetProperties();
                var result     = new StringBuilder();

                if (addHeaderRow)
                {
                    var methods = properties
                                  .Select(p => p.GetMethod)
                                  .Select(v => StringToCSVCell(
                                              ((v == null) ? "" : v.ToString())
                                              ))
                                  .Select(m => m.Substring(m.IndexOf("get_") + 4).Replace("()", ""));
                    result.AppendLine(string.Join(",", methods));
                }

                foreach (var row in data)
                {
                    var values = properties.Select(p => p.GetValue(row, null))
                                 .Select(v => StringToCSVCell(
                                             ((v == null) ? "" : v.ToString())
                                             ));
                    var line = string.Join(",", values);
                    result.AppendLine(line);
                }

                return(result.ToString());
            } catch (Exception ex) {
                LogIt.E(ex);
                throw ex;
            }
        }
コード例 #12
0
 public static bool Execute(
     string AWSAccessKey,
     string AWSSecretKey,
     string bucketName,
     string fileKey,
     RegionEndpoint re,
     out MemoryStream ms
     )
 {
     ms = null;
     try {
         using (var s3c = new AmazonS3Client(AWSAccessKey, AWSSecretKey, re)) {
             var response = s3c.GetObject(
                 new GetObjectRequest {
                 BucketName = bucketName,
                 Key        = fileKey
             });
             using (var rs = response.ResponseStream) {
                 ms = new MemoryStream();
                 rs.CopyTo(ms);
                 return(true);
             }
         }
     } catch (Exception ex) {
         LogIt.E(ex);
         return(false);
     }
 }
コード例 #13
0
 public static bool Execute(
     string AWSAccessKey,
     string AWSSecretKey,
     string bucketName,
     string objectKey,
     out string url,
     int numberOfMinutes = 30
     )
 {
     url = "";
     try {
         using (var s3Client = new AmazonS3Client(Amazon.RegionEndpoint.USEast1)) {
             var gpsur = new GetPreSignedUrlRequest {
                 BucketName = bucketName,
                 Key        = objectKey,
                 Expires    = DateTime.UtcNow.AddMinutes(numberOfMinutes)
             };
             url = s3Client.GetPreSignedURL(gpsur);
         }
         return(true);
     } catch (Exception ex) {
         LogIt.E(ex);
         return(false);
     }
 }
コード例 #14
0
        private DataSet GetAllSchools()
        {
            DataSet ds = new DataSet();

            try
            {
                LogIt.LogInfo("Getting schools.");
                using (ODBCClass o = new ODBCClass("MySql"))
                {
                    var procName = "select SchoolID from SchoolInfo";

                    using (OdbcCommand oCommand = o.GetCommand(procName))
                    {
                        using (OdbcDataAdapter oAdapter = new OdbcDataAdapter(oCommand))
                        {
                            oAdapter.Fill(ds);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                var msg = $"Error getting schools: {ex.Message}";
                LogIt.LogError(msg);
            }
            return(ds);
        }
コード例 #15
0
        public static List <AreaCode> AcquireFromResources()
        {
            try {
                var content = Properties.Resources.area_codes;
                var lol     = content.Split(new string[] { "\r\n", "\n" }, StringSplitOptions.RemoveEmptyEntries).ToList();
                //skip header: Area Code,Region
                lol.RemoveAt(0);
                _loac = new List <AreaCode> {
                };
                foreach (var l in lol)
                {
                    var los = l.Split(new char[] { ',' });
                    //var location = los[1];
                    //if (location.Length == 2) {
                    //  if (States.GetStateName(location) != null) {
                    //    location = States.GetStateName(location);
                    //  }
                    //}
                    //do I include non us/ca states?
                    _loac.Add(new AreaCode {
                        numberCode = los[0], stateCode = los[1]
                    });
                }

                return(_loac);
            } catch (Exception ex) {
                LogIt.E(ex);
                return(null);
            }
        }
コード例 #16
0
        /// <summary>
        /// verify work order belongs to job
        /// </summary>
        /// <param name="jobID"></param>
        /// <param name="woNo"></param>
        /// <returns>boolean indicating work order belongs to job</returns>
        private static bool valid_work_order(int jobID, string woNo, string connectionString)
        {
            bool   isValid     = false;
            string projFinalID = $"{jobID}-{woNo}";

            try
            {
                using (SqlConnection conn = new SqlConnection(connectionString))
                {
                    LogIt.LogInfo($"Validating work order \"{woNo}\" for job {jobID}");
                    string cmdText = "SELECT COUNT(ProjectFinalID) FROM MLG.POL.tblProjectFinal where ProjectFinalID = @projFinalID";
                    using (SqlCommand cmd = new SqlCommand(cmdText, conn))
                    {
                        cmd.Parameters.AddWithValue("@projFinalID", projFinalID);
                        conn.Open();
                        int rows = (int)cmd.ExecuteScalar();
                        isValid = (rows > 0);
                    }
                }
            }
            catch (Exception ex)
            {
                LogIt.LogError($"Error validating work order \"{woNo}\" for job {jobID}: {ex.Message}");
            }
            return(isValid);
        }
コード例 #17
0
        private void lblSettings_Click(object sender, EventArgs e)
        {
            SettingsForm sf = new SettingsForm();

            sf.StartPosition = FormStartPosition.CenterParent;
            sf.ShowDialog();
            doc.Load(settingsFile);
            if (GetSettings())
            {
                fromDate          = DateTime.Today.AddDays(-fromDaysAgo);
                dtpFromDate.Value = fromDate;

                toDate          = DateTime.Today.AddDays(-toDaysAgo);
                dtpToDate.Value = toDate;

                LogIt.LogInfo($"Got beginning and ending dates from settings file: FromDate={fromDate.ToShortDateString()}, ToDate={toDate.ToShortDateString()}");

                CheckSelectedSchools();
                this.btnPreview.Enabled = true;
                this.btnProcess.Enabled = true;
            }
            else
            {
                this.btnPreview.Enabled = false;
                this.btnProcess.Enabled = false;
            }
        }
コード例 #18
0
        /// <summary>
        /// updates timesheet totals for supplied timesheet IDs
        /// </summary>
        /// <param name="timesheetsUpdated">List of timesheet IDs to be updated</param>
        /// <param name="connectionString"></param>
        /// <returns></returns>
        private bool update_timesheet_totals(List <string> timesheetsUpdated, string connectionString)
        {
            bool result = false;

            string where = string.Join("','", timesheetsUpdated);
            string sql = "UPDATE ts SET ts.TotalHours = tse.HoursWorked, ts.RegHours = case when tse.HoursWorked <= 40 then tse.HoursWorked else 40 end, "
                         + "ts.OTHours = case when tse.HoursWorked <= 40 then 0 else tse.HoursWorked - 40 end "
                         + "FROM MLG.POL.tblWeeklyTimeSheets ts INNER JOIN "
                         + "(SELECT WeeklyTimeSheetID, sum(HoursWorked) as HoursWorked FROM MLG.POL.tblWeeklyTimeSheetEntries GROUP BY WeeklyTimeSheetID) as tse "
                         + $"ON tse.WeeklyTimeSheetID = ts.WeeklyTimeSheetID WHERE ts.WeeklyTimeSheetID in('{where}')";

            try
            {
                using (SqlConnection conn = new SqlConnection(connectionString))
                {
                    using (SqlCommand cmd = new SqlCommand(sql, conn))
                    {
                        conn.Open();
                        var recs = cmd.ExecuteNonQuery();
                        result = (recs >= 1);
                    }
                }
            }
            catch (Exception ex)
            {
                string msg = $"Error updating timesheet totals: {ex.Message}";
                Status = msg;
                LogIt.LogError(msg);
            }
            return(result);
        }
コード例 #19
0
        /// <summary>
        /// adds a timesheet entry for supplied timesheet ID
        /// </summary>
        /// <param name="timesheetId">8-digit hashed ID of timesheet to add hours to</param>
        /// <param name="jobId">AIMM job number</param>
        /// <param name="workOrder">AIMM work order number</param>
        /// <param name="startTime">Date-time work reported for</param>
        /// <param name="regularHours">Number of regular hours reported</param>
        /// <param name="overtimeHours">Number of overtime hours reported</param>
        /// <param name="doubleOvertimeHours">Number of double overtime hours reported</param>
        /// <param name="connectionString"></param>
        /// <returns></returns>
        private bool add_timesheet_detail(string timesheetId, int jobId, string workOrder, DateTime startTime, float regularHours, float overtimeHours, float doubleOvertimeHours, string connectionString)
        {
            bool   result = false;
            string estID  = $"{jobId}-{workOrder}";
            float  hours  = regularHours + overtimeHours + doubleOvertimeHours;
            KeyValuePair <DateTime, DateTime> wkStartAndEnd = get_week_start_and_end(startTime, DayOfWeek.Wednesday);
            string workDate = startTime.Date.ToString("yyyy-MM-dd 00:00:00.000");
            string weDate   = wkStartAndEnd.Value.ToString("yyyy-MM-dd 00:00:00.000");

            ;
            string sql = "INSERT INTO MLG.POL.tblWeeklyTimeSheetEntries (WeeklyTimeSheetID, JobID, HoursWorked, EstimateID, EstimateTypeID, TheDate, "
                         + "Notes, PerformanceLevel, AttendCode, NPReasonCode, Correction, JobErrorID, WeekEndingDate) VALUES "
                         + $"( '{timesheetId}', {jobId}, {hours}, '{estID}', null, '{workDate}', null, null, null, null, 0, null, '{weDate}')";

            try
            {
                using (SqlConnection conn = new SqlConnection(connectionString))
                {
                    using (SqlCommand cmd = new SqlCommand(sql, conn))
                    {
                        conn.Open();
                        var recs = cmd.ExecuteNonQuery();
                        result = (recs == 1);
                    }
                }
            }
            catch (Exception ex)
            {
                string msg = $"Error adding timesheet detail for timesheet \"{timesheetId}\" for {startTime.ToShortDateString()}: {ex.Message}";
                Status = msg;
                LogIt.LogError(msg);
            }
            return(result);
        }
コード例 #20
0
ファイル: ViaDb.cs プロジェクト: DejanMilicic/MoarUtils
 public static string GetCountryCode(string ip, bool throwOnError = false, bool doNotWarnOnNotInDb = true)
 {
     try {
         var cr = maxmindDr.City(ip);
         //LogIt.D(or.Country.IsoCode + "|" + or.City.Name);
         return(cr.Country.IsoCode);
     } catch (Exception ex) {
         if (doNotWarnOnNotInDb && ex.Message.Contains("is not in the database"))
         {
             //LogIt.W(ip + "|" + ex.Message);
         }
         else
         {
             LogIt.W(ip + "|" + ex.Message);
         }
         if (throwOnError)
         {
             throw ex;
         }
         else
         {
             return(null);
         }
     }
 }
コード例 #21
0
        static void Main(string[] args)
        {
            LogIt log = null;

            if (log != null)
            {
                log("initial");
            }
            // INVALID: log = LogDouble;
            // log = new LogIt(LogFancy);
            log  = LogFancy;
            log += LogNormal;
            if (log != null)
            {
                log("blablabla");
            }
            log -= LogFancy;
            if (log != null)
            {
                log("another");
            }


            Console.ReadKey();
        }
コード例 #22
0
ファイル: Exists.cs プロジェクト: DejanMilicic/MoarUtils
 public static bool Execute(
     string AWSAccessKey,
     string AWSSecretKey,
     string fileKey,
     string bucketName,
     RegionEndpoint re,
     out string url
     )
 {
     url = "";
     try {
         using (var s3c = new AmazonS3Client(
                    awsAccessKeyId: AWSAccessKey,
                    awsSecretAccessKey: AWSSecretKey,
                    region: re
                    )) {
             var s3FileInfo = new Amazon.S3.IO.S3FileInfo(s3c, bucketName, fileKey);
             url = "https://s3.amazonaws.com/" + bucketName + "/" + fileKey;
             return(s3FileInfo.Exists);
         }
     } catch (Exception ex) {
         LogIt.E(ex);
         return(false);
     }
 }
コード例 #23
0
        private DataSet GetPaymentsForSchool(string school)
        {
            DataSet ds = new DataSet();

            try
            {
                //if(Status != null)
                //    Status += Environment.NewLine;
                status = $"Getting payments made";
                LogIt.LogInfo(status);
                Status += Environment.NewLine + "  " + status;

                using (ODBCClass o = new ODBCClass("MySql"))
                {
                    var procName = "payments_made(?,?,?)";
                    var parms    = new KeyValuePair <string, string>[] {
                        new KeyValuePair <string, string>("_school", school),
                        new KeyValuePair <string, string>("_fromDate", fromDate.ToString("yyyy-MM-dd")),
                        new KeyValuePair <string, string>("_toDate", toDate.ToString("yyyy-MM-dd"))
                    };

                    using (OdbcCommand oCommand = o.GetCommand(procName, parms))
                    {
                        using (OdbcDataAdapter oAdapter = new OdbcDataAdapter(oCommand))
                        {
                            oAdapter.Fill(ds);
                        }
                    }
                }
            }
            catch (Exception)
            {
            }
            return(ds);
        }
コード例 #24
0
 private void DebugLog(string message)
 {
     if (this.debug)
     {
         var now = Convert.ToString(CurrentTime());
         //Console.WriteLine("[{0}] {1}", now, message);
         LogIt.D(message);
     }
 }
コード例 #25
0
//this does not return state name... wonder why ic ommited
        public static string GetStateName(string areaCode)
        {
            try {
                return(loacUsCa.Where(ac => ac.numberCode == areaCode).Select(ac => ac.stateCode).FirstOrDefault());
            } catch (Exception ex) {
                LogIt.E(ex);
                return(null);
            }
        }
コード例 #26
0
ファイル: GetJsonString.cs プロジェクト: BlarghLabs/CoarUtils
 public static string Execute(object o)
 {
     try {
         return(JsonConvert.SerializeObject(o));
     } catch (Exception ex) {
         LogIt.E(ex);
     }
     return("");
 }
コード例 #27
0
 public static void RemoveFromPool(WebProxy wp)
 {
     lock (mLouwp) {
         if (_louwp.Contains(wp))
         {
             _louwp.Remove(wp);
             LogIt.D(wp.Address);
         }
     }
 }
コード例 #28
0
 public static bool IsDisposable(string email)
 {
     try {
         var disposableDomain = loDomains.Where(d => email.EndsWith(d, StringComparison.CurrentCultureIgnoreCase)).FirstOrDefault();
         return(disposableDomain != null);
     } catch (Exception ex) {
         LogIt.E(ex);
         return(false);
     }
 }
コード例 #29
0
 public static void Execute()
 {
     try {
         foreach (var ci in CultureInfo.GetCultures(System.Globalization.CultureTypes.AllCultures).OrderBy(ci => ci.Name))
         {
             LogIt.D(ci.Name + "|" + ci.EnglishName);
         }
     } catch (Exception ex) {
         LogIt.E(ex);
     }
 }
コード例 #30
0
        public static Coordinate Execute(string address)
        {
            var c = new Coordinate {
                g = Geocoder.Esri
            };

            try {
                if (!string.IsNullOrEmpty(address) && !address.Equals("0"))
                {
                    var uea = HttpUtility.UrlEncode(address.Trim());

                    //http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/find?text=1700 Penny ave washingtn dc&f=pjson&forStorage=false&maxLocations=1
                    var client   = new RestClient("http://geocode.arcgis.com/");
                    var request  = new RestRequest("/arcgis/rest/services/World/GeocodeServer/find?text=" + uea + "&f=pjson&forStorage=false&maxLocations=1", Method.GET);
                    var response = client.Execute(request);

                    if (response.StatusCode != System.Net.HttpStatusCode.OK)
                    {
                        LogIt.D(response.StatusCode + "|" + address);
                    }
                    else
                    {
                        var     content = response.Content;
                        dynamic json    = Newtonsoft.Json.Linq.JObject.Parse(content);

                        if (json.locations.Count > 0)
                        {
                            var geometry = json.locations[0].feature.geometry;
                            if (geometry != null)
                            {
                                var lng = Convert.ToDecimal(geometry.x.Value);
                                var lat = Convert.ToDecimal(geometry.y.Value);
                                if ((lat != 0) && (lng != 0))
                                {
                                    c.lng = lng;
                                    c.lat = lat;
                                }
                            }
                            var precision = json.locations[0].feature.attributes;
                            if (precision != null)
                            {
                                var pc = precision.Score.Value;
                                c.precision = Convert.ToString(pc);
                            }
                        }
                    }
                }
            } catch (Exception ex) {
                LogIt.W(address);
                LogIt.E(ex);
            }

            return(c);
        }