Пример #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_TxtCartao.AcquireTextBox(i_Form.TxtCartao, this, event_val_TxtCartao, 6);

                ctrl_TxtDiario.AcquireTextBox(i_Form.TxtDiario, this, event_val_TxtDiario, "R$", 8);
                ctrl_TxtMensal.AcquireTextBox(i_Form.TxtMensal, this, event_val_TxtMensal, "R$", 8);
                ctrl_TxtEdu.AcquireTextBox(i_Form.TxtEdu, this, event_val_TxtEdu, "R$", 8);
                ctrl_TxtExtra.AcquireTextBox(i_Form.TxtExtra, this, event_val_TxtExtra, "R$", 8);

                ctrl_TxtDin.AcquireTextBox(i_Form.TxtDin, this, event_val_TxtDin, "R$", 8);

                ctrl_TxtCartao.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);
                ctrl_TxtDiario.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);
                ctrl_TxtMensal.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);
                ctrl_TxtEdu.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);
                ctrl_TxtExtra.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);

                ctrl_TxtDin.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);

                ctrl_TxtCartao.IsUserValidated = false;

                ctrl_TxtDtIni.AcquireTextBox(i_Form.TxtDtIni, this, event_val_TxtDtIni, dateTextController.FORMAT_DDMMYYYY);
                ctrl_TxtDtFim.AcquireTextBox(i_Form.TxtDtFim, this, event_val_TxtDtFim, dateTextController.FORMAT_DDMMYYYY);

                ctrl_TxtDtIni.SetTextBoxText(DateTime.Now.AddDays(-7).Day.ToString().PadLeft(2, '0') +
                                             DateTime.Now.AddDays(-7).Month.ToString().PadLeft(2, '0') +
                                             DateTime.Now.AddDays(-7).Year.ToString().PadLeft(2, '0'));

                ctrl_TxtDtFim.SetTextBoxText(DateTime.Now.Day.ToString().PadLeft(2, '0') +
                                             DateTime.Now.Month.ToString().PadLeft(2, '0') +
                                             DateTime.Now.Year.ToString().PadLeft(2, '0'));

                if (header.get_tg_user_type() != TipoUsuario.SuperUser &&
                    header.get_tg_user_type() == TipoUsuario.OperadorEdu)
                {
                    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_Definir -

            case event_Definir:
            {
                //InitEventCode event_Definir

                if (!ctrl_TxtCartao.IsUserValidated)
                {
                    return(false);
                }

                dlgAutorizacao autor = new dlgAutorizacao();

                autor.ShowDialog();

                Application.DoEvents();

                if (autor.IsConfirmed)
                {
                    var_exchange.exec_edu_alteraDiario(var_util.getMd5Hash(autor.senha),
                                                       ctrl_TxtDiario.getTextBoxValue_NumberStr(),
                                                       ctrl_TxtEmpresa.getTextBoxValue() +
                                                       ctrl_TxtCartao.getTextBoxValue() + "01",
                                                       ref header);
                }

                doEvent(event_BuscaDados, null);

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Pagamento -

            case event_Pagamento:
            {
                //InitEventCode event_Pagamento

                if (!ctrl_TxtCartao.IsUserValidated)
                {
                    return(false);
                }

                dlgAutorizacao autor = new dlgAutorizacao();

                autor.ShowDialog();

                Application.DoEvents();

                if (autor.IsConfirmed)
                {
                    var_exchange.exec_depotEduImediato(var_util.getMd5Hash(autor.senha),
                                                       ctrl_TxtEdu.getTextBoxValue_NumberStr(),
                                                       ctrl_TxtExtra.getTextBoxValue_NumberStr(),
                                                       ctrl_TxtEmpresa.getTextBoxValue(),
                                                       ctrl_TxtCartao.getTextBoxValue(),
                                                       ref header);
                }

                doEvent(event_BuscaDados, null);

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Vis -

            case event_Vis:
            {
                //InitEventCode event_Vis

                // ##############################
                // # SETUP LISTS ################
                // ##############################

                ArrayList lstHeader     = new ArrayList();
                ArrayList lstContent    = new ArrayList();
                ArrayList lstTableSizes = new ArrayList();
                ArrayList lstFooter     = new ArrayList();
                ArrayList lstMessages   = new ArrayList();
                ArrayList lstFilters    = new ArrayList();

                ArrayList lstFooterSub1  = new ArrayList();
                ArrayList lstHeaderSub1  = new ArrayList();
                ArrayList lstContentSub1 = new ArrayList();

                lstHeader.Add(lstHeaderSub1);
                lstFooter.Add(lstFooterSub1);
                lstContent.Add(lstContentSub1);

                // ##############################
                // # CUSTOMIZE
                // ##############################

                string st_csv           = "";
                string st_empresa       = "";
                string st_total_periodo = "";

                if (!var_exchange.fetch_rel_edu_extrato(var_util.GetDataBaseTimeFormat(ctrl_TxtDtIni.getTextBoxValue_Date()),
                                                        var_util.GetDataBaseTimeFormat(ctrl_TxtDtFim.getTextBoxValue_Date().AddDays(1)),
                                                        ctrl_TxtEmpresa.getTextBoxValue(),
                                                        ctrl_TxtCartao.getTextBoxValue(),
                                                        ref header,
                                                        ref st_csv,
                                                        ref st_empresa,
                                                        ref st_total_periodo))
                {
                    return(false);
                }

                lstMessages.Add("Extrato do aluno: " + i_Form.TxtAluno.Text);

                lstTableSizes.Add(950);

                lstHeaderSub1.Add("NSU");
                lstHeaderSub1.Add("Data");
                lstHeaderSub1.Add("Valor R$");
                lstHeaderSub1.Add("Loja");
                lstHeaderSub1.Add("Saldo R$");
                lstHeaderSub1.Add("Fundo R$");
                lstHeaderSub1.Add("Operação");

                money money_helper = new money();

                ArrayList full_memory = new ArrayList();

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

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

                ArrayList desc    = new TipoConfirmacaoDesc().GetArray();
                ArrayList desc_op = new OperacaoCartaoDesc().GetArray();

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

                    ArrayList lstLine1 = new ArrayList();

                    lstLine1.Add(rel_line.get_st_nsu());
                    lstLine1.Add(var_util.getDDMMYYYY_format(rel_line.get_dt_trans()));

                    lstLine1.Add(money_helper.formatToMoney(rel_line.get_vr_valor()));

                    lstLine1.Add(rel_line.get_st_loja());
                    lstLine1.Add(money_helper.formatToMoney(rel_line.get_vr_disp()));
                    lstLine1.Add(money_helper.formatToMoney(rel_line.get_vr_fundo()));

                    if (rel_line.get_en_oper() == OperacaoCartao.VENDA_EMPRESARIAL)
                    {
                        lstLine1.Add("Utilização do cartão");
                    }
                    else
                    {
                        lstLine1.Add(desc_op [Convert.ToInt32(rel_line.get_en_oper())].ToString());
                    }

                    lstContentSub1.Add(lstLine1);
                }

                SyCrafReport rel = new SyCrafReport("Extrado de Transações por cartão",
                                                    "ETC",
                                                    st_empresa,
                                                    ctrl_TxtDtIni.getTextBoxValue(),
                                                    ctrl_TxtDtFim.getTextBoxValue(),
                                                    ref lstHeader,
                                                    ref lstContent,
                                                    ref lstTableSizes,
                                                    ref lstFooter,
                                                    ref lstMessages,
                                                    ref lstFilters);

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtCartao -

            case event_val_TxtCartao:
            {
                //InitEventCode event_val_TxtCartao

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

                    break;
                }

                default: break;
                }

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

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtDiario -

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

                #endregion

                #region - event_val_TxtMensal -

            case event_val_TxtMensal:
            {
                //InitEventCode event_val_TxtMensal

                if (!ctrl_TxtCartao.IsUserValidated)
                {
                    return(false);
                }

                long val = ctrl_TxtMensal.getTextBoxValue_Long();

                if (val > 0)
                {
                    ctrl_TxtDiario.SetTextBoxLong(val / 31);
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtEdu -

            case event_val_TxtEdu:
            {
                //InitEventCode event_val_TxtEdu

                if (!ctrl_TxtCartao.IsUserValidated)
                {
                    return(false);
                }

                long val = ctrl_TxtEdu.getTextBoxValue_Long() +
                           ctrl_TxtExtra.getTextBoxValue_Long();

                ctrl_TxtDin.SetTextBoxLong(val);

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtExtra -

            case event_val_TxtExtra:
            {
                //InitEventCode event_val_TxtExtra

                if (!ctrl_TxtCartao.IsUserValidated)
                {
                    return(false);
                }

                long val = ctrl_TxtEdu.getTextBoxValue_Long() +
                           ctrl_TxtExtra.getTextBoxValue_Long();

                ctrl_TxtDin.SetTextBoxLong(val);

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtDoc -

            case event_val_TxtDoc:
            {
                //InitEventCode event_val_TxtDoc

                /*if ( !ctrl_TxtCartao.IsUserValidated )
                 *      return false;
                 *
                 * if ( ctrl_TxtDoc.getTextBoxValue_Long() > 0 )
                 * {
                 *      long diario = ctrl_TxtDoc.getTextBoxValue_Long() / 31;
                 *
                 *      i_Form.rb1.Text =   "Em Fundo Educacional, definindo R$ " +
                 *                                              new money().formatToMoney ( diario.ToString() ) +
                 *                                              " diário";
                 * }
                 */

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BuscaDados -

            case event_BuscaDados:
            {
                //InitEventCode event_BuscaDados

                if (!ctrl_TxtEmpresa.IsUserValidated || !ctrl_TxtCartao.IsUserValidated)
                {
                    return(false);
                }

                DadosCartaoEdu dce = new DadosCartaoEdu();

                if (var_exchange.fetch_dadosAluno(ctrl_TxtEmpresa.getTextBoxValue() +
                                                  ctrl_TxtCartao.getTextBoxValue() +
                                                  "01",
                                                  ref header,
                                                  ref dce))
                {
                    i_Form.TxtAluno.Text = dce.get_st_aluno();

                    ctrl_TxtDiario.SetTextBoxString(dce.get_vr_diario().PadLeft(6, '0'));

                    int diario   = Convert.ToInt32(dce.get_vr_diario());
                    int calc_mes = diario * 31;

                    i_Form.TxtMensal.Text = "R$ " + new money().formatToMoney(calc_mes.ToString());

                    i_Form.TxtVrDisp.Text       = "R$ " + new money().formatToMoney(dce.get_vr_disp());
                    i_Form.TxtVrDispDiario.Text = "R$ " + new money().formatToMoney(diario.ToString());
                    i_Form.TxtVrDispMensal.Text = "R$ " + new money().formatToMoney(calc_mes.ToString());
                    i_Form.TxtSaldoTotal.Text   = "R$ " + new money().formatToMoney(dce.get_vr_depot());

                    DateTime tim = new DateTime(DateTime.Now.Year,
                                                DateTime.Now.Month,
                                                1).AddMonths(1);

                    long dias     = tim.Subtract(DateTime.Now).Days;
                    long prev_mes = dias * diario;

                    i_Form.TxtVrSaldoMes.Text = "R$ " + new money().formatToMoney(prev_mes.ToString());
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtDin -

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

                #endregion

                #region - event_val_TxtDtIni -

            case event_val_TxtDtIni:
            {
                //InitEventCode event_val_TxtDtIni

                switch (arg as string)
                {
                case dateTextController.DATE_INVALID:
                {
                    i_Form.TxtDtIni.BackColor     = colorInvalid;
                    ctrl_TxtDtIni.IsUserValidated = false;
                    break;
                }

                case dateTextController.DATE_VALID:
                {
                    i_Form.TxtDtIni.BackColor     = Color.White;
                    ctrl_TxtDtIni.IsUserValidated = true;
                    ctrl_TxtDtIni.CleanError();
                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtDtFim -

            case event_val_TxtDtFim:
            {
                //InitEventCode event_val_TxtDtFim

                switch (arg as string)
                {
                case dateTextController.DATE_INVALID:
                {
                    i_Form.TxtDtFim.BackColor     = colorInvalid;
                    ctrl_TxtDtFim.IsUserValidated = false;
                    break;
                }

                case dateTextController.DATE_VALID:
                {
                    i_Form.TxtDtFim.BackColor     = Color.White;
                    ctrl_TxtDtFim.IsUserValidated = true;
                    ctrl_TxtDtIni.CleanError();
                    break;
                }

                default: 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 == 6)
                    {
                        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_BtnAlterarClick -

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

                #endregion

                #region - event_BtnPagamentoClick -

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

                #endregion

                #region - event_BtnExtratoClick -

            case event_BtnExtratoClick:
            {
                //InitEventCode event_BtnExtratoClick
                //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_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_TxtQtdCartoes.AcquireTextBox(i_Form.TxtQtdCartoes, this, event_val_TxtQtdCartoes, 6);
                ctrl_TxtQtdParc.AcquireTextBox(i_Form.TxtQtdParc, this, event_val_TxtQtdParc, 6);
                ctrl_TxtQtdLojas.AcquireTextBox(i_Form.TxtQtdLojas, this, event_val_TxtQtdLojas, 6);

                ctrl_TxtVrMin.AcquireTextBox(i_Form.TxtVrMin, this, event_val_TxtVrMin, "R$", 6);
                ctrl_TxtVrMax.AcquireTextBox(i_Form.TxtVrMax, this, event_val_TxtVrMax, "R$", 6);

                //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_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_TxtQtdCartoes -

            case event_val_TxtQtdCartoes:
            {
                //InitEventCode event_val_TxtQtdCartoes

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

                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtQtdParc -

            case event_val_TxtQtdParc:
            {
                //InitEventCode event_val_TxtQtdParc

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

                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtVrMin -

            case event_val_TxtVrMin:
            {
                //InitEventCode event_val_TxtVrMin

                if (ctrl_TxtVrMin.getTextBoxValue_Long() > 0)
                {
                    i_Form.TxtVrMin.BackColor     = Color.White;
                    ctrl_TxtVrMin.IsUserValidated = true;
                }
                else
                {
                    i_Form.TxtVrMin.BackColor     = colorInvalid;
                    ctrl_TxtVrMin.IsUserValidated = false;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtVrMax -

            case event_val_TxtVrMax:
            {
                //InitEventCode event_val_TxtVrMax

                if (ctrl_TxtVrMax.getTextBoxValue_Long() > 0)
                {
                    i_Form.TxtVrMax.BackColor     = Color.White;
                    ctrl_TxtVrMax.IsUserValidated = true;
                }
                else
                {
                    i_Form.TxtVrMax.BackColor     = colorInvalid;
                    ctrl_TxtVrMax.IsUserValidated = false;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Consultar -

            case event_Consultar:
            {
                //InitEventCode event_Consultar

                i_Form.BtnConsultar.Enabled = false;

                DadosConsultaEmpresa dce = new DadosConsultaEmpresa();

                dce.set_st_nome(ctrl_TxtNome.getTextBoxValue());
                dce.set_st_cidade(ctrl_TxtCidade.getTextBoxValue());
                dce.set_st_estado(ctrl_TxtEstado.getTextBoxValue());
                dce.set_nu_cartoes(ctrl_TxtQtdCartoes.getTextBoxValue());
                dce.set_nu_parcelas(ctrl_TxtQtdParc.getTextBoxValue());
                dce.set_vr_taxa_min(ctrl_TxtVrMin.getTextBoxValue_NumberStr());
                dce.set_vr_taxa_max(ctrl_TxtVrMax.getTextBoxValue_NumberStr());
                dce.set_nu_lojas(ctrl_TxtQtdLojas.getTextBoxValue());

                string st_csv_id = "";

                i_Form.LstEmpresas.Items.Clear();
                Application.DoEvents();

                if (var_exchange.fetch_consultaEmpresa(ref dce,
                                                       ref header,
                                                       ref st_csv_id))
                {
                    ArrayList full_memory = new ArrayList();

                    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]);
                            }
                        }
                    }

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

                        string [] full_row = new string [] { de.get_st_empresa(),
                                  de.get_st_fantasia(),
                                  de.get_st_cidade(),
                                  de.get_st_estado(),
                                  de.get_nu_cartoes(),
                                  de.get_nu_parcelas(),
                                                             "R$ " + new money().formatToMoney(de.get_vr_mensalidade()),
                                                             de.get_nu_lojas(),
                                                             de.get_nu_CNPJ() };

                        i_Form.LstEmpresas.Items.Add(var_util.GetListViewItem(de.get_st_empresa(), full_row));
                    }
                }

                i_Form.BtnConsultar.Enabled = true;

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Editar -

            case event_Editar:
            {
                //InitEventCode event_Editar

                if (i_Form.LstEmpresas.SelectedItems.Count > 0)
                {
                    event_dlgNovaEmpresa ev_call = new event_dlgNovaEmpresa(var_util, var_exchange);

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

                    ev_call.i_Form.ShowDialog();
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtQtdLojas -

            case event_val_TxtQtdLojas:
            {
                //InitEventCode event_val_TxtQtdLojas

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

                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Cancelar -

            case event_Cancelar:
            {
                //InitEventCode event_Cancelar

                if (i_Form.LstEmpresas.SelectedItems.Count > 0)
                {
                    dlgAutorizacao autor = new dlgAutorizacao();

                    autor.ShowDialog();

                    Application.DoEvents();

                    var_exchange.exec_cancelaEmpresa(var_util.getMd5Hash(autor.senha),
                                                     new ApplicationUtil().getSelectedListViewItemTag(i_Form.LstEmpresas),
                                                     ref header);
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BtnConsultarClick -

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

                #endregion

                #region - event_LstEmpresasDoubleClick -

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

                #endregion

                #region - event_BtnCancelarClick -

            case event_BtnCancelarClick:
            {
                //InitEventCode event_BtnCancelarClick
                //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
                doEvent(event_Translate, null);
                doEvent(event_FormIsOpening, null);
                //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_TxtDt_Ini.AcquireTextBox(i_Form.TxtDt_Ini, this, event_val_TxtDt_Ini, dateTextController.FORMAT_DDMMYYYY);
                ctrl_TxtDt_Fim.AcquireTextBox(i_Form.TxtDt_Fim, this, event_val_TxtDt_Fim, dateTextController.FORMAT_DDMMYYYY);
                ctrl_TxtDt_Ini.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);
                ctrl_TxtDt_Fim.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);

                doEvent(event_BuscaDados, null);

                //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_TxtDt_Ini -

            case event_val_TxtDt_Ini:
            {
                //InitEventCode event_val_TxtDt_Ini

                switch (arg as string)
                {
                case dateTextController.DATE_INVALID:
                {
                    i_Form.TxtDt_Ini.BackColor     = Color.Lavender;;
                    ctrl_TxtDt_Ini.IsUserValidated = false;
                    break;
                }

                case dateTextController.DATE_VALID:
                {
                    i_Form.TxtDt_Ini.BackColor     = Color.White;
                    ctrl_TxtDt_Ini.IsUserValidated = true;
                    ctrl_TxtDt_Ini.CleanError();
                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtDt_Fim -

            case event_val_TxtDt_Fim:
            {
                //InitEventCode event_val_TxtDt_Fim

                switch (arg as string)
                {
                case dateTextController.DATE_INVALID:
                {
                    i_Form.TxtDt_Fim.BackColor     = Color.Lavender;;
                    ctrl_TxtDt_Fim.IsUserValidated = false;
                    break;
                }

                case dateTextController.DATE_VALID:
                {
                    i_Form.TxtDt_Fim.BackColor     = Color.White;
                    ctrl_TxtDt_Fim.IsUserValidated = true;
                    ctrl_TxtDt_Fim.CleanError();
                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BuscaDados -

            case event_BuscaDados:
            {
                //InitEventCode event_BuscaDados

                i_Form.LstMsg.Items.Clear();
                var_util.clearPortable();

                string st_csv_content = "";

                if (!var_exchange.fetch_edu_messages(ref header,
                                                     ref st_csv_content))
                {
                    return(false);
                }

                ArrayList full_memory = new ArrayList();

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

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

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

                    string time = var_util.getDDMMYYYY_format(dem.get_dt_start()).Replace(" 00:00:00", "") + " - " +
                                  var_util.getDDMMYYYY_format(dem.get_dt_end()).Replace(" 23:59:59", "");

                    string [] full_row = new string [] { dem.get_st_msg(), time };

                    var_util.savePortable(dem.get_id_mem(), dem);

                    i_Form.LstMsg.Items.Add(var_util.GetListViewItem(dem.get_id_mem(), full_row));
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_LstMsgDoubleClick -

            case event_LstMsgDoubleClick:
            {
                //InitEventCode event_LstMsgDoubleClick

                id = var_util.getSelectedListViewItemTag(i_Form.LstMsg);

                DadosEduMessage dem = new DadosEduMessage(var_util.retrievePortable(id) as DataPortable);

                i_Form.txtMsg.Text = dem.get_st_msg();

                DateTime tim = Convert.ToDateTime(dem.get_dt_start());

                ctrl_TxtDt_Ini.SetTextBoxText(tim.Day.ToString().PadLeft(2, '0') +
                                              tim.Month.ToString().PadLeft(2, '0') +
                                              tim.Year.ToString());

                DateTime tim2 = Convert.ToDateTime(dem.get_dt_end());

                ctrl_TxtDt_Fim.SetTextBoxText(tim2.Day.ToString().PadLeft(2, '0') +
                                              tim2.Month.ToString().PadLeft(2, '0') +
                                              tim2.Year.ToString());

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BtnNovoClick -

            case event_BtnNovoClick:
            {
                //InitEventCode event_BtnNovoClick

                dlgAutorizacao autor = new dlgAutorizacao();

                autor.ShowDialog();

                Application.DoEvents();

                if (autor.IsConfirmed)
                {
                    DadosEduMessage dem = new DadosEduMessage();

                    dem.set_dt_start(var_util.GetDataBaseTimeFormat(ctrl_TxtDt_Ini.getTextBoxValue_Date()));
                    dem.set_dt_end(var_util.GetDataBaseTimeFormat(ctrl_TxtDt_Fim.getTextBoxValue_Date().AddHours(23).AddMinutes(59).AddSeconds(59)));
                    dem.set_st_msg(i_Form.txtMsg.Text);

                    var_exchange.ins_edu_msg(ref dem, ref header);

                    doEvent(event_BuscaDados, null);
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BtnAtualizarClick -

            case event_BtnAtualizarClick:
            {
                //InitEventCode event_BtnAtualizarClick

                dlgAutorizacao autor = new dlgAutorizacao();

                autor.ShowDialog();

                Application.DoEvents();

                if (autor.IsConfirmed)
                {
                    DadosEduMessage dem = new DadosEduMessage();

                    dem.set_dt_start(var_util.GetDataBaseTimeFormat(ctrl_TxtDt_Ini.getTextBoxValue_Date()));
                    dem.set_dt_end(var_util.GetDataBaseTimeFormat(ctrl_TxtDt_Fim.getTextBoxValue_Date().AddHours(23).AddMinutes(59).AddSeconds(59)));
                    dem.set_st_msg(i_Form.txtMsg.Text);
                    dem.set_id_mem(id);

                    var_exchange.exec_change_edu_msg(ref dem, ref header);

                    doEvent(event_BuscaDados, null);
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BtnRemoverClick -

            case event_BtnRemoverClick:
            {
                //InitEventCode event_BtnRemoverClick

                if (MessageBox.Show("Remover mensagem?",
                                    "Aviso",
                                    MessageBoxButtons.YesNo,
                                    MessageBoxIcon.Question,
                                    MessageBoxDefaultButton.Button2) == DialogResult.No)
                {
                    return(false);
                }

                string       tag = var_util.getSelectedListViewItemTag(i_Form.LstMsg);
                DataPortable tmp = var_util.retrievePortable(tag);

                id = "";

                DadosEduMessage dem = new DadosEduMessage(tmp);

                var_exchange.del_edu_msg(dem.get_id_mem(), ref header);

                doEvent(event_BuscaDados, null);

                //EndEventCode
                return(true);
            }

                #endregion

            default: break;
            }

            return(false);
        }