public static void ActiveUserAppointmentsListener() { FireBaseManager.GetFireBaseInstance().ActiveMyAppointmentsListener(currentUser.userID, currentUser.userType, delegate(List <AppointmentModel> appointments) { SetCurrentUserAppointments(appointments); DefineAppointmentsBadges(); }); }
static void GetAllServicesProvidedFromCompanyAsUser() { Delegates.GetAllServicesProvidedFromCompany getAllServicesProvided = (services) => { (currentUser as CompanyModel).servicesProvided = services.ToDictionary(x => x.serviceID, x => (object)x); }; FireBaseManager.GetFireBaseInstance().GetAllServicesProvidedFromCompany(currentUser.userID, getAllServicesProvided); }
public static void RemoveMessage(MessageModel message, Delegates.GeneralListenerSuccess success) { FireBaseManager.GetFireBaseInstance().DeleteMessage(currentUser, message.id, delegate() { userMessages.Remove(message); success(); }); }
public static void DeleteClient(UserModel client, Delegates.GeneralListenerSuccess success, Delegates.GeneralListenerFail fail) { FireBaseManager.GetFireBaseInstance().DeleteClientToCompany(currentUser.userID, client, delegate() { (currentUser as CompanyModel).clients.Remove(client.userID); success(); }, fail); }
public static void GetServicesFromAllResponsibles(Delegates.GetAllServicesProvided success) { success += (mresponsibles) => responsibles = mresponsibles; FireBaseManager.GetFireBaseInstance().UpdateServicesFromAllResponsibles(responsibles, success, delegate(string error) { Debug.LogError("Erro ao pegar os servicos: " + error); }); }
public void CreateNewUserWithEmailAndPassword(string name, string phone, string email, string password, Constants.UserType userType, Delegates.CreateNewUser success, Delegates.GeneralListenerFail fail) { auth.CreateUserWithEmailAndPasswordAsync(email, password).ContinueWith(task => { if (task.IsCanceled) { Debug.LogError("CreateUserWithEmailAndPasswordAsync was canceled."); fail("Criação cancelada"); return; } if (task.IsFaulted) { fail(GetErrorMessage(task.Exception.InnerExceptions [0] as FirebaseException)); Debug.LogError("CreateUserWithEmailAndPasswordAsync encountered an error: " + task.Exception); return; } // Firebase user has been created. user = task.Result; if (userType == Constants.UserType.User) { DataManager.currentUser = FireBaseManager.GetFireBaseInstance().CreateNewUser(auth.CurrentUser.UserId, name, phone); } var profile = new Firebase.Auth.UserProfile { DisplayName = name }; UpdateUserProfile(profile); success(user.UserId); Debug.LogFormat("Firebase user created successfully: {0} ({1})", user.DisplayName, user.UserId); }); }
public static void CreateNewMessageFromClientOrCompanyToResponsilbe(UserModel from, string toID, string message, string type, Delegates.GeneralListenerSuccess success, Delegates.GeneralListenerFail fail) { string companyID = ""; var mMessage = new MessageModel(from.name, toID, message, DateTime.Now.ToString(Constants.dateformat), type); if (from.userType == Constants.UserType.Responsible.ToString()) { companyID = (from as ResponsibleModel).companyID; FireBaseManager.GetFireBaseInstance().CreateNewMessage(mMessage, from.userID, toID, companyID, delegate() { success(); }, delegate(string error) { fail(error); }); } else if (from.userType == Constants.UserType.Client.ToString()) { FireBaseManager.GetFireBaseInstance().CreateNewMessageScheduleByCompany(mMessage, toID, currentResponsible.companyID, delegate() { success(); }, delegate(string error) { fail(error); }); } else { fail("Usuário não é um profissional!"); } }
static void UpdateServiceResponsible(ServicesProvidedModel service, string responsibleID, Delegates.GeneralListenerSuccess success, Delegates.GeneralListenerFail fail) { FireBaseManager.GetFireBaseInstance().UpdateSeviceResponsible(responsibleID, service, delegate() { success(); }, delegate(string error) { fail(error); }); }
public static void ActiveUserMessagesListener() { FireBaseManager.GetFireBaseInstance().ActiveUserMessagesListener(currentUser.userID, currentUser.userType, delegate(List <MessageModel> messages) { SetCurrentUserMessages(messages); userMessages = messages; DefineMessagesBadges(); }); }
static void GetAllDaysWorkedFromCompanyAsUser() { Delegates.GetDaysWorked getDaysWorkedCallBack = delegate(List <bool> daysWorked) { (currentUser as CompanyModel).daysOfWork = daysWorked; }; FireBaseManager.GetFireBaseInstance().GetAllDaysWorkedFromCompany(currentUser.userID, getDaysWorkedCallBack); }
static void GetCompanyIDFromResponsibleAsUser() { Delegates.GetCompanyID getCompanyIDCallBack = delegate(string companyID) { (currentUser as ResponsibleModel).companyID = companyID; }; FireBaseManager.GetFireBaseInstance().GetCompanyIDFromResponsible(currentUser.userID, getCompanyIDCallBack); }
static void GetAllInitWorkFromCompanyAsUser() { Delegates.GetDaysTimeWorked getInitDaysWorkedCallBack = delegate(List <int> initTimeDays) { (currentUser as CompanyModel).timeToBeginWork = initTimeDays; }; FireBaseManager.GetFireBaseInstance().GetAllInitDaysWorkedFromCompany(currentUser.userID, getInitDaysWorkedCallBack); }
static void GetAllEndWorkFromCompanyAsUser() { Delegates.GetDaysTimeWorked getFinishDaysWorkedCallBack = delegate(List <int> finishTimeDays) { (currentUser as CompanyModel).timeToFinishWork = finishTimeDays; }; FireBaseManager.GetFireBaseInstance().GetAllFinishDaysWorkedFromCompany(currentUser.userID, getFinishDaysWorkedCallBack); }
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) { }); }
static void GetAllResponsablesFromCompanyAsUser() { Delegates.GetAllResponsibles getAllResponsiblesListener = (mresponsibles) => { responsibles = mresponsibles; (currentUser as CompanyModel).employees = mresponsibles.ToDictionary(x => x.userID, x => (object)x); }; FireBaseManager.GetFireBaseInstance().GetAllResponsiblesFromCompany(currentUser.userID, getAllResponsiblesListener); }
static void UpdateServiceCompany(ServicesProvidedModel service, Delegates.GeneralListenerSuccess success, Delegates.GeneralListenerFail fail) { FireBaseManager.GetFireBaseInstance().UpdateSeviceCompany(companyData.userID, service, delegate() { success(); }, delegate(string error) { fail(error); }); }
public static void RemoveUser(UserModel user, Delegates.GeneralListenerSuccess success, Delegates.GeneralListenerFail fail) { FirebaseAPIHelper.GetFireBaseAPIHelperInstance().RemoveUser(user.userID, delegate() { FireBaseManager.GetFireBaseInstance().RemoveUser(user.userID, user.userType, delegate() { GetAllResponsablesFromCompanyAsUser(); success(); }); }, fail); }
public static void AddServiceToCompanyAsUser(ServicesProvidedModel service) { FireBaseManager.GetFireBaseInstance().AddServicesToCompany(currentUser.userID, new List <ServicesProvidedModel> () { service }, delegate(List <ServicesProvidedModel> services) { services.ForEach(x => (currentUser as CompanyModel).servicesProvided.Add(x.serviceID, (object)x)); }); }
public static void UpdateResponsibleServices(ResponsibleModel responsible, List <ServicesProvidedModel> services, Delegates.GeneralListenerSuccess success, Delegates.GeneralListenerFail fail) { FireBaseManager.GetFireBaseInstance().RemoveAllServcesFromResponsible(responsible.companyID, responsible, delegate() { FireBaseManager.GetFireBaseInstance().AddServicesToResponsible(responsible.companyID, responsible, services); success(); }, delegate(string error) { fail(error); }); }
public static void GetResponsibleAppointments(Delegates.GeneralListenerSuccess success, Delegates.GeneralListenerFail fail) { FireBaseManager.GetFireBaseInstance().GetResponsibleAppointments(currentResponsible.userID, delegate(List <AppointmentModel> appointments) { responsibleAppointmentList.Clear(); appointments.ForEach(x => responsibleAppointmentList.Add(x)); success(); }, delegate(string error) { fail(error); }); }
public static void CreateNewResponsibleToCompanyAsUser(string reponsibleID, string name, List <ServicesProvidedModel> services, List <bool> daysWorked, List <int> initTime, List <int> finishTime, string phone = "") { var mPhone = phone; if (string.IsNullOrEmpty(phone)) { mPhone = (currentUser as CompanyModel).phone; } responsibles.Add(FireBaseManager.GetFireBaseInstance().CreateNewResponsibleToCompany(reponsibleID, (currentUser as CompanyModel).userID, name, services, daysWorked, initTime, finishTime, mPhone)); }
public static void GetCurrentUserMessages(Delegates.GeneralListenerSuccess success, Delegates.GeneralListenerFail fail) { FireBaseManager.GetFireBaseInstance().GetUserMessages(currentUser.userID, delegate(List <MessageModel> messages) { userMessages.Clear(); userMessages = messages; success(); }, delegate(string error) { fail(error); }); }
void CheckCompanies() { Loading = true; FireBaseManager.GetFireBaseInstance().GetAllCompanies(delegate(List <CompanyModel> companies) { DataManager.companiesList = companies; FillList(); }, delegate(string error) { Loading = false; Error = true; }); }
void Awake() { FirebaseApp.DefaultInstance.SetEditorDatabaseUrl(myProjectURL); reference = FirebaseDatabase.DefaultInstance.RootReference; reference.KeepSynced(true); if (_instance == null) { _instance = this; } }
public static void SetMessagesToRead() { userMessages.ForEach(x => { if (x.isNew) { x.isNew = false; FireBaseManager.GetFireBaseInstance().UpdateMessage(currentUser, x); } }); SetCurrentUserMessages(userMessages); DefineMessagesBadges(); }
public static void CreateNewClientToCompany(string name, string phone, Delegates.GeneralListenerSuccess success, Delegates.GeneralListenerFail fail) { var user = FireBaseManager.GetFireBaseInstance().CreateNewClient(name, phone); FireBaseManager.GetFireBaseInstance().AddClientToCompany(companyData.userID, user, delegate() { if (currentUser.userType == Constants.UserType.Company.ToString()) { (currentUser as CompanyModel).clients.Add(user.userID, (object)user); } success(); }, delegate(string error) { fail(error); }); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.HomePage); fireBaseManager = FireBaseManager.GetInstance(); mTvWelcome = FindViewById <TextView>(Resource.Id.txtWelcome); var user = fireBaseManager.mAuth?.CurrentUser; if (user != null) { mTvWelcome.Text = $"Welcome {user.DisplayName}"; profile = user.PhotoUrl; } mBtnSignOut = FindViewById <Button>(Resource.Id.btnSignOut); mBtnSignOut.Click += MBtnSignOut_Click; mIvProfile = FindViewById <ImageView>(Resource.Id.ivProfile); //mIvProfile.SetImageURI(profile); if (profile != null) { var bit = GetImageBitmapFromUrl(profile?.ToString()); mIvProfile.SetImageBitmap(bit); } // PushNotificatiob mPSMsg = FindViewById <TextView>(Resource.Id.playServiceMsg); if (Intent.Extras != null) { foreach (var key in Intent.Extras.KeySet()) { var value = Intent.Extras.GetString(key); Log.Debug("Dev PushNot", "Key: {0} Value: {1}", key, value); } } IsPlayServicesAvailable(); CreateNotificationChannel(); var logTokenButton = FindViewById <Button>(Resource.Id.logTokenButton); logTokenButton.Click += delegate { //var instanceIdResult = await FirebaseInstanceId.Instance.GetInstanceId().AsAsync<IInstanceIdResult>(); //var token = instanceIdResult.Token; Log.Debug("Dev PushNot", "InstanceID token: " + FirebaseInstanceId.Instance?.Token); }; }
public static void RemoveAppointmentFromUser(AppointmentModel appointment, Delegates.GeneralListenerSuccess success, Delegates.GeneralListenerFail fail) { FireBaseManager.GetFireBaseInstance().DeleteAppointment(appointment, delegate() { currentUser.appoitments.Remove(appointment.appointmentID); string minute = (appointment.minute.ToString() == "0" ? "00" : "0"); var message = string.Format("{0} desmarcou o agendamento de {1} marcado para dia {2} às {3}:{4}h", currentUser.name, appointment.description, appointment.data, appointment.hour, minute); CreateNewMessageFromUserToResponsilbe(currentUser, currentResponsible, message, Constants.MessageType.RemoveAppointment.ToString(), delegate() { }, delegate(string error) { }); success(); }, delegate(string error) { fail(error); }); }
public static void CreateCompanyDataWithMockData(string companyID) { companyData = FireBaseManager.GetFireBaseInstance().CreateNewCompany(companyID, "Minha Empresa", "32456789", "Campinas", "Rua Joãozinho", "13082660"); // var servicesList = new List<ServicesProvidedModel> (); // servicesList.Add (new ServicesProvidedModel ("Cabeleireiro", 1)); // servicesList.Add (new ServicesProvidedModel ("Manicure", 0.5f)); // servicesList.Add (new ServicesProvidedModel ("Pedicure", 1.5f)); // responsibles.Add (FireBaseManager.GetFireBaseInstance ().CreateNewResponsibleToCompany (companyData.userID, "Funcionario 1", new List<ServicesProvidedModel> { servicesList [0] })); // responsibles.Add (FireBaseManager.GetFireBaseInstance ().CreateNewResponsibleToCompany (companyData.userID, "Funcionario 2", new List<ServicesProvidedModel> { servicesList [1] })); // responsibles.Add (FireBaseManager.GetFireBaseInstance ().CreateNewResponsibleToCompany (companyData.userID, "Funcionario 3", new List<ServicesProvidedModel> { servicesList [2] })); // responsibles.Add (FireBaseManager.GetFireBaseInstance ().CreateNewResponsibleToCompany (companyData.userID, "Funcionario 4", servicesList)); companyData.employees = responsibles.ToDictionary(x => x.userID, x => (object)x); }
public static void SetMyAppointmentsAsRead() { if (currentUser.appoitments != null) { foreach (var appointmentKey in currentUser.appoitments.Keys) { AppointmentModel appointment; appointment = (AppointmentModel)currentUser.appoitments [appointmentKey]; if (appointment.isNew) { appointment.isNew = false; FireBaseManager.GetFireBaseInstance().UpdateMyAppointment(currentUser, appointmentKey); } } } DefineAppointmentsBadges(); }