예제 #1
0
        public override bool doEvent(int event_number, object arg)
        {
            switch (event_number)
            {
                #region - event_Load -

            case event_Load:
            {
                //InitEventCode event_Load

                                        #if ROBOT
                var_util.execDefinedRobot(this, var_alias);
                                        #else
                doEvent(event_Translate, null);
                doEvent(event_FormIsOpening, null);
                                        #endif

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Translate -

            case event_Translate:
            {
                //InitEventCode event_Translate
                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_FormIsOpening -

            case event_FormIsOpening:
            {
                //InitEventCode event_FormIsOpening

                ctrl_TxtNovaSenha.AcquireTextBox(i_Form.TxtNovaSenha, this, event_val_TxtNovaSenha, 4);
                ctrl_TxtConfirmaSenha.AcquireTextBox(i_Form.TxtConfirmaSenha, this, event_val_TxtConfirmaSenha, 4);

                ctrl_TxtEmpresa.AcquireTextBox(i_Form.TxtEmpresa, this, event_val_TxtEmpresa, 6);
                ctrl_TxtMatricula.AcquireTextBox(i_Form.TxtMatricula, this, event_val_TxtMatricula, 6);
                ctrl_TxtTitularidade.AcquireTextBox(i_Form.TxtTitularidade, this, event_val_TxtTitularidade, 2);

                ctrl_TxtNovaSenha.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);
                ctrl_TxtConfirmaSenha.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);
                ctrl_TxtEmpresa.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);
                ctrl_TxtMatricula.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);
                ctrl_TxtTitularidade.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);

                if (header.get_tg_user_type() == TipoUsuario.Administrador ||
                    header.get_tg_user_type() == TipoUsuario.Operador)
                {
                    ctrl_TxtEmpresa.SetTextBoxText(header.get_st_empresa());
                    i_Form.TxtEmpresa.ReadOnly = true;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - robot_ShowDialog -

            case robot_ShowDialog:
            {
                //InitEventCode robot_ShowDialog
                //EndEventCode
                return(true);
            }

                #endregion

                #region - robot_CloseDialog -

            case robot_CloseDialog:
            {
                //InitEventCode robot_CloseDialog
                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Confirmar -

            case event_Confirmar:
            {
                //InitEventCode event_Confirmar

                bool IsDone = true;

                if (!ctrl_TxtNovaSenha.IsUserValidated)
                {
                    ctrl_TxtNovaSenha.SetErrorMessage("Senha deve possuir 4 caracteres numéricos");      IsDone = false;
                }
                if (!ctrl_TxtConfirmaSenha.IsUserValidated)
                {
                    ctrl_TxtConfirmaSenha.SetErrorMessage("Senha deve possuir 4 caracteres numéricos");      IsDone = false;
                }
                if (!ctrl_TxtEmpresa.IsUserValidated)
                {
                    ctrl_TxtEmpresa.SetErrorMessage("Código de empresa não está preenchido");      IsDone = false;
                }
                if (!ctrl_TxtMatricula.IsUserValidated)
                {
                    ctrl_TxtMatricula.SetErrorMessage("Código de matricula não está preenchido");      IsDone = false;
                }
                if (!ctrl_TxtTitularidade.IsUserValidated)
                {
                    ctrl_TxtTitularidade.SetErrorMessage("Titularidade não está preenchida");      IsDone = false;
                }

                if (!IsDone)
                {
                    return(false);
                }

                var_exchange.exec_alteraSenhaCartao(ctrl_TxtEmpresa.getTextBoxValue(),
                                                    ctrl_TxtMatricula.getTextBoxValue(),
                                                    ctrl_TxtTitularidade.getTextBoxValue(),
                                                    "",
                                                    var_util.DESCript(ctrl_TxtNovaSenha.getTextBoxValue().PadLeft(8, '*'), "12345678"),
                                                    ref header);

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtSenha -

            case event_val_TxtSenha:
            {
                //InitEventCode event_val_TxtSenha
                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtNovaSenha -

            case event_val_TxtNovaSenha:
            {
                //InitEventCode event_val_TxtNovaSenha

                switch (arg as string)
                {
                case numberTextController.NUMBER_INCOMPLETE:
                case numberTextController.NUMBER_COMPLETE:
                {
                    if (i_Form.TxtNovaSenha.Text.Length == 4)
                    {
                        i_Form.TxtNovaSenha.BackColor     = Color.White;
                        ctrl_TxtNovaSenha.IsUserValidated = true;
                        ctrl_TxtNovaSenha.CleanError();
                    }
                    else
                    {
                        i_Form.TxtNovaSenha.BackColor     = colorInvalid;
                        ctrl_TxtNovaSenha.IsUserValidated = false;
                    }

                    break;
                }
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtConfirmaSenha -

            case event_val_TxtConfirmaSenha:
            {
                //InitEventCode event_val_TxtConfirmaSenha

                switch (arg as string)
                {
                case numberTextController.NUMBER_INCOMPLETE:
                case numberTextController.NUMBER_COMPLETE:
                {
                    if (i_Form.TxtConfirmaSenha.Text.Length == 4)
                    {
                        i_Form.TxtConfirmaSenha.BackColor     = Color.White;
                        ctrl_TxtConfirmaSenha.IsUserValidated = true;
                        ctrl_TxtConfirmaSenha.CleanError();
                    }
                    else
                    {
                        i_Form.TxtConfirmaSenha.BackColor     = colorInvalid;
                        ctrl_TxtConfirmaSenha.IsUserValidated = false;
                    }

                    break;
                }
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtEmpresa -

            case event_val_TxtEmpresa:
            {
                //InitEventCode event_val_TxtEmpresa

                switch (arg as string)
                {
                case numberTextController.NUMBER_INCOMPLETE:
                case numberTextController.NUMBER_COMPLETE:
                {
                    if (i_Form.TxtEmpresa.Text.Length > 0)
                    {
                        i_Form.TxtEmpresa.BackColor     = Color.White;
                        ctrl_TxtEmpresa.IsUserValidated = true;
                        ctrl_TxtEmpresa.CleanError();
                    }
                    else
                    {
                        i_Form.TxtEmpresa.BackColor     = colorInvalid;
                        ctrl_TxtEmpresa.IsUserValidated = false;
                    }

                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtMatricula -

            case event_val_TxtMatricula:
            {
                //InitEventCode event_val_TxtMatricula

                switch (arg as string)
                {
                case numberTextController.NUMBER_INCOMPLETE:
                case numberTextController.NUMBER_COMPLETE:
                {
                    if (i_Form.TxtMatricula.Text.Length > 0)
                    {
                        i_Form.TxtMatricula.BackColor     = Color.White;
                        ctrl_TxtMatricula.IsUserValidated = true;
                        ctrl_TxtMatricula.CleanError();
                    }
                    else
                    {
                        i_Form.TxtMatricula.BackColor     = colorInvalid;
                        ctrl_TxtMatricula.IsUserValidated = false;
                    }

                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtTitularidade -

            case event_val_TxtTitularidade:
            {
                //InitEventCode event_val_TxtTitularidade

                switch (arg as string)
                {
                case numberTextController.NUMBER_INCOMPLETE:
                case numberTextController.NUMBER_COMPLETE:
                {
                    if (i_Form.TxtTitularidade.Text.Length > 0)
                    {
                        i_Form.TxtTitularidade.BackColor     = Color.White;
                        ctrl_TxtTitularidade.IsUserValidated = true;
                        ctrl_TxtTitularidade.CleanError();
                    }
                    else
                    {
                        i_Form.TxtTitularidade.BackColor     = colorInvalid;
                        ctrl_TxtTitularidade.IsUserValidated = false;
                    }

                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BtnConfirmarClick -

            case event_BtnConfirmarClick:
            {
                //InitEventCode event_BtnConfirmarClick
                //EndEventCode
                return(true);
            }

                #endregion

            default: break;
            }

            return(false);
        }
예제 #2
0
        public override bool doEvent(int event_number, object arg)
        {
            switch (event_number)
            {
                #region - event_Load -

            case event_Load:
            {
                //InitEventCode event_Load

                                        #if ROBOT
                var_util.execDefinedRobot(this, var_alias);
                                        #else
                doEvent(event_Translate, null);
                doEvent(event_FormIsOpening, null);
                                        #endif

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Translate -

            case event_Translate:
            {
                //InitEventCode event_Translate
                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_FormIsOpening -

            case event_FormIsOpening:
            {
                //InitEventCode event_FormIsOpening

                ctrl_TxtSenha.AcquireTextBox(i_Form.TxtSenha, this, event_val_TxtSenha, 4);
                ctrl_TxtCartao.AcquireTextBox(i_Form.TxtCartao, this, event_val_TxtCartao, 15);

                ctrl_TxtSenha.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);
                ctrl_TxtCartao.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);

                //EndEventCode
                return(true);
            }

                #endregion

                #region - robot_ShowDialog -

            case robot_ShowDialog:
            {
                //InitEventCode robot_ShowDialog
                //EndEventCode
                return(true);
            }

                #endregion

                #region - robot_CloseDialog -

            case robot_CloseDialog:
            {
                //InitEventCode robot_CloseDialog
                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtSenha -

            case event_val_TxtSenha:
            {
                //InitEventCode event_val_TxtSenha

                switch (arg as string)
                {
                case pinpadTextController.PINPAD_INCOMPLETE:
                case pinpadTextController.PINPAD_COMPLETE:
                {
                    if (i_Form.TxtSenha.Text.Length > 3)
                    {
                        i_Form.TxtSenha.BackColor     = Color.White;
                        ctrl_TxtSenha.IsUserValidated = true;
                        ctrl_TxtSenha.CleanError();
                    }
                    else
                    {
                        i_Form.TxtSenha.BackColor     = colorInvalid;
                        ctrl_TxtSenha.IsUserValidated = false;
                    }

                    break;
                }

                case pinpadTextController.PINPAD_ENTRA:
                {
                    doEvent(event_Confirmar, null);
                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtCartao -

            case event_val_TxtCartao:
            {
                //InitEventCode event_val_TxtCartao

                switch (arg as string)
                {
                case pincardTextController.PINCARD_INCOMPLETE:
                {
                    i_Form.TxtCartao.BackColor     = colorInvalid;
                    ctrl_TxtCartao.IsUserValidated = false;
                    break;
                }

                case pincardTextController.PINCARD_COMPLETE:
                {
                    i_Form.TxtCartao.BackColor     = Color.White;
                    ctrl_TxtCartao.IsUserValidated = true;
                    ctrl_TxtCartao.CleanError();

                    if (ctrl_TxtCartao.IsTermInput)
                    {
                        i_Form.TxtSenha.Focus();
                    }

                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Confirmar -

            case event_Confirmar:
            {
                //InitEventCode event_Confirmar

                bool IsDone = true;

                if (!ctrl_TxtCartao.IsUserValidated)
                {
                    ctrl_TxtCartao.SetErrorMessage("O código completo do cartão deve ser informado (12 digitos)");      IsDone = false;
                }
                if (!ctrl_TxtSenha.IsUserValidated)
                {
                    ctrl_TxtSenha.SetErrorMessage("A senha deve ter 4 digitos");       IsDone = false;
                }

                if (!IsDone)
                {
                    return(false);
                }

                var_exchange.exec_edu_habilita(ctrl_TxtCartao.getTextBoxValue(),
                                               var_util.DESCript(ctrl_TxtSenha.getTextBoxValue().PadLeft(8, '*'), "12345678"),
                                               ref header);

                ctrl_TxtCartao.SetTextBoxText("");
                ctrl_TxtSenha.SetTextBoxText("");

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtEmpresa -

            case event_val_TxtEmpresa:
            {
                //InitEventCode event_val_TxtEmpresa
                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BtnConfirmarClick -

            case event_BtnConfirmarClick:
            {
                //InitEventCode event_BtnConfirmarClick
                //EndEventCode
                return(true);
            }

                #endregion

            default: break;
            }

            return(false);
        }