Exemple #1
0
        public void OnDataChange(DataSnapshot snapshot)
        {
            if (snapshot.Value != null)
            {
                var child = snapshot.Children.ToEnumerable <DataSnapshot>().Where(a => a.Key != id).ToList();
                //receiving_NewTripsList.Clear();

                foreach (var item in child)
                {
                    Receiving_NewTripDetails receiving_NewTrip = new Receiving_NewTripDetails();
                    receiving_NewTrip.RideID             = item.Key;
                    receiving_NewTrip.rider_name         = item.Child("rider_name").Value.ToString();
                    receiving_NewTrip.rider_phone        = item.Child("rider_phone").Value.ToString();
                    receiving_NewTrip.PickupAddress      = item.Child("pickup_address").Value.ToString();
                    receiving_NewTrip.DestinationAddress = item.Child("destination_address").Value.ToString();
                    receiving_NewTrip.Paymentmethod      = item.Child("payment_method").Value.ToString();

                    receiving_NewTrip.PickupLat = (double)item.Child("location/latitude").Value;
                    receiving_NewTrip.PickupLng = (double)item.Child("location/longitude").Value;

                    // Destination lang
                    receiving_NewTrip.DestinationLat = (double)item.Child("destination/latitude").Value;
                    receiving_NewTrip.DestinationLng = (double)item.Child("destination/longitude").Value;

                    receiving_NewTripsList.Add(receiving_NewTrip);

                    // Make it inside foreach to call Record By Record
                    DataRetrived.Invoke(this, new DataEventArgs {
                        Receiving_NewTrip = receiving_NewTripsList
                    });
                    id = item.Key;
                    return;
                }
            }
        }
        public void OnDataChange(DataSnapshot snapshot)
        {
            if (snapshot.Value != null)
            {
                // var child = snapshot.Children.ToEnumerable<DataSnapshot>();

                var      Info     = snapshot.Child("");
                UserInfo userinfo = new UserInfo();

                userinfo.RideID   = Info.Key;
                userinfo.fullname = Info.Child("fullname").Value.ToString();
                userinfo.phone    = Info.Child("phone").Value.ToString();
                userinfo.email    = Info.Child("email").Value.ToString();
                userinfo.ImgURL   = Info.Child("ImgURL").Value.ToString();

                DataRetrived.Invoke(this, new DataEventArgs {
                    fireData = userinfo
                });
            }
        }