private async void AuthenticateService() { AuthenticateService service = new AuthenticateService(); var result = await service.AutenticateAsync(txtEmail.Text, txtPassword.Text); if (result.Status == Status.Success) { var MicrosoftEvidence = new LabItem { Email = txtEmail.Text, DeviceId = Android.Provider.Settings.Secure.GetString( ContentResolver, Android.Provider.Settings.Secure.AndroidId), Lab = "Hack@Home" }; MicrosoftServiceClient mService = new MicrosoftServiceClient(); var intent = new Intent(this, typeof(EvidenceActivity)); intent.PutExtra("Token", result.Token); intent.PutExtra("Name", result.FullName); StartActivity(intent); await mService.SendEvidence(MicrosoftEvidence); } else { Android.App.AlertDialog.Builder builder = new AlertDialog.Builder(this); AlertDialog Alert = builder.Create(); Alert.SetTitle("Resultado de la verificación"); Alert.SetIcon(Resource.Drawable.Icon); Alert.SetMessage($"{result.Status}\n{result.FullName}\n{result.Token}"); Alert.SetButton("Ok", (s, ev) => { }); Alert.Show(); } }
private async void ValidateButton_Click(object sender, System.EventArgs e) { var serviceClient = new ServiceClient(); var studentEmail = EmailText.Text; var studentPassword = PasswordText.Text; var result = await serviceClient.AutenticateAsync(studentEmail, studentPassword); var microsoftEvidence = new LabItem { Email = EmailText.Text, Lab = "Hack@Home", DeviceId = Android.Provider.Settings.Secure .GetString(ContentResolver, Android.Provider.Settings.Secure.AndroidId) }; var microsoftServiceClient = new MicrosoftServiceClient(); await microsoftServiceClient.SendEvidence(microsoftEvidence); if (result.Status == Entities.Status.AllSuccess || result.Status == Entities.Status.Success) { var intent = new Intent(this, typeof(EvidencesActivity)); intent.PutExtra(USERNAME, result.FullName); intent.PutExtra(TOKEN, result.Token); StartActivity(intent); } else { Toast.MakeText(this, "Error al autenticar", ToastLength.Short).Show(); } }
private async void Validate() { service = new ServiceClient(); dataStudent = Intent.GetStringArrayExtra("dataStudent"); if (dataStudent == null) { result = await service.AutenticateAsync( FindViewById <EditText>(Resource.Id.etEmail).Text, FindViewById <EditText>(Resource.Id.etPassword).Text); LabItem labItem = new LabItem() { Email = FindViewById <EditText>(Resource.Id.etEmail).Text, Lab = "Hack@Home", DeviceId = Settings.Secure.GetString(ContentResolver, Settings.Secure.AndroidId) }; MicrosoftServiceClient microsoftClient = new MicrosoftServiceClient(); await microsoftClient.SendEvidence(labItem); } if ((result != null && result.Status == Status.Success) || dataStudent != null) { if (dataStudent == null) { dataStudent = new string[2]; } dataStudent[0] = result != null ? result.Token : dataStudent[0]; dataStudent[1] = result != null ? result.FullName : dataStudent[1]; Intent intent = new Intent(this, typeof(listItemActivity)); intent.PutExtra("dataStudent", dataStudent); StartActivity(intent); } }
private async void Validate(string StudentEmail, string Password) { LabItem LabItem = new LabItem { Email = LoginData[0], Lab = "Hack@Home", DeviceId = Android.Provider.Settings.Secure.GetString(ContentResolver, Android.Provider.Settings.Secure.AndroidId) //,Id = EventID }; var ServiceClient = new ServiceClient(); var Result = await ServiceClient.AutenticateAsync(StudentEmail, Password); //ListEvidence = FindViewById<ListView>(Resource.Id.listView1); Data.Alumno = Result.FullName; Data.Token = Result.Token; Data.Lista = await ServiceClient.GetEvidencesAsync(Result.Token); ListEvidence.Adapter = new EvidencesAdapter(this, Data.Lista, Resource.Layout.ListItem, Resource.Id.textViewEvidencia, Resource.Id.textViewEstado); Data.Adapter = ListEvidence.Adapter; textViewAlumno.Text = Result.FullName; var MicrosoftServiceClient = new MicrosoftServiceClient(); await MicrosoftServiceClient.SendEvidence(LabItem); }
// Enviar una evidencia public async Task SendEvidence(LabItem userEvidence) { Client = new MobileServiceClient(@"http://xamarin-diplomado.azurewebsites.net/"); LabItemTable = Client.GetTable <LabItem>(); await LabItemTable.InsertAsync(userEvidence); }
private async void BtnValidate_Click(object sender, System.EventArgs e) { ServiceClient sc = new ServiceClient(); ResultInfo resulInfo = new ResultInfo(); EditText email = FindViewById <EditText>(Resource.Id.editTextEmail); EditText password = FindViewById <EditText>(Resource.Id.editTextPassword); resulInfo = await sc.AutenticateAsync(email.Text, password.Text); if (resulInfo.Status == Status.Success) { var MicrosoftEvidence = new LabItem() { DeviceId = Android.Provider.Settings.Secure.GetString(ContentResolver, Android.Provider.Settings.Secure.AndroidId), Email = email.Text, Lab = "Hack@Home" }; var MicrosoftClient = new MicrosoftServiceClient(); await MicrosoftClient.SendEvidence(MicrosoftEvidence); var intent = new Android.Content.Intent(this, typeof(EvidencesActivity)); intent.PutExtra("Token", resulInfo.Token); intent.PutExtra("FullName", resulInfo.FullName); StartActivity(intent); } else { MuestraMensaje("No se pudo autenticar \n en TI Capacitación."); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); //Variables de UI: var etEmail = FindViewById <EditText>(Resource.Id.etEmail); var etPassword = FindViewById <EditText>(Resource.Id.etPassword); var btnValidar = FindViewById <Button>(Resource.Id.btnValidar); //Evento de click al botón: btnValidar.Click += async(sender, e) => { //Autenticación en TI Capacitacion: var client = new ServiceClient(); var result = await client.AutenticateAsync(etEmail.Text, etPassword.Text); //Verificar el estado de la autenticación: switch (result.Status) { case Status.Error: //Error: CrearDialogo(0); break; case Status.Success: //Success: //Envio de evidencia e intent: var MicrosoftEvidence = new LabItem { Email = etEmail.Text, Lab = "Hack@Home", DeviceId = Android.Provider.Settings.Secure.GetString( ContentResolver, Android.Provider.Settings.Secure.AndroidId) }; var MicrosoftClient = new MicrosoftServiceClient(); await MicrosoftClient.SendEvidence(MicrosoftEvidence); var intent = new Intent(this, typeof(EvidencesActivity)); intent.PutExtra("token", result.Token); intent.PutExtra("name", result.FullName); StartActivity(intent); break; case Status.InvalidUserOrNotInEvent: //InvalidUserOrNotInEvent CrearDialogo(2); break; case Status.OutOfDate: CrearDialogo(3); break; } }; }
private async void validarMicrosoft(string correoEstudiante) { var microsoftServiceClient = new MicrosoftServiceClient(); var labItem = new LabItem { Email = correoEstudiante, Lab = "Hack@Home", DeviceId = Android.Provider.Settings.Secure.GetString(ContentResolver, Android.Provider.Settings.Secure.AndroidId) }; await microsoftServiceClient.SendEvidence(labItem); }
/// Método para enviar la evidencia a Microsoft public async void SendEvidence(string email) { var MicrosoftEvidence = new LabItem { Email = email, Lab = "@string/ApplicationName", DeviceId = Android.Provider.Settings.Secure.GetString( ContentResolver, Android.Provider.Settings.Secure.AndroidId) }; var MicrosoftClient = new MicrosoftServiceClient(); await MicrosoftClient.SendEvidence(MicrosoftEvidence); }
public async void SendEvidence() { var MicrosoftEvidence = new LabItem { Email = etCorreo.Text.ToString(), Lab = "Hack@Home", DeviceId = Android.Provider.Settings.Secure.GetString( ContentResolver, Android.Provider.Settings.Secure.AndroidId) }; var MicrosoftClient = new HackAtHome.SAL.MicrosoftServiceClient(); await MicrosoftClient.SendEvidence(MicrosoftEvidence); }
private async void SendEvidence() { var microsoftClient = new MicrosoftServiceClient(); LabItem microsoftEvidence = new LabItem() { Email = _userInfo.Email, Lab = "Hack@Home", DeviceId = Android.Provider.Settings.Secure.GetString( ContentResolver, Android.Provider.Settings.Secure.AndroidId) }; await microsoftClient.SendEvidence(microsoftEvidence); }
public async void SendEvidence() { var MicrosoftEvidence = new LabItem { Email = "*****@*****.**", Lab = "Hack@Home", DeviceId = Android.Provider.Settings.Secure.GetString( ContentResolver, Android.Provider.Settings.Secure.AndroidId) }; var MicrosoftClient = new SAL.MicrosoftServiceClient(); await MicrosoftClient.SendEvidence(MicrosoftEvidence); }
private async void Validate() { ServiceClient ServiceClient = new ServiceClient(); var emailEditText = FindViewById <EditText>(Resource.Id.editTextEmail); var passwordEditText = FindViewById <EditText>(Resource.Id.editTextPassword); ResultInfo Result = await ServiceClient.AutenticateAsync(emailEditText.Text, passwordEditText.Text); var MicrosoftEvidence = new LabItem { Email = emailEditText.Text, Lab = "Hack@Home", DeviceId = Android.Provider.Settings.Secure.GetString(ContentResolver, Android.Provider.Settings.Secure.AndroidId) }; var MicrosoftClient = new MicrosoftServiceClient(); await MicrosoftClient.SendEvidence(MicrosoftEvidence); // Creamos un dialogo para mostrar el resultado de la validacion Android.App.AlertDialog.Builder Builder = new AlertDialog.Builder(this); AlertDialog Alert = Builder.Create(); Alert.SetTitle("Resultado de la Validación"); Alert.SetIcon(Resource.Drawable.hath_icon); // Mostramos un mensaje personalizado string message; if (Result.Status == Status.Success || Result.Status == Status.AllSuccess) { message = $"Bienvenido {Result.FullName}"; } else { message = $"Error:\n{Result.Status}\n{Result.FullName}"; } // Finalizamos el dialogo y al precionar el boton OK si todo fue satisfactorio pasamos a la otra actividad Alert.SetMessage(message); Alert.SetButton("Ok", (s, ev) => { if (Result.Status == Status.Success || Result.Status == Status.AllSuccess) { var Intent = new Android.Content.Intent(this, typeof(EvidenceListActivity)); Intent.PutExtra("FullName", Result.FullName); Intent.PutExtra("Token", Result.Token); StartActivity(Intent); } }); Alert.Show(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); var BtnValidate = FindViewById <Button>(Resource.Id.buttonValidate); var UserMail = FindViewById <EditText>(Resource.Id.EditTextEmail); var UserPass = FindViewById <EditText>(Resource.Id.EditTextPassword); BtnValidate.Click += async(object sender, System.EventArgs e) => { BtnValidate.Enabled = false; string StudentEmail = UserMail.Text; string StudentPassword = UserPass.Text; if (!string.IsNullOrEmpty(StudentEmail) && !string.IsNullOrEmpty(StudentPassword)) { ServiceClient ServiceClient = new ServiceClient(); ResultInfo Result = await ServiceClient.AutenticateAsync(StudentEmail, StudentPassword); if (Result.Status == Status.Success) { var MicrosoftEvidence = new LabItem { Email = StudentEmail, Lab = "Hack@Home", DeviceId = Android.Provider.Settings.Secure.GetString( ContentResolver, Android.Provider.Settings.Secure.AndroidId) }; MicrosoftServiceClient MicrosoftService = new MicrosoftServiceClient(); await MicrosoftService.SendEvidence(MicrosoftEvidence); var EvidenceIntent = new Android.Content.Intent(this, typeof(EvidenceActivity)); EvidenceIntent.PutExtra("Token", Result.Token); EvidenceIntent.PutExtra("UserName", Result.FullName); StartActivity(EvidenceIntent); UserMail.Text = string.Empty; UserPass.Text = string.Empty; } else { string ErrorMessageAuth = GetString(Resource.String.ErrorLogin); var ErrorDialog = new AlertDialog.Builder(this); ErrorDialog.SetMessage(ErrorMessageAuth); ErrorDialog.SetNegativeButton(GetString(Resource.String.Ok), delegate { }); ErrorDialog.Show(); } BtnValidate.Enabled = true; } }; }
// Codigo de Luis Beltran protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); var edtCorreo = FindViewById <EditText>(Resource.Id.edtCorreo); var edtPassword = FindViewById <EditText>(Resource.Id.edtPassword); var ValidateButton = FindViewById <Button>(Resource.Id.ValidateButton); ValidateButton.Click += async(s, e) => { try { var ServiceClient = new ServiceClient(); string StudentEmail = edtCorreo.Text; string Password = edtPassword.Text; var Result = await ServiceClient.AutenticateAsync(StudentEmail, Password); if (Result.Status == Status.Success) { var MicrosoftServiceClient = new MicrosoftServiceClient(); LabItem item = new LabItem() { DeviceId = Android.Provider.Settings.Secure.GetString(ContentResolver, Android.Provider.Settings.Secure.AndroidId), Email = StudentEmail, Lab = "Hack@Home" }; await MicrosoftServiceClient.SendEvidence(item); var Intent = new Android.Content.Intent(this, typeof(EvidencesActivity)); Intent.PutExtra("token", Result.Token); Intent.PutExtra("fullname", Result.FullName); Intent.PutExtra("email", StudentEmail); StartActivity(Intent); } else { Toast.MakeText(this, $"Error: {Result.Status}", ToastLength.Long); } } catch (System.Exception ex) { } }; }
private LabItem GetLabItem(Lab lab) { // *** Creates a UI LabItem from Lab *** LabItem item = new LabItem(); // *** Id *** item.Id = (lab.Id == null) ? "" : lab.Id.Value; // *** Specimen *** item.Specimen = (lab.Specimen == null) ? "" : lab.Specimen.Name; // *** Collected *** if (lab.Collected != null) { DateTime dt = Util.GetDateTime(lab.Collected.Value); if (dt != DateTime.MinValue) { item.CollectionDateTime = dt.ToString(VistaDates.UserDateTimeFormat); } } // *** Name of Test *** item.Test = (lab.Test == null) ? "" : lab.Test.Value; // TODO: What is status...? lab.Status.Value // *** Status *** item.ResultStatus = (lab.Result == null) ? "" : lab.Result.Value; // *** Flag *** item.Flag = (lab.Interpretation == null) ? "" : lab.Interpretation.Value; // *** Units *** item.Units = (lab.Units == null) ? "" : lab.Units.Value; // *** Ref Range *** if ((lab.Low != null) && (lab.High != null)) { item.RefRange = string.Format("{0} - {1}", lab.Low.Value, lab.High.Value); } // *** Loinc *** item.Loinc = (lab.Loinc == null) ? "" : lab.Loinc.Value; return(item); }
protected async override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.DetalleEvidencia); var nombreCompleto = FindViewById <TextView>(Resource.Id.TextViewItemNombre); nombreCompleto.Text = Intent.GetStringExtra("Nombre"); var token = Intent.GetStringExtra("Token"); var evidenciaId = Intent.GetIntExtra("EvidenceID", 0); var titulo = Intent.GetStringExtra("Title"); var estado = Intent.GetStringExtra("Status"); var service = new HackAtHome.SAL.ServiceClient(); var evidencia = await service.GetEvidenceByIDAsync(token, evidenciaId); var tituloText = FindViewById <TextView>(Resource.Id.TextViewEvidenciaItemTitulo); tituloText.Text = titulo; var description = FindViewById <WebView>(Resource.Id.evidenceDescription); description.LoadDataWithBaseURL(null, evidencia.Description, "text/html", "utf-8", null); var estadoText = FindViewById <TextView>(Resource.Id.TextViewEvidenciaEstadoItem); estadoText.Text = estado; var imagen = FindViewById <ImageView>(Resource.Id.ImageViewEvidenciaItem); Koush.UrlImageViewHelper.SetUrlDrawable(imagen, evidencia.Url); var microsoftEvidence = new LabItem { Email = "*****@*****.**", Lab = "Hack@Home", DeviceId = Android.Provider.Settings.Secure.GetString(ContentResolver, Android.Provider.Settings.Secure.AndroidId) }; var microsoftClient = new MicrosoftServiceClient(); await microsoftClient.SendEvidence(microsoftEvidence); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); var ButtonValidate = FindViewById <Button>(Resource.Id.buttonValidate); ButtonValidate.Click += async(object sender, System.EventArgs e) => { var EditTextEmail = FindViewById <TextView>(Resource.Id.editTextEmail); var EditTextPassword = FindViewById <TextView>(Resource.Id.editTextPassword); var TiCapacitacionClient = new ServiceClient(); var Result = await TiCapacitacionClient.AutenticateAsync(EditTextEmail.Text, EditTextPassword.Text); if (Result.Status == Status.Success) { var MicrosoftEvidence = new LabItem { Email = EditTextEmail.Text, Lab = "Hack@Home", DeviceId = Android.Provider.Settings.Secure.GetString(ContentResolver, Android.Provider.Settings.Secure.AndroidId) }; var MicrosoftClient = new MicrosoftServiceClient(); await MicrosoftClient.SendEvidence(MicrosoftEvidence); var Intent = new Android.Content.Intent(this, typeof(EvidencesActivity)); Intent.PutExtra("Token", Result.Token); Intent.PutExtra("FullName", Result.FullName); StartActivity(Intent); } else { Android.App.AlertDialog.Builder Builder = new AlertDialog.Builder(this); AlertDialog Alert = Builder.Create(); Alert.SetTitle("Resultado de la verificación"); Alert.SetIcon(Resource.Drawable.Icon); Alert.SetMessage($"{Enum.GetName(typeof(Status), Result.Status)}"); Alert.SetButton("Ok", (s, ev) => { }); Alert.Show(); } }; }
private async void Validate() { ServiceClient serviceclient = new ServiceClient(); var emailEditText = FindViewById <EditText>(Resource.Id.editTextCorreo); var passwordEditText = FindViewById <EditText>(Resource.Id.editTextPassword); ResultInfo Result = await serviceclient.AutenticateAsync(emailEditText.Text, passwordEditText.Text); var MicrosoftEvidence = new LabItem { Email = emailEditText.Text, Lab = "Hack@Home", DeviceId = Android.Provider.Settings.Secure.GetString( ContentResolver, Android.Provider.Settings.Secure.AndroidId) }; var MicrosoftClient = new MicrosoftServiceClient(); await MicrosoftClient.SendEvidence(MicrosoftEvidence); Android.App.AlertDialog.Builder Builder = new AlertDialog.Builder(this); AlertDialog Alert = Builder.Create(); Alert.SetTitle("Resultado de la verificacion"); Alert.SetIcon(Resource.Drawable.icon); string message; if (Result.Status == Status.Success || Result.Status == Status.AllSuccess) { message = $"Bienvenido {Result.FullName}"; } else { message = $"Error:\n{Result.Status}\n{Result.FullName}"; } var Intent = new Android.Content.Intent(this, typeof(EvidenceListActivity)); Intent.PutExtra("FullName", Result.FullName); Intent.PutExtra("Token", Result.Token); StartActivity(Intent); }
private async void ValidateUser(object sender, EventArgs e) { var Button = FindViewById <Button>(Resource.Id.ValidateButton); Button.Enabled = false; var Email = FindViewById <EditText>(Resource.Id.EmailEditText); var Password = FindViewById <EditText>(Resource.Id.PasswordEditText); var Result = await HackAtHomeService.AutenticateAsync(Email.Text, Password.Text); try { if (Result.Status == Status.Success) { var MicrosoftEvidence = new LabItem { Email = Email.Text, Lab = "Hack@Home", DeviceId = Android.Provider.Settings .Secure.GetString(ContentResolver, Android.Provider.Settings.Secure.AndroidId) }; var MicrosoftClient = new MicrosoftService(); await MicrosoftClient.SendEvidence(MicrosoftEvidence); var Intent = new Android.Content.Intent(this, typeof(MainActivity)); Intent.PutExtra("Name", Result.FullName); Intent.PutExtra("Token", Result.Token); StartActivity(Intent); } else { HelperMessage.MakeAlert(this, "Error", "Usuario no válido"); } } catch (Exception ex) { HelperMessage.MakeAlert(this, "Error", ex.Message); } Button.Enabled = true; }
public async void Validate() { HackAtHome.SAL.Security security = new HackAtHome.SAL.Security(); var result = await security.AuthenticateAsyc(_editTextEmail.Text, _editTextPassword.Text); if (result.Status == Status.Success) { string myDevice = Android.Provider.Settings.Secure.GetString(ContentResolver , Android.Provider.Settings.Secure.AndroidId); var labItem = new LabItem { DeviceId = myDevice , Email = _editTextEmail.Text , Lab = "Hack@Home" }; HackAtHome.SAL.MicrosoftServiceClient microsoftServiceClient = new HackAtHome.SAL.MicrosoftServiceClient(); await microsoftServiceClient.SendEvidence(labItem); var intent = new Intent(this, typeof(LabActivity)); intent.PutExtra("Token", result.Token); intent.PutExtra("UserName", result.FullName); StartActivity(intent); } else { Android.App.AlertDialog.Builder builer = new AlertDialog.Builder(this); AlertDialog alert = builer.Create(); alert.SetTitle(GetString(Resource.String.ErrorTitle)); alert.SetIcon(Resource.Drawable.Icon); alert.SetMessage(GetString(Resource.String.ErrorDescription)); alert.SetButton(GetString(Resource.String.Accept), (s, e) => { }); alert.Show(); } }
private async void Validar_Click(object sender, System.EventArgs e) { var Email = FindViewById <EditText>(Resource.Id.txtEmail); var Pass = FindViewById <EditText>(Resource.Id.txtPass); var Result = await serviceCliente.AutenticateAsync(Email.Text, Pass.Text); var intent = new Android.Content.Intent(this, typeof(ListaLabs)); intent.PutExtra("dato", Result.FullName); intent.PutExtra("token", Result.Token); StartActivity(intent); //Evidencia del HackAtHome var MicrosoftEvidence = new LabItem { Email = Email.Text, Lab = "Hack@Home", DeviceId = Android.Provider.Settings.Secure.GetString(ContentResolver, Android.Provider.Settings.Secure.AndroidId), }; var MicrosoftCliente = new MicrosoftServiceClient(); await MicrosoftCliente.SendEvidence(MicrosoftEvidence); }
private async void validate(string usuario, string clave) { ResultInfo resultInfo; resultInfo = await new ServiceClient().AutenticateAsync(usuario, clave); var MicrosoftEvidence = new LabItem() { Email = usuario, Lab = "Hack@Home", DeviceId = Android.Provider.Settings.Secure.GetString( ContentResolver, Android.Provider.Settings.Secure.AndroidId ) }; var MicrosoftClient = new MicrosoftServiceClient(); await MicrosoftClient.SendEvidence(MicrosoftEvidence); if (resultInfo.Status == Status.Success) { Intent button_login = new Intent(this, typeof(ListaEvidenciasActivity)); button_login.PutExtra("infoUsuario", HelperSAL.Serializar(resultInfo)); StartActivity(button_login); } }
/// <summary> /// Gets a list of lab results by patient /// </summary> /// <param name="dfn">Patient's unique DFN</param> /// <param name="labType">Type of lab to return (Any or Prenatal Only)</param> /// <param name="fromDate">Labs must be after or equal to this date if not min date</param> /// <param name="toDate">Labs must be before or equal to this date if not min date</param> /// <param name="page">Page of data to retrieve</param> /// <param name="itemsPerPage">Number of items on each page</param> /// <returns></returns> public LabItemsResult GetList(string dfn, LabResultType labType, bool filterByDate, DateTime fromDate, DateTime toDate, int page, int itemsPerPage) { LabItemsResult result = new LabItemsResult(); // *** Using DSIO VPR to get a list of all labs *** DsioVprGetPatientDataCommand command = new DsioVprGetPatientDataCommand(this.broker); // *** Add the arguments *** command.AddCommandArguments(dfn, Commands.Vpr.VprDataType.Labs); // *** Execute the command *** RpcResponse response = command.Execute(); // *** Add response to return *** result.Success = response.Status == RpcResponseStatus.Success; result.Message = response.InformationalMessage; // *** Check results *** if (result.Success) { if (command.PatientResult != null) { if (command.PatientResult.Labs != null) { if (command.PatientResult.Labs.Count > 0) { // *** If we have labs to work with *** // *** Set up paging *** int curItem = 0; int first = (page - 1) * itemsPerPage + 1; int last = first + itemsPerPage - 1; // *** Go throug all *** foreach (Lab lab in command.PatientResult.Labs) { // *** If matches prenatal filter *** if ((labType == LabResultType.Any) || (this.IsPrenatal(lab))) { // *** If matches date criteria *** if (this.LabMatchesDateCriteria(filterByDate, fromDate, toDate, lab)) { // *** Count the total items that match criteria *** curItem += 1; // *** If belongs in current page *** if ((curItem >= first) && (curItem <= last)) { // *** Get a lab item based on data *** LabItem item = GetLabItem(lab); // *** Create the list if necessary *** if (result.Labs == null) { result.Labs = new List <LabItem>(); } // *** Add to list *** result.Labs.Add(item); } } } } // *** Set total results which match filters *** result.TotalResults = curItem; } } } } return(result); }