/// <summary> /// Triggered when user refreshes the page /// </summary> /// <returns></returns> public async Task GetUpdatedReports() { ReportList.Clear(); List <Report> reports = new List <Report>(); if (CrossConnectivity.IsSupported && CrossConnectivity.Current.IsConnected) { var remoteReports = await ServerDatabaseService.GetReportsByEmployee(UserDataCache.CurrentEmployeeData); await DatabaseService.InsertListReportData(remoteReports); reports = await GetReportsByEmployee(UserDataCache.CurrentEmployeeData); } else if (!CrossConnectivity.IsSupported || !CrossConnectivity.Current.IsConnected) { // update from the local database reports = await GetReportsByEmployee(UserDataCache.CurrentEmployeeData); } foreach (var report in reports) { ReportList.Add(report); } // update the cached list InspectionDataCache.CachedReportsList = reports; }
public Report() { InitializeComponent(); comboBoxModel.Items.Clear(); ReportList.Clear(); DateTime startFilterTime = DateTime.Now; DateTime endFilterTime = DateTime.Now; while (DateTime.Compare(endFilterTime, startFilterTime) >= 0) { string folderReport = @"C:\DaeyoungVN\FCT\History\" + startFilterTime.ToString("yyyy") + "\\" + startFilterTime.ToString("MMMM") + "\\" + startFilterTime.ToString("dd") + "\\"; if (Directory.Exists(folderReport)) { string[] fileReport = Directory.GetFiles(folderReport, "*.txt"); for (int i = 0; i < fileReport.Length; i++) { ReportList.Add(fileReport[i]); string fileName = Path.GetFileNameWithoutExtension(fileReport[i]); comboBoxModel.Items.Add(fileName); } } startFilterTime = startFilterTime.AddDays(1); } if (comboBoxModel.Items.Count > 0) { comboBoxModel.SelectedIndex = 0; } }
public async Task GetReports() { ReportList.Clear(); // check if the inspection list has already been fetched before in this session if (!InspectionDataCache.IsReportListFetched) { InspectionDataCache.CachedReportsList = await GetReportsByEmployee(UserDataCache.CurrentEmployeeData); InspectionDataCache.IsReportListFetched = true; } foreach (var cachedReport in InspectionDataCache.CachedReportsList) { ReportList.Add(cachedReport); } }
/// <summary> /// Limpa conteúdo ja deletado da datagrid /// </summary> private void ClearDatagrid() { ReportList.Clear(); }