public override void ViewDidLoad()
 {
     base.ViewDidLoad();
     //Gets the information of the employee, received from the segue.
     user_id = Id;
     //Gets the a team memeber containing the received user id.
     userNode = root.GetChild("team_members").GetChild(user_id.Id);
     //Gets the rfid found with the user rfid code.
     rfidNode = root.GetChild("rfid").GetChild(user_id.RFID);
     //Creates an observe event from the rfid node.
     rfidNode.ObserveSingleEvent(DataEventType.Value, (snapshot) =>
     {
         if (snapshot == null)
         {
         }
         else
         {
             //Sets the information to the user input.
             var data     = snapshot.GetValue <NSDictionary>();
             lblRfid.Text = data.ValueForKey(new NSString("tag")).ToString();
         }
     });
     //Sets the received information to the user input.
     lblName.Text     = user_id.Name;
     lblAmount.Text   = user_id.Fare.ToString();
     lblPosition.Text = user_id.Position;
 }
 public override void ViewDidLoad()
 {
     base.ViewDidLoad();
     //Initialize firebase nodes.
     userNode = root.GetChild("team_members");
     rfidNode = root.GetChild("rfid");
 }
        // Creates the folder in Firebase Database
        void CreateFolder(string folderName)
        {
            // Create folder key node
            var folderNodeName = folderName.Replace(' ', '_');

            folderNodeName = char.ToLower(folderNodeName [0]) + folderNodeName.Substring(1, folderNodeName.Length - 1);

            // Create data to be saved in node
            var created = AppDelegate.GetUtcTimestamp();

            object [] keys   = { "created", "lastModified", "name", "negativeLastModified", "notesCount" };
            object [] values = { created, created, folderName, -created, 0 };
            var       data   = NSDictionary.FromObjectsAndKeys(values, keys, keys.Length);

            // Points to https://MyDatabaseId.firebaseio.com/folders/«userUid»/«folderUid»
            DatabaseReference folderNode = foldersNode.GetChild(folderNodeName);

            // Keep data offline
            folderNode.KeepSynced(true);
            // Save data in folder node
            folderNode.SetValue(data);

            // Increment folders count in Firebase Database
            foldersCountNode.SetValue(NSNumber.FromNUInt(++foldersCount));

            GetFolders();
        }
Esempio n. 4
0
        public void GetMessage()
        {
            var userId   = authService.GetUserId();
            var messages = databaseReference.GetChild("items").GetChild(userId);

            nuint handleReference2 = messages.ObserveEvent(DataEventType.Value, (snapshot) =>
            {
                //var folderData = snapshot.GetValue<NSDictionary>();
                // Do magic with the folder data
                NSObject value = snapshot.GetValue();
                ObservableCollection <Homework> list = new ObservableCollection <Homework>();
                if (value is NSDictionary folderData)
                {
                    foreach (var item in folderData)
                    {
                        list.Add(new Homework
                        {
                            Key      = item.Key.ToString(),
                            HomeWork = item.Value.ToString()
                        });
                    }
                }
                MessagingCenter.Send(FirebaseDBService.KEY_MESSAGE, FirebaseDBService.KEY_MESSAGE, list);
            });
        }
        /// <summary>
        /// Method to initialize the lists and firebase node references.
        /// </summary>
        public void initializeView()
        {
            lst_timetracking     = new List <TimeTrackingClass>();
            key_list             = new List <string>();
            lst_Employees        = new List <Employee>();
            TableView.Delegate   = this;
            TableView.DataSource = this;

            root = Database.DefaultInstance.GetRootReference();
            time_trackingNode = root.GetChild("time_tracking");
            userNode          = root.GetChild("team_members");
        }
Esempio n. 6
0
        public void Connect()
        {
            DatabaseReference rootNode = Database.DefaultInstance.GetRootReference();

            DatabaseReference foldersNode     = rootNode.GetChild("count");
            DatabaseReference foldersNode1    = rootNode.GetChild("race2ias-219814");
            nuint             handleReference = foldersNode.ObserveEvent(DataEventType.Value, (snapshot) => {
                var folderData = snapshot.GetValue <NSDictionary>();
                // Do magic with the folder data
                string question = folderData.Values.ToString();
                Q = question;
            });
        }
Esempio n. 7
0
 public void GetMessage()
 {
     var   userId          = authService.GetUserId();
     var   messages        = databaseReference.GetChild("messages").GetChild(userId);
     nuint handleReference = messages.ObserveEvent(DataEventType.Value, (snapshot) => {
         //var folderData = snapshot.GetValue<NSDictionary>();
         // Do magic with the folder data
         String message = "";
         if (snapshot.GetValue() != NSNull.Null)
         {
             message = snapshot.GetValue().ToString();
         }
         MessagingCenter.Send(FirebaseDBService.KEY_MESSAGE, FirebaseDBService.KEY_MESSAGE, message);
     });
 }
Esempio n. 8
0
        void InitialComponent()
        {
            rootNode = Database.DefaultInstance.GetRootReference();
            DatabaseReference userNode = rootNode.GetChild("users").GetChild(AppDelegate.UserUid);

            //traerDatos();



            diarios = new List <Dia>();
            diarios.Clear();
            tableList.Dispose();
            tableList.ReloadData();
            DatabaseReference foldersNode     = rootNode.GetChild("users").GetChild(AppDelegate.UserUid);
            nuint             handleReference = foldersNode.ObserveEvent(DataEventType.Value, (snapshot) =>
            {
                if (snapshot.ChildrenCount != 0)
                {
                    var folderData = snapshot.GetValue <NSDictionary>();
                    // Do magic with the folder data
                    int h = (int)folderData.Count;
                    var g = folderData.Values;

                    for (int i = 0; i < g.Length; i++)
                    {
                        Dia dia1 = new Dia();

                        var e = g[i].ValueForKey((NSString)"Estatus").ToString();

                        if (e.Equals("1"))
                        {
                            dia1.Fecha       = g[i].ValueForKey((NSString)"Fecha").ToString();
                            dia1.Descripcion = g[i].ValueForKey((NSString)"Descripcion").ToString();
                            dia1.Emocion     = g[i].ValueForKey((NSString)"Emocion").ToString();
                            dia1.Foto        = g[i].ValueForKey((NSString)"Foto").ToString();
                            dia1.Titulo      = g[i].ValueForKey((NSString)"Titulo").ToString();


                            diarios.Add(dia1);
                            var dt = diarios.Count;
                        }
                    }

                    tableList.Source = new TablaSource(diarios);
                    Add(tableList);
                }
            });
        }
Esempio n. 9
0
        partial void AddButton_TouchUpInside(UIButton sender)
        {
            Utils.Task task = new Utils.Task();

            task.Id          = Guid.NewGuid().ToString();
            task.description = taskInputText.Text;
            task.createdDate = DateTime.Now.ToString();

            NSString text  = new NSString(task.description);
            var      child = dbReference.GetChild(task.Id);

            child.SetValue <NSString>(text);

            var iconattrs = new Dictionary <string, string>
            {
                { "Id", task.Id },
                { "Description", task.description },
                { "CreatedDate", task.createdDate }
            };

            var myResult = NSDictionary.FromObjectsAndKeys(iconattrs.Values.ToArray()
                                                           , iconattrs.Keys.ToArray());

            child.SetValue <NSDictionary>(myResult);
        }
Esempio n. 10
0
        void FirebaseDatabaseService.AddValueEvent <T>(string nodeKey, Action <T> action)
        {
            DatabaseReference rootRef = Database.DefaultInstance.GetRootReference();

            DatabaseReference nodeRef = rootRef.GetChild(nodeKey);

            nuint handleReference = nodeRef.ObserveEvent(DataEventType.Value, (snapshot) =>
            {
                if (snapshot.Exists && snapshot.HasChildren && action != null)
                {
                    NSDictionary itemDict = snapshot.GetValue <NSDictionary>();
                    NSError error         = null;
                    string itemDictString = NSJsonSerialization.Serialize(itemDict, NSJsonWritingOptions.PrettyPrinted, out error).ToString();

                    T item = JsonConvert.DeserializeObject <T>(itemDictString);
                    action(item);
                }
                else
                {
                    T item = default(T);
                    action(item);
                }
            });

            ValueEventHandles[nodeKey] = handleReference;
        }
Esempio n. 11
0
        void FirebaseDatabaseService.SetValue(string nodeKey, object obj, Action onSuccess, Action <string> onError)
        {
            DatabaseReference rootRef = Database.DefaultInstance.GetRootReference();

            DatabaseReference nodeRef = rootRef.GetChild(nodeKey);

            NSObject nsObj = null;

            if (obj != null)
            {
                string  objectJsonString = JsonConvert.SerializeObject(obj);
                NSError jsonError        = null;
                NSData  nsData           = NSData.FromString(objectJsonString);

                nsObj = NSJsonSerialization.Deserialize(nsData, NSJsonReadingOptions.AllowFragments, out jsonError);
            }

            nodeRef.SetValue(nsObj, (NSError error, DatabaseReference reference) =>
            {
                if (error == null)
                {
                    if (onSuccess != null)
                    {
                        onSuccess();
                    }
                }
                else if (onError != null)
                {
                    onError(error.Description);
                }
            });
        }
Esempio n. 12
0
        void FirebaseDatabaseService.BatchSetChildValues(string nodeKey, Dictionary <string, object> dict, Action onSuccess, Action <string> onError)
        {
            DatabaseReference rootRef = Database.DefaultInstance.GetRootReference();

            DatabaseReference nodeRef = rootRef.GetChild(nodeKey);

            NSDictionary nsDict = null;

            if (dict != null)
            {
                string objectJsonString = JsonConvert.SerializeObject(dict);
                NSData nsData           = NSData.FromString(objectJsonString);

                NSError jsonError = null;
                nsDict = NSJsonSerialization.Deserialize(nsData, NSJsonReadingOptions.AllowFragments, out jsonError) as NSDictionary;
            }

            //nodeRef.SetValue(nsObj, (NSError error, DatabaseReference reference) =>
            nodeRef.UpdateChildValues(nsDict, (NSError error, DatabaseReference reference) =>
            {
                if (error == null)
                {
                    if (onSuccess != null)
                    {
                        onSuccess();
                    }
                }
                else if (onError != null)
                {
                    onError(error.Description);
                }
            });
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            lst_timetracking = new List <TimeTrackingClass>();
            //TODO: Validate if user has no time to delete the top bar.
            if (Employee == null)
            {
                employee_details = EmployeeAdmin;
                navWorker.Hidden = true;
            }
            else
            {
                employee_details = Employee;
            }
            if (employee_details.WorkedTime == null)
            {
                time_trackingNode = root.GetChild("time_tracking");
                loadUserTimes();
            }
            else
            {
                navWorker.Hidden = true;
            }
        }
Esempio n. 14
0
        public FirebaseService()
        {
            stories = new List <Story>();

            Database db = Database.From(Firebase.Core.App.DefaultInstance);

            dataRef = db.GetRootReference();

            DatabaseReference testDir         = dataRef.GetChild("currentSales");
            nuint             handleReference = testDir.ObserveEvent(DataEventType.Value, (snapshot) => {
                NSEnumerator children = snapshot.Children;

                var child = children.NextObject() as DataSnapshot;

                while (child != null)
                {
                    var data = (StoryObj)child.GetValue <NSDictionary>();
                    if (data.ImgUrl != "false")
                    {
                        stories.Add(data);
                    }

                    child = children.NextObject() as DataSnapshot;
                }
            }, (error) =>
            {
                Console.WriteLine(error);
            });
        }
Esempio n. 15
0
        void BtnGuardarDiaM_TouchUpInside(object sender, EventArgs e)
        {
            emocionT = txtDatoM.Text;
            //var currentTime = DateTime.Now;
            var fecha = diaM.Fecha;

            if (imgAdjuntoM.Image != null)
            {
                string encodedString = imgAdjuntoM.Image.AsJPEG(0.23f).GetBase64EncodedString(NSDataBase64EncodingOptions.None);
                foto = encodedString;
            }
            //var fechaEnviar = currentTime.ToString("d", System.Globalization.CultureInfo.GetCultureInfo("es-mx"));
            var fotoE = "";

            fotoE = fotoE + foto;
            var emocionE = "" + emocionT as string;
            var titulo   = "";

            titulo = txtTituloM.Text;
            var descripcion = "";

            descripcion = txtDescripcionM.Text;

            if (descripcion != "" && emocionE != "" && titulo != "")
            {
                userNode = rootNode.GetChild("users").GetChild(AppDelegate.UserUid).GetChild("Dia_" + fecha);
                object[] keys   = { "Titulo", "Descripcion", "Emocion", "Foto", "Fecha", "Estatus" };
                object[] values = { titulo, descripcion, emocionE, fotoE, fecha, "1" };
                var      data   = NSDictionary.FromObjectsAndKeys(values, keys, keys.Length);

                userNode.SetValue <NSDictionary>(data);

                //txtDescripcionM.Text = "";
                //txtDatoM.Text = "";

                UIAlertView _error = new UIAlertView("Correcto", "Datos actualizados", null, "Ok", null);

                _error.Show();
            }
            else
            {
                UIAlertView _error = new UIAlertView("Campos vacios", "Favor de no dejar campos vacios", null, "Ok", null);

                _error.Show();
            }
        }
Esempio n. 16
0
        public void LoadSesionWaitingRoom(string patientServiceType, string patientDocument)
        {
            patientServicesType = patientServiceType;
            patientDocuments    = patientDocument;

            // Se llena la información del paciente.
            object[] noteKeys   = { "onLineFrom", "id" };
            object[] noteValues = { ExistsPatient != null ? ExistsPatient : ServerValue.Timestamp, patientDocument };
            var      patient    = NSDictionary.FromObjectsAndKeys(noteValues, noteKeys, noteKeys.Length);

            // Envío la información del paciente.
            database.GetChild($"queques/{patientServiceType}/patients/{patientDocument}").UpdateChildValues(patient);
            ExistsPatient = ExistsPatient != null ? ExistsPatient : new DateTimeOffset(DateTime.UtcNow).ToUnixTimeMilliseconds();

            // Si el paciente se desconecta, se limpia la información de la base de datos.
            database.GetChild($"queques/{patientServiceType}/patients/{patientDocument}").RemoveValueOnDisconnect();
            database.GetChild($"display/{patientDocument}").RemoveValueOnDisconnect();

            // Me suscribo a la información relevante para el paciente conectado.
            var messages = database.GetChild($"display/{patientDocument}");

            handleReferencePatient = messages.ObserveEvent(DataEventType.Value, (snapshot) => {
                // Do magic with the folder data
                PatientRealTime patientLocal = null;

                if (snapshot.GetValue() != NSNull.Null)
                {
                    var folderData = snapshot.GetValue <NSDictionary>();
                    var position   = folderData.ValueForKey((NSString)"position");
                    var room       = folderData.ValueForKey((NSString)"room");
                    var doctor     = folderData.ValueForKey((NSString)"doctor");
                    var onLineFrom = folderData.ValueForKey((NSString)"onLineFrom");

                    patientLocal = new PatientRealTime
                    {
                        Position   = position == null ? 1 : Convert.ToInt32(position.ToString()),
                        Doctor     = doctor == null ? 0 : Convert.ToInt32(doctor.ToString()),
                        OnLineFrom = onLineFrom?.ToString(),
                        Room       = room?.ToString()
                    };

                    MessagingCenter.Send(KEY_MESSAGE, KEY_MESSAGE, patientLocal);
                }
            });
        }
Esempio n. 17
0
        public void Accept()
        {
            var locationCordinate = new NSDictionary
                                    (
                "latitude", currentLocation.Latitude.ToString(),
                "longitude", currentLocation.Longitude.ToString()
                                    );

            tripRef.GetChild("driver_location").SetValue <NSDictionary>(locationCordinate);
            tripRef.GetChild("driver_name").SetValue((NSString)AppDataHelper.GetFullName());
            tripRef.GetChild("driver_id").SetValue((NSString)AppDataHelper.GetDriverID());
            tripRef.GetChild("driver_phone").SetValue((NSString)AppDataHelper.GetPhone());
            tripRef.GetChild("status").SetValue((NSString)"accepted");
        }
Esempio n. 18
0
        protected override DatabaseReference GetEntityNode(DatabaseReference rootNode)
        {
            // nodes will be keyed by the user
#if __ANDROID__
            return(rootNode.Child(Identifier).Child(Settings.Current.UserId));
#elif __IOS__
            return(rootNode.GetChild(Identifier).GetChild(Settings.Current.UserId));
#endif
        }
 void CreateNodes()
 {
     // Points to https://MyDatabaseId.firebaseio.com/storage/users/«userUid»/notesCount
     notesCountNode = userNode.GetChild("notesCount");
     // Points to https://MyDatabaseId.firebaseio.com/storage/notes/«userUid»/
     notesNode = AppDelegate.RootNode.GetChild("notes").GetChild(AppDelegate.UserUid);
     // Points to https://MyDatabaseId.firebaseio.com/storage/notes/«userUid»/ but sorted by "negativeLastModified" value
     notesByDate = notesNode.GetQueryOrderedByChild("negativeLastModified");
 }
Esempio n. 20
0
        private DatabaseReference GetNodeFromPath(string path)
        {
            DatabaseReference rootNode = instance.GetRootReference();

            foreach (var part in path.Split('/'))
            {
                rootNode = rootNode.GetChild(part);
            }
            return(rootNode);
        }
        public async Task <GeneralResponse> SendComment(string topic, string comment)
        {
            var task = new Task <GeneralResponse>(() =>
            {
                var commentItem = new Comment {
                    Text = comment, User = User, Topic = _topic
                };

                _databaseReference.GetChild(topic).GetChildByAutoId().SetValue(new NSString(JsonConvert.SerializeObject(commentItem)));

                return(new GeneralResponse {
                    IsOK = true
                });
            });

            task.Start();

            return(await task);
        }
Esempio n. 22
0
        void FirebaseDatabaseService.RemoveValueEvent(string nodeKey)
        {
            if (ValueEventHandles.ContainsKey(nodeKey))
            {
                DatabaseReference rootRef = Database.DefaultInstance.GetRootReference();

                DatabaseReference nodeRef = rootRef.GetChild(nodeKey);
                nodeRef.RemoveObserver(ValueEventHandles[nodeKey]);
            }
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            CollectionView.Delegate   = this;
            CollectionView.DataSource = this;
            lst_employees             = new List <Employee>();
            //Gets the all t he information of the database.
            root = Database.DefaultInstance.GetRootReference();
            //Get the child nodes from the root.
            tempNode         = root.GetChild("temp_entrance");
            userNode         = root.GetChild("team_members");
            timetrackingNode = root.GetChild("time_tracking");

            //Adds an event to check if there is a change on the userNode.
            FirebaseOnChange();

            //Adds an event to check if the user is online or offline.
            CheckIfOnline_Event();
        }
        public string Create(T obj)
        {
            DatabaseReference objNode;

            if (string.IsNullOrEmpty(obj.Id))
            {
                objNode = _dbGroupNode.GetChildByAutoId();
                obj.Id  = objNode.Key;
            }
            else
            {
                objNode = _dbGroupNode.GetChild(obj.Id);
            }

            var updates = Encoder.EncodeObject(obj);

            objNode.UpdateChildValues(updates);

            return(obj.Id);
        }
Esempio n. 25
0
        void InsertarEnFireBase()
        {
            object[]          alcoholKeys   = { "Nombre", "Edad", "Correo", "Password", "Sexo", "rutaImagen" };
            object[]          alcoholValues = { txtNombreRegistro.Text, txtEdadRegistro.Text, txtCorreoRegistro.Text, txtContraRegistro.Text, txtSexoRegistro.Text, "holis" };
            var               qs2           = NSDictionary.FromObjectsAndKeys(alcoholValues, alcoholKeys, alcoholKeys.Length);
            DatabaseReference rootNode      = Database.DefaultInstance.GetRootReference();
            DatabaseReference productosNode = rootNode.GetChild("0").GetChild("Usuarios");
            DatabaseReference productoNode  = productosNode.GetChildByAutoId();

            productoNode.SetValue <NSDictionary>(qs2);
        }
Esempio n. 26
0
        public static void Invite(UIViewController thisView, ChatListClass toChat, string inviteeEmail)
        {
            UserClass inviteeUser  = null;
            UserClass inviterUser  = AppData.curUser;
            String    thisChatName = toChat.ChatName;

            AppData.UsersNode.ObserveSingleEvent(DataEventType.Value, (snapshot) =>
            {
                NSEnumerator children = snapshot.Children;
                var childSnapShot     = children.NextObject() as DataSnapshot;

                while (childSnapShot != null)
                {
                    NSDictionary childDict = childSnapShot.GetValue <NSDictionary>();

                    if (childDict.ValueForKey((NSString)"email").ToString() == inviteeEmail)
                    {
                        // user exist
                        inviteeUser = new UserClass
                        {
                            Name  = childDict.ValueForKey((NSString)"name").ToString(),
                            Email = childDict.ValueForKey((NSString)"email").ToString(),
                            Uid   = childDict.ValueForKey((NSString)"uid").ToString()
                        };
                        break;
                    }
                    childSnapShot = children.NextObject() as DataSnapshot;
                }


                if (inviteeUser == null)
                {
                    AlertShow.Alert(thisView, "No Such User", "User is not registered with us");
                    return;
                }

                String invitationTitle = inviterUser.Uid + "|" + thisChatName;

                object[] ownerKeys = { "ownerUid", "ownerEmail", "ownerName" };
                object[] ownerVals = { inviterUser.Uid, inviterUser.Email, inviterUser.Name };
                var ownerDict      = NSDictionary.FromObjectsAndKeys(ownerVals, ownerKeys);

                object[] inviteeKeys = { "chatName", "owner" };
                object[] inviteeVals = { thisChatName, ownerDict };
                var inviteeDict      = NSDictionary.FromObjectsAndKeys(inviteeVals, inviteeKeys);

                DatabaseReference inviteeNode = AppData.UsersNode.GetChild(inviteeUser.Uid);
                inviteeNode.GetChild("myInvitations")
                .GetChild(invitationTitle)
                .SetValue <NSDictionary>(inviteeDict);

                AlertShow.Alert(thisView, "Invitation Sent", "You have successfully invited " + inviteeUser.Name + " to this chat");
            });
        }
Esempio n. 27
0
        public void LoadQuestData()
        {
            //We need a parameter for the QuestID for this is Quest01
            string questNodeParam = "Quest01";
            //Prepare Firebase access
            DatabaseReference rootNode  = Database.DefaultInstance.GetRootReference();
            DatabaseReference userNode  = rootNode.GetChild("Users").GetChild("User");
            DatabaseReference questNode = userNode.GetChild("ActiveQuests").GetChild(questNodeParam);
            //Prepare stages node using QuestID parameter
            DatabaseReference stagesNode = questNode.GetChild("QuestStages");

            stagesNode.ObserveSingleEvent(DataEventType.Value, (snapshot) =>
            {
                //Create stages list
                List <Stage> stages = new List <Stage> ();
                var stagesData      = snapshot.GetValue <NSDictionary> ().Values;
                int c = 0;
                foreach (var stage in stagesData)
                {
                    Stage tStage       = new Stage();
                    tStage.IDStage     = c++;
                    tStage.Description = stage.ValueForKey(new NSString("Description")).ToString();
                    tStage.isCompleted = (stage.ValueForKey(new NSString("isCompleted")).ToString() == "true");
                    stages.Add(tStage);
                }
                //Create Quest
                Quest quest = new Quest();
                questNode.ObserveSingleEvent(DataEventType.Value, (snapshot2) =>
                {
                    var questData = snapshot2.GetValue <NSDictionary> ().Values;
                    foreach (var node in questData)
                    {
                        quest.Name         = node.ValueForKey(new NSString("Name")).ToString();
                        quest.Description  = node.ValueForKey(new NSString("Description")).ToString();
                        quest.RewardXP     = int.Parse(node.ValueForKey(new NSString("RewardXP")).ToString());
                        quest.StartDate    = DateTime.Parse(node.ValueForKey(new NSString("StartDate")).ToString());
                        quest.ExpiringDate = DateTime.Parse(node.ValueForKey(new NSString("ExpiringDate")).ToString());
                        quest.isCompleted  = (node.ValueForKey(new NSString("isCompleted")).ToString() == "true");
                        quest.Status       = (node.ValueForKey(new NSString("Status")).ToString() == "true");
                    }
                    quest.QuestStages = stages;

                    //Do whatever with this quest.
                    //TODO: Display on table.
                    Console.WriteLine(quest);
                }, (err) =>
                {
                    Console.WriteLine(err.LocalizedDescription);
                });
            }, (error) =>
            {
                Console.WriteLine(error.LocalizedDescription);
            });
        }
        /// <summary>
        /// Method to create a single event to check for values in the timetracking node.
        ///This contains all the dates that the employees has work.
        /// </summary>
        public void loadUserTimes()
        {
            DatabaseReference user_ttNode = time_trackingNode.GetChild(employee_details.Id);

            user_ttNode.ObserveSingleEvent(DataEventType.Value, (snapshot) =>
            {
                try
                {
                    var data = snapshot.GetValue <NSDictionary>();
                    //Gets the keys for each user in the table.
                    var keys = data.Keys;

                    double employee_payment = 0;
                    //Adds the key to the temporary list.
                    employee_details.FortNightWorkedTime = new TimeSpan(0, 0, 0);
                    foreach (var time in data.Values)
                    {
                        //Gets the information found in the time_tracking node. This also calculates the worked time of the user and stores it into
                        //a list
                        timeTracking            = new TimeTrackingClass();
                        timeTracking.End_Date   = DateTime.Parse(time.ValueForKey(new NSString("end_date")).ToString());
                        timeTracking.Start_Date = DateTime.Parse(time.ValueForKey(new NSString("start_date")).ToString());


                        DateTime currentDate = DateTime.Now;
                        if (currentDate.Month == timeTracking.Start_Date.Month)
                        {
                            if (timeTracking.Start_Date.Day < 15 && currentDate.Day < 15)
                            {
                                TimeSpan worked_time = (timeTracking.End_Date - timeTracking.Start_Date);
                                employee_payment    += Math.Round(worked_time.TotalHours, 2);
                                employee_details.FortNightWorkedTime += worked_time;
                                lst_timetracking.Add(timeTracking);
                            }


                            if (currentDate.Day > 15 && timeTracking.Start_Date.Day > 15)
                            {
                                TimeSpan worked_time = (timeTracking.End_Date - timeTracking.Start_Date);
                                employee_payment    += Math.Round(worked_time.TotalHours, 2);
                                employee_details.FortNightWorkedTime += worked_time;
                                lst_timetracking.Add(timeTracking);
                            }
                        }
                    }
                    employee_payment            = 0;
                    employee_details.WorkedTime = lst_timetracking;
                    lst_timetracking            = new List <TimeTrackingClass>();
                    TableView.ReloadData();
                }
                catch (Exception ex) {}
            });
        }
        void IFirebaseDatabase.RemoveChildEvent(string nodeKey)
        {
            if (ChildAddedEventHandles.ContainsKey(nodeKey))
            {
                DatabaseReference rootRef = Database.DefaultInstance.GetRootReference();

                DatabaseReference nodeRef = rootRef.GetChild(nodeKey);
                nodeRef.RemoveObserver(ChildAddedEventHandles[nodeKey]);
                nodeRef.RemoveObserver(ChildRemovedEventHandles[nodeKey]);
                nodeRef.RemoveObserver(ChildChangedEventHandles[nodeKey]);
            }
        }
        // Check in Firebase Database if user exists
        void VerifyIfUserExists()
        {
            // Get value of user with ObserveEvent method
            userNode.ObserveEvent(DataEventType.Value, (snapshot) => {
                if (!snapshot.Exists)
                {
                    CreateUser();
                }
                else
                {
                    // Points to https://MyDatabaseId.firebaseio.com/users/«userUid»/foldersCount
                    foldersCountNode = userNode.GetChild("foldersCount");
                    // Points to https://MyDatabaseId.firebaseio.com/folders/«userUid»/
                    foldersNode = AppDelegate.RootNode.GetChild("folders").GetChild(AppDelegate.UserUid);
                    // Points to https://MyDatabaseId.firebaseio.com/folders/«userUid»/ but sorted by "negativeLastModified" value
                    foldersByDate = foldersNode.GetQueryOrderedByChild("negativeLastModified");

                    GetFoldersCount();
                }
            });
        }