static void GetAllClientsFromCompanyAsUser() { Delegates.GetAllClients getAllClients = (clients) => { (currentUser as CompanyModel).clients = clients.ToDictionary(x => x.userID, x => (object)x); }; FireBaseManager.GetFireBaseInstance().GetAllClientsFromCompany(currentUser.userID, getAllClients, delegate(string error) { }); }
public void GetAllClientsFromCompany(String companyID, Delegates.GetAllClients getAllClientsListener, Delegates.GeneralListenerFail fail) { FirebaseDatabase.DefaultInstance.GetReference(DBTable.Company.ToString()).Child(companyID).Child(Parameters.clients.ToString()) .GetValueAsync().ContinueWith(task => { if (task.IsFaulted) { fail(task.Exception.ToString()); } else if (task.IsCompleted) { DataSnapshot snapshot = task.Result; List <UserModel> clients = new List <UserModel> (); foreach (var client in snapshot.Children) { string json = client.GetRawJsonValue(); clients.Add(JsonUtility.FromJson <UserModel> (json)); } getAllClientsListener(clients); } }); }
public static void GetAllClientsFromCompany(string companyID, Delegates.GetAllClients getClientsSuccess) { FireBaseManager.GetFireBaseInstance().GetAllClientsFromCompany(companyID, getClientsSuccess, delegate(string error) { }); }