/// ------------------------------------------------------------------------------------------------ #region public functions /// <summary> /// Refresh the list of vists data /// </summary> public void OnRefreshList() { List <CreateVisitsList> VisitsList; CreateVisitsList VisitsData; Lstvw_Main.BeginRefresh(); IndexMapping iMap; iMap = AppData.PropertyModel.SelectedRecord.IndexMap; iMap = new IndexMapping(iMap.Property, iMap.RequestGroup, iMap.Record, 0); var InspectionList = AppData.PropertyModel.EntityFromMapping(iMap) as SRiInspection; VisitsList = new List <CreateVisitsList>(); var visitcount = InspectionList.Visits.Count; for (int j = 0; j < visitcount; j++) { var data = InspectionList.Visits[j]; VisitsData = new CreateVisitsList() { VisitTypeDescription = data.VisitTypeDescription, ScheduleDate = data.Visit.DateScheduled.ToString("dd MMM yyyy", "Scheduled for ", "Not scheduled"), CompletedDate = data.Visit.DateVisit.ToString("dd MMM yyyy", "Completed on ", "Outstanding"), VisitListIndex = j }; VisitsList.Add(VisitsData); } Lstvw_Main.ItemsSource = VisitsList; Lstvw_Main.HeightRequest = (VisitsList.Count * 110) + 40; Lstvw_Main.EndRefresh(); GC.Collect(); }
/// ------------------------------------------------------------------------------------------------ /// ------------------------------------------------------------------------------------------------ #region private functions /// <summary> /// Refresh the list of vists data /// </summary> private void OnRefreshList() { try { Lstvw_Main.BeginRefresh(); var iMap = AppData.PropertyModel.SelectedRecord.IndexMap; iMap = new IndexMapping(iMap.Property, iMap.RequestGroup, iMap.Record, 0); var inspectionList = AppData.PropertyModel.EntityFromMapping(iMap) as SRiInspection; var visitsList = new List <CreateVisitsList>(); if (inspectionList != null) { var visitcount = inspectionList.Visits.Count; for (int j = 0; j < visitcount; j++) { var data = inspectionList.Visits[j]; var visitsData = new CreateVisitsList() { VisitTypeDescription = data.VisitTypeDescription, ScheduleDate = data.Visit.DateScheduled.ToString("dd MMM yyyy", "Scheduled for ", "Not scheduled"), CompletedDate = data.Visit.DateVisit.ToString("dd MMM yyyy", "Completed on ", "Outstanding"), VisitListIndex = j }; visitsList.Add(visitsData); } } Lstvw_Main.ItemsSource = visitsList; Lstvw_Main.HeightRequest = visitsList.Count * 100; Lstvw_Main.EndRefresh(); GC.Collect(); } catch (Exception ex) { LogTracking.LogTrace(ex.ToString()); } }
/// ------------------------------------------------------------------------------------------------ /// <summary> /// Load the Record details /// </summary> private void OnLoad() { try { int visitcount = -1; //To Load the Record Summary Details _recordSummary = new CreateRecordList(); if (_recordSummary.Details.Count > 0) { var recordSummaryStackLayout = new RecordSummaryStackLayout(_recordSummary); S_RecordSummary.Children.Add(recordSummaryStackLayout); } //To load the Visits Details _lstVisitsList = new List <CreateVisitsList>(); if (AppData.PropertyModel.SelectedRecord.Record.Record.Inspections.Count > 0) { visitcount = AppData.PropertyModel.SelectedRecord.Record.Record.Inspections[0].Visits.Count; for (int j = 0; j < visitcount; j++) { var data = AppData.PropertyModel.SelectedRecord.Record.Record.Inspections[0].Visits[j]; _visitsData = new CreateVisitsList() { VisitTypeDescription = data.VisitTypeDescription, ScheduleDate = data.Visit.DateScheduled.ToString("dd MMM yyyy", "Scheduled for ", "Not scheduled"), CompletedDate = data.Visit.DateVisit.ToString("dd MMM yyyy", "Completed on ", "Outstanding"), VisitListIndex = j }; _lstVisitsList.Add(_visitsData); } } if (_lstVisitsList.Count > 0) { var recordSummaryStackLayout = new VisitsView(_lstVisitsList); S_RecordSummary.Children.Add(recordSummaryStackLayout); } else { var recordSummaryStackLayout = new VisitsView(_lstVisitsList); S_RecordSummary.Children.Add(recordSummaryStackLayout); //if visit has no value need to show add visit } //To Load the Customer Details _customerLists = new CreateCustomerList(); if (_customerLists.Details.Count > 0 || (AppData.PropertyModel.SelectedProperty.Status == SyncStatus.New)) { var recordSummaryStackLayout = new RecordSummaryStackLayout(_customerLists); S_RecordSummary.Children.Add(recordSummaryStackLayout); } } catch (Exception ex) { LogTracking.LogTrace(ex.ToString()); } }