public void AssignProperties() { InitProperties(); int i; if (!string.IsNullOrEmpty(StrYear) && !StrYear.Contains("-") && int.TryParse(StrYear, out i)) { Year = i; } if (!string.IsNullOrEmpty(StrYear) && StrYear.Contains("-") && int.TryParse(StrYear.Split('-')[0], out i)) { Year = i; } if (!string.IsNullOrEmpty(StrYear) && StrYear.Contains("-") && int.TryParse(StrYear.Split('-')[1], out i)) { EndYear = i; } if (!string.IsNullOrEmpty(StrYear) && StrYear.Contains("�") && int.TryParse(StrYear.Split('�')[0], out i)) { Year = i; } if (!string.IsNullOrEmpty(StrYear) && StrYear.Contains("�") && int.TryParse(StrYear.Split('�')[1], out i)) { EndYear = i; } }
public void AssignProperties() { if (!ResponseValid) { return; } InitProperties(); DateTime dt; if (!string.IsNullOrEmpty(StrReleased) && DateTime.TryParse(StrReleased, CultureInfo.InvariantCulture, DateTimeStyles.AssumeLocal, out dt)) { Released = dt; } if (!string.IsNullOrEmpty(StrDVD) && DateTime.TryParse(StrDVD, CultureInfo.InvariantCulture, DateTimeStyles.AssumeLocal, out dt)) { DVDRelease = dt; } int i; if (!string.IsNullOrEmpty(StrYear) && !StrYear.Contains("-") && int.TryParse(StrYear, out i)) { Year = i; } if (!string.IsNullOrEmpty(StrYear) && StrYear.Contains("-") && int.TryParse(StrYear.Split('-')[0], out i)) { Year = i; } if (!string.IsNullOrEmpty(StrYear) && StrYear.Contains("-") && int.TryParse(StrYear.Split('-')[1], out i)) { EndYear = i; } if (!string.IsNullOrEmpty(StrYear) && StrYear.Contains("�") && int.TryParse(StrYear.Split('�')[0], out i)) { Year = i; } if (!string.IsNullOrEmpty(StrYear) && StrYear.Contains("�") && int.TryParse(StrYear.Split('�')[1], out i)) { EndYear = i; } if (!string.IsNullOrEmpty(StrRuntime) && StrRuntime.EndsWith("min", StringComparison.InvariantCultureIgnoreCase) && int.TryParse(StrRuntime.Remove(StrRuntime.Length - 3).Trim(), out i)) { Runtime = i; } if (!string.IsNullOrEmpty(StrImdbVotes) && int.TryParse(StrImdbVotes, out i)) { ImdbVotes = i; } if (!string.IsNullOrEmpty(StrTomatoMeter) && int.TryParse(StrTomatoMeter, out i)) { TomatoMeter = i; } if (!string.IsNullOrEmpty(StrTomatoReviews) && int.TryParse(StrTomatoReviews, out i)) { TomatoTotalReviews = i; } if (!string.IsNullOrEmpty(StrTomatoFresh) && int.TryParse(StrTomatoFresh, out i)) { TomatoFreshReviews = i; } if (!string.IsNullOrEmpty(StrTomatoRotten) && int.TryParse(StrTomatoRotten, out i)) { TomatoRottenReviews = i; } if (!string.IsNullOrEmpty(StrTomatoUserMeter) && int.TryParse(StrTomatoUserMeter, out i)) { TomatoUserMeter = i; } if (!string.IsNullOrEmpty(StrTomatoUserReviews) && int.TryParse(StrTomatoUserReviews, out i)) { TomatoUserTotalReviews = i; } double d; if (!string.IsNullOrEmpty(StrImdbRating) && double.TryParse(StrImdbRating, NumberStyles.Float, CultureInfo.InvariantCulture, out d)) { ImdbRating = d; } if (!string.IsNullOrEmpty(StrTomatoRating) && double.TryParse(StrTomatoRating, NumberStyles.Float, CultureInfo.InvariantCulture, out d)) { TomatoRating = d; } if (!string.IsNullOrEmpty(StrBoxOffice) && StrBoxOffice.StartsWith("$", StringComparison.InvariantCultureIgnoreCase) && StrBoxOffice.EndsWith("M", StringComparison.InvariantCultureIgnoreCase) && double.TryParse(StrBoxOffice.Substring(1, StrImdbRating.Length - 2), NumberStyles.Float, CultureInfo.InvariantCulture, out d)) { Revenue = Convert.ToInt64(d * 1000000); } string[] strings = null; if (!string.IsNullOrEmpty(StrGenre)) { strings = StrGenre.Split(','); } if (strings != null) { Genres = new List <string>(strings).Select(s => CleanString(s)).Distinct().ToList(); } strings = null; if (!string.IsNullOrEmpty(StrDirector)) { strings = StrDirector.Split(','); } if (strings != null) { Directors = new List <string>(strings).Select(s => CleanString(s)).Distinct().ToList(); } strings = null; if (!string.IsNullOrEmpty(StrWriter)) { strings = StrWriter.Split(','); } if (strings != null) { Writers = new List <string>(strings).Select(s => CleanString(s)).Distinct().ToList(); } strings = null; if (!string.IsNullOrEmpty(StrActors)) { strings = StrActors.Split(','); } if (strings != null) { Actors = new List <string>(strings).Select(s => CleanString(s)).Distinct().ToList(); } }