public FriendDetailViewModel(User user) { this.Name = string.Format("{0} {1}", user.firstname, user.lastname); this.PhotoUri = user.photo; if (user.venue != null) { string prefix = user.venue.name != "Off the Grid" ? "@ " : string.Empty; this.VenueDisplay = prefix + user.venue.name; this.LatLong = string.Format("{0}, {1}", user.venue.geolat, user.venue.geolong); this.Elapsed = Utilities.GetElapsedText(DateTime.Parse(user.checkin.created).AddHours(-8)); this.ShowMap = Visibility.Visible; } else { this.VenueDisplay = "Off the Grid"; this.LatLong = string.Empty; this.ShowMap = Visibility.Collapsed; } //user.checkin. Items = new ObservableCollection<ItemViewModel>(); foreach (var item in user.badges) { Items.Add(new ItemViewModel { LineOne = item.name, LineTwo = item.description, PhotoUri = item.icon, }); } }
public static bool UserHasCheckInHasVenue(User user) { if (user == null || user.checkin == null || user.checkin.venue == null) return false; return true; }
public static bool UserHasPhoto(User user) { if (user == null || string.IsNullOrEmpty(user.photo)) return false; return true; }
public static string UserGetPhoto(User user) { if (user == null || string.IsNullOrEmpty(user.photo)) return string.Empty; return user.photo; }
public static bool UserHasBadges(User user) { if (user == null || user.badges == null || user.badges.Count == 0) return false; return true; }
public static string UserGetId(User user) { if (user == null || string.IsNullOrEmpty(user.id)) return string.Empty; return user.id; }
public static string UserGetLastName(User user) { if (user == null || string.IsNullOrEmpty(user.lastname)) return string.Empty; return user.lastname; }
public static string UserGetEmail(User user) { if (user == null || string.IsNullOrEmpty(user.email)) return string.Empty; return user.email; }
public static string UserGetCheckInGetVenueGetName(User user) { if (user == null || user.checkin == null || user.checkin.venue == null || string.IsNullOrEmpty(user.checkin.venue.name)) return string.Empty; return user.checkin.venue.name; }
public static string UserGetCheckInGetVenueGetAddress(User user) { if (user == null || user.checkin == null || user.checkin.venue == null || string.IsNullOrEmpty(user.checkin.venue.address)) return string.Empty; return user.checkin.venue.address; }
public static Venue UserGetCheckInGetVenue(User user) { if (user == null || user.checkin == null) return null; return user.checkin.venue; }
public static string UserGetCheckInGetCreatedDate(User user) { if (user == null || user.checkin == null || string.IsNullOrEmpty(user.checkin.created)) return string.Empty; return user.checkin.created; }