Esempio n. 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_TxtValor.AcquireTextBox(i_Form.TxtValor, this, event_val_TxtValor, "R$", 8);
                ctrl_TxtNome.AcquireTextBox(i_Form.TxtNome, this, event_val_TxtNome, 40, alphaTextController.ENABLE_NUMBERS, alphaTextController.ENABLE_SYMBOLS);

                ctrl_TxtEmpresa.AcquireTextBox(i_Form.TxtEmpresa, this, event_val_TxtEmpresa, 6);

                if (header.get_tg_user_type() == TipoUsuario.AdminGift)
                {
                    ctrl_TxtEmpresa.SetTextBoxText(header.get_st_empresa());
                    i_Form.TxtEmpresa.ReadOnly = true;

                    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_BuscaDados -

            case event_BuscaDados:
            {
                //InitEventCode event_BuscaDados

                ArrayList lst = new ArrayList();

                if (header.get_tg_user_type() == TipoUsuario.SuperUser)
                {
                    header.set_st_empresa(ctrl_TxtEmpresa.getTextBoxValue());
                }

                var_exchange.fetch_extraGift(ref header, ref lst);

                if (header.get_tg_user_type() == TipoUsuario.SuperUser)
                {
                    header.set_st_empresa("000000");
                }

                i_Form.LstProd.Items.Clear();
                for (int t = 0; t < lst.Count; ++t)
                {
                    DadosProdutoGift dpg = new DadosProdutoGift(lst[t] as DataPortable);

                    string [] full_row = new string [] { dpg.get_st_nome(), "R$ " + new money().formatToMoney(dpg.get_vr_valor()) };

                    i_Form.LstProd.Items.Add(var_util.GetListViewItem(dpg.get_id_produto(), full_row));
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Remover -

            case event_Remover:
            {
                //InitEventCode event_Remover

                if (i_Form.LstProd.SelectedItems.Count == 0)
                {
                    return(false);
                }

                if (MessageBox.Show("Confirma remoção de produto ?",
                                    "Aviso",
                                    MessageBoxButtons.YesNo,
                                    MessageBoxIcon.Question,
                                    MessageBoxDefaultButton.Button2) == DialogResult.No)
                {
                    return(false);
                }

                var_exchange.del_extraGift(var_util.getSelectedListViewItemTag(i_Form.LstProd), ref header);

                doEvent(event_BuscaDados, null);

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Adicionar -

            case event_Adicionar:
            {
                //InitEventCode event_Adicionar

                if (!ctrl_TxtValor.IsUserValidated && !ctrl_TxtNome.IsUserValidated)
                {
                    return(false);
                }

                DadosProdutoGift prod = new DadosProdutoGift();

                prod.set_st_nome(ctrl_TxtNome.getTextBoxValue());
                prod.set_vr_valor(ctrl_TxtValor.getTextBoxValue_NumberStr());

                var_exchange.ins_extraGift(ref prod, ref header);

                doEvent(event_BuscaDados, null);

                //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 > 3)
                    {
                        i_Form.TxtNome.BackColor     = Color.White;
                        ctrl_TxtNome.IsUserValidated = true;
                        ctrl_TxtNome.CleanError();
                    }
                    else
                    {
                        i_Form.TxtNome.BackColor     = colorInvalid;
                        ctrl_TxtNome.IsUserValidated = false;
                    }

                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtValor -

            case event_val_TxtValor:
            {
                //InitEventCode event_val_TxtValor

                if (ctrl_TxtValor.getTextBoxValue_Long() == 0)
                {
                    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_Selecionar -

            case event_Selecionar:
            {
                //InitEventCode event_Selecionar

                if (i_Form.LstProd.SelectedItems.Count == 0)
                {
                    return(false);
                }

                ctrl_TxtNome.SetTextBoxText(i_Form.LstProd.SelectedItems[0].SubItems[0].Text);
                ctrl_TxtValor.SetTextBoxLong(new money().getNumericValue(i_Form.LstProd.SelectedItems[0].SubItems[1].Text.Replace("R$ ", "")));

                //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();

                        if (ctrl_TxtEmpresa.GetEnterPressed())
                        {
                            doEvent(event_BuscaDados, null);
                        }
                    }
                    else
                    {
                        i_Form.TxtEmpresa.BackColor     = colorInvalid;
                        ctrl_TxtEmpresa.IsUserValidated = false;
                    }

                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_LstProdClick -

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

                #endregion

                #region - event_BtnRemoverClick -

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

                #endregion

                #region - event_BtnAdicionarClick -

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

                #endregion

            default: break;
            }

            return(false);
        }
Esempio n. 3
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_TxtLoja.AcquireTextBox(i_Form.TxtLoja, this, event_val_TxtLoja, 6);
                ctrl_TxtCNPJ.AcquireTextBox(i_Form.TxtCNPJ, this, event_val_TxtCNPJ);

                ctrl_TxtDtAbIni.AcquireTextBox(i_Form.TxtDtAbIni, this, event_val_TxtDtAbIni, dateTextController.FORMAT_DDMMYYYY);
                ctrl_TxtDtAbFim.AcquireTextBox(i_Form.TxtDtAbFim, this, event_val_TxtDtAbFim, dateTextController.FORMAT_DDMMYYYY);

                ctrl_TxtDtFechIni.AcquireTextBox(i_Form.TxtDtFechIni, this, event_val_TxtDtFechIni, dateTextController.FORMAT_DDMMYYYY);
                ctrl_TxtDtFechFim.AcquireTextBox(i_Form.TxtDtFechFim, this, event_val_TxtDtFechFim, dateTextController.FORMAT_DDMMYYYY);

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

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

                ArrayList lst = new ArrayList();

                var_exchange.fetch_conveyUsuarios(ref header, ref lst);

                i_Form.CboOpers.Items.Clear();
                i_Form.CboOpers.Items.Add("(Todos)");
                i_Form.CboResp.Items.Add("(Todos)");

                for (int t = 0; t < lst.Count; ++t)
                {
                    DadosUsuario us = new DadosUsuario(lst[t] as DataPortable);

                    i_Form.CboOpers.Items.Add(us.get_st_nome());
                    i_Form.CboResp.Items.Add(us.get_st_nome());
                }

                i_Form.CboOpers.SelectedIndex      = 0;
                i_Form.CboResp.SelectedIndex       = 0;
                i_Form.CboCateg.SelectedIndex      = 0;
                i_Form.CboPrioridade.SelectedIndex = 0;
                i_Form.CboSit.SelectedIndex        = 0;

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

            case event_Procurar:
            {
                //InitEventCode event_Procurar

                string nu_categ      = (i_Form.CboCateg.SelectedIndex - 1).ToString();
                string nu_prioridade = (i_Form.CboPrioridade.SelectedIndex - 1).ToString();
                string st_operador   = "";
                string st_resp       = "";
                string tg_closed     = i_Form.CboSit.SelectedIndex.ToString();
                string dt_ini_ab     = "";
                string dt_fim_ab     = "";
                string dt_ini_fech   = "";
                string dt_fim_fech   = "";
                string tg_tecnico    = Context.FALSE;
                string st_loja       = "";

                if (i_Form.CboOpers.SelectedIndex > 0)
                {
                    st_operador = i_Form.CboOpers.SelectedItem.ToString();
                }

                if (i_Form.CboResp.SelectedIndex > 0)
                {
                    st_resp = i_Form.CboResp.SelectedItem.ToString();
                }

                if (ctrl_TxtLoja.IsUserValidated)
                {
                    st_loja = ctrl_TxtLoja.getTextBoxValue();
                }

                if (i_Form.ChkTecnico.Checked)
                {
                    tg_tecnico = Context.TRUE;
                }

                if (ctrl_TxtDtAbIni.IsUserValidated)
                {
                    dt_ini_ab = var_util.GetDataBaseTimeFormat(ctrl_TxtDtAbIni.getTextBoxValue_Date());
                }

                if (ctrl_TxtDtAbFim.IsUserValidated)
                {
                    dt_fim_ab = var_util.GetDataBaseTimeFormat(ctrl_TxtDtAbFim.getTextBoxValue_Date().AddDays(1));
                }

                if (ctrl_TxtDtFechIni.IsUserValidated)
                {
                    dt_ini_fech = var_util.GetDataBaseTimeFormat(ctrl_TxtDtFechIni.getTextBoxValue_Date());
                }

                if (ctrl_TxtDtFechFim.IsUserValidated)
                {
                    dt_fim_fech = var_util.GetDataBaseTimeFormat(ctrl_TxtDtFechFim.getTextBoxValue_Date().AddDays(1));
                }

                string st_block = "";

                var_exchange.fetch_chamados(nu_categ,
                                            nu_prioridade,
                                            st_operador,
                                            tg_closed,
                                            dt_ini_ab,
                                            dt_fim_ab,
                                            dt_ini_fech,
                                            dt_fim_fech,
                                            tg_tecnico,
                                            st_loja,
                                            st_resp,
                                            ref header,
                                            ref st_block);

                ArrayList full_memory = new ArrayList();

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

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

                i_Form.LstChamados.Items.Clear();

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

                    string dt_ab   = var_util.getDDMMYYYY_format(dc.get_dt_ab());
                    string dt_fech = dc.get_dt_fech();

                    if (dt_fech.Length > 0)
                    {
                        dt_fech = var_util.getDDMMYYYY_format(dt_fech);
                    }

                    string [] full_row = new string [] { dt_ab,
                                                         dt_fech,
                                                         dc.get_st_oper() + " (" + dc.get_st_resp() + ")",
                                                         dc.get_st_motivo() };

                    i_Form.LstChamados.Items.Add(var_util.GetListViewItem(dc.get_id_chamado(), full_row));
                }

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

                        if (ctrl_TxtLoja.GetEnterPressed())
                        {
                            DadosLoja dl = new DadosLoja();

                            var_exchange.fetch_dadosLoja("", ctrl_TxtLoja.getTextBoxValue(), ref header, ref dl);

                            i_Form.TxtNome.Text = dl.get_st_nome();
                            ctrl_TxtCNPJ.SetTextBoxText(dl.get_nu_CNPJ());
                        }
                    }
                    else
                    {
                        i_Form.TxtLoja.BackColor     = colorInvalid;
                        ctrl_TxtLoja.IsUserValidated = false;

                        if (ctrl_TxtLoja.GetEnterPressed())
                        {
                            event_dlgConsultaLoja ev_call = new event_dlgConsultaLoja(var_util, var_exchange);

                            ev_call.header = header;

                            ev_call.i_Form.Show();
                        }
                    }

                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtDtAbIni -

            case event_val_TxtDtAbIni:
            {
                //InitEventCode event_val_TxtDtAbIni

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

                case dateTextController.DATE_VALID:
                {
                    i_Form.TxtDtAbIni.BackColor     = Color.White;
                    ctrl_TxtDtAbIni.IsUserValidated = true;
                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtDtAbFim -

            case event_val_TxtDtAbFim:
            {
                //InitEventCode event_val_TxtDtAbFim

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

                case dateTextController.DATE_VALID:
                {
                    i_Form.TxtDtAbFim.BackColor     = Color.White;
                    ctrl_TxtDtAbFim.IsUserValidated = true;
                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtDtFechIni -

            case event_val_TxtDtFechIni:
            {
                //InitEventCode event_val_TxtDtFechIni

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

                case dateTextController.DATE_VALID:
                {
                    i_Form.TxtDtFechIni.BackColor     = Color.White;
                    ctrl_TxtDtFechIni.IsUserValidated = true;
                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtDtFechFim -

            case event_val_TxtDtFechFim:
            {
                //InitEventCode event_val_TxtDtFechFim

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

                case dateTextController.DATE_VALID:
                {
                    i_Form.TxtDtFechFim.BackColor     = Color.White;
                    ctrl_TxtDtFechFim.IsUserValidated = true;
                    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;

                    if (ctrl_TxtCNPJ.GetEnterPressed())
                    {
                        event_dlgConsultaLoja ev_call = new event_dlgConsultaLoja(var_util, var_exchange);

                        ev_call.header = header;

                        ev_call.i_Form.Show();
                    }

                    break;
                }

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

                    if (ctrl_TxtLoja.GetEnterPressed())
                    {
                        DadosLoja dl = new DadosLoja();

                        var_exchange.fetch_dadosLoja(ctrl_TxtCNPJ.getTextBoxValue(), "", ref header, ref dl);

                        ctrl_TxtLoja.SetTextBoxText(dl.get_st_loja());

                        i_Form.TxtNome.Text = dl.get_st_nome();
                    }

                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Editar -

            case event_Editar:
            {
                //InitEventCode event_Editar

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

                    ev_call.header     = header;
                    ev_call.id_chamado = var_util.getSelectedListViewItemTag(i_Form.LstChamados);

                    ev_call.i_Form.ShowDialog();
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Relatorio -

            case event_Relatorio:
            {
                //InitEventCode event_Relatorio

                ArrayList lstReport = new ArrayList();

                lstReport.Add("RELATÓRIO DE CHAMADOS");
                lstReport.Add("");
                lstReport.Add("DT. ABERTURA                  DT. FECHAMENTO                OPER (RESP)");
                lstReport.Add("DESCRIÇÃO");
                lstReport.Add("-------------------------------------------------------------------------------------------------------");
                lstReport.Add("");

                string line = "";

                for (int t = 0; t < i_Form.LstChamados.Items.Count; ++t)
                {
                    line  = i_Form.LstChamados.Items[t].SubItems[0].Text.PadRight(29, ' ') + " ";
                    line += i_Form.LstChamados.Items[t].SubItems[1].Text.PadRight(29, ' ') + " ";
                    line += i_Form.LstChamados.Items[t].SubItems[2].Text.PadRight(32, ' ') + " ";

                    lstReport.Add(line);

                    line = i_Form.LstChamados.Items[t].SubItems[3].Text.PadRight(100, ' ').Substring(0, 100);

                    lstReport.Add(line);
                    lstReport.Add("");
                }

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

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Print -

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

                #endregion

                #region - event_LstChamadosDoubleClick -

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

                #endregion

                #region - event_BtnProcurarClick -

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

                #endregion

                #region - event_BtnReportClick -

            case event_BtnReportClick:
            {
                //InitEventCode event_BtnReportClick
                //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

                                        #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);

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

                    doEvent(event_BuscaDados, ctrl_TxtEmpresa.getTextBoxValue());
                }
                else                         // root
                {
                    ctrl_TxtEmpresa.SetTextBoxText("0");

                    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_Confirmar -

            case event_Confirmar:
            {
                //InitEventCode event_Confirmar

                if (i_Form.CboAcao.SelectedItem != null)
                {
                    if (i_Form.LstUsuarios.SelectedItems.Count > 0)
                    {
                        var_exchange.exec_alteraUsuario(i_Form.CboAcao.SelectedIndex.ToString(),
                                                        var_util.getSelectedListViewItemTag(i_Form.LstUsuarios),
                                                        ref header);

                        doEvent(event_BuscaDados, ctrl_TxtEmpresa.getTextBoxValue());
                    }
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Detalhes -

            case event_Detalhes:
            {
                //InitEventCode event_Detalhes
                //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();

                        if (ctrl_TxtEmpresa.GetEnterPressed())
                        {
                            doEvent(event_BuscaDados, ctrl_TxtEmpresa.getTextBoxValue());
                        }
                    }
                    else
                    {
                        i_Form.TxtEmpresa.BackColor     = colorInvalid;
                        ctrl_TxtEmpresa.IsUserValidated = false;
                    }

                    break;
                }

                default: break;
                }
                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BuscaDados -

            case event_BuscaDados:
            {
                //InitEventCode event_BuscaDados

                i_Form.LstUsuarios.Items.Clear();

                ArrayList list = new ArrayList();

                string st_csv_id = "";

                var_util.clearPortable();

                // customiza header!
                CNetHeader head = new CNetHeader(header as DataPortable);

                head.set_st_empresa(arg as string);

                i_Form.LstUsuarios.Items.Clear();

                if (var_exchange.fetch_listaUsuarios(ref head, 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, "200", 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 TipoUsuarioDesc().GetArray();

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

                        string id      = info.get_id_usuario();
                        string nome    = info.get_st_nome();
                        string bloq    = info.get_tg_bloqueio();
                        string nivel   = desc [Convert.ToInt32(info.get_tg_nivel())].ToString();
                        string empresa = info.get_st_empresa();

                        if (bloq == Context.TRUE)
                        {
                            bloq = "Sim";
                        }
                        else
                        {
                            bloq = "Não";
                        }

                        if (empresa == "000000")
                        {
                            empresa = "";
                        }

                        switch (nivel)
                        {
                        case TipoUsuario.SuperUser:             nivel = "Super Usuário";        break;

                        case TipoUsuario.Administrador: nivel = "Administrador";        break;

                        case TipoUsuario.Operador:              nivel = "Operador";                     break;

                        default: break;
                        }

                        string [] full_row = new string [] { nome, bloq, nivel, empresa };

                        i_Form.LstUsuarios.Items.Add(var_util.GetListViewItem(id, full_row));
                    }
                }

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

                                        #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

                                        #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_TxtCodigo.AcquireTextBox(i_Form.TxtCodigo, this, event_val_TxtCodigo, 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_TxtCodigo -

            case event_val_TxtCodigo:
            {
                //InitEventCode event_val_TxtCodigo

                switch (arg as string)
                {
                case numberTextController.NUMBER_INCOMPLETE:
                case numberTextController.NUMBER_COMPLETE:
                {
                    if (i_Form.TxtCodigo.Text.Length > 0)
                    {
                        i_Form.TxtCodigo.BackColor     = Color.White;
                        ctrl_TxtCodigo.IsUserValidated = true;
                        ctrl_TxtCodigo.CleanError();

                        if (ctrl_TxtCodigo.GetEnterPressed())
                        {
                            doEvent(event_buscaDados, null);
                        }
                    }
                    else
                    {
                        i_Form.TxtCodigo.BackColor     = colorInvalid;
                        ctrl_TxtCodigo.IsUserValidated = false;
                    }

                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Cancelar -

            case event_Cancelar:
            {
                //InitEventCode event_Cancelar

                var_exchange.exec_cancelaDespesa(var_util.getSelectedListViewItemTag(i_Form.LstDespesas),
                                                 ref header);

                doEvent(event_buscaDados, null);

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_buscaDados -

            case event_buscaDados:
            {
                //InitEventCode event_buscaDados

                if (i_Form.CboTipo.SelectedIndex != -1)
                {
                    ArrayList list = new ArrayList();

                    string nome   = "";
                    string tg_emp = Context.FALSE;

                    if (i_Form.CboTipo.SelectedIndex == 0)
                    {
                        tg_emp = Context.TRUE;
                    }

                    var_exchange.fetch_dadosDespesas(tg_emp,
                                                     ctrl_TxtCodigo.getTextBoxValue(),
                                                     ref header,
                                                     ref nome,
                                                     ref list);

                    i_Form.TxtNome.Text = nome;

                    i_Form.LstDespesas.Items.Clear();

                    for (int t = 0; t < list.Count; ++t)
                    {
                        DadosDespesas dd = new DadosDespesas(list [t] as DataPortable);

                        string [] full_row = new string [] { dd.get_st_info(),
                                                             new money().formatToMoney(dd.get_vr_cobrança()) };

                        i_Form.LstDespesas.Items.Add(var_util.GetListViewItem(dd.get_fk_faturadet(), full_row));
                    }

                    Application.DoEvents();
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BtnCancelarClick -

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

                #endregion

            default: break;
            }

            return(false);
        }
Esempio n. 8
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
                //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_Adicionar -

            case event_Adicionar:
            {
                //InitEventCode event_Adicionar

                event_dlgCadastroAtividade ev_call = new event_dlgCadastroAtividade(var_util, var_exchange);

                ev_call.header = header;

                ev_call.i_Form.ShowDialog();

                if (ev_call.HouveCadastro)
                {
                    doEvent(event_buscaDados, null);
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Remover -

            case event_Remover:
            {
                //InitEventCode event_Remover

                string fk_agenda = var_util.getSelectedListViewItemTag(i_Form.LstTrans);

                if (fk_agenda != null)
                {
                    var_exchange.del_agenda(fk_agenda, ref header);

                    doEvent(event_buscaDados, null);
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_buscaDados -

            case event_buscaDados:
            {
                //InitEventCode event_buscaDados

                Application.DoEvents();

                string st_csv_id = "";

                i_Form.LstTrans.Items.Clear();

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

                if (var_exchange.fetch_agenda(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)
                    {
                        DadosAgenda da = new DadosAgenda(full_memory[t] as DataPortable);

                        int index = Convert.ToInt32(da.get_en_atividade()) - 1;

                        string [] full_row = new string [] { da.get_st_empresa() + " - " + da.get_st_nome_empresa(),
                                  desc[index].ToString(),
                                  da.get_st_info() };

                        i_Form.LstTrans.Items.Add(var_util.GetListViewItem(da.get_fk_agenda(), full_row));
                    }

                    Application.DoEvents();
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BtnAdicionarClick -

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

                #endregion

                #region - event_BtnRemoverClick -

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

                #endregion

                #region - event_DlgAgendamentoShown -

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

                #endregion

            default: break;
            }

            return(false);
        }
Esempio n. 9
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_TxtNome.AcquireTextBox(i_Form.TxtNome, this, event_val_TxtNome, 20, "");

                ctrl_TxtNome.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);

                //EndEventCode
                return(true);
            }

                #endregion

                #region - robot_ShowDialog -

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

                #endregion

                #region - robot_CloseDialog -

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

                #endregion

                #region - event_val_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;
                        ctrl_TxtNome.CleanError();

                        if (ctrl_TxtNome.GetEnterPressed())
                        {
                            ArrayList lst = new ArrayList();

                            if (var_exchange.fetch_nomeLoja(ctrl_TxtNome.getTextBoxValue(),
                                                            st_cod_empresa,
                                                            ref header,
                                                            ref lst))
                            {
                                i_Form.LstLojas.Items.Clear();
                                for (int t = 0; t < lst.Count; ++t)
                                {
                                    DadosLoja dl = new DadosLoja(lst[t] as DataPortable);

                                    string [] full_row = new string [] { dl.get_st_nome(), dl.get_st_loja() };

                                    i_Form.LstLojas.Items.Add(var_util.GetListViewItem(dl.get_st_loja(), full_row));
                                }
                            }
                        }
                    }
                    else
                    {
                        i_Form.TxtNome.BackColor     = colorInvalid;
                        ctrl_TxtNome.IsUserValidated = false;
                    }

                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Confirmar -

            case event_Confirmar:
            {
                //InitEventCode event_Confirmar

                i_Form.Close();

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_LojaClick -

            case event_LojaClick:
            {
                //InitEventCode event_LojaClick

                if (i_Form.LstLojas.SelectedItems.Count > 0)
                {
                    string st_cod_loja = new ApplicationUtil().getSelectedListViewItemTag(i_Form.LstLojas);

                    ArrayList lst = new ArrayList();

                    if (var_exchange.fetch_termLoja(st_cod_loja, ref header, ref lst))
                    {
                        for (int t = 0; t < lst.Count; ++t)
                        {
                            DadosTerminal dt = new DadosTerminal(lst [t] as DataPortable);

                            string [] full_row = new string [] { dt.get_st_terminal(), dt.get_st_localizacao() };

                            i_Form.LstTerm.Items.Add(var_util.GetListViewItem(dt.get_st_terminal(), full_row));
                        }
                    }
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_TermClick -

            case event_TermClick:
            {
                //InitEventCode event_TermClick

                if (i_Form.LstTerm.SelectedItems.Count > 0 &&
                    i_Form.LstLojas.SelectedItems.Count > 0)
                {
                    st_cod_terminal = var_util.getSelectedListViewItemTag(i_Form.LstTerm);
                    st_nome_loja    = i_Form.LstLojas.SelectedItems[0].SubItems[0].Text;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_LstLojasClick -

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

                #endregion

                #region - event_LstTermClick -

            case event_LstTermClick:
            {
                //InitEventCode event_LstTermClick
                //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

                                        #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);

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

                //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_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();

                        if (ctrl_TxtEmpresa.GetEnterPressed())
                        {
                            doEvent(event_BuscaDados, null);
                        }
                    }
                    else
                    {
                        i_Form.TxtEmpresa.BackColor     = colorInvalid;
                        ctrl_TxtEmpresa.IsUserValidated = false;
                    }

                    break;
                }

                default: break;
                }

                //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 > 0)
                    {
                        i_Form.TxtCartao.BackColor     = Color.White;
                        ctrl_TxtCartao.IsUserValidated = true;
                        ctrl_TxtCartao.CleanError();

                        if (ctrl_TxtCartao.GetEnterPressed())
                        {
                            doEvent(event_BuscaDados, null);
                        }
                    }
                    else
                    {
                        i_Form.TxtCartao.BackColor     = colorInvalid;
                        ctrl_TxtCartao.IsUserValidated = false;
                    }

                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Confirmar -

            case event_Confirmar:
            {
                //InitEventCode event_Confirmar

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

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BuscaDados -

            case event_BuscaDados:
            {
                //InitEventCode event_BuscaDados

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

                ArrayList lstCred    = new ArrayList();
                ArrayList lstProd    = new ArrayList();
                ArrayList lstComprov = new ArrayList();

                string nome = "";
                string disp = "";
                string sit  = "";

                if (!var_exchange.fetch_consultaCartaoGift(ctrl_TxtEmpresa.getTextBoxValue(),
                                                           ctrl_TxtCartao.getTextBoxValue(),
                                                           ref header,
                                                           ref nome,
                                                           ref disp,
                                                           ref sit,
                                                           ref lstCred,
                                                           ref lstProd,
                                                           ref lstComprov))
                {
                    return(false);
                }

                i_Form.TxtNome.Text  = nome;
                i_Form.TxtSaldo.Text = new money().formatToMoney(disp);
                i_Form.TxtSit.Text   = sit;

                for (int t = 0; t < lstComprov.Count; ++t)
                {
                    DadosComprovGift dcg = new DadosComprovGift(lstComprov[t] as DataPortable);

                    string [] full_row = new string [] { dcg.get_dt_venda(),
                                                         "R$ " + new money().formatToMoney(dcg.get_vr_valor()),
                                                         dcg.get_st_tipo() };

                    i_Form.LstComprov.Items.Add(var_util.GetListViewItem(dcg.get_id_venda(), full_row));
                }

                if (i_Form.LstComprov.Items.Count > 0)
                {
                    i_Form.LstComprov.Items[0].Selected = true;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Print -

            case event_Print:
            {
                //InitEventCode event_Print

                ArrayList lst = new ArrayList();

                string id_gift = var_util.getSelectedListViewItemTag(i_Form.LstComprov);

                if (id_gift == "")
                {
                    return(false);
                }

                var_exchange.fetch_comprov_Gift(id_gift, Context.TRUE, 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_BtnConfirmarClick -

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

                #endregion

            default: break;
            }

            return(false);
        }
Esempio n. 11
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_TxtDataIni.AcquireTextBox(i_Form.TxtDataIni, this, event_val_TxtDataIni, dateTextController.FORMAT_DDMMYYYY);

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

                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_Confirmar -

            case event_Confirmar:
            {
                //InitEventCode event_Confirmar

                if (i_Form.LstLojas.SelectedItems.Count == 0)
                {
                    return(false);
                }

                event_dlgConfFinalRepasse ev_call = new event_dlgConfFinalRepasse(var_util, var_exchange);

                ev_call.header = header;

                ev_call.st_codLoja  = var_util.getSelectedListViewItemTag(i_Form.LstLojas);
                ev_call.st_loja     = i_Form.LstLojas.SelectedItems[0].SubItems[0].Text;
                ev_call.vr_valor    = i_Form.LstLojas.SelectedItems[0].SubItems[1].Text.Replace(",", "");
                ev_call.lstParcelas = hshLojas [ev_call.st_codLoja] as ArrayList;

                ev_call.i_Form.ShowDialog();

                doEvent(event_BuscaDados, null);

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_DetalheCheck -

            case event_DetalheCheck:
            {
                //InitEventCode event_DetalheCheck

                if (i_Form.LstLojas.SelectedItems.Count == 0)
                {
                    return(false);
                }

                string st_loja = var_util.getSelectedListViewItemTag(i_Form.LstLojas);

                ArrayList lstDets = hshLojas [st_loja] as ArrayList;

                long tot_detalhes = 0;

                for (int t = 0; t < i_Form.LstDetalhes.Items.Count; ++t)
                {
                    DadosRepasse dr = lstDets [t] as DadosRepasse;

                    if (i_Form.LstDetalhes.Items[t].Checked)
                    {
                        tot_detalhes += Convert.ToInt64(dr.get_vr_repasse());

                        dr.set_tg_confirmado(Context.TRUE);
                    }
                    else
                    {
                        dr.set_tg_confirmado(Context.FALSE);
                    }
                }

                i_Form.LstLojas.SelectedItems[0].SubItems[1].Text = new money().formatToMoney(tot_detalhes.ToString());

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtDataIni -

            case event_val_TxtDataIni:
            {
                //InitEventCode event_val_TxtDataIni

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

                case dateTextController.DATE_VALID:
                {
                    i_Form.TxtDataIni.BackColor     = Color.White;
                    ctrl_TxtDataIni.IsUserValidated = true;

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

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_SelecionaLoja -

            case event_SelecionaLoja:
            {
                //InitEventCode event_SelecionaLoja

                if (i_Form.LstLojas.SelectedItems.Count == 0)
                {
                    return(false);
                }

                string st_loja = var_util.getSelectedListViewItemTag(i_Form.LstLojas);

                ArrayList lstDets = hshLojas [st_loja] as ArrayList;

                i_Form.LstDetalhes.Items.Clear();

                for (int t = 0; t < lstDets.Count; ++t)
                {
                    DadosRepasse dr = new DadosRepasse(lstDets [t] as DataPortable);

                    DateTime tim_repasse = Convert.ToDateTime(dr.get_dt_repasse());

                    string dt_rep = var_util.getDDMMYYYY_format(dr.get_dt_repasse()).Substring(0, 10);

                    if (dt_rep == ctrl_TxtDataIni.getTextBoxValue())
                    {
                        dt_rep += " [hoje]";
                    }
                    else if (tim_repasse > ctrl_TxtDataIni.getTextBoxValue_Date())
                    {
                        dt_rep += " [futuro]";
                    }

                    string [] full_row = new string [] { new money().formatToMoney(dr.get_vr_repasse()),
                                                         dr.get_st_cartao(),
                                                         dr.get_st_nsu(),
                                                         var_util.getDDMMYYYY_format(dr.get_dt_trans()),
                                                         dt_rep };



                    if (dt_rep.IndexOf("futuro") >= 0 || dt_rep.IndexOf("hoje") >= 0)
                    {
                        i_Form.LstDetalhes.Items.Add(var_util.GetListViewItem(dr.get_st_nsu(),
                                                                              full_row,
                                                                              Color.Black,
                                                                              Color.Bisque));
                    }
                    else
                    {
                        i_Form.LstDetalhes.Items.Add(var_util.GetListViewItem(dr.get_st_nsu(),
                                                                              full_row));
                    }

                    i_Form.LstDetalhes.Items[t].Checked = false;

                    if (dr.get_tg_confirmado() == Context.TRUE)
                    {
                        i_Form.LstDetalhes.Items[t].Checked = true;
                    }
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BuscaDados -

            case event_BuscaDados:
            {
                //InitEventCode event_BuscaDados

                string block_detalhe_loja = "";
                string block_sumario_loja = "";

                i_Form.LstLojas.Items.Clear();
                i_Form.LstDetalhes.Items.Clear();

                hshLojas.Clear();

                Application.DoEvents();

                var_exchange.fetch_repasseData(ctrl_TxtDataIni.getTextBoxValue(),
                                               ref header,
                                               ref block_detalhe_loja,
                                               ref block_sumario_loja);

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

                    if (var_exchange.fetch_memory(block_detalhe_loja, "400", ref block_detalhe_loja, ref tmp_memory))
                    {
                        for (int t = 0; t < tmp_memory.Count; ++t)
                        {
                            DadosRepasse dr = new DadosRepasse(tmp_memory[t] as DataPortable);

                            string cod = dr.get_st_loja();

                            if (hshLojas [cod] == null)
                            {
                                hshLojas [cod] = new ArrayList();
                            }

                            ArrayList tmp_list = hshLojas [cod] as ArrayList;

                            string dt_rep = var_util.getDDMMYYYY_format(dr.get_dt_repasse()).Substring(0, 10);

                            DateTime tim_repasse = Convert.ToDateTime(dr.get_dt_repasse());

                            if (dt_rep == ctrl_TxtDataIni.getTextBoxValue())
                            {
                                dr.set_tg_confirmado(Context.FALSE);
                            }
                            else if (tim_repasse > ctrl_TxtDataIni.getTextBoxValue_Date())
                            {
                                dr.set_tg_confirmado(Context.FALSE);
                            }

                            tmp_list.Add(dr);
                        }
                    }
                }

                long vr_repasse = 0;

                ArrayList full_memory = new ArrayList();

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

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

                ArrayList sorted_memory = new ArrayList();

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

                    sorted_memory.Add(dsr.get_vr_valor().PadLeft(20, '0') + dsr.get_st_codLoja().PadRight(20, ' '));
                }

                sorted_memory.Sort();

                for (int g = sorted_memory.Count - 1; g >= 0; --g)
                {
                    string tag = sorted_memory[g].ToString().Substring(20, 20).Trim();

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

                        if (dsr.get_st_codLoja() == tag)
                        {
                            vr_repasse += Convert.ToInt64(dsr.get_vr_valor());

                            string [] full_row = new string [] { dsr.get_st_loja(),
                                                                 new money().formatToMoney(dsr.get_vr_valor()) };

                            i_Form.LstLojas.Items.Add(var_util.GetListViewItem(dsr.get_st_codLoja(), full_row));
                        }
                    }
                }

                i_Form.TxtRepasse.Text = "R$ " + new money().formatToMoney(vr_repasse.ToString());

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_LstLojasClick -

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

                #endregion

                #region - event_BtnConfirmarClick -

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

                #endregion

                #region - event_ListView1ItemChecked -

            case event_ListView1ItemChecked:
            {
                //InitEventCode event_ListView1ItemChecked
                //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_TxtCartao.AcquireTextBox(i_Form.TxtCartao, this, event_val_TxtCartao, 6);
                ctrl_TxtEmpresa.AcquireTextBox(i_Form.TxtEmpresa, this, event_val_TxtEmpresa, 6);
                ctrl_TxtNome.AcquireTextBox(i_Form.TxtNome, this, event_val_TxtNome, 20);
                ctrl_TxtLimTotal.AcquireTextBox(i_Form.TxtLimTotal, this, event_val_TxtLimTotal, "R$", 6);
                ctrl_TxtLimMensal.AcquireTextBox(i_Form.TxtLimMensal, this, event_val_TxtLimMensal, "R$", 6);
                ctrl_TxtCotaExtra.AcquireTextBox(i_Form.TxtCotaExtra, this, event_val_TxtCotaExtra, "R$", 6);

                ctrl_TxtCidade.AcquireTextBox(i_Form.TxtCidade, this, event_val_TxtCidade, 20, false);
                ctrl_TxtEstado.AcquireTextBox(i_Form.TxtEstado, this, event_val_TxtEstado, 20, false);

                ctrl_TxtCpf.AcquireTextBox(i_Form.TxtCpf, this, event_val_TxtCpf);
                ctrl_TxtCNPJ.AcquireTextBox(i_Form.TxtCNPJ, this, event_val_TxtCNPJ);

                if (header.get_tg_user_type() == TipoUsuario.Administrador ||
                    header.get_tg_user_type() == TipoUsuario.AdminGift ||
                    header.get_tg_user_type() == TipoUsuario.VendedorGift ||
                    header.get_tg_user_type() == TipoUsuario.Operador)
                {
                    ctrl_TxtEmpresa.SetTextBoxText(header.get_st_empresa());

                    i_Form.TxtEmpresa.ReadOnly = true;
                }

                if (header.get_tg_user_type() == TipoUsuario.SuperUser)
                {
                    i_Form.BtnExclui.Visible = true;
                }

                i_Form.CboSit.SelectedIndex = 3;
                i_Form.CboExp.SelectedIndex = 2;

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

                DadosConsultaCartoes dcc = new DadosConsultaCartoes();

                if (header.get_tg_user_type() == TipoUsuario.Administrador)
                {
                    dcc.set_st_empresa(header.get_st_empresa());
                }
                else
                {
                    dcc.set_st_cnpj(ctrl_TxtCNPJ.getTextBoxValue());
                    dcc.set_st_empresa(ctrl_TxtEmpresa.getTextBoxValue());
                }

                dcc.set_st_cpf(ctrl_TxtCpf.getTextBoxValue());
                dcc.set_st_cartao(ctrl_TxtCartao.getTextBoxValue());
                dcc.set_st_nome(ctrl_TxtNome.getTextBoxValue());
                dcc.set_vr_limTotal(ctrl_TxtLimTotal.getTextBoxValue_NumberStr());
                dcc.set_vr_limMensal(ctrl_TxtLimMensal.getTextBoxValue_NumberStr());
                dcc.set_vr_cotaExtra(ctrl_TxtCotaExtra.getTextBoxValue_NumberStr());

                dcc.set_st_cidade(ctrl_TxtCidade.getTextBoxValue());
                dcc.set_st_estado(ctrl_TxtEstado.getTextBoxValue());

                dcc.set_tg_bloqueado(i_Form.CboSit.SelectedIndex.ToString());
                dcc.set_tg_expedido(i_Form.CboExp.SelectedIndex.ToString());

                string st_csv_block = "";

                i_Form.LstCartao.Items.Clear();

                i_Form.LblCart.Text = "Processando...";
                Application.DoEvents();

                ArrayList full_memory = new ArrayList();

                if (var_exchange.fetch_consultaCartao(ref dcc,
                                                      ref header,
                                                      ref st_csv_block))
                {
                    while (st_csv_block != "")
                    {
                        ArrayList tmp_memory = new ArrayList();

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

                    string bloq = "";

                    if (i_Form.ChkAlfa.Checked)
                    {
                        ArrayList lst_sort = new ArrayList();
                        Hashtable hsh_sort = new Hashtable();

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

                            lst_sort.Add(dc.get_st_proprietario() + dc.get_st_matricula());

                            hsh_sort [dc.get_st_proprietario() + dc.get_st_matricula()] = dc;
                        }

                        lst_sort.Sort();

                        for (int t = 0; t < lst_sort.Count; ++t)
                        {
                            DadosCartao dc = hsh_sort [lst_sort[t]] as DadosCartao;

                            if (dc.get_tg_status() == CartaoStatus.Bloqueado)
                            {
                                bloq = "Sim";
                            }
                            else
                            {
                                bloq = "Não";
                            }

                            string [] full_row = new string [] { dc.get_st_empresa() + "." + dc.get_st_matricula() + "-" + dc.get_st_titularidade(),
                                      bloq,
                                      dc.get_st_proprietario(),
                                                                 "R$ " + new money().formatToMoney(dc.get_vr_limiteTotal()),
                                                                 "R$ " + new money().formatToMoney(dc.get_vr_limiteMensal()),
                                                                 "R$ " + new money().formatToMoney(dc.get_vr_extraCota()),
                                                                 "R$ " + new money().formatToMoney(dc.get_vr_dispMes()),
                                                                 "R$ " + new money().formatToMoney(dc.get_vr_dispTotal()) };

                            i_Form.LstCartao.Items.Add(var_util.GetListViewItem(dc.get_st_cpf(), full_row));
                        }
                    }
                    else
                    {
                        for (int t = 0; t < full_memory.Count; ++t)
                        {
                            DadosCartao dc = new DadosCartao(full_memory[t] as DataPortable);

                            if (dc.get_tg_status() == CartaoStatus.Bloqueado)
                            {
                                bloq = "Sim";
                            }
                            else
                            {
                                bloq = "Não";
                            }

                            string [] full_row = new string [] { dc.get_st_empresa() + "." + dc.get_st_matricula() + "-" + dc.get_st_titularidade(),
                                      bloq,
                                      dc.get_st_proprietario(),
                                                                 "R$ " + new money().formatToMoney(dc.get_vr_limiteTotal()),
                                                                 "R$ " + new money().formatToMoney(dc.get_vr_limiteMensal()),
                                                                 "R$ " + new money().formatToMoney(dc.get_vr_extraCota()),
                                                                 "R$ " + new money().formatToMoney(dc.get_vr_dispMes()),
                                                                 "R$ " + new money().formatToMoney(dc.get_vr_dispTotal()) };

                            i_Form.LstCartao.Items.Add(var_util.GetListViewItem(dc.get_st_cpf(), full_row));
                        }
                    }
                }

                if (full_memory.Count != 0)
                {
                    i_Form.LblCart.Text = full_memory.Count.ToString() + " cartões encontrados";
                }
                else
                {
                    i_Form.LblCart.Text = "Nenhum cartão encontrado";
                }

                i_Form.BtnConsultar.Enabled = true;

                //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 (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_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_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_TxtLimTotal -

            case event_val_TxtLimTotal:
            {
                //InitEventCode event_val_TxtLimTotal

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

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtLimMensal -

            case event_val_TxtLimMensal:
            {
                //InitEventCode event_val_TxtLimMensal

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

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtCotaExtra -

            case event_val_TxtCotaExtra:
            {
                //InitEventCode event_val_TxtCotaExtra

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

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

            case event_val_TxtCartao:
            {
                //InitEventCode event_val_TxtCartao

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

                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtCpf -

            case event_val_TxtCpf:
            {
                //InitEventCode event_val_TxtCpf

                switch (arg as string)
                {
                case cnpjTextController.CNPJ_INCOMPLETE:
                case cnpjTextController.CNPJ_INVALID:
                case cpfTextController.CPF_INCOMPLETE:
                case cpfTextController.CPF_INVALID:
                {
                    i_Form.TxtCpf.BackColor     = colorInvalid;
                    ctrl_TxtCpf.IsUserValidated = false;
                    break;
                }

                case cpfTextController.CPF_VALID:
                case cnpjTextController.CNPJ_VALID:
                {
                    i_Form.TxtCpf.BackColor     = System.Drawing.Color.White;
                    ctrl_TxtCpf.IsUserValidated = true;
                    break;
                }
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Editar -

            case event_Editar:
            {
                //InitEventCode event_Editar

                if (i_Form.LstCartao.SelectedItems.Count > 0)
                {
                    string cpf_cnpj = var_util.getSelectedListViewItemTag(i_Form.LstCartao);

                    DadosProprietario dp = new DadosProprietario();

                    if (var_exchange.fetch_proprietario(cpf_cnpj,
                                                        ref header,
                                                        ref dp))
                    {
                        if (dp.get_tg_found() == Context.TRUE)
                        {
                            event_dlgDadosCadastrais ev_call = new event_dlgDadosCadastrais(var_util, var_exchange);

                            ev_call.header   = header;
                            ev_call.dp       = dp;
                            ev_call.cpf_cnpj = cpf_cnpj;

                            ev_call.i_Form.ShowDialog();
                        }
                    }
                }

                //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 DE CONSULTA DE CARTÃO");
                lstReport.Add("");
                lstReport.Add("                                                                 Limite    Limite   Cota Extra  Disponível  Disponível ");
                lstReport.Add("CARTÃO              BLOQ NOME                                    TOTAL     MENSAL               MENSAL      TOTAL");
                lstReport.Add("------------------------------------------------------------------------------------------------------------------------");
                lstReport.Add("");

                string line = "";

                for (int t = 0; t < i_Form.LstCartao.Items.Count; ++t)
                {
                    line  = i_Form.LstCartao.Items[t].SubItems[0].Text + " ";
                    line += i_Form.LstCartao.Items[t].SubItems[1].Text.PadLeft(4, ' ') + " ";
                    line += i_Form.LstCartao.Items[t].SubItems[2].Text.PadRight(38, ' ').Substring(0, 38);
                    line += i_Form.LstCartao.Items[t].SubItems[3].Text.PadLeft(14, ' ').Replace("R$ ", "");
                    line += i_Form.LstCartao.Items[t].SubItems[4].Text.PadLeft(14, ' ').Replace("R$ ", "");
                    line += i_Form.LstCartao.Items[t].SubItems[5].Text.PadLeft(14, ' ').Replace("R$ ", "");
                    line += i_Form.LstCartao.Items[t].SubItems[6].Text.PadLeft(14, ' ').Replace("R$ ", "");
                    line += i_Form.LstCartao.Items[t].SubItems[7].Text.PadLeft(14, ' ').Replace("R$ ", "");

                    lstReport.Add(line);
                }

                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_LstCartaoDoubleClick -

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

                #endregion

                #region - event_BtnRelatorioClick -

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

                #endregion

                #region - event_ChkAlfaCheckedChanged -

            case event_ChkAlfaCheckedChanged:
            {
                //InitEventCode event_ChkAlfaCheckedChanged

                doEvent(event_Consultar, null);

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BtnExcluiClick -

            case event_BtnExcluiClick:
            {
                //InitEventCode event_BtnExcluiClick

                if (i_Form.LstCartao.SelectedItems.Count == 1)
                {
                    string emp = i_Form.LstCartao.SelectedItems[0].SubItems[0].Text.Substring(0, 6);
                    string mat = i_Form.LstCartao.SelectedItems[0].SubItems[0].Text.Substring(7, 6);
                    string tit = i_Form.LstCartao.SelectedItems[0].SubItems[0].Text.Substring(14, 2);

                    var_exchange.exec_excluiCart(emp, mat, tit, ref header);
                }

                //EndEventCode
                return(true);
            }

                #endregion

            default: break;
            }

            return(false);
        }
Esempio n. 13
0
        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

                string upgradePath = "Pendencias";

                if (var_util.offline)
                {
                    i_Form.BtnConfirmar.Enabled = false;
                }

                i_Form.LstPend.Items.Clear();

                if (Directory.Exists(upgradePath))
                {
                    string [] my_files = Directory.GetFiles(upgradePath);
                    int       numFiles = my_files.GetLength(0);

                    for (int t = 0; t < numFiles; ++t)
                    {
                        string fileName = my_files[t];

                        StreamReader sr = new StreamReader(fileName);

                        string cart = sr.ReadLine();
                        string valu = "R$ " + new SyCrafEngine.money().formatToMoney(sr.ReadLine());

                        string [] full_row = { cart, valu };

                        i_Form.LstPend.Items.Add(var_util.GetListViewItem(fileName, full_row));

                        i_Form.LstPend.Items[t].Selected = true;

                        sr.Close();
                    }
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BtnRemoverClick -

            case event_BtnRemoverClick:
            {
                //InitEventCode event_BtnRemoverClick

                if (MessageBox.Show("Confirma remoção deste registro?",
                                    "Aviso",
                                    MessageBoxButtons.YesNo,
                                    MessageBoxIcon.Question,
                                    MessageBoxDefaultButton.Button2) == DialogResult.No)
                {
                    return(false);
                }

                string file = var_util.getSelectedListViewItemTag(i_Form.LstPend);

                File.Delete(file);

                doEvent(event_FormIsOpening, null);

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BtnConfirmarClick -

            case event_BtnConfirmarClick:
            {
                //InitEventCode event_BtnConfirmarClick

                if (i_Form.LstPend.SelectedItems.Count == 0)
                {
                    return(false);
                }

                int max = i_Form.LstPend.SelectedItems.Count;

                for (int t = 0; t < max; ++t)
                {
                    string st_cart  = i_Form.LstPend.SelectedItems[t].SubItems[0].Text;
                    string vr_valor = i_Form.LstPend.SelectedItems[t].SubItems[1].Text;

                    vr_valor = vr_valor.Replace("R$ ", "").Replace(".", "").Replace(",", "");

                    string fileName = i_Form.LstPend.SelectedItems[t].Tag.ToString();

                    if (var_exchange.exec_venda_pend_lojista(st_cart,
                                                             vr_valor,
                                                             ref header))
                    {
                        if (File.Exists(fileName))
                        {
                            File.Delete(fileName);
                        }
                    }
                }

                doEvent(event_FormIsOpening, null);

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