Пример #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            LblNome.Text = Session["nome"].ToString();

            TxtMes.Text = (DateTime.Now.Month - 1).ToString();
            TxtAno.Text = DateTime.Now.Year.ToString();

            string pass = Session["pass"].ToString();
            string cnpj = Session["cnpj"].ToString();

            GetConnection();

            try
            {
                ArrayList lst = new ArrayList();

                if (var_exchange.fetch_listawebConveniosLoja(cnpj,
                                                             pass,
                                                             ref lst))
                {
                    var_exchange.m_Client.ExitSession();

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

                        CboEmp.Items.Add(de.get_st_empresa());
                    }
                }
                else
                {
                    var_exchange.m_Client.ExitSession();

                    Session["st_error"]      = var_exchange.m_Client.GetServerMessage();
                    Session["st_error_dest"] = "rep.aspx";
                    Response.Redirect("error.aspx", true);
                }
            }
            catch (System.Exception se)
            {
                if (se.Message == "Exit")
                {
                    Session["st_error"]      = "Esgotado tempo de espera no servidor";
                    Session["st_error_dest"] = "login.aspx";
                    Response.Redirect("error.aspx", true);
                }
            }
        }
    }
Пример #2
0
        public override bool doEvent(int event_number, object arg)
        {
            switch (event_number)
            {
                #region - event_Load -

            case event_Load:
            {
                //InitEventCode event_Load

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

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Translate -

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

                #endregion

                #region - event_FormIsOpening -

            case event_FormIsOpening:
            {
                //InitEventCode event_FormIsOpening

                doEvent(event_val_TxtEmpresa, 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.CboEmpresa.SelectedIndex == -1)
                {
                    MessageBox.Show("Nenhuma empresa disponível");
                    return(false);
                }

                if (i_Form.TxtFile.Text.Length == 0)
                {
                    MessageBox.Show("Escolha um arquivo de destino");
                    return(false);
                }

                i_Form.BtnConfirmar.Enabled = false;

                string st_csv = "";

                if (!var_exchange.fetch_cartoes_grafica(i_Form.CboEmpresa.SelectedItem.ToString(), ref header, ref st_csv))
                {
                    i_Form.BtnConfirmar.Enabled = true;
                    return(false);
                }

                ArrayList full_memory = new ArrayList();

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

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

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

                StreamWriter sw = new StreamWriter(i_Form.TxtFile.Text);

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

                    sw.WriteLine(port.get_st_line());
                }

                sw.Close();

                MessageBox.Show("Arquivo gerado sucesso", "Aviso");

                i_Form.BtnConfirmar.Enabled = true;

                doEvent(event_val_TxtEmpresa, null);

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtEmpresa -

            case event_val_TxtEmpresa:
            {
                //InitEventCode event_val_TxtEmpresa

                ArrayList lst = new ArrayList();

                dlgStatus st = new dlgStatus("Empresas com novos cartões");

                st.LblActivity.Text = "Buscando cartões";
                st.Show();

                Application.DoEvents();

                var_exchange.fetch_empresasGrafica(ref header, ref lst);

                i_Form.TxtFile.Text = "";
                i_Form.CboEmpresa.Items.Clear();
                hshEmp.Clear();

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

                    i_Form.CboEmpresa.Items.Add(de.get_st_empresa());

                    hshEmp [de.get_st_empresa()] = de;
                }

                if (lst.Count > 0)
                {
                    i_Form.CboEmpresa.SelectedIndex = 0;
                }

                st.Close();

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_ComboChanged -

            case event_ComboChanged:
            {
                //InitEventCode event_ComboChanged

                DadosEmpresa de = hshEmp [i_Form.CboEmpresa.SelectedItem.ToString()] as DadosEmpresa;

                i_Form.TxtNome.Text = de.get_st_fantasia();

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BtnDirClick -

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

                #endregion

                #region - event_BtnConfirmarClick -

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

                #endregion

                #region - event_CboEmpresaSelectedIndexChanged -

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

                if (header.get_tg_user_type() == TipoUsuario.Lojista)
                {
                    ArrayList lst = new ArrayList();

                    var_exchange.fetch_lojistaEmpresas(header.get_st_empresa(), ref header, ref lst);

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

                        i_Form.LstEmp.Items.Add(de.get_st_empresa() + " " + de.get_st_fantasia());
                    }
                }

                //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.LstEmp.SelectedIndex == -1)
                {
                    return(false);
                }

                string st_empresa = i_Form.LstEmp.SelectedItem.ToString();

                st_empresa = st_empresa.Substring(0, st_empresa.IndexOf(" "));

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

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

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

                string st_csv_contents = "";

                dlgStatus stat = new dlgStatus("Relatório");

                stat.LblActivity.Text = "Processando relatório no servidor";
                stat.Show();
                Application.DoEvents();

                if (!var_exchange.fetch_rel_prevLojista(st_empresa,
                                                        ref header,
                                                        ref st_csv_contents))
                {
                    stat.Close();
                    return(false);
                }

                ArrayList full_memory = new ArrayList();

                stat.LblActivity.Text = "Buscando detalhes...";
                Application.DoEvents();

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

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

                money money_helper = new money();

                stat.LblActivity.Text = "Gerando relatório para web";
                Application.DoEvents();

                lstMessages.Add("Transações confirmadas para a loja: " + header.get_st_empresa());

                lstTableSizes.Add(650);

                ArrayList lst_sub_tbl_head = new ArrayList();

                lst_sub_tbl_head.Add("Cartão");
                lst_sub_tbl_head.Add("NSU");
                lst_sub_tbl_head.Add("Data e Hora");
                lst_sub_tbl_head.Add("Parcela");
                lst_sub_tbl_head.Add("Valor R$");
                lst_sub_tbl_head.Add("Valor Repasse R$");

                lstHeader.Add(lst_sub_tbl_head);

                long tot_repasse = 0;

                ArrayList my_line_container = new ArrayList();

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

                    ArrayList lst_line_content = new ArrayList();

                    lst_line_content.Add(dr.get_st_cartao());
                    lst_line_content.Add(dr.get_st_nsu());
                    lst_line_content.Add(var_util.getDDMMYYYY_format(dr.get_dt_trans()));
                    lst_line_content.Add(dr.get_id_parcela());
                    lst_line_content.Add(money_helper.formatToMoney(dr.get_vr_total()));
                    lst_line_content.Add(money_helper.formatToMoney(dr.get_vr_repasse()));

                    tot_repasse += Convert.ToInt64(dr.get_vr_repasse());

                    my_line_container.Add(lst_line_content);
                }

                lstContent.Add(my_line_container);

                ArrayList lst_sub_foot = new ArrayList();

                lst_sub_foot.Add("Total de repasse: " + money_helper.formatToMoney(tot_repasse.ToString()));

                lstFooter.Add(lst_sub_foot);

                stat.Close();

                SyCrafReport rel = new SyCrafReport("Relatório de previsão de repasse ao lojista",
                                                    "RPR",
                                                    i_Form.LstEmp.SelectedItem.ToString(),
                                                    var_util.getDDMMYYYY_format(DateTime.Now.ToString()),
                                                    "",
                                                    ref lstHeader,
                                                    ref lstContent,
                                                    ref lstTableSizes,
                                                    ref lstFooter,
                                                    ref lstMessages,
                                                    ref lstFilters);

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

                i_Form.Text += " " + st_cod_empresa.PadLeft(6, '0');

                i_Form.CboReport.SelectedIndex = 0;

                ctrl_TxtMes.AcquireTextBox(i_Form.TxtMes, this, event_val_TxtMes, 2);
                ctrl_TxtAno.AcquireTextBox(i_Form.TxtAno, this, event_val_TxtAno, 4);

                ctrl_TxtMes.SetTextBoxText(DateTime.Now.Month.ToString());
                ctrl_TxtAno.SetTextBoxText(DateTime.Now.Year.ToString());

                ArrayList lst = new ArrayList();

                string nome_emp = "";

                var_exchange.fetch_empresasAfiliadas(st_cod_empresa,
                                                     ref header,
                                                     ref nome_emp,
                                                     ref lst);

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

                    i_Form.CboAfiliada.Items.Add(de.get_st_empresa());
                }

                if (lst.Count == 0)
                {
                    i_Form.CboAfiliada.Items.Add("");
                }

                i_Form.CboAfiliada.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_Confirmar -

            case event_Confirmar:
            {
                //InitEventCode event_Confirmar

                if (!ctrl_TxtAno.IsUserValidated && !ctrl_TxtMes.IsUserValidated)
                {
                    return(false);
                }

                switch (i_Form.CboReport.SelectedIndex)
                {
                case 0: doEvent(event_PorEmpresa, null);     break;

                case 1: doEvent(event_PorCartao, null);      break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtMes -

            case event_val_TxtMes:
            {
                //InitEventCode event_val_TxtMes

                if (ctrl_TxtMes.getTextBoxValue() == "" ||
                    ctrl_TxtMes.getTextBoxValue_Long() > 12)
                {
                    i_Form.TxtMes.BackColor     = colorInvalid;
                    ctrl_TxtMes.IsUserValidated = false;
                }
                else
                {
                    i_Form.TxtMes.BackColor     = Color.White;
                    ctrl_TxtMes.IsUserValidated = true;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtAno -

            case event_val_TxtAno:
            {
                //InitEventCode event_val_TxtAno

                if (ctrl_TxtAno.getTextBoxValue().Length < 4)
                {
                    i_Form.TxtAno.BackColor     = colorInvalid;
                    ctrl_TxtAno.IsUserValidated = false;
                }
                else
                {
                    i_Form.TxtAno.BackColor     = Color.White;
                    ctrl_TxtAno.IsUserValidated = true;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_PorEmpresa -

            case event_PorEmpresa:
            {
                //InitEventCode event_PorEmpresa

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

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

                string st_empresa             = "";
                string st_csv_cartao          = "";
                string st_csv_loja            = "";
                string st_csv_loja_content    = "";
                string st_csv_subtotal_loja   = "";
                string st_csv_subtotal_cartao = "";
                string st_csv_cartao_content  = "";
                string st_total = "";

                dlgStatus stat = new dlgStatus("Relatório");

                stat.LblActivity.Text = "Processando relatório no servidor";
                stat.Show();
                Application.DoEvents();

                if (!var_exchange.fetch_rel_3_fech("0",
                                                   ctrl_TxtMes.getTextBoxValue(),
                                                   ctrl_TxtAno.getTextBoxValue(),
                                                   st_cod_empresa,
                                                   i_Form.CboAfiliada.SelectedItem.ToString(),
                                                   ref header,
                                                   ref st_empresa,
                                                   ref st_csv_cartao,
                                                   ref st_csv_loja,
                                                   ref st_csv_loja_content,
                                                   ref st_csv_subtotal_loja,
                                                   ref st_csv_subtotal_cartao,
                                                   ref st_csv_cartao_content,
                                                   ref st_total))
                {
                    stat.Close();
                    return(false);
                }

                money     money_helper = new money();
                Hashtable mem_Lojas    = new Hashtable();

                stat.LblActivity.Text = "Obtendo resultados";

                Application.DoEvents();

                #region Busca todos os registros de todos as lojas
                {
                    ArrayList full_memory = new ArrayList();

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

                        if (var_exchange.fetch_memory(st_csv_loja_content, "400", ref st_csv_loja_content, 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)
                    {
                        DadosFechamento df = new DadosFechamento(full_memory[t] as DataPortable);

                        string tmp_loja = df.get_st_loja();

                        if (mem_Lojas [tmp_loja] == null)
                        {
                            mem_Lojas [tmp_loja] = new ArrayList();
                        }

                        ArrayList memoryLoja = mem_Lojas [tmp_loja] as ArrayList;

                        memoryLoja.Add(df);
                    }
                }
                #endregion

                stat.LblActivity.Text = "Gerando relatório para web";

                Application.DoEvents();

                int tot_Lojas = var_util.indexCSV(st_csv_loja);

                long tot_repasse = 0;

                ApplicationUtil var_utilFooter = new ApplicationUtil();

                var_utilFooter.indexCSV(st_csv_subtotal_loja);

                for (int h = 0; h < tot_Lojas; ++h)
                {
                    string loja = var_util.getCSV(h);

                    ArrayList memLojaList = mem_Lojas [loja] as ArrayList;

                    ArrayList lstFooterSub  = new ArrayList();
                    ArrayList lstHeaderSub  = new ArrayList();
                    ArrayList lstContentSub = new ArrayList();

                    lstMessages.Add("Fechamento da loja: " + loja);

                    lstTableSizes.Add(650);

                    lstHeaderSub.Add("NSU");
                    lstHeaderSub.Add("Cartão");
                    lstHeaderSub.Add("Nome");
                    lstHeaderSub.Add("Data e Hora");
                    lstHeaderSub.Add("Valor R$");
                    lstHeaderSub.Add("Parcela");
                    lstHeaderSub.Add("Terminal");

                    long sub_repasse = 0;

                    if (memLojaList != null)
                    {
                        for (int t = 0; t < memLojaList.Count; ++t)
                        {
                            DadosFechamento df = new DadosFechamento(memLojaList[t] as DataPortable);

                            ArrayList lstLine = new ArrayList();

                            lstLine.Add(df.get_st_nsu().PadLeft(6, '0'));
                            lstLine.Add(df.get_st_cartao());
                            lstLine.Add(df.get_st_nome());
                            lstLine.Add(var_util.getDDMMYYYY_format(df.get_dt_trans()));
                            lstLine.Add(money_helper.formatToMoney(df.get_vr_valor()));
                            lstLine.Add(df.get_nu_parcela());
                            lstLine.Add(df.get_st_terminal());

                            sub_repasse += Convert.ToInt64(df.get_vr_repasse());

                            lstContentSub.Add(lstLine);
                        }
                    }

                    lstFooterSub.Add("Sub-Total: " + "R$ " + money_helper.formatToMoney(var_utilFooter.getCSV(h)));
                    lstFooterSub.Add("Sub-Total repasse: " + "R$ " + money_helper.setMoneyFormat(sub_repasse));

                    tot_repasse += sub_repasse;

                    lstHeader.Add(lstHeaderSub);
                    lstFooter.Add(lstFooterSub);
                    lstContent.Add(lstContentSub);

                    if (h == tot_Lojas - 1)
                    {
                        lstFooterSub.Add("");
                        lstFooterSub.Add("Total de vendas nas lojas: " + "R$ " + money_helper.formatToMoney(st_total));
                        lstFooterSub.Add("Total de repasse para lojas: " + "R$ " + money_helper.setMoneyFormat(tot_repasse));
                    }
                }

                stat.Close();

                SyCrafReport rel = new SyCrafReport("Relatório de Fechamento por loja",
                                                    "RFE",
                                                    st_empresa,
                                                    "Mês " + ctrl_TxtMes.getTextBoxValue(),
                                                    "Ano " + ctrl_TxtAno.getTextBoxValue(),
                                                    ref lstHeader,
                                                    ref lstContent,
                                                    ref lstTableSizes,
                                                    ref lstFooter,
                                                    ref lstMessages,
                                                    ref lstFilters);


                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_PorCartao -

            case event_PorCartao:
            {
                //InitEventCode event_PorCartao

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

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

                string st_empresa             = "";
                string st_csv_cartao          = "";
                string st_csv_loja            = "";
                string st_csv_loja_content    = "";
                string st_csv_subtotal_loja   = "";
                string st_csv_subtotal_cartao = "";
                string st_csv_cartao_content  = "";
                string st_total = "";

                dlgStatus stat = new dlgStatus("Relatório");

                stat.LblActivity.Text = "Processando relatório no servidor";
                stat.Show();
                Application.DoEvents();

                if (!var_exchange.fetch_rel_3_fech("1",
                                                   ctrl_TxtMes.getTextBoxValue(),
                                                   ctrl_TxtAno.getTextBoxValue(),
                                                   st_cod_empresa,
                                                   i_Form.CboAfiliada.SelectedItem.ToString(),
                                                   ref header,
                                                   ref st_empresa,
                                                   ref st_csv_cartao,
                                                   ref st_csv_loja,
                                                   ref st_csv_loja_content,
                                                   ref st_csv_subtotal_loja,
                                                   ref st_csv_subtotal_cartao,
                                                   ref st_csv_cartao_content,
                                                   ref st_total))
                {
                    stat.Close();
                    return(false);
                }

                money     money_helper = new money();
                Hashtable mem_Cartoes  = new Hashtable();

                stat.LblActivity.Text = "Obtendo resultados";

                Application.DoEvents();

                #region Busca todos os registros de todos os cartoes
                {
                    ArrayList full_memory = new ArrayList();

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

                        if (var_exchange.fetch_memory(st_csv_cartao_content, "400", ref st_csv_cartao_content, 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)
                    {
                        DadosFechamento df = new DadosFechamento(full_memory[t] as DataPortable);

                        string tmp_cartao = df.get_st_cartao();

                        if (mem_Cartoes [tmp_cartao] == null)
                        {
                            mem_Cartoes [tmp_cartao] = new ArrayList();
                        }

                        ArrayList memoryCart = mem_Cartoes [tmp_cartao] as ArrayList;

                        memoryCart.Add(df);
                    }
                }

                #endregion

                stat.LblActivity.Text = "Gerando relatório para web";

                Application.DoEvents();

                int tot_Cartoes = var_util.indexCSV(st_csv_cartao);

                ApplicationUtil var_utilFooter = new ApplicationUtil();

                var_utilFooter.indexCSV(st_csv_subtotal_cartao);

                for (int h = 0; h < tot_Cartoes; ++h)
                {
                    string cart = var_util.getCSV(h);

                    ArrayList lstFooterSub  = new ArrayList();
                    ArrayList lstHeaderSub  = new ArrayList();
                    ArrayList lstContentSub = new ArrayList();

                    lstMessages.Add("Fechamento do cartão: " + cart);

                    lstTableSizes.Add(800);

                    lstHeaderSub.Add("NSU");
                    lstHeaderSub.Add("Loja");
                    lstHeaderSub.Add("Data e Hora");
                    lstHeaderSub.Add("Valor R$");
                    lstHeaderSub.Add("Parcela");

                    ArrayList memCartList = mem_Cartoes [cart] as ArrayList;

                    if (memCartList != null)
                    {
                        for (int t = 0; t < memCartList.Count; ++t)
                        {
                            DadosFechamento df = new DadosFechamento(memCartList[t] as DataPortable);

                            ArrayList lstLine = new ArrayList();

                            lstLine.Add(df.get_st_nsu().PadLeft(6, '0'));
                            lstLine.Add(df.get_st_loja());
                            lstLine.Add(var_util.getDDMMYYYY_format(df.get_dt_trans()));
                            lstLine.Add(money_helper.formatToMoney(df.get_vr_valor()));
                            lstLine.Add(df.get_nu_parcela());

                            lstContentSub.Add(lstLine);
                        }
                    }

                    lstFooterSub.Add("Sub-Total: R$ " + money_helper.formatToMoney(var_utilFooter.getCSV(h)));

                    lstHeader.Add(lstHeaderSub);
                    lstFooter.Add(lstFooterSub);
                    lstContent.Add(lstContentSub);

                    if (h == tot_Cartoes - 1)
                    {
                        lstFooterSub.Add("");
                        lstFooterSub.Add("Total: " + "R$ " + money_helper.formatToMoney(st_total));
                    }
                }

                stat.Close();

                SyCrafReport rel = new SyCrafReport("Relatório de Fechamento por cartões",
                                                    "RFE",
                                                    st_empresa,
                                                    "Mês : " + ctrl_TxtMes.getTextBoxValue(),
                                                    "Ano : " + ctrl_TxtAno.getTextBoxValue(),
                                                    ref lstHeader,
                                                    ref lstContent,
                                                    ref lstTableSizes,
                                                    ref lstFooter,
                                                    ref lstMessages,
                                                    ref lstFilters);


                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BDF -

            case event_BDF:
            {
                //InitEventCode event_BDF

                if (i_Form.CboReport.SelectedIndex != 1)
                {
                    MessageBox.Show("Geração somente para relatório de cartões", "Aviso");
                    return(false);
                }

                event_dlgDBF_Fechamento ev_call = new event_dlgDBF_Fechamento(var_util, var_exchange);

                ev_call.header = header;

                ev_call.mes            = ctrl_TxtMes.getTextBoxValue();
                ev_call.ano            = ctrl_TxtAno.getTextBoxValue();
                ev_call.st_cod_empresa = st_cod_empresa;

                ev_call.i_Form.ShowDialog();

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BtnConfirmarClick -

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

                #endregion

                #region - event_BtnDBFClick -

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

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

                    string [] full_row = new string [] { de.get_st_empresa(), de.get_st_fantasia() };

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

                //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.LstEmpresas.SelectedItems.Count > 0)
                {
                    var_empresa  = i_Form.LstEmpresas.SelectedItems[0].SubItems[0].Text;
                    var_fantasia = i_Form.LstEmpresas.SelectedItems[0].SubItems[1].Text;

                    i_Form.Close();
                }

                //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_TxtMesHor.AcquireTextBox(i_Form.TxtMesHor, this, event_val_TxtMesHor, dateTimeTextController.FORMAT_HHMM);
                ctrl_TxtSemHor.AcquireTextBox(i_Form.TxtSemHor, this, event_val_TxtSemHor, dateTimeTextController.FORMAT_HHMM);
                ctrl_TxtDiaHor.AcquireTextBox(i_Form.TxtDiaHor, this, event_val_TxtDiaHor, dateTimeTextController.FORMAT_HHMM);
                ctrl_TxtEmpresa.AcquireTextBox(i_Form.TxtEmpresa, this, event_val_TxtEmpresa, 6);
                ctrl_TxtDiaMes.AcquireTextBox(i_Form.TxtDiaMes, this, event_val_TxtDiaMes, 2);

                ctrl_TxtEmpresa.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);

                i_Form.CboAtiv.Items.AddRange(new TipoAtividadeDesc().GetArray().ToArray());

                if (header.get_tg_user_type() != TipoUsuario.SuperUser &&
                    header.get_tg_user_type() == TipoUsuario.Operador)
                {
                    ctrl_TxtEmpresa.SetTextBoxText(header.get_st_empresa());
                }

                //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.CboAtiv.SelectedIndex == -1)
                {
                    MessageBox.Show("Selecione a atividade", "Aviso");
                    return(false);
                }

                if (!ctrl_TxtEmpresa.IsUserValidated)
                {
                    ctrl_TxtEmpresa.SetErrorMessage("Código da empresa deve ser informado");
                    return(false);
                }

                string en_tipo_schedule = "";
                string st_horario       = "";
                string st_aux           = "";

                if (ctrl_TxtDiaHor.IsUserValidated)
                {
                    en_tipo_schedule = Scheduler.Daily;
                    st_horario       = ctrl_TxtDiaHor.getTextBoxValue();
                }
                else if (ctrl_TxtSemHor.IsUserValidated)
                {
                    if (i_Form.CboDiaSem.SelectedIndex == -1)
                    {
                        MessageBox.Show("Escolha o dia da semana para a atividade", "Aviso");
                        return(false);
                    }

                    en_tipo_schedule = Scheduler.Weekly;
                    st_horario       = ctrl_TxtSemHor.getTextBoxValue();
                    st_aux           = i_Form.CboDiaSem.SelectedIndex.ToString();
                }
                else if (ctrl_TxtMesHor.IsUserValidated)
                {
                    if (!ctrl_TxtDiaMes.IsUserValidated)
                    {
                        MessageBox.Show("Escolha o dia do mês para a atividade", "Aviso");
                        return(false);
                    }

                    en_tipo_schedule = Scheduler.Monthly;
                    st_horario       = ctrl_TxtMesHor.getTextBoxValue();
                    st_aux           = ctrl_TxtDiaMes.getTextBoxValue();
                }

                var_exchange.ins_agenda(ctrl_TxtEmpresa.getTextBoxValue(),
                                        (i_Form.CboAtiv.SelectedIndex + 1).ToString(),
                                        en_tipo_schedule,
                                        st_horario.Replace(":", ""),
                                        st_aux,
                                        i_Form.CboAff.SelectedItem.ToString(),
                                        ref header);

                HouveCadastro = true;

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtMesHor -

            case event_val_TxtMesHor:
            {
                //InitEventCode event_val_TxtMesHor

                switch (arg as string)
                {
                case dateTimeTextController.DATE_INVALID:
                {
                    i_Form.TxtMesHor.BackColor     = colorInvalid;
                    ctrl_TxtMesHor.IsUserValidated = false;
                    break;
                }

                case dateTimeTextController.DATE_VALID:
                {
                    i_Form.TxtMesHor.BackColor     = Color.White;
                    ctrl_TxtMesHor.IsUserValidated = true;
                    ctrl_TxtMesHor.CleanError();

                    ctrl_TxtSemHor.SetTextBoxText("");
                    ctrl_TxtDiaHor.SetTextBoxText("");
                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtSemHor -

            case event_val_TxtSemHor:
            {
                //InitEventCode event_val_TxtSemHor

                switch (arg as string)
                {
                case dateTimeTextController.DATE_INVALID:
                {
                    i_Form.TxtSemHor.BackColor     = colorInvalid;
                    ctrl_TxtSemHor.IsUserValidated = false;
                    break;
                }

                case dateTimeTextController.DATE_VALID:
                {
                    i_Form.TxtSemHor.BackColor     = Color.White;
                    ctrl_TxtSemHor.IsUserValidated = true;
                    ctrl_TxtSemHor.CleanError();

                    ctrl_TxtMesHor.SetTextBoxText("");
                    ctrl_TxtDiaHor.SetTextBoxText("");
                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtDiaHor -

            case event_val_TxtDiaHor:
            {
                //InitEventCode event_val_TxtDiaHor

                switch (arg as string)
                {
                case dateTimeTextController.DATE_INVALID:
                {
                    i_Form.TxtDiaHor.BackColor     = colorInvalid;
                    ctrl_TxtDiaHor.IsUserValidated = false;
                    break;
                }

                case dateTimeTextController.DATE_VALID:
                {
                    i_Form.TxtDiaHor.BackColor     = Color.White;
                    ctrl_TxtDiaHor.IsUserValidated = true;
                    ctrl_TxtDiaHor.CleanError();

                    ctrl_TxtMesHor.SetTextBoxText("");
                    ctrl_TxtSemHor.SetTextBoxText("");
                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtEmpresa -

            case event_val_TxtEmpresa:
            {
                //InitEventCode event_val_TxtEmpresa

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

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

                            string nome_emp = "";

                            var_exchange.fetch_empresasAfiliadas(ctrl_TxtEmpresa.getTextBoxValue(),
                                                                 ref header,
                                                                 ref nome_emp,
                                                                 ref lst);

                            i_Form.CboAff.Items.Clear();

                            i_Form.TxtNome.Text = nome_emp;

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

                                i_Form.CboAff.Items.Add(de.get_st_empresa());
                            }

                            if (lst.Count == 0)
                            {
                                i_Form.CboAff.Items.Add("");
                            }

                            i_Form.CboAff.SelectedIndex = 0;
                        }
                    }
                    else
                    {
                        i_Form.TxtEmpresa.BackColor     = colorInvalid;
                        ctrl_TxtEmpresa.IsUserValidated = false;
                    }

                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtDiaMes -

            case event_val_TxtDiaMes:
            {
                //InitEventCode event_val_TxtDiaMes

                if (ctrl_TxtDiaMes.getTextBoxValue_Long() > 28 ||
                    ctrl_TxtDiaMes.getTextBoxValue_Long() < 1)
                {
                    i_Form.TxtDiaMes.BackColor     = colorInvalid;
                    ctrl_TxtDiaMes.IsUserValidated = false;
                }
                else
                {
                    i_Form.TxtDiaMes.BackColor     = Color.White;
                    ctrl_TxtDiaMes.IsUserValidated = true;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BtnConfirmarClick -

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

                #endregion

            default: break;
            }

            return(false);
        }
Пример #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

                i_Form.CboCob.Items.Clear();
                i_Form.CboCob.Items.AddRange(new TipoCobrancaDesc().GetArray().ToArray());

                if (IsMaintenance)
                {
                    i_Form.Text = "Manutenção de cadastro da empresa";
                    i_Form.BtnConfirmar.Text = "Atualizar";
                }
                else
                {
                    i_Form.Text = "Cadastro de empresa";
                }

                ctrl_TxtEmpresa.AcquireTextBox(i_Form.TxtEmpresa, this, event_val_TxtEmpresa, 6);
                ctrl_TxtCNPJ.AcquireTextBox(i_Form.TxtCNPJ, this, event_val_TxtCNPJ);
                ctrl_TxtFantasia.AcquireTextBox(i_Form.TxtFantasia, this, event_val_TxtFantasia, 40, alphaTextController.ENABLE_NUMBERS);
                ctrl_TxtSocial.AcquireTextBox(i_Form.TxtSocial, this, event_val_TxtSocial, 40, alphaTextController.ENABLE_NUMBERS, alphaTextController.ENABLE_SYMBOLS);
                ctrl_TxtEndereco.AcquireTextBox(i_Form.TxtEndereco, this, event_val_TxtEndereco, 40, alphaTextController.ENABLE_NUMBERS, alphaTextController.ENABLE_SYMBOLS);
                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_TxtCEP.AcquireTextBox(i_Form.TxtCEP, this, event_val_TxtCEP, 10);
                ctrl_TxtTelefone.AcquireTextBox(i_Form.TxtTelefone, this, event_val_TxtTelefone, 10);
                ctrl_TxtCartoes.AcquireTextBox(i_Form.TxtCartoes, this, event_val_TxtCartoes, 6);
                ctrl_TxtParcelas.AcquireTextBox(i_Form.TxtParcelas, this, event_val_TxtParcelas, 2);
                ctrl_TxtFatura.AcquireTextBox(i_Form.TxtFatura, this, event_val_TxtFatura, 2);

                ctrl_TxtObs.AcquireTextBox(i_Form.TxtObs, this, event_val_TxtObs, 200, alphaTextController.ENABLE_NUMBERS, alphaTextController.ENABLE_SYMBOLS);

                // faturamento

                ctrl_TxtTarif.AcquireTextBox(i_Form.TxtTarif, this, event_val_TxtTarif, "R$", 6);
                ctrl_TxtPctTrans.AcquireTextBox(i_Form.TxtPctTrans, this, event_val_TxtTarif, 5, 2);
                ctrl_TxtVrTrans.AcquireTextBox(i_Form.TxtVrTrans, this, event_val_TxtVrTrans, "R$", 6);
                ctrl_TxtVrMin.AcquireTextBox(i_Form.TxtVrMin, this, event_val_TxtVrMin, "R$", 6);
                ctrl_TxtFranqTrans.AcquireTextBox(i_Form.TxtFranqTrans, this, event_val_TxtFranqTrans, 8);
                ctrl_TxtBancoCob.AcquireTextBox(i_Form.TxtBancoCob, this, event_val_TxtBancoCob, 3);
                ctrl_TxtDiaVenc.AcquireTextBox(i_Form.TxtDiaVenc, this, event_val_TxtDiaVenc, 2);
                ctrl_TxtValCartAtv.AcquireTextBox(i_Form.TxtValCartAtv, this, event_val_TxtValCartAtv, "R$", 6);
                ctrl_TxtContaDeb.AcquireTextBox(i_Form.TxtContaDeb, this, event_val_TxtContaDeb, 14);

                ctrl_TxtEmpresa.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);
                ctrl_TxtCNPJ.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);
                ctrl_TxtFantasia.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);
                ctrl_TxtSocial.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);
                ctrl_TxtEndereco.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);
                ctrl_TxtCidade.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);
                ctrl_TxtEstado.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);
                ctrl_TxtCEP.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);
                ctrl_TxtTelefone.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);
                ctrl_TxtCartoes.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);
                ctrl_TxtParcelas.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);
                ctrl_TxtFatura.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);
                ctrl_TxtTarif.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);
                ctrl_TxtPctTrans.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);
                ctrl_TxtVrTrans.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);
                ctrl_TxtVrMin.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);
                ctrl_TxtFranqTrans.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);
                ctrl_TxtBancoCob.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);
                ctrl_TxtDiaVenc.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);
                ctrl_TxtValCartAtv.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);
                ctrl_TxtContaDeb.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);
                ctrl_TxtObs.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);

                ctrl_TxtFranqTrans.SetTextBoxText("0");

                i_Form.BtnBloq.Visible    = false;
                i_Form.BtnDesbloq.Visible = false;

                if (par_code.Length > 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

                bool IsDone = true;

                if (!ctrl_TxtEmpresa.IsUserValidated)
                {
                    ctrl_TxtEmpresa.SetErrorMessage("Código de empresa deve estar preenchido");  IsDone = false;
                }
                if (!ctrl_TxtCNPJ.IsUserValidated)
                {
                    ctrl_TxtCNPJ.SetErrorMessage("CNPJ deve estar preenchido");       IsDone = false;
                }
                if (!ctrl_TxtFantasia.IsUserValidated)
                {
                    ctrl_TxtFantasia.SetErrorMessage("Descrição de fantasia deve estar preenchida");      IsDone = false;
                }
                if (!ctrl_TxtSocial.IsUserValidated)
                {
                    ctrl_TxtSocial.SetErrorMessage("Descrição social deve estar preenchida");   IsDone = false;
                }
                if (!ctrl_TxtEndereco.IsUserValidated)
                {
                    ctrl_TxtEndereco.SetErrorMessage("Endereço deve estar preenchido");   IsDone = false;
                }
                if (!ctrl_TxtEstado.IsUserValidated)
                {
                    ctrl_TxtEstado.SetErrorMessage("Estado deve ser preenchido");       IsDone = false;
                }
                if (!ctrl_TxtCidade.IsUserValidated)
                {
                    ctrl_TxtCidade.SetErrorMessage("Cidade deve ser preenchida");       IsDone = false;
                }
                if (!ctrl_TxtCEP.IsUserValidated)
                {
                    ctrl_TxtCEP.SetErrorMessage("CEP deve ser informado");   IsDone = false;
                }
                if (!ctrl_TxtTelefone.IsUserValidated)
                {
                    ctrl_TxtTelefone.SetErrorMessage("Telefone deve conter 10 caracteres");       IsDone = false;
                }
                if (!ctrl_TxtCartoes.IsUserValidated)
                {
                    ctrl_TxtCartoes.SetErrorMessage("Número de cartões deve ser informado");     IsDone = false;
                }
                if (!ctrl_TxtParcelas.IsUserValidated)
                {
                    ctrl_TxtParcelas.SetErrorMessage("Número de parcelas deve ser informado");    IsDone = false;
                }
                if (!ctrl_TxtFatura.IsUserValidated)
                {
                    ctrl_TxtFatura.SetErrorMessage("O dia de fatura deve ser informado");       IsDone = false;
                }
                if (!ctrl_TxtDiaVenc.IsUserValidated)
                {
                    ctrl_TxtDiaVenc.SetErrorMessage("O dia de vencimento de fatura deve ser informado"); IsDone = false;
                }
                if (!ctrl_TxtBancoCob.IsUserValidated)
                {
                    ctrl_TxtBancoCob.SetErrorMessage("O banco para cobrança deve ser informado"); IsDone = false;
                }
                if (i_Form.CboCob.SelectedIndex == -1)
                {
                    MessageBox.Show("Esolha o tipo de Cobrança para faturamento", "Aviso");  IsDone = false;
                }

                if (!ctrl_TxtObs.IsUserValidated)
                {
                    ctrl_TxtObs.SetErrorMessage("Observação deve estar preenchida"); IsDone = false;
                }

                if (!ctrl_TxtFranqTrans.IsUserValidated)
                {
                    ctrl_TxtFranqTrans.SetErrorMessage("O número de transações deve ser informado");        IsDone = false;
                }
                if (!ctrl_TxtContaDeb.IsUserValidated)
                {
                    ctrl_TxtContaDeb.SetErrorMessage("O número de conta deve ser informado");     IsDone = false;
                }

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

                DadosEmpresa de = new DadosEmpresa();

                de.set_st_empresa(ctrl_TxtEmpresa.getTextBoxValue());
                de.set_nu_CNPJ(ctrl_TxtCNPJ.getTextBoxValue());
                de.set_st_fantasia(ctrl_TxtFantasia.getTextBoxValue());
                de.set_st_social(ctrl_TxtSocial.getTextBoxValue());
                de.set_st_endereco(ctrl_TxtEndereco.getTextBoxValue());
                de.set_st_cidade(ctrl_TxtCidade.getTextBoxValue());
                de.set_st_estado(ctrl_TxtEstado.getTextBoxValue());
                de.set_nu_CEP(ctrl_TxtCEP.getTextBoxValue());
                de.set_nu_telefone(ctrl_TxtTelefone.getTextBoxValue());
                de.set_nu_cartoes(ctrl_TxtCartoes.getTextBoxValue());
                de.set_nu_parcelas(ctrl_TxtParcelas.getTextBoxValue());
                de.set_nu_periodoFat(ctrl_TxtFatura.getTextBoxValue());
                de.set_vr_mensalidade(ctrl_TxtTarif.getTextBoxValue_NumberStr());
                de.set_vr_cartaoAtivo(ctrl_TxtValCartAtv.getTextBoxValue_NumberStr());
                de.set_nu_pctValor(ctrl_TxtPctTrans.getTextBoxValue().PadLeft(1, '0'));
                de.set_vr_transacao(ctrl_TxtVrTrans.getTextBoxValue_NumberStr());
                de.set_vr_minimo(ctrl_TxtVrMin.getTextBoxValue_NumberStr());
                de.set_nu_franquia(ctrl_TxtFranqTrans.getTextBoxValue());
                de.set_nu_diaVenc(ctrl_TxtDiaVenc.getTextBoxValue());
                de.set_tg_tipoCobranca(i_Form.CboCob.SelectedIndex.ToString());
                de.set_nu_bancoFat(ctrl_TxtBancoCob.getTextBoxValue());
                de.set_nu_contaDeb(ctrl_TxtContaDeb.getTextBoxValue());
                de.set_st_obs(ctrl_TxtObs.getTextBoxValue());
                de.set_st_homepage(i_Form.txtHomepage.Text);

                if (i_Form.CheckIsento.Checked)
                {
                    de.set_tg_isento(Context.TRUE);
                }
                else
                {
                    de.set_tg_isento(Context.FALSE);
                }

                if (IsMaintenance)
                {
                    var_exchange.exec_alteraEmpresa(ref de, ref header);
                }
                else
                {
                    var_exchange.ins_empresa(ref de, ref header);
                    i_Form.Close();
                }

                //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 (IsMaintenance)
                        {
                            if (ctrl_TxtEmpresa.GetEnterPressed())
                            {
                                doEvent(event_BuscaDados, "Empresa");
                            }
                        }
                    }
                    else
                    {
                        i_Form.TxtEmpresa.BackColor     = colorInvalid;
                        ctrl_TxtEmpresa.IsUserValidated = false;

                        if (ctrl_TxtEmpresa.GetEnterPressed())
                        {
                            if (IsMaintenance)
                            {
                                doEvent(event_BuscaDados, "Empresa");
                            }
                        }
                    }

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

                    if (ctrl_TxtCNPJ.GetEnterPressed())
                    {
                        if (IsMaintenance)
                        {
                            doEvent(event_BuscaDados, "CNPJ");
                        }
                    }

                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtFantasia -

            case event_val_TxtFantasia:
            {
                //InitEventCode event_val_TxtFantasia

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

                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtSocial -

            case event_val_TxtSocial:
            {
                //InitEventCode event_val_TxtSocial

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

                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtEndereco -

            case event_val_TxtEndereco:
            {
                //InitEventCode event_val_TxtEndereco

                switch (arg as string)
                {
                case alphaTextController.ALPHA_COMPLETE:
                case alphaTextController.ALPHA_INCOMPLETE:
                {
                    if (ctrl_TxtEndereco.getTextBoxValue().Length > 8)
                    {
                        i_Form.TxtEndereco.BackColor     = Color.White;
                        ctrl_TxtEndereco.IsUserValidated = true;
                        ctrl_TxtEndereco.CleanError();
                    }
                    else
                    {
                        i_Form.TxtEndereco.BackColor     = colorInvalid;
                        ctrl_TxtEndereco.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;
                        ctrl_TxtCidade.CleanError();
                    }
                    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 == 2)
                    {
                        i_Form.TxtEstado.BackColor     = Color.White;
                        ctrl_TxtEstado.IsUserValidated = true;
                        ctrl_TxtEstado.CleanError();
                    }
                    else
                    {
                        i_Form.TxtEstado.BackColor     = colorInvalid;
                        ctrl_TxtEstado.IsUserValidated = false;
                    }

                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtCEP -

            case event_val_TxtCEP:
            {
                //InitEventCode event_val_TxtCEP

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

                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtTelefone -

            case event_val_TxtTelefone:
            {
                //InitEventCode event_val_TxtTelefone

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

                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtCartoes -

            case event_val_TxtCartoes:
            {
                //InitEventCode event_val_TxtCartoes

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

                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtFatura -

            case event_val_TxtFatura:
            {
                //InitEventCode event_val_TxtFatura

                switch (arg as string)
                {
                case numberTextController.NUMBER_INCOMPLETE:
                case numberTextController.NUMBER_COMPLETE:
                {
                    if (ctrl_TxtFatura.getTextBoxValue_Long() > 0 &&
                        ctrl_TxtFatura.getTextBoxValue_Long() < 29)
                    {
                        i_Form.TxtFatura.BackColor     = Color.White;
                        ctrl_TxtFatura.IsUserValidated = true;
                        ctrl_TxtFatura.CleanError();
                    }
                    else
                    {
                        i_Form.TxtFatura.BackColor     = colorInvalid;
                        ctrl_TxtFatura.IsUserValidated = false;
                    }

                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtDiaCredito -

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

                #endregion

                #region - event_val_TxtTaxa -

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

                #endregion

                #region - event_val_TxtDiasBloqueio -

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

                #endregion

                #region - event_val_TxtPontos -

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

                #endregion

                #region - event_val_TxtParcelas -

            case event_val_TxtParcelas:
            {
                //InitEventCode event_val_TxtParcelas

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

                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BuscaDados -

            case event_BuscaDados:
            {
                //InitEventCode event_BuscaDados

                if (par_code.Length > 0)
                {
                    ctrl_TxtEmpresa.SetTextBoxText(par_code);
                }
                else if (ctrl_TxtEmpresa.getTextBoxValue().Length == 0)
                {
                    return(false);
                }

                DadosEmpresa de = new DadosEmpresa();

                if (var_exchange.fetch_dadosEmpresa(ctrl_TxtEmpresa.getTextBoxValue(), ref header, ref de))
                {
                    ctrl_TxtEmpresa.SetTextBoxText(de.get_st_empresa());

                    ctrl_TxtCNPJ.SetTextBoxText(de.get_nu_CNPJ());
                    ctrl_TxtCNPJ.forceValidation();

                    ctrl_TxtFantasia.SetTextBoxText(de.get_st_fantasia());
                    ctrl_TxtSocial.SetTextBoxText(de.get_st_social());
                    ctrl_TxtEndereco.SetTextBoxText(de.get_st_endereco());
                    ctrl_TxtCidade.SetTextBoxText(de.get_st_cidade());
                    ctrl_TxtEstado.SetTextBoxText(de.get_st_estado());
                    ctrl_TxtCEP.SetTextBoxText(de.get_nu_CEP());
                    ctrl_TxtTelefone.SetTextBoxText(de.get_nu_telefone());
                    ctrl_TxtCartoes.SetTextBoxText(de.get_nu_cartoes());
                    ctrl_TxtParcelas.SetTextBoxText(de.get_nu_parcelas());
                    ctrl_TxtFatura.SetTextBoxText(de.get_nu_periodoFat());
                    ctrl_TxtContaDeb.SetTextBoxText(de.get_nu_contaDeb().PadLeft(1, '0'));
                    ctrl_TxtTarif.SetTextBoxString(de.get_vr_mensalidade());
                    ctrl_TxtValCartAtv.SetTextBoxString(de.get_vr_cartaoAtivo());
                    ctrl_TxtPctTrans.SetTextBoxText(de.get_nu_pctValor());
                    ctrl_TxtVrTrans.SetTextBoxString(de.get_vr_transacao());
                    ctrl_TxtVrMin.SetTextBoxString(de.get_vr_minimo());
                    ctrl_TxtFranqTrans.SetTextBoxText(de.get_nu_franquia());
                    ctrl_TxtDiaVenc.SetTextBoxText(de.get_nu_diaVenc());
                    ctrl_TxtBancoCob.SetTextBoxText(de.get_nu_bancoFat());
                    ctrl_TxtObs.SetTextBoxText(de.get_st_obs());
                    ctrl_TxtHomepage.SetTextBoxText(de.get_st_homepage());

                    if (de.get_tg_bloq() == Context.TRUE)
                    {
                        i_Form.LblBloq.Text       = "Bloqueada";
                        i_Form.BtnBloq.Visible    = false;
                        i_Form.BtnDesbloq.Visible = true;
                    }
                    else
                    {
                        i_Form.LblBloq.Text       = "Operacional";
                        i_Form.BtnBloq.Visible    = true;
                        i_Form.BtnDesbloq.Visible = false;
                    }

                    if (de.get_tg_tipoCobranca() != "")
                    {
                        i_Form.CboCob.SelectedIndex = Convert.ToInt32(de.get_tg_tipoCobranca());
                    }

                    if (de.get_tg_isento() == Context.TRUE)
                    {
                        i_Form.CheckIsento.Checked = true;
                    }
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtTarif -

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

                #endregion

                #region - event_val_TxtPctTrans -

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

                #endregion

                #region - event_val_TxtVrTrans -

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

                #endregion

                #region - event_val_TxtVrMin -

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

                #endregion

                #region - event_val_TxtFranqTrans -

            case event_val_TxtFranqTrans:
            {
                //InitEventCode event_val_TxtFranqTrans

                if (ctrl_TxtFranqTrans.getTextBoxValue().Length > 0)
                {
                    i_Form.TxtFranqTrans.BackColor     = Color.White;
                    ctrl_TxtFranqTrans.IsUserValidated = true;
                    ctrl_TxtFranqTrans.CleanError();
                }
                else
                {
                    i_Form.TxtFranqTrans.BackColor     = colorInvalid;
                    ctrl_TxtFranqTrans.IsUserValidated = false;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtBancoCob -

            case event_val_TxtBancoCob:
            {
                //InitEventCode event_val_TxtBancoCob

                if (ctrl_TxtBancoCob.getTextBoxValue().Length > 0)
                {
                    i_Form.TxtBancoCob.BackColor     = Color.White;
                    ctrl_TxtBancoCob.IsUserValidated = true;
                    ctrl_TxtBancoCob.CleanError();
                }
                else
                {
                    i_Form.TxtBancoCob.BackColor     = colorInvalid;
                    ctrl_TxtBancoCob.IsUserValidated = false;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtDiaVenc -

            case event_val_TxtDiaVenc:
            {
                //InitEventCode event_val_TxtDiaVenc

                long dia = ctrl_TxtDiaVenc.getTextBoxValue_Long();

                if (dia > 0 && dia < 29)
                {
                    i_Form.TxtDiaVenc.BackColor     = Color.White;
                    ctrl_TxtDiaVenc.IsUserValidated = true;
                    ctrl_TxtDiaVenc.CleanError();
                }
                else
                {
                    i_Form.TxtDiaVenc.BackColor     = colorInvalid;
                    ctrl_TxtDiaVenc.IsUserValidated = false;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtValCartAtv -

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

                #endregion

                #region - event_val_TxtContaDeb -

            case event_val_TxtContaDeb:
            {
                //InitEventCode event_val_TxtContaDeb

                if (ctrl_TxtContaDeb.getTextBoxValue().Length == 14)
                {
                    i_Form.TxtContaDeb.BackColor     = Color.White;
                    ctrl_TxtContaDeb.IsUserValidated = true;
                    ctrl_TxtContaDeb.CleanError();
                }
                else
                {
                    i_Form.TxtContaDeb.BackColor     = colorInvalid;
                    ctrl_TxtContaDeb.IsUserValidated = false;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtObs -

            case event_val_TxtObs:
            {
                //InitEventCode event_val_TxtObs

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

                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BtnConfirmarClick -

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

                #endregion

                #region - event_BtnBloqClick -

            case event_BtnBloqClick:
            {
                //InitEventCode event_BtnBloqClick

                var_exchange.exec_bloq_empresa(ctrl_TxtEmpresa.getTextBoxValue(), ref header);

                doEvent(event_BuscaDados, null);

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BtnDesbloqClick -

            case event_BtnDesbloqClick:
            {
                //InitEventCode event_BtnDesbloqClick

                var_exchange.exec_desbloq_empresa(ctrl_TxtEmpresa.getTextBoxValue(), ref header);

                doEvent(event_BuscaDados, null);

                //EndEventCode
                return(true);
            }

                #endregion

            default: break;
            }

            return(false);
        }
Пример #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_TxtEmpresa.AcquireTextBox(i_Form.TxtEmpresa, this, event_val_TxtEmpresa, 6);

                ctrl_TxtEmpresa.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_TxtEmpresa -

            case event_val_TxtEmpresa:
            {
                //InitEventCode event_val_TxtEmpresa

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

                    break;
                }

                default: break;
                }

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

                    ctrl_TxtEmpresa.SetTextBoxText(ctrl_TxtEmpresa.getTextBoxValue().PadLeft(6, '0'));
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Remover -

            case event_Remover:
            {
                //InitEventCode event_Remover

                if (i_Form.LstEmp.SelectedItem == null)
                {
                    return(false);
                }

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

                var_exchange.exec_alteraAdminEmpresa(ctrl_TxtEmpresa.getTextBoxValue(),
                                                     Context.TRUE,
                                                     i_Form.LstEmp.SelectedItem.ToString().Substring(0, 6),
                                                     ref header);

                doEvent(event_BuscaDados, null);

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Adicionar -

            case event_Adicionar:
            {
                //InitEventCode event_Adicionar

                if (i_Form.LstEmpDisp.SelectedItem == null)
                {
                    return(false);
                }

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

                var_exchange.exec_alteraAdminEmpresa(ctrl_TxtEmpresa.getTextBoxValue(),
                                                     Context.FALSE,
                                                     i_Form.LstEmpDisp.SelectedItem.ToString().Substring(0, 6),
                                                     ref header);

                doEvent(event_BuscaDados, null);

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BuscaDados -

            case event_BuscaDados:
            {
                //InitEventCode event_BuscaDados

                DadosEmpresa de = new DadosEmpresa();

                i_Form.LstEmp.Items.Clear();
                i_Form.LstEmpDisp.Items.Clear();

                if (var_exchange.fetch_dadosEmpresa(ctrl_TxtEmpresa.getTextBoxValue(),
                                                    ref header,
                                                    ref de))
                {
                    i_Form.TxtNome.Text = de.get_st_fantasia();

                    string st_csv_in  = "";
                    string st_csv_out = "";

                    if (var_exchange.fetch_dadosAdministradora(ctrl_TxtEmpresa.getTextBoxValue(),
                                                               ref header,
                                                               ref st_csv_in,
                                                               ref st_csv_out))
                    {
                        // obtem in
                        {
                            ArrayList full_memory = new ArrayList();

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

                                if (var_exchange.fetch_memory(st_csv_in, "400", ref st_csv_in, 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 dex = new DadosEmpresa(full_memory[t] as DataPortable);

                                i_Form.LstEmp.Items.Add(dex.get_st_empresa() + " - " + dex.get_st_fantasia());
                            }
                        }

                        // obtem out
                        {
                            ArrayList full_memory = new ArrayList();

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

                                if (var_exchange.fetch_memory(st_csv_out, "400", ref st_csv_out, 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 dex = new DadosEmpresa(full_memory[t] as DataPortable);

                                i_Form.LstEmpDisp.Items.Add(dex.get_st_empresa() + " - " + dex.get_st_fantasia());
                            }
                        }
                    }
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BtnRemoverClick -

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

                #endregion

                #region - event_BtnVincularClick -

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

                #endregion

            default: break;
            }

            return(false);
        }
Пример #10
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_TxtEmpresa.AcquireTextBox(i_Form.TxtEmpresa, this, event_val_TxtEmpresa, 6);
                ctrl_TxtFantasia.AcquireTextBox(i_Form.TxtFantasia, this, event_val_TxtFantasia, 40, alphaTextController.ENABLE_NUMBERS);
                ctrl_TxtTaxa.AcquireTextBox(i_Form.TxtTaxa, this, event_val_TxtTaxa, 4, 2);
                ctrl_TxtRepasse.AcquireTextBox(i_Form.TxtRepasse, this, event_val_TxtRepasse, 3);

                ctrl_TxtEmpresa.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);
                ctrl_TxtRepasse.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);

                ctrl_TxtBanco.AcquireTextBox(i_Form.TxtBanco, this, event_val_TxtBanco, 3);
                ctrl_TxtAg.AcquireTextBox(i_Form.TxtAg, this, event_val_TxtAg, 5, alphaTextController.ENABLE_NUMBERS);
                ctrl_TxtConta.AcquireTextBox(i_Form.TxtConta, this, event_val_TxtBanco, 11);

                ctrl_TxtBanco.SetTextBoxText("0");
                ctrl_TxtAg.SetTextBoxText("0");
                ctrl_TxtConta.SetTextBoxText("0");
                ctrl_TxtRepasse.SetTextBoxText("0");

                ctrl_TxtTaxa.IsUserValidated = 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)
                    {
                        if (i_Form.TxtEmpresa.Text.Length < 6)
                        {
                            i_Form.TxtEmpresa.BackColor     = colorInvalid;
                            ctrl_TxtEmpresa.IsUserValidated = false;
                        }
                        else
                        {
                            i_Form.TxtEmpresa.BackColor = Color.White;
                        }

                        ctrl_TxtEmpresa.IsUserValidated = true;
                        ctrl_TxtEmpresa.CleanError();

                        if (ctrl_TxtEmpresa.GetEnterPressed())
                        {
                            string st_nome    = "";
                            string st_empresa = ctrl_TxtEmpresa.getTextBoxValue().PadLeft(6, '0');

                            if (var_exchange.fetch_validaEmpresa(st_empresa,
                                                                 ref header,
                                                                 ref st_nome))
                            {
                                ctrl_TxtEmpresa.SetTextBoxText(st_empresa);
                                ctrl_TxtFantasia.SetTextBoxText(st_nome);

                                i_Form.TxtFantasia.BackColor     = Color.White;
                                i_Form.TxtEmpresa.BackColor      = Color.White;
                                ctrl_TxtFantasia.IsUserValidated = true;
                                ctrl_TxtEmpresa.IsUserValidated  = true;
                            }
                            else
                            {
                                i_Form.TxtEmpresa.BackColor      = colorInvalid;
                                i_Form.TxtFantasia.BackColor     = colorInvalid;
                                ctrl_TxtFantasia.IsUserValidated = false;
                                ctrl_TxtEmpresa.IsUserValidated  = false;
                            }
                        }
                    }
                    else
                    {
                        i_Form.TxtEmpresa.BackColor     = colorInvalid;
                        ctrl_TxtEmpresa.IsUserValidated = false;

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

                            ev_call.header = header;

                            ev_call.i_Form.ShowDialog();
                        }
                    }

                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtFantasia -

            case event_val_TxtFantasia:
            {
                //InitEventCode event_val_TxtFantasia

                switch (arg as string)
                {
                case alphaTextController.ALPHA_COMPLETE:
                case alphaTextController.ALPHA_INCOMPLETE:
                {
                    if (ctrl_TxtFantasia.getTextBoxValue().Length > 3)
                    {
                        ctrl_TxtFantasia.CleanError();

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

                            if (var_exchange.fetch_nomeEmpresa(ctrl_TxtFantasia.getTextBoxValue(),
                                                               ref header,
                                                               ref lst))
                            {
                                event_dlgSelecionaEmpresa ev_call = new event_dlgSelecionaEmpresa(var_util, var_exchange);

                                ev_call.header = header;
                                ev_call.lst    = lst;

                                ev_call.i_Form.ShowDialog();

                                if (ev_call.var_empresa != "" && ev_call.var_fantasia != "")
                                {
                                    ctrl_TxtEmpresa.SetTextBoxText(ev_call.var_empresa);
                                    ctrl_TxtFantasia.SetTextBoxText(ev_call.var_fantasia);

                                    i_Form.TxtFantasia.BackColor     = Color.White;
                                    i_Form.TxtEmpresa.BackColor      = Color.White;
                                    ctrl_TxtFantasia.IsUserValidated = true;
                                    ctrl_TxtEmpresa.IsUserValidated  = true;
                                }
                                else
                                {
                                    ctrl_TxtEmpresa.SetTextBoxText("");
                                    ctrl_TxtFantasia.SetTextBoxText("");

                                    i_Form.TxtEmpresa.BackColor      = colorInvalid;
                                    i_Form.TxtFantasia.BackColor     = colorInvalid;
                                    ctrl_TxtFantasia.IsUserValidated = false;
                                    ctrl_TxtEmpresa.IsUserValidated  = false;
                                }
                            }
                        }
                    }
                    else
                    {
                        i_Form.TxtFantasia.BackColor     = colorInvalid;
                        ctrl_TxtFantasia.IsUserValidated = false;
                    }

                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Adicionar -

            case event_Adicionar:
            {
                //InitEventCode event_Adicionar

                bool IsDone = true;

                if (!ctrl_TxtEmpresa.IsUserValidated)
                {
                    ctrl_TxtEmpresa.SetErrorMessage("O código da empresa deve ser informado");   IsDone = false;
                }
                if (!ctrl_TxtRepasse.IsUserValidated)
                {
                    ctrl_TxtRepasse.SetErrorMessage("O número de dias para repasse deve ser informado"); IsDone = false;
                }

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

                int max = i_Form.LstConvenios.Items.Count;

                for (int t = 0; t < max; ++t)
                {
                    if (i_Form.LstConvenios.Items[t].SubItems[0].Text == ctrl_TxtEmpresa.getTextBoxValue())
                    {
                        i_Form.LstConvenios.Items[t].SubItems [2].Text = ctrl_TxtTaxa.getTextBoxValue().PadLeft(4, '0').Insert(2, ",") + " %";
                        i_Form.LstConvenios.Items[t].SubItems [3].Text = ctrl_TxtRepasse.getTextBoxValue();
                        i_Form.LstConvenios.Items[t].SubItems [4].Text = i_Form.TxtBanco.Text;
                        i_Form.LstConvenios.Items[t].SubItems [5].Text = i_Form.TxtAg.Text;
                        i_Form.LstConvenios.Items[t].SubItems [6].Text = i_Form.TxtConta.Text;
                        return(false);
                    }
                }

                string [] full_row = new string [] { ctrl_TxtEmpresa.getTextBoxValue(),
                          ctrl_TxtFantasia.getTextBoxValue(),
                          ctrl_TxtTaxa.getTextBoxValue().PadLeft(4, '0').Insert(2, ",") + " %",
                                                     ctrl_TxtRepasse.getTextBoxValue(),
                                                     ctrl_TxtBanco.getTextBoxValue(),
                                                     ctrl_TxtAg.getTextBoxValue(),
                                                     ctrl_TxtConta.getTextBoxValue() };

                string emp = ctrl_TxtEmpresa.getTextBoxValue();

                i_Form.LstConvenios.Items.Add(var_util.GetListViewItem(emp, full_row));

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Remover -

            case event_Remover:
            {
                //InitEventCode event_Remover

                if (i_Form.LstConvenios.SelectedItems.Count > 0)
                {
                    string emp = i_Form.LstConvenios.SelectedItems[0].Text;

                    i_Form.LstConvenios.Items.Remove(i_Form.LstConvenios.SelectedItems[0]);
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Confirmar -

            case event_Confirmar:
            {
                //InitEventCode event_Confirmar

                int max = i_Form.LstConvenios.Items.Count;

                string st_csv_empresas     = "";
                string st_csv_taxas        = "";
                string st_csv_dias_repasse = "";

                string st_csv_banco_repasse = "";
                string st_csv_ag_repasse    = "";
                string st_csv_conta_repasse = "";

                for (int t = 0; t < max; ++t)
                {
                    string emp = i_Form.LstConvenios.Items[t].SubItems[0].Text;

                    st_csv_empresas     += emp;
                    st_csv_taxas        += i_Form.LstConvenios.Items[t].SubItems[2].Text.Replace(",", "").Replace(" %", "");
                    st_csv_dias_repasse += i_Form.LstConvenios.Items[t].SubItems[3].Text;

                    st_csv_banco_repasse += i_Form.LstConvenios.Items[t].SubItems[4].Text;
                    st_csv_ag_repasse    += i_Form.LstConvenios.Items[t].SubItems[5].Text;
                    st_csv_conta_repasse += i_Form.LstConvenios.Items[t].SubItems[6].Text;

                    if (t < max - 1)
                    {
                        st_csv_empresas      += ",";
                        st_csv_taxas         += ",";
                        st_csv_dias_repasse  += ",";
                        st_csv_banco_repasse += ",";
                        st_csv_ag_repasse    += ",";
                        st_csv_conta_repasse += ",";
                    }
                }

                DadosLoja dl = new DadosLoja();

                dl.set_nu_CNPJ(cnpj);

                var_exchange.exec_alteraLoja(st_csv_empresas,
                                             st_csv_taxas,
                                             st_csv_dias_repasse,
                                             st_csv_banco_repasse,
                                             st_csv_ag_repasse,
                                             st_csv_conta_repasse,
                                             ref dl,
                                             ref header);

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtTaxa -

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

                #endregion

                #region - event_val_TxtRepasse -

            case event_val_TxtRepasse:
            {
                //InitEventCode event_val_TxtRepasse

                if (i_Form.TxtRepasse.Text.Length == 0)
                {
                    i_Form.TxtRepasse.BackColor     = colorInvalid;
                    ctrl_TxtRepasse.IsUserValidated = false;
                }
                else
                {
                    i_Form.TxtRepasse.BackColor     = Color.White;
                    ctrl_TxtRepasse.IsUserValidated = true;
                    ctrl_TxtRepasse.CleanError();
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtCNPJ -

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

                #endregion

                #region - event_Convenio -

            case event_Convenio:
            {
                //InitEventCode event_Convenio

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

                int index = i_Form.LstConvenios.SelectedIndices[0];

                string emp   = i_Form.LstConvenios.Items [index].SubItems[0].Text;
                string ft    = i_Form.LstConvenios.Items [index].SubItems[1].Text;
                string tx    = i_Form.LstConvenios.Items [index].SubItems[2].Text;
                string rp    = i_Form.LstConvenios.Items [index].SubItems[3].Text;
                string banco = i_Form.LstConvenios.Items [index].SubItems[4].Text;
                string ag    = i_Form.LstConvenios.Items [index].SubItems[5].Text;
                string conta = i_Form.LstConvenios.Items [index].SubItems[6].Text;

                ctrl_TxtEmpresa.SetTextBoxText(emp);      i_Form.TxtEmpresa.BackColor  = Color.White;
                ctrl_TxtFantasia.SetTextBoxText(ft);      i_Form.TxtFantasia.BackColor = Color.White;
                ctrl_TxtTaxa.SetTextBoxText(tx);      i_Form.TxtTaxa.BackColor         = Color.White;
                ctrl_TxtRepasse.SetTextBoxText(rp);      i_Form.TxtRepasse.BackColor   = Color.White;

                ctrl_TxtBanco.SetTextBoxText(banco.PadLeft(1, '0'));
                ctrl_TxtAg.SetTextBoxText(ag.PadLeft(1, '0'));
                ctrl_TxtConta.SetTextBoxText(conta.PadLeft(1, '0'));

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtBanco -

            case event_val_TxtBanco:
            {
                //InitEventCode event_val_TxtBanco

                if (i_Form.TxtBanco.Text.Length == 0)
                {
                    i_Form.TxtBanco.BackColor     = colorInvalid;
                    ctrl_TxtBanco.IsUserValidated = false;
                }
                else
                {
                    i_Form.TxtBanco.BackColor     = Color.White;
                    ctrl_TxtBanco.IsUserValidated = true;
                    ctrl_TxtBanco.CleanError();
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtAg -

            case event_val_TxtAg:
            {
                //InitEventCode event_val_TxtAg

                if (ctrl_TxtAg.getTextBoxValue().Length == 0)
                {
                    i_Form.TxtAg.BackColor     = colorInvalid;
                    ctrl_TxtAg.IsUserValidated = false;
                }
                else
                {
                    i_Form.TxtAg.BackColor     = Color.White;
                    ctrl_TxtAg.IsUserValidated = true;
                    ctrl_TxtAg.CleanError();
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtConta -

            case event_val_TxtConta:
            {
                //InitEventCode event_val_TxtConta

                if (ctrl_TxtConta.getTextBoxValue_Long() == 0)
                {
                    i_Form.TxtConta.BackColor     = colorInvalid;
                    ctrl_TxtConta.IsUserValidated = false;
                }
                else
                {
                    i_Form.TxtConta.BackColor     = Color.White;
                    ctrl_TxtConta.IsUserValidated = true;
                    ctrl_TxtConta.CleanError();
                }

                //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 (i_Form.TxtLoja.Text.Length > 0)
                    {
                        i_Form.TxtLoja.BackColor     = Color.White;
                        ctrl_TxtLoja.IsUserValidated = true;
                        ctrl_TxtLoja.CleanError();

                        if (ctrl_TxtLoja.GetEnterPressed())
                        {
                            ArrayList list = new ArrayList();

                            var_exchange.fetch_listaConveniosLoja(ctrl_TxtLoja.getTextBoxValue(),
                                                                  ref header,
                                                                  ref cnpj,
                                                                  ref list);

                            i_Form.LstConvenios.Items.Clear();

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

                                string emp = de.get_st_empresa();

                                string [] full_row = new string [] { emp,
                                                                     de.get_st_fantasia(),
                                                                     de.get_tx_convenio().PadLeft(4, '0').Insert(2, ",") + " %",
                                                                     de.get_nu_dias_convenio(),
                                                                     de.get_st_banco(),
                                                                     de.get_st_ag(),
                                                                     de.get_st_conta() };

                                i_Form.LstConvenios.Items.Add(var_util.GetListViewItem(emp, full_row));
                            }
                        }
                    }
                    else
                    {
                        i_Form.TxtLoja.BackColor     = colorInvalid;
                        ctrl_TxtLoja.IsUserValidated = false;
                    }
                    break;
                }
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_LstConveniosClick -

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

                #region - event_BtnConfirmarClick -

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

                #endregion

            default: break;
            }

            return(false);
        }