Exemple #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_TxtEmpresa.AcquireTextBox(i_Form.TxtEmpresa, this, event_val_TxtEmpresa, 6);

                ctrl_TxtLoja.AcquireTextBox(i_Form.TxtLoja, this, event_val_TxtLoja, 6);
                ctrl_TxtCNPJ.AcquireTextBox(i_Form.TxtCNPJ, this, event_val_TxtCNPJ);

                ctrl_TxtNome.AcquireTextBox(i_Form.TxtNome, this, event_val_TxtNome, 40);
                ctrl_TxtCidade.AcquireTextBox(i_Form.TxtCidade, this, event_val_TxtCidade, 20, false);
                ctrl_TxtEstado.AcquireTextBox(i_Form.TxtEstado, this, event_val_TxtEstado, 2, false);

                ctrl_TxtQtdTerm.AcquireTextBox(i_Form.TxtQtdTerm, this, event_val_TxtQtdTerm, 2);

                if (header.get_tg_user_type() == TipoUsuario.Administrador ||
                    header.get_tg_user_type() == TipoUsuario.AdminGift)
                {
                    i_Form.TxtEmpresa.Text     = 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_Consultar -

            case event_Consultar:
            {
                //InitEventCode event_Consultar

                i_Form.BtnConsultar.Enabled = false;

                DadosConsultaLoja dcl = new DadosConsultaLoja();

                dcl.set_st_empresa(ctrl_TxtEmpresa.getTextBoxValue());
                dcl.set_st_nome(ctrl_TxtNome.getTextBoxValue());
                dcl.set_st_cidade(ctrl_TxtCidade.getTextBoxValue());
                dcl.set_st_estado(ctrl_TxtEstado.getTextBoxValue());
                dcl.set_nu_qtd_term(ctrl_TxtQtdTerm.getTextBoxValue());
                dcl.set_st_loja(ctrl_TxtLoja.getTextBoxValue());
                dcl.set_st_cnpj(ctrl_TxtCNPJ.getTextBoxValue());

                string st_csv_id = "";

                i_Form.LstLojas.Items.Clear();

                i_Form.LblQtd.Text = "Processando...";

                Application.DoEvents();

                if (var_exchange.fetch_consultaLoja(ref dcl,
                                                    ref header,
                                                    ref st_csv_id))
                {
                    full_memory.Clear();

                    while (st_csv_id != "")
                    {
                        ArrayList tmp_memory = new ArrayList();

                        if (var_exchange.fetch_memory(st_csv_id, "400", ref st_csv_id, ref tmp_memory))
                        {
                            for (int t = 0; t < tmp_memory.Count; ++t)
                            {
                                full_memory.Add(tmp_memory[t]);
                            }

                            i_Form.LblQtd.Text = "Buscando " + full_memory.ToString() + " registros";
                            Application.DoEvents();
                        }
                    }

                    for (int t = 0; t < full_memory.Count; ++t)
                    {
                        DadosLoja dl = new DadosLoja(full_memory[t] as DataPortable);

                        string [] full_row = new string [] { dl.get_st_loja(),
                                  dl.get_st_nome(),
                                  dl.get_st_cidade(),
                                  dl.get_st_estado(),
                                  dl.get_st_obs(),
                                  dl.get_nu_CNPJ(),
                                  dl.get_nu_diasRep(),
                                  dl.get_nu_pctRep(),
                                  dl.get_st_convenios() };

                        i_Form.LstLojas.Items.Add(var_util.GetListViewItem(dl.get_nu_CNPJ(), full_row));
                    }

                    i_Form.LblQtd.Text = full_memory.Count.ToString() + " registros encontrados";
                }
                else
                {
                    i_Form.LblQtd.Text = "";
                }

                i_Form.BtnConsultar.Enabled = true;

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Editar -

            case event_Editar:
            {
                //InitEventCode event_Editar

                if (i_Form.LstLojas.SelectedItems.Count > 0)
                {
                    if (header.get_tg_user_type() == TipoUsuario.SuperUser ||
                        header.get_tg_user_type() == TipoUsuario.Administrador ||
                        header.get_tg_user_type() == TipoUsuario.AdminGift)
                    {
                        event_dlgNovaLoja ev_call = new event_dlgNovaLoja(var_util, var_exchange);

                        ev_call.header        = header;
                        ev_call.IsMaintenance = true;
                        ev_call.par_code      = var_util.getSelectedListViewItemTag(i_Form.LstLojas);

                        ev_call.i_Form.ShowDialog();
                    }
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Remover -

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

                #endregion

                #region - event_val_TxtNome -

            case event_val_TxtNome:
            {
                //InitEventCode event_val_TxtNome

                switch (arg as string)
                {
                case alphaTextController.ALPHA_COMPLETE:
                case alphaTextController.ALPHA_INCOMPLETE:
                {
                    if (ctrl_TxtNome.getTextBoxValue().Length > 0)
                    {
                        i_Form.TxtNome.BackColor     = Color.White;
                        ctrl_TxtNome.IsUserValidated = true;
                    }
                    else
                    {
                        i_Form.TxtNome.BackColor     = colorInvalid;
                        ctrl_TxtNome.IsUserValidated = false;
                    }

                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtCidade -

            case event_val_TxtCidade:
            {
                //InitEventCode event_val_TxtCidade

                switch (arg as string)
                {
                case alphaTextController.ALPHA_COMPLETE:
                case alphaTextController.ALPHA_INCOMPLETE:
                {
                    if (ctrl_TxtCidade.getTextBoxValue().Length > 0)
                    {
                        i_Form.TxtCidade.BackColor     = Color.White;
                        ctrl_TxtCidade.IsUserValidated = true;
                    }
                    else
                    {
                        i_Form.TxtCidade.BackColor     = colorInvalid;
                        ctrl_TxtCidade.IsUserValidated = false;
                    }

                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtEstado -

            case event_val_TxtEstado:
            {
                //InitEventCode event_val_TxtEstado

                switch (arg as string)
                {
                case alphaTextController.ALPHA_COMPLETE:
                case alphaTextController.ALPHA_INCOMPLETE:
                {
                    if (ctrl_TxtEstado.getTextBoxValue().Length > 0)
                    {
                        i_Form.TxtEstado.BackColor     = Color.White;
                        ctrl_TxtEstado.IsUserValidated = true;
                    }
                    else
                    {
                        i_Form.TxtEstado.BackColor     = colorInvalid;
                        ctrl_TxtEstado.IsUserValidated = false;
                    }

                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtRamo -

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

                #endregion

                #region - event_val_TxtQtdTerm -

            case event_val_TxtQtdTerm:
            {
                //InitEventCode event_val_TxtQtdTerm

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

                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtEmpresa -

            case event_val_TxtEmpresa:
            {
                //InitEventCode event_val_TxtEmpresa

                if (header.get_tg_user_type() == TipoUsuario.Administrador ||
                    header.get_tg_user_type() == TipoUsuario.AdminGift)
                {
                    return(false);
                }

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

                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtLoja -

            case event_val_TxtLoja:
            {
                //InitEventCode event_val_TxtLoja

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

                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtCNPJ -

            case event_val_TxtCNPJ:
            {
                //InitEventCode event_val_TxtCNPJ

                switch (arg as string)
                {
                case cnpjTextController.CNPJ_INCOMPLETE:
                case cnpjTextController.CNPJ_INVALID:
                {
                    i_Form.TxtCNPJ.BackColor     = colorInvalid;
                    ctrl_TxtCNPJ.IsUserValidated = false;
                    break;
                }

                case cnpjTextController.CNPJ_VALID:
                {
                    i_Form.TxtCNPJ.BackColor     = Color.White;
                    ctrl_TxtCNPJ.IsUserValidated = true;
                    ctrl_TxtCNPJ.CleanError();
                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Print -

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

                #endregion

                #region - event_Report -

            case event_Report:
            {
                //InitEventCode event_Report

                ArrayList lstReport = new ArrayList();

                lstReport.Add("RELATÓRIO COMPLETO DE LOJAS");
                lstReport.Add("");
                lstReport.Add("COD.     NOME                                                   CIDADE       CNPJ             DIAS REP.   PCT. REPASSE");
                lstReport.Add("TELEFONE E ENDEREÇO");
                lstReport.Add("CONVENIOS");
                lstReport.Add("------------------------------------------------------------------------------------------------------------------------");
                lstReport.Add("");

                string line = "";

                for (int t = 0; t < i_Form.LstLojas.Items.Count; ++t)
                {
                    line  = i_Form.LstLojas.Items[t].SubItems[0].Text.PadRight(8, ' ') + " ";
                    line += i_Form.LstLojas.Items[t].SubItems[1].Text.PadRight(48, ' ').Substring(0, 48) + " ";
                    line += i_Form.LstLojas.Items[t].SubItems[2].Text.Trim().PadLeft(18, ' ') + " ";
                    line += i_Form.LstLojas.Items[t].SubItems[5].Text.PadLeft(14, ' ') + " ";
                    line += i_Form.LstLojas.Items[t].SubItems[6].Text.PadLeft(11, ' ') + " ";
                    line += i_Form.LstLojas.Items[t].SubItems[7].Text.PadLeft(11, ' ') + " ";

                    lstReport.Add(line);

                    for (int h = 0; h < full_memory.Count; ++h)
                    {
                        DadosLoja dl = new DadosLoja(full_memory[h] as DataPortable);

                        if (dl.get_st_nome() != i_Form.LstLojas.Items[t].SubItems[1].Text)
                        {
                            continue;
                        }

                        lstReport.Add(dl.get_st_endereco());
                        break;
                    }

                    lstReport.Add("Convênios: " + i_Form.LstLojas.Items[t].SubItems[8].Text);
                    lstReport.Add("");
                }

                new ConveyPrinter("Courier New", 7, 10, ref lstReport);

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BtnConsultarClick -

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

                #endregion

                #region - event_LstLojasDoubleClick -

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

                #endregion

                #region - event_BtnRelatorioClick -

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

                #endregion

            default: break;
            }

            return(false);
        }
        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_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, 4);
                ctrl_TxtValor.AcquireTextBox(i_Form.TxtValor, this, event_val_TxtValor, "R$", 9);

                ctrl_TxtCodAcesso.AcquireTextBox(i_Form.TxtCodAcesso, this, event_val_TxtCodAcesso, 4);

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

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

                DadosConsultaLoja dcl = new DadosConsultaLoja();

                dcl.set_st_empresa(header.get_st_empresa());

                string st_csv_id = "";

                if (var_exchange.fetch_consultaLojasGift(header.get_st_empresa(),
                                                         ref header,
                                                         ref st_csv_id))
                {
                    ArrayList tmp_memory = new ArrayList();

                    while (st_csv_id != "")
                    {
                        if (var_exchange.fetch_memory(st_csv_id, "120", ref st_csv_id, ref tmp_memory))
                        {
                            for (int t = 0; t < tmp_memory.Count; ++t)
                            {
                                lstLojas.Add(tmp_memory[t]);
                            }
                        }
                    }

                    for (int t = 0; t < lstLojas.Count; ++t)
                    {
                        DadosLoja dl = new DadosLoja(lstLojas[t] as DataPortable);

                        i_Form.LstLojas.Items.Add(dl.get_st_nome());
                    }
                }

                //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_TxtEmpresa.IsUserValidated)
                {
                    ctrl_TxtEmpresa.SetErrorMessage("O código da empresa deve ser informado");      IsDone = false;
                }
                if (!ctrl_TxtMatricula.IsUserValidated)
                {
                    ctrl_TxtMatricula.SetErrorMessage("O código da matricula deve ser informado");      IsDone = false;
                }
                if (!ctrl_TxtTitularidade.IsUserValidated)
                {
                    ctrl_TxtTitularidade.SetErrorMessage("A titularidade do cartão deve ser informada");      IsDone = false;
                }
                if (!ctrl_TxtValor.IsUserValidated)
                {
                    ctrl_TxtValor.SetErrorMessage("O valor da venda deve ser informado");      IsDone = false;
                }
                if (!ctrl_TxtCodAcesso.IsUserValidated)
                {
                    ctrl_TxtValor.SetErrorMessage("O código de acesso deve ser informado");      IsDone = false;
                }

                if (i_Form.LstLojas.SelectedIndex == -1)
                {
                    MessageBox.Show("Selecione a loja");
                    return(false);
                }

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

                if (MessageBox.Show("Confirma venda no valor de R$ " +
                                    ctrl_TxtValor.getTextBoxValue() +
                                    " para " +
                                    i_Form.LstLojas.SelectedItem.ToString() +
                                    " ?",
                                    "Aviso",
                                    MessageBoxButtons.YesNo,
                                    MessageBoxIcon.Question,
                                    MessageBoxDefaultButton.Button2) == DialogResult.No)
                {
                    return(false);
                }

                string cript_senha = new ApplicationUtil().DESCript("9999".PadLeft(8, '*'), "12345678");

                DadosLoja dl = new DadosLoja(lstLojas [i_Form.LstLojas.SelectedIndex] as DataPortable);

                POS_Entrada pe = new POS_Entrada();

                pe.set_st_senha(cript_senha);
                pe.set_st_empresa(ctrl_TxtEmpresa.getTextBoxValue().PadLeft(6, '0'));
                pe.set_st_matricula(ctrl_TxtMatricula.getTextBoxValue().PadLeft(6, '0'));
                pe.set_st_titularidade("01");
                pe.set_vr_valor(ctrl_TxtValor.getTextBoxValue_NumberStr().PadLeft(12, '0'));
                pe.set_st_terminal(dl.get_st_obs());
                pe.set_nu_parcelas("1");
                pe.set_st_valores(ctrl_TxtValor.getTextBoxValue_NumberStr().PadLeft(12, '0'));

                POS_Resposta resp = new POS_Resposta();

                string msg = "";

                var_exchange.m_Client.QuietMode = true;


                string codAc = var_util.calculaCodigoAcesso(ctrl_TxtEmpresa.getTextBoxValue().PadLeft(6, '0'),
                                                            ctrl_TxtMatricula.getTextBoxValue().PadLeft(6, '0'),
                                                            ctrl_TxtTitularidade.getTextBoxValue());

                if (codAc != ctrl_TxtCodAcesso.getTextBoxValue())
                {
                    MessageBox.Show("Cartão inválido", "Aviso");
                    return(false);
                }

                if (var_exchange.exec_pos_vendaEmpresarial(ref pe,
                                                           ref msg,
                                                           ref resp))
                {
                    nsu_venda = resp.get_st_nsuRcb();

                    if (var_exchange.exec_pos_confirmaVendaEmpresarial(nsu_venda,
                                                                       ref pe,
                                                                       ref msg,
                                                                       ref resp))
                    {
                        var_exchange.m_Client.QuietMode = false;

                        MessageBox.Show("NSU: " + nsu_venda, "Transação confirmada");

                        PrintDocument pd      = new PrintDocument();
                        PrintDialog   pDialog = new PrintDialog();

                        pDialog.Document = pd;

                        PrintPreviewDialog prevDialog = new PrintPreviewDialog();
                        prevDialog.Document = pd;

                        pd.PrintPage += new PrintPageEventHandler(i_Form.Inven_Report);
                        prevDialog.ShowDialog();

                        if (pDialog.ShowDialog() == DialogResult.OK)
                        {
                            pd.Print();
                        }
                    }
                    else
                    {
                        MessageBox.Show(msg, "Erro na transação");
                    }
                }
                else
                {
                    MessageBox.Show(msg, "Erro na transação");
                }

                var_exchange.m_Client.QuietMode = false;

                //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;
                }

                if (ctrl_TxtEmpresa.GetEnterPressed())
                {
                    doEvent(event_BuscaDados, null);
                }

                //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;
                }

                if (ctrl_TxtMatricula.GetEnterPressed())
                {
                    doEvent(event_BuscaDados, null);
                }

                //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 == 4)
                    {
                        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;
                }

                if (ctrl_TxtTitularidade.GetEnterPressed())
                {
                    doEvent(event_BuscaDados, null);
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtValor -

            case event_val_TxtValor:
            {
                //InitEventCode event_val_TxtValor

                if (arg as string == moneyTextController.MONEY_ZERO)
                {
                    i_Form.TxtValor.BackColor     = colorInvalid;
                    ctrl_TxtValor.IsUserValidated = false;
                }
                else
                {
                    i_Form.TxtValor.BackColor     = Color.White;
                    ctrl_TxtValor.IsUserValidated = true;
                    ctrl_TxtValor.CleanError();
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BuscaDados -

            case event_BuscaDados:
            {
                //InitEventCode event_BuscaDados

                string st_nu_maxParcelas = "";
                string st_vr_dispMes     = "";
                string st_vr_dispTotal   = "";
                string st_nome           = "";

                if (var_exchange.fetch_dadosCartao(ctrl_TxtEmpresa.getTextBoxValue(),
                                                   ctrl_TxtMatricula.getTextBoxValue(),
                                                   "01",
                                                   ref header,
                                                   ref st_nu_maxParcelas,
                                                   ref st_vr_dispMes,
                                                   ref st_vr_dispTotal,
                                                   ref st_nome))
                {
                    i_Form.TxtVrDispTotal.Text = new money().formatToMoney(st_vr_dispTotal);
                    i_Form.TxtNome.Text        = st_nome;
                }
                else
                {
                    i_Form.TxtVrDispTotal.Text = "";
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Print -

            case event_Print:
            {
                //InitEventCode event_Print

                ArrayList lst = new ArrayList();

                var_exchange.fetch_reciboVendaGift(nsu_venda, ref header, ref lst);

                PrintPageEventArgs e = arg as PrintPageEventArgs;

                Graphics g      = e.Graphics;
                int      n      = 0;
                Font     myFont = new Font("Courier New", 10);

                try
                {
                    for (int t = 0; t < lst.Count; ++t)
                    {
                        DataPortable port = lst[t] as DataPortable;

                        g.DrawString(port.getValue("linha"), myFont, Brushes.Black, 10, 10 + (n * 20)); ++n;
                    }

                    myFont.Dispose();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message.ToString());
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtCodAcesso -

            case event_val_TxtCodAcesso:
            {
                //InitEventCode event_val_TxtCodAcesso

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

                    break;
                }

                default: break;
                }

                if (ctrl_TxtCodAcesso.GetEnterPressed())
                {
                    doEvent(event_BuscaDados, null);
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BtnConfirmarClick -

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

                #endregion

            default: break;
            }

            return(false);
        }