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_TxtAluno.AcquireTextBox(i_Form.TxtAluno, this, event_val_TxtAluno, 26);

                //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
                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtCartao -

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

                #endregion

                #region - event_Cancelar -

            case event_Cancelar:
            {
                //InitEventCode event_Cancelar

                if (i_Form.LstAlunos.SelectedIndex == -1)
                {
                    return(false);
                }

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

                string cart = i_Form.LstAlunos.SelectedItem.ToString().Substring(0, 14);

                var_exchange.exec_edu_cancelaCartao(cart, ref header);

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtAluno -

            case event_val_TxtAluno:
            {
                //InitEventCode event_val_TxtAluno

                switch (arg as string)
                {
                case alphaTextController.ALPHA_COMPLETE:
                case alphaTextController.ALPHA_INCOMPLETE:
                {
                    if (ctrl_TxtAluno.getTextBoxValue().Length > 1)
                    {
                        i_Form.TxtAluno.BackColor     = Color.White;
                        ctrl_TxtAluno.IsUserValidated = true;
                        ctrl_TxtAluno.CleanError();

                        if (ctrl_TxtAluno.GetEnterPressed())
                        {
                            string st_csv = "";

                            var_exchange.fetch_edu_nomeAluno(ctrl_TxtAluno.getTextBoxValue(),
                                                             ref header,
                                                             ref st_csv);


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

                            i_Form.LstAlunos.Items.Clear();

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

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

                                i_Form.LstAlunos.Items.Add(aluno.get_st_cartao() + " " + aluno.get_st_aluno());
                            }
                        }
                    }
                    else
                    {
                        i_Form.TxtAluno.BackColor     = colorInvalid;
                        ctrl_TxtAluno.IsUserValidated = false;
                    }

                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BtnCancelarClick -

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

                #endregion

            default: break;
            }

            return(false);
        }
Esempio n. 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            GetConnection();

            LblMsg1.Visible = false;
            LblMsg2.Visible = false;
            LblMsg3.Visible = false;
            LblMsg4.Visible = false;
            LblMsg5.Visible = false;

            LblTit1.Visible = false;
            LblTit2.Visible = false;
            LblTit3.Visible = false;
            LblTit4.Visible = false;
            LblTit5.Visible = false;

            ArrayList lst    = new ArrayList();
            ArrayList lstMsg = new ArrayList();

            try
            {
                string st_nomeResp = "";

                if (var_exchange.web_fetch_resp_alunos(Session["st_cpf"].ToString(),
                                                       Session["st_senha"].ToString(),
                                                       ref st_nomeResp,
                                                       ref lst,
                                                       ref lstMsg))
                {
                    LblResp.Text = st_nomeResp;

                    Session["st_nomeResp"] = st_nomeResp;

                    ArrayList values = new ArrayList();

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

                        PositionData_RespAlunos bind = new PositionData_RespAlunos();

                        bind.cartao = dce.get_st_cartao();
                        bind.nome   = dce.get_st_aluno();
                        bind.saldo  = "R$ " + new money().formatToMoney(dce.get_vr_disp());

                        values.Add(bind);

                        GridAlunos.DataSource = values;
                        GridAlunos.DataBind();
                    }

                    for (int t = 0; t < lstMsg.Count; ++t)
                    {
                        if (t >= 5)
                        {
                            break;
                        }

                        DadosEduMessage dem = new DadosEduMessage(lstMsg[t] as DataPortable);

                        string st_text = dem.get_st_msg();

                        while (st_text.Contains(" www."))
                        {
                            int index    = st_text.IndexOf(" www.");
                            int indexFim = st_text.IndexOf(" ", index + 1);

                            string teste = st_text.Substring(index + 1, indexFim - index - 1);

                            st_text = st_text.Replace(teste, "<a href=\"http://" + teste + "\">" + teste + "</a>");
                        }

                        switch (t)
                        {
                        case 0:
                        {
                            LblTit1.Text = dem.get_st_title();
                            LblMsg1.Text = st_text;

                            LblMsg1.Visible = true;
                            LblTit1.Visible = true;
                            break;
                        }

                        case 1:
                        {
                            LblTit2.Text = dem.get_st_title();
                            LblMsg2.Text = st_text;

                            LblMsg2.Visible = true;
                            LblTit2.Visible = true;
                            break;
                        }

                        case 2:
                        {
                            LblTit3.Text = dem.get_st_title();
                            LblMsg3.Text = st_text;

                            LblMsg3.Visible = true;
                            LblTit3.Visible = true;
                            break;
                        }

                        case 3:
                        {
                            LblTit4.Text = dem.get_st_title();
                            LblMsg4.Text = st_text;

                            LblMsg4.Visible = true;
                            LblTit4.Visible = true;
                            break;
                        }

                        case 4:
                        {
                            LblTit5.Text = dem.get_st_title();
                            LblMsg5.Text = st_text;

                            LblMsg5.Visible = true;
                            LblTit5.Visible = true;
                            break;
                        }

                        default: break;
                        }
                    }
                }

                var_exchange.m_Client.ExitSession();
            }
            catch (System.Exception se)
            {
                if (se.Message == "Exit")
                {
                    Session["st_error"]      = "Esgotado tempo de espera no servidor";
                    Session["st_error_dest"] = "default.aspx";
                    Response.Redirect("error.aspx", true);
                }
            }
        }
    }