Beispiel #1
0
        async void Transferir()
        {
            if (vm.Cuenta_Origen == null || string.IsNullOrEmpty(vm.Cuenta_Origen.IDCUENTA))
            {
                ShowAlert(i18n.getString("L_CUENTA_ORIGEN_REQUERIDA"));
                return;
            }

            if (vm.Cuenta_Destino == null || string.IsNullOrEmpty(vm.Cuenta_Destino.IDCUENTA))
            {
                ShowAlert(i18n.getString("L_CUENTA_DESTINO_REQUERIDA"));
                return;
            }

            if (vm.Cuenta_Origen.IDCUENTA == vm.Cuenta_Destino.IDCUENTA)
            {
                ShowAlert(i18n.getString("L_CUENTAS_IGUALES"));
                return;
            }

            if (vm.Cuenta_Origen.BALANCE < vm.Monto)
            {
                ShowAlert(i18n.getString("L_MONTO_MENOR"));
                return;
            }

            if (vm.Monto == 0 || vm.Monto < 0)
            {
                ShowAlert(i18n.getString("L_MONTO_REQUERIDO"));
                return;
            }
            var msgTx = i18n.getString("L_CONFIRM_TRANSFERENCIA")
                        .Replace("{monto}", String.Format("{0:C}", vm.Monto))
                        .Replace("{cuenta_origen}", vm.Cuenta_Origen.IDCUENTA)
                        .Replace("{cuenta_destino}", vm.Cuenta_Destino.IDCUENTA);

            var UserOk = await DisplayAlert("",
                                            msgTx,
                                            i18n.getString("L_ACEPTAR"),
                                            i18n.getString("L_CANCELAR"));

            if (UserOk)
            {
                dialog.Show();
                var msg = await vm.DoTransferencia(this.Frg_type);

                var toast = DependencyService.Get <IToast>();
                dialog.Hide();

                var resumen = new Resumen.Resumen();
                await Navigation.PushAsync(resumen);

                Models.Utils.ClearNavigationStack(this.Navigation);
                await resumen.refresh(true);

                toast.LongAlert(msg.DESCRIPCION);
            }
        }
Beispiel #2
0
        async void Bloquear()
        {
            if (string.IsNullOrEmpty(this.vm.Tarjeta.tarjeta))
            {
                await DisplayAlert("", i18n.getString("L_CARD_REQUIRED"), i18n.getString("L_ACEPTAR"));

                return;
            }
            if (string.IsNullOrEmpty(this.vm.Tipo_Bloqueo.T_TiposDeBloqueo_Codigo))
            {
                await DisplayAlert("", i18n.getString("L_BLOCK_TYPE_REQUIRED"), i18n.getString("L_ACEPTAR"));

                return;
            }

            var msg = i18n.getString("L_CONFIRM_BLOQUEO_TARJETA")
                      .Replace("{tarjeta}", vm.Tarjeta.tarjetaEncriptada);

            var blockAnswer = await DisplayAlert(i18n.getString("L_CONFIRM_COOPMOVIL"),
                                                 msg,
                                                 i18n.getString("L_ACEPTAR"),
                                                 i18n.getString("L_CANCELAR"));

            if (blockAnswer)
            {
                dialog.Show();
                var msgBlock = await this.vm.Bloquear();

                dialog.Hide();

                var resumen = new Resumen.Resumen();
                await Navigation.PushAsync(resumen);

                Models.Utils.ClearNavigationStack(this.Navigation);
                await resumen.refresh(true);

                toast.LongAlert(msgBlock.DESCRIPCION);
            }
        }
Beispiel #3
0
        private void buttonReviewTest_Click(object sender, EventArgs e)
        {
            try
            {
                //throw new NotImplementedException();
                this.Hide();

                SearchTestForm searchTest = new SearchTestForm();
                if (searchTest.ShowDialog() == System.Windows.Forms.DialogResult.OK && searchTest.IsTestSelected)
                {
                    if (string.IsNullOrWhiteSpace(searchTest.EyeTrackerData) || searchTest.TestData == null)
                    {
                        throw new ArgumentNullException("No eye tracker or test data was found");
                    }

                    switch (searchTest.TestType)
                    {
                    case LookAndPlayForm.TestType.reading:

                        //if (string.IsNullOrWhiteSpace(searchTest.FixData))
                        //throw new ArgumentNullException("No reading data was found");

                        Resumen.Resumen resumenGame1 = new Resumen.Resumen(false, false, searchTest.FixData, searchTest.EyeTrackerData, searchTest.TestData);
                        resumenGame1.ShowDialog();

                        if (resumenGame1.closeApp)
                        {
                            this.Close();
                        }
                        else
                        {
                            this.Show();
                        }
                        break;

                    case LookAndPlayForm.TestType.pursuit:

                        if (string.IsNullOrWhiteSpace(searchTest.PursuitData))
                        {
                            throw new ArgumentNullException("No pursuit data was found");
                        }

                        ReviewPersuit.ReviewPersuit reviewPersuit = new ReviewPersuit.ReviewPersuit(false, false, searchTest.PursuitData, searchTest.EyeTrackerData, searchTest.TestData);
                        reviewPersuit.ShowDialog();

                        if (reviewPersuit.closeApp)
                        {
                            this.Close();
                        }
                        else
                        {
                            this.Show();
                        }
                        break;

                    default:
                        MessageBox.Show("Error. Test type not identified.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        break;
                    }
                }
                else
                {
                    this.Show();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show((ex.GetBaseException().ToString()), "Review Test Error");
                ErrorLog.ErrorLog.toErrorFile(ex.GetBaseException().ToString());
                this.Show();
                //this.Close();
            }
        }
Beispiel #4
0
        //new test
        private void buttonNewTest_Click(object sender, EventArgs e)
        {
            try
            {
                this.Hide();

                data2Log.Time_start = DateTime.Now.ToString("HH:mm:ss");

                if (showHomeForm)
                {
                    //tester search
                    TesterLoginForm fTester = new TesterLoginForm();
                    fTester.ShowDialog();

                    if (fTester.closeApp)
                    {
                        fTester.Dispose();
                        fTester = null;
                        this.Close();
                        return;
                    }

                    aws_class_engine.UpdateTestersFile(Program.datosCompartidos.institutionName);
                    data2Log.Tester = fTester.testerDataSelected.tester_name;
                    Program.datosCompartidos.activeTester = fTester.testerDataSelected.tester_id;
                    fTester.Dispose();
                    fTester = null;

                    //patient search
                    PatientLoginForm patientLoginForm = new PatientLoginForm();
                    patientLoginForm.ShowDialog();

                    if (patientLoginForm.closeApp)
                    {
                        patientLoginForm.Dispose();
                        patientLoginForm = null;
                        this.Close();
                        return;
                    }

                    if (patientLoginForm.newUser)
                    {
                        //nuevo patient
                        ConsentForm.consentForm formularioConsentimiento = new ConsentForm.consentForm();
                        formularioConsentimiento.ShowDialog();

                        if (formularioConsentimiento.closeApp)
                        {
                            patientLoginForm.Dispose();
                            patientLoginForm = null;
                            formularioConsentimiento.Dispose();
                            formularioConsentimiento = null;
                            this.Close();//no acepto las condiciones
                            return;
                        }
                        else
                        {                //si acepto las condiciones
                            formularioConsentimiento.Dispose();
                            formularioConsentimiento = null;
                        }
                    }

                    aws_class_engine.UpdateUsersFile(Program.datosCompartidos.institutionName);
                    data2Log.Patient = patientLoginForm.patientDataSelected.user_name;
                    Program.datosCompartidos.activeUser = patientLoginForm.patientDataSelected.user_id;

                    patientLoginForm.Dispose();
                    patientLoginForm = null;
                }

                //user position
                Program.eyeTrackingEngine = new EyeTrackingEngine();
                EyeXWinForm eyeXWinForm = new EyeXWinForm(Program.eyeTrackingEngine);
                eyeXWinForm.ShowDialog();

                if (eyeXWinForm.closeApp)
                {
                    releaseEyeTracker();
                    eyeXWinForm.Dispose();
                    eyeXWinForm = null;
                    this.Close();
                    return;
                }

                eyeXWinForm.Dispose();
                eyeXWinForm = null;

                //test selection
                FormSelectionTest selectionTestForm = new FormSelectionTest();
                selectionTestForm.ShowDialog();

                if (selectionTestForm.closeApp)
                {
                    releaseEyeTracker();
                    selectionTestForm.Dispose();
                    selectionTestForm = null;
                    this.Close();
                    return;
                }

                selectionTestForm.Dispose();
                selectionTestForm = null;

                switch (Program.datosCompartidos.testSelected)
                {
                case TestType.reading:

                    //configuration reading test
                    ConfigurationReadingForm.ConfigurationReadingForm configurationReadingForm = new ConfigurationReadingForm.ConfigurationReadingForm();
                    configurationReadingForm.ShowDialog();

                    if (configurationReadingForm.closeApp)
                    {
                        releaseEyeTracker();
                        configurationReadingForm.Dispose();
                        configurationReadingForm = null;
                        this.Close();
                        return;
                    }

                    configurationReadingForm.Dispose();
                    configurationReadingForm = null;

                    //instruction reading test
                    InstructionReadingForm.InstructionReadingForm instructionReadingForm = new InstructionReadingForm.InstructionReadingForm();
                    instructionReadingForm.ShowDialog();

                    if (instructionReadingForm.closeApp)
                    {
                        releaseEyeTracker();
                        instructionReadingForm.Dispose();
                        instructionReadingForm = null;
                        this.Close();
                        return;
                    }

                    instructionReadingForm.Dispose();
                    instructionReadingForm = null;

                    //test reading
                    Game1 game1 = new Game1();
                    game1.ShowDialog();

                    if (game1.closeApp)
                    {
                        game1.Dispose();
                        game1 = null;
                        releaseEyeTracker();
                        this.Close();
                        return;
                    }

                    game1.Dispose();
                    game1 = null;
                    releaseEyeTracker();

                    if (Program.datosCompartidos.no_se_cancelo_el_test)
                    {
                        saveData();
                        //updateLogFile();

                        //review reading test
                        Resumen.Resumen reviewReading = new Resumen.Resumen(true, true, null, null, null);
                        reviewReading.ShowDialog();

                        //backupTest();

                        if (reviewReading.closeApp)
                        {
                            reviewReading.Dispose();
                            reviewReading = null;
                            this.Close();
                        }
                        else
                        {
                            if (reviewReading.toHome)
                            {
                                showHomeForm = true;
                                reviewReading.Dispose();
                                reviewReading = null;
                                this.Show();
                            }
                            else
                            {
                                showHomeForm = false;
                                reviewReading.Dispose();
                                reviewReading = null;
                                buttonNewTest_Click(this, EventArgs.Empty);
                            }
                        }
                    }
                    else
                    {
                        this.Show();
                    }
                    break;

                case TestType.pursuit:

                    //instruction pursuit test
                    InstructionPursuitForm.InstructionPursuit instructionPursuit = new InstructionPursuitForm.InstructionPursuit();
                    instructionPursuit.ShowDialog();

                    if (instructionPursuit.closeApp)
                    {
                        releaseEyeTracker();
                        instructionPursuit.Dispose();
                        instructionPursuit = null;
                        this.Close();
                        return;
                    }

                    instructionPursuit.Dispose();
                    instructionPursuit = null;

                    //test pursuit
                    StimuloPersuitHorizontal.StimuloPersuit persuit = new StimuloPersuitHorizontal.StimuloPersuit();
                    persuit.ShowDialog();

                    if (persuit.closeApp)
                    {
                        persuit.Dispose();
                        persuit = null;
                        releaseEyeTracker();
                        this.Close();
                        return;
                    }

                    persuit.Dispose();
                    persuit = null;
                    releaseEyeTracker();

                    if (Program.datosCompartidos.no_se_cancelo_el_test)
                    {
                        saveData();
                        //updateLogFile();

                        //review pursuit test
                        ReviewPersuit.ReviewPersuit reviewPersuit = new ReviewPersuit.ReviewPersuit(true, true, null, null, null);
                        reviewPersuit.ShowDialog();

                        //backupTest();

                        if (reviewPersuit.closeApp)
                        {
                            reviewPersuit.Dispose();
                            reviewPersuit = null;
                            this.Close();
                        }
                        else
                        {
                            if (reviewPersuit.toHome)
                            {
                                showHomeForm = true;
                                reviewPersuit.Dispose();
                                reviewPersuit = null;
                                this.Show();
                            }
                            else
                            {
                                showHomeForm = false;
                                reviewPersuit.Dispose();
                                reviewPersuit = null;
                                buttonNewTest_Click(this, EventArgs.Empty);
                            }
                        }
                    }
                    else
                    {
                        this.Show();
                    }
                    break;

                default:
                    releaseEyeTracker();
                    MessageBox.Show("Error. Unknow test.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    this.Show();
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("There was an error. Please contact Mr. Patch.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                ErrorLog.ErrorLog.toErrorFile(ex.GetBaseException().ToString());
                this.Close();
            }
        }