/// <summary> /// Creates a new model from the specified Couchbase object. /// </summary> /// <returns>A new model.</returns> /// <param name="dictionaryObject">Dictionary object.</param> public static Contact Create(DictionaryObject dictionaryObject) { return(new Contact( contactType: dictionaryObject.ParseEnum <ContactType>(JsonProperties.Type), contactMethod: dictionaryObject.ParseEnum <ContactMethod>(JsonProperties.Method), contactValue: dictionaryObject.GetString(JsonProperties.Contact))); }
private void ExecuteLoadItemsCommand() { if (IsBusy) { return; } IsBusy = true; try { using (var dict = _db.GetDocument(CoreApp.DocId)) { var arr = dict.GetArray(CoreApp.ArrKey); for (int i = 0; i < arr.Count; i++) { DictionaryObject d = arr.GetDictionary(i); _items[i].Name = d.GetString("key"); _items[i].Quantity = d.GetInt("value"); _items[i].ImageByteArray = d.GetBlob("image")?.Content; } } } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } }
/// <summary> /// Creates a new model from the specified Couchbase object. /// </summary> /// <returns>A new model.</returns> /// <param name="dictionaryObject">Dictionary object.</param> public PersonObfuscated(DictionaryObject dictionaryObject) : this( entryGuid : dictionaryObject.ParseGuid(JsonProperties.EntryGuid), entryType : dictionaryObject.GetString(JsonProperties.EntryType), firstName : dictionaryObject.GetString(JsonProperties.FirstName), lastName : dictionaryObject.GetString(JsonProperties.LastName), maidenName : dictionaryObject.GetString(JsonProperties.MaidenName), displayName : dictionaryObject.GetString(JsonProperties.DisplayName), organizationName : dictionaryObject.GetString(JsonProperties.OrganizationName), locationGuid : dictionaryObject.ParseGuid(JsonProperties.LocationGuid), siteGuid : dictionaryObject.ParseGuid(JsonProperties.SiteGuid), siteName : dictionaryObject.GetString(JsonProperties.SiteName), userStatus : dictionaryObject.GetString(JsonProperties.UserStatus), departmentName : dictionaryObject.GetString(JsonProperties.DepartmentName), residenceArea : dictionaryObject.GetString(JsonProperties.ResidenceArea), workAreaName : dictionaryObject.GetString(JsonProperties.WorkAreaName), teamName : dictionaryObject.GetString(JsonProperties.TeamName), contacts : dictionaryObject.ParseDictionaryObjects(JsonProperties.Contacts) .Select(Contact.Create) .ToList(), spouseEntryGuid : dictionaryObject.ParseGuid(JsonProperties.SpouseEntryGuid), personPrimaryPhotoGuid : dictionaryObject.ParseGuid(JsonProperties.PersonPrimaryPhotoGuid), primaryPhotoUrl : dictionaryObject.GetString(JsonProperties.PrimaryPhotoUrl), emergencyContactGuids : dictionaryObject.ParseGuids(JsonProperties.EmergencyContactGuids), lastUpdated : dictionaryObject.GetDate(IPerishableDataExtensions.JsonProperties.LastUpdated), expirationDate : dictionaryObject.GetDate(IPerishableDataExtensions.JsonProperties.ExpirationDate)) { }