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_TxtLimMensal.AcquireTextBox(i_Form.TxtLimMensal, this, event_val_TxtLimMensal, "R$", 8);
                ctrl_TxtLimTotal.AcquireTextBox(i_Form.TxtLimTotal, this, event_val_TxtLimTotal, "R$", 8);
                ctrl_TxtLimRotativo.AcquireTextBox(i_Form.TxtLimRotativo, this, event_val_TxtLimRotativo, "R$", 8);
                ctrl_TxtCotaExtra.AcquireTextBox(i_Form.TxtCotaExtra, this, event_val_TxtCotaExtra, "R$", 8);

                ctrl_TxtCpf.AcquireTextBox(i_Form.TxtCpf, this, event_val_TxtCpf, 11);

                ctrl_TxtLimMensal.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);
                ctrl_TxtLimTotal.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);
                ctrl_TxtLimRotativo.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);
                ctrl_TxtCotaExtra.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);

                ctrl_TxtLimTotal.IsUserValidated    = false;
                ctrl_TxtLimMensal.IsUserValidated   = false;
                ctrl_TxtLimRotativo.IsUserValidated = false;
                ctrl_TxtCotaExtra.IsUserValidated   = 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_Confirmar -

            case event_Confirmar:
            {
                //InitEventCode event_Confirmar

                if (i_Form.LstCartoes.SelectedItems.Count > 0)
                {
                    bool IsDone = true;

                    if (!ctrl_TxtLimTotal.IsUserValidated)
                    {
                        ctrl_TxtLimTotal.SetErrorMessage("Valor deve estar preenchido");      IsDone = false;
                    }
                    if (!ctrl_TxtLimMensal.IsUserValidated)
                    {
                        ctrl_TxtLimMensal.SetErrorMessage("Valor deve estar preenchido");      IsDone = false;
                    }
                    if (!ctrl_TxtLimRotativo.IsUserValidated)
                    {
                        ctrl_TxtLimRotativo.SetErrorMessage("Valor deve estar preenchido");      IsDone = false;
                    }
                    if (!ctrl_TxtCotaExtra.IsUserValidated)
                    {
                        ctrl_TxtCotaExtra.SetErrorMessage("Valor deve estar preenchido");      IsDone = false;
                    }

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

                    if (ctrl_TxtLimMensal.getTextBoxValue_Long() > ctrl_TxtLimTotal.getTextBoxValue_Long())
                    {
                        ctrl_TxtLimMensal.SetErrorMessage("Valor mensal deve ser menor que o valor total");
                        return(false);
                    }

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

                    DadosCartao dc = new DadosCartao(tmp);

                    dc.set_vr_limiteTotal(ctrl_TxtLimTotal.getTextBoxValue_NumberStr());
                    dc.set_vr_limiteMensal(ctrl_TxtLimMensal.getTextBoxValue_NumberStr());
                    dc.set_vr_limiteRotativo(ctrl_TxtLimRotativo.getTextBoxValue_NumberStr());
                    dc.set_vr_extraCota(ctrl_TxtCotaExtra.getTextBoxValue_NumberStr());

                    var_exchange.exec_alteraCartao(ref dc, ref header);
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtCpf -

            case event_val_TxtCpf:
            {
                //InitEventCode event_val_TxtCpf

                if (ctrl_TxtCpf.getTextBoxValue().Length < 11)
                {
                    i_Form.TxtCpf.BackColor     = colorInvalid;
                    ctrl_TxtCpf.IsUserValidated = false;

                    i_Form.LstCartoes.Items.Clear();
                    i_Form.LblNome.Text = "";
                }
                else
                {
                    i_Form.TxtCpf.BackColor = Color.White;

                    if (ctrl_TxtCpf.IsUserValidated == false)
                    {
                        string st_csv_id = "";

                        i_Form.LstCartoes.Items.Clear();

                        if (var_exchange.fetch_limitesCartao(ctrl_TxtCpf.getTextBoxValue(),
                                                             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]);
                                    }
                                }
                            }

                            ArrayList desc = new CartaoStatusDesc().GetArray();

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

                                string nu_cartao = dc.get_st_empresa() + dc.get_st_matricula();

                                int index = Convert.ToInt32(dc.get_tg_status());

                                string status = desc [index].ToString();
                                string venc   = dc.get_st_vencimento().Substring(0, 2) +
                                                "/" +
                                                dc.get_st_vencimento().Substring(2, 2);

                                string [] full_row = new string [] { nu_cartao,
                                                                     status,
                                                                     venc };

                                var_util.savePortable(nu_cartao, dc);

                                i_Form.LstCartoes.Items.Add(var_util.GetListViewItem(nu_cartao, full_row));

                                i_Form.LblNome.Text = dc.get_st_proprietario();
                            }

                            if (full_memory.Count > 0)
                            {
                                i_Form.LstCartoes.Items[0].Selected = true;
                                doEvent(event_Click, null);
                            }
                        }
                    }

                    ctrl_TxtCpf.IsUserValidated = true;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtLimTotal -

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

                #endregion

                #region - event_val_TxtLimMensal -

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

                #endregion

                #region - event_val_TxtLimRotativo -

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

                #endregion

                #region - event_val_TxtCotaExtra -

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

                #endregion

                #region - event_Click -

            case event_Click:
            {
                //InitEventCode event_Click

                if (i_Form.LstCartoes.SelectedItems.Count > 0)
                {
                    string       tag = var_util.getSelectedListViewItemTag(i_Form.LstCartoes);
                    DataPortable tmp = var_util.retrievePortable(tag);

                    DadosCartao dc = new DadosCartao(tmp);

                    ctrl_TxtLimTotal.SetTextBoxString(dc.get_vr_limiteTotal());
                    ctrl_TxtLimMensal.SetTextBoxString(dc.get_vr_limiteMensal());
                    ctrl_TxtLimRotativo.SetTextBoxString(dc.get_vr_limiteRotativo());
                    ctrl_TxtCotaExtra.SetTextBoxString(dc.get_vr_extraCota());

                    ctrl_TxtLimTotal.IsUserValidated    = true;
                    ctrl_TxtLimMensal.IsUserValidated   = true;
                    ctrl_TxtLimRotativo.IsUserValidated = true;
                    ctrl_TxtCotaExtra.IsUserValidated   = true;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_LstCartoesClick -

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

                #endregion

                #region - event_BtnConfirmarClick -

            case event_BtnConfirmarClick:
            {
                //InitEventCode event_BtnConfirmarClick
                //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);
        }