internal async void CheckByImplementation(ReportsModel reportsModel) { bool isChecked = false; if (reportsModel != null) { switch (Constants.UserProfile.Role) { case "patient": isChecked = !String.IsNullOrEmpty(reportsModel.ASPCHKBY); break; case "doctor": isChecked = !String.IsNullOrEmpty(reportsModel.ASDCHKBY); break; case "agent": isChecked = !String.IsNullOrEmpty(reportsModel.ASACHKBY); break; case "guarantor": isChecked = !String.IsNullOrEmpty(reportsModel.ASGCHKBY); break; } if (isChecked) { var loader = await MaterialDialog.Instance.LoadingDialogAsync("Loading"); var result = await ReportsService.CheckReports(Constants.UserProfile.Role, reportsModel.ASBRCH, reportsModel.ASYEAR, reportsModel.ASREF, "", DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fff")); await loader.DismissAsync(); if (result.Success) { reportsModel.CheckedSource = "checkbox.png"; // reportsModel.CheckDate = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fff"); //App.TabbedPage.viewModel.LabCount++; //App.TabbedPage.viewModel.LabCountVisibility = App.TabbedPage.viewModel.LabCount != 0; switch (Constants.UserProfile.Role) { case "patient": reportsModel.ASPCHKBY = reportsModel.CheckDate = String.Empty; break; case "doctor": reportsModel.ASDCHKBY = reportsModel.CheckDate = String.Empty; break; case "agent": reportsModel.ASACHKBY = reportsModel.CheckDate = String.Empty; break; case "guarantor": reportsModel.ASGCHKBY = reportsModel.CheckDate = String.Empty; break; } } else { await MaterialDialog.Instance.AlertAsync(result.Message); } } else { var loader = await MaterialDialog.Instance.LoadingDialogAsync("Loading"); var result = await ReportsService.CheckReports(Constants.UserProfile.Role, reportsModel.ASBRCH, reportsModel.ASYEAR, reportsModel.ASREF, Constants.UserProfile.LabID, DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fff")); await loader.DismissAsync(); if (result.Success) { reportsModel.CheckedSource = "check.png"; reportsModel.CheckDate = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fff"); //App.TabbedPage.viewModel.LabCount--; //App.TabbedPage.viewModel.LabCountVisibility = App.TabbedPage.viewModel.LabCount != 0; switch (Constants.UserProfile.Role) { case "patient": reportsModel.ASPCHKBY = Constants.UserProfile.LabID; break; case "doctor": reportsModel.ASDCHKBY = Constants.UserProfile.LabID; break; case "agent": reportsModel.ASACHKBY = Constants.UserProfile.LabID; break; case "guarantor": reportsModel.ASGCHKBY = Constants.UserProfile.LabID; break; } } else { await MaterialDialog.Instance.AlertAsync(result.Message); } } } }
internal async void CheckByImplementation(ReportsModel reportsModel) { if (Constants.UserProfile.Role == "guarantor" && Constants.UserProfile.LabID == reportsModel.ASGUAR2) { await MaterialDialog.Instance.AlertAsync("Your account dont have permissions to check this document "); return; } bool isChecked = false; if (reportsModel != null) { switch (Constants.UserProfile.Role) { case "patient": isChecked = !String.IsNullOrEmpty(reportsModel.ASPCHKBY); break; case "doctor": isChecked = !String.IsNullOrEmpty(reportsModel.ASDCHKBY); break; case "agent": isChecked = !String.IsNullOrEmpty(reportsModel.ASACHKBY); break; case "guarantor": isChecked = !String.IsNullOrEmpty(reportsModel.ASGCHKBY); break; } if (isChecked) { var loader = await MaterialDialog.Instance.LoadingDialogAsync("Loading"); var result = await ReportsService.CheckReports(Constants.UserProfile.Role, reportsModel.ASBRCH, reportsModel.ASYEAR, reportsModel.ASREF, "", DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fff")); await loader.DismissAsync(); if (result.Success) { //App.TabbedPage.viewModel.RadioCount++; //App.TabbedPage.viewModel.RadioCountVisibility = App.TabbedPage.viewModel.RadioCount != 0; switch (Constants.UserProfile.Role) { case "patient": reportsModel.ASPCHKBY = reportsModel.CheckDate = String.Empty; break; case "doctor": reportsModel.ASDCHKBY = reportsModel.CheckDate = String.Empty; break; case "agent": reportsModel.ASACHKBY = reportsModel.CheckDate = String.Empty; break; case "guarantor": reportsModel.ASGCHKBY = reportsModel.CheckDate = String.Empty; break; } reportsModel.CheckedSource = "checkbox.png"; //reportsModel.CheckDate = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fff"); } else { await MaterialDialog.Instance.AlertAsync(result.Message); } } else { var loader = await MaterialDialog.Instance.LoadingDialogAsync("loading"); var result = await ReportsService.CheckReports(Constants.UserProfile.Role, reportsModel.ASBRCH, reportsModel.ASYEAR, reportsModel.ASREF, Constants.UserProfile.LabID, DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fff")); await loader.DismissAsync(); if (result.Success) { //App.TabbedPage.viewModel.RadioCount--; //App.TabbedPage.viewModel.RadioCountVisibility = App.TabbedPage.viewModel.RadioCount != 0; switch (Constants.UserProfile.Role) { case "patient": reportsModel.ASPCHKBY = Constants.UserProfile.LabID; break; case "doctor": reportsModel.ASDCHKBY = Constants.UserProfile.LabID; break; case "agent": reportsModel.ASACHKBY = Constants.UserProfile.LabID; break; case "guarantor": reportsModel.ASGCHKBY = Constants.UserProfile.LabID; break; } reportsModel.CheckedSource = "check.png"; reportsModel.CheckDate = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fff"); } else { await MaterialDialog.Instance.AlertAsync(result.Message); } } // LabCountVisibility = RadioCountVisibility = false; //var result1 = await new ReportsService().GetLabReportsCount(Constants.UserProfile.Role, Constants.UserProfile.LabID); //if (result1.Success) //{ // if (result1.labCount > 0) // { // LabCount = result1.labCount; // LabCountVisibility = true; // } // if (result1.radioCount > 0) // { // RadioCount = result1.radioCount; // RadioCountVisibility = true; // } //} } }