public async Task Initilize() { try { UserDialogs.Instance.ShowLoading(); PageNumber = 1; CheckFilterIndex = 2; SortedIndex = 4; //var result = await ReportsService.GetLabReports(Constants.UserProfile.Role, Constants.UserProfile.LabID, "L", 1); var result = await ReportsService.GetAllLabReports(Constants.UserProfile.Role, Constants.UserProfile.LabID, "L", CalendarSelectedDates.StartDate, CalendarSelectedDates.EndDate); if (result.Success) { int unViewed = 0; foreach (var reportsModel in result.data) { //ReportViewedModel viewedModel = new ReportViewedModel //{ // ReportBrch = reportsModel.ASBRCH, // ReportRef = reportsModel.ASREF, // ReportYear = reportsModel.ASYEAR //}; //var data = Settings.LabortoryReportViewed; //if (data.Any(x => x.ReportBrch == reportsModel.ASBRCH && // x.ReportRef == reportsModel.ASREF && // x.ReportYear == reportsModel.ASYEAR)) //{ // reportsModel.IsViewed = true; //} bool isChecked = false; string checkedOn = String.Empty; switch (Constants.UserProfile.Role) { case "patient": isChecked = !String.IsNullOrEmpty(reportsModel.ASPCHKBY); checkedOn = reportsModel.ASPCHKDTE; reportsModel.IsViewed = !String.IsNullOrEmpty(reportsModel.ASPVIEWED); break; case "doctor": isChecked = !String.IsNullOrEmpty(reportsModel.ASDCHKBY); checkedOn = reportsModel.ASDCHKDTE; reportsModel.IsViewed = !String.IsNullOrEmpty(reportsModel.ASDVIEWED); break; case "agent": isChecked = !String.IsNullOrEmpty(reportsModel.ASACHKBY); checkedOn = reportsModel.ASACHKDTE; reportsModel.IsViewed = !String.IsNullOrEmpty(reportsModel.ASAVIEWED); break; case "guarantor": isChecked = !String.IsNullOrEmpty(reportsModel.ASGCHKBY); checkedOn = reportsModel.ASGCHKDTE; reportsModel.IsViewed = !String.IsNullOrEmpty(reportsModel.ASGVIEWED); break; } reportsModel.CheckedSource = isChecked ? "check.png" : "checkbox.png"; reportsModel.CheckDate = isChecked ? checkedOn : String.Empty; } LabResultListComplete = new ObservableCollection <ReportsModel>(result.data); var newList = SortAndFilter(CheckFilterIndex, SortedIndex, PageNumber, CalendarSelectedDates); newList.ForEach(s => LabResultList.Add(s)); } } catch (Exception ex) { } finally { UserDialogs.Instance.HideLoading(); } }