public void GetJourneyDetails(RootObjectJourneydetail Journey)
 {
     ObjCommon.JourneyListDetails = JsonConvert.SerializeObject(Journey);
     StrCommonObject = JsonConvert.SerializeObject(ObjCommon);
     lstjourneyList.ItemsSource = ObjRootJouneyDtls.user_journey.journeydetails;
     if (jlist != null)
     {
         string number = jlist.journey_id;
         ClsJourney objJourney = new ClsJourney();
         objJourney.GetJourneyDetails(ObjCommon.DeviceId, jlist.journey_id, this);
         //NavigationService.Navigate(new Uri("/Pages/frmDetailMessage.xaml?ph_num=" + number +"&Contact_Header=" + mlist.ContactName, UriKind.Relative));
     }
 }
        public void GetJourneyDetails(RootObjectJourneydetail Journey)
        {
            ObjCommon.JourneyListDetails = JsonConvert.SerializeObject(Journey);
            StrCommonObject = JsonConvert.SerializeObject(ObjCommon);
            var context = new DataAccessLayer.AgeasDriverDetails(ClsDBHelper.ClsDBHelper.DBConnectionString);
            ObjCommon.ClearLocationRecord();
            ObjCommon.JourneySave();
            List<JourneyDetails> Journelist = (from a in context.tblJourneyDetails select a).ToList();
            List<Journeydetail> databaseJlist = new List<Journeydetail>();
            Journeydetail _Journey;
            for (int i = 0; i < Journelist.Count; i++)
            {
                _Journey = new Journeydetail();
                _Journey.journey_id = Journelist[i].JourneyId.ToString();
                _Journey.distance = Convert.ToDouble(Journelist[i].Last_distance);
                _Journey.time = Journelist[i].TimeDuration.ToString();
                _Journey.date = Journelist[i].JDate.ToString();
                databaseJlist.Add(_Journey);
                _Journey = null;
            }

            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                lstjourneyList.ItemsSource = null;
                lstjourneyList.ItemsSource = databaseJlist;
            });

            if (jlist != null)
            {
                string number = jlist.journey_id;
                ClsJourney objJourney = new ClsJourney();
                objJourney.GetJourneyDetails(ObjCommon.DeviceId, jlist.journey_id, this);
            }
        }
        private void lstSelectJourney(object sender, SelectionChangedEventArgs e)
        {
            ListBox cmd = (ListBox)sender;
            jlist = new Journeydetail();
            timer.Stop();
            if (Microsoft.Phone.Net.NetworkInformation.NetworkInterface.NetworkInterfaceType != Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceType.None)
            {
                jlist = (Journeydetail)cmd.SelectedItem;
                cnvBackground.Visibility = Visibility.Visible;
                progressBar1.Visibility = Visibility.Visible;
                if (ObjCommon.IsRecordHaveForUpload())
                {
                    ObjSubmitJourneyLocation = new ClsSubmitJourneyLocation();
                    ObjSubmitJourneyLocation.PostJourneyLocationDetails(ObjCommon.DeviceId, this);

                }
                else
                {
                    if (jlist != null)
                    {
                        string number = jlist.journey_id;
                        ClsJourney objJourney = new ClsJourney();
                        objJourney.GetJourneyDetails(ObjCommon.DeviceId, jlist.journey_id, this);
                        objJourney = null;
                    }
                }
                cmd = null;
            }
            else
            {
                MessageBox.Show("Internet connection not available. Please try again later!");
            }
        }
        private void lstSelectJourney(object sender, SelectionChangedEventArgs e)
        {
            ListBox cmd = (ListBox)sender;
            jlist = new Journeydetail();
            jlist = (Journeydetail)cmd.SelectedItem;
            cnvBackground.Visibility = Visibility.Visible;
            progressBar1.Visibility = Visibility.Visible;
            if (Microsoft.Phone.Net.NetworkInformation.NetworkInterface.NetworkInterfaceType != Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceType.None)
            {
                progressBar1.Visibility = Visibility.Visible;
                if (ObjCommon.IsRecordHaveForUpload())
                {
                    ObjSubmitJourneyLocation = new ClsSubmitJourneyLocation();
                    ObjSubmitJourneyLocation.PostJourneyLocationDetails(ObjCommon.DeviceId, this);
                    var context = new DataAccessLayer.AgeasDriverDetails(ClsDBHelper.ClsDBHelper.DBConnectionString);
                    objDBHelper = new ClsDBHelper.ClsDBHelper();
                    IQueryable<DataAccessLayer.LocationTable> DeleteLocation = from c in context.tblLocation select c;
                    objDBHelper.DeleteLocation(DeleteLocation, context);
                }
                else
                {
                    if (jlist != null)
                    {
                        string number = jlist.journey_id;
                        ClsJourney objJourney = new ClsJourney();
                        objJourney.GetJourneyDetails(ObjCommon.DeviceId, jlist.journey_id, this);
                        //NavigationService.Navigate(new Uri("/Pages/frmDetailMessage.xaml?ph_num=" + number +"&Contact_Header=" + mlist.ContactName, UriKind.Relative));
                    }
                }

            }
            else
            {
                MessageBox.Show("Internet connection not available. Please try again later!");
            }
        }