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 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); }
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_TxtTelefone.AcquireTextBox(i_Form.TxtTelefone, this, event_val_TxtTelefone, 10); ctrl_TxtCartao.AcquireTextBox(i_Form.TxtCartao, this, event_val_TxtCartao, 14); ctrl_TxtCodLoja.AcquireTextBox(i_Form.TxtCodLoja, this, event_val_TxtCodLoja, 8); ctrl_TxtNSU.AcquireTextBox(i_Form.TxtNSU, this, event_val_TxtNSU, 6); ctrl_TxtCodEmpresa.AcquireTextBox(i_Form.TxtCodEmpresa, this, event_val_TxtCNPJEmpresa, 12); ctrl_TxtCNPJLoja.AcquireTextBox(i_Form.TxtCNPJLoja, this, event_val_TxtCNPJLoja); ctrl_TxtTerminal.AcquireTextBox(i_Form.TxtTerminal, this, event_val_TxtTerminal, 8); ctrl_TxtValor.AcquireTextBox(i_Form.TxtValor, this, event_val_TxtValor, "R$", 9); ctrl_TxtParcelas.AcquireTextBox(i_Form.TxtParcelas, this, event_val_TxtParcelas, 2); ctrl_TxtDataIni.AcquireTextBox(i_Form.TxtDataIni, this, event_val_TxtDataIni, dateTextController.FORMAT_DDMMYYYY); ctrl_TxtDataFim.AcquireTextBox(i_Form.TxtDataFim, this, event_val_TxtDataFim, dateTextController.FORMAT_DDMMYYYY); ctrl_TxtDataIni.SetTextBoxText(DateTime.Now.Day.ToString().PadLeft(2, '0') + DateTime.Now.Month.ToString().PadLeft(2, '0') + DateTime.Now.Year.ToString().PadLeft(2, '0')); ctrl_TxtDataFim.SetTextBoxText(DateTime.Now.Day.ToString().PadLeft(2, '0') + DateTime.Now.Month.ToString().PadLeft(2, '0') + DateTime.Now.Year.ToString().PadLeft(2, '0')); i_Form.CboOper.Items.Clear(); i_Form.CboOper.Items.Add("(Todas)"); i_Form.CboOper.Items.AddRange(new OperacaoCartaoDesc().GetArray().ToArray()); i_Form.CboOper.SelectedIndex = 0; if (header.get_tg_user_type() == TipoUsuario.Administrador) { i_Form.TxtCodEmpresa.Text = header.get_st_empresa(); i_Form.TxtCodEmpresa.ReadOnly = true; } i_Form.CboStat.Items.Clear(); i_Form.CboStat.Items.Add("(Todos)"); i_Form.CboStat.Items.AddRange(new TipoConfirmacaoDesc().GetArray().ToArray()); i_Form.CboStat.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_val_TxtNSU - case event_val_TxtNSU: { //InitEventCode event_val_TxtNSU switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (ctrl_TxtNSU.getTextBoxValue().Length > 0) { i_Form.TxtNSU.BackColor = Color.White; ctrl_TxtNSU.IsUserValidated = true; } else { i_Form.TxtNSU.BackColor = colorInvalid; ctrl_TxtNSU.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtCNPJEmpresa - case event_val_TxtCNPJEmpresa: { //InitEventCode event_val_TxtCNPJEmpresa //EndEventCode return(true); } #endregion #region - event_val_TxtCNPJLoja - case event_val_TxtCNPJLoja: { //InitEventCode event_val_TxtCNPJLoja switch (arg as string) { case cnpjTextController.CNPJ_INCOMPLETE: case cnpjTextController.CNPJ_INVALID: { i_Form.TxtCNPJLoja.BackColor = colorInvalid; ctrl_TxtCNPJLoja.IsUserValidated = false; break; } case cnpjTextController.CNPJ_VALID: { i_Form.TxtCNPJLoja.BackColor = Color.White; ctrl_TxtCNPJLoja.IsUserValidated = true; ctrl_TxtCNPJLoja.CleanError(); break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtTerminal - case event_val_TxtTerminal: { //InitEventCode event_val_TxtTerminal switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (ctrl_TxtTerminal.getTextBoxValue().Length > 0) { i_Form.TxtTerminal.BackColor = Color.White; ctrl_TxtTerminal.IsUserValidated = true; } else { i_Form.TxtTerminal.BackColor = colorInvalid; ctrl_TxtTerminal.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtValor - case event_val_TxtValor: { //InitEventCode event_val_TxtValor if (arg as string == moneyTextController.MONEY_ZERO) { i_Form.TxtValor.BackColor = colorInvalid; ctrl_TxtValor.IsUserValidated = false; } else { i_Form.TxtValor.BackColor = Color.White; ctrl_TxtValor.IsUserValidated = true; } //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().Length > 0) { i_Form.TxtParcelas.BackColor = Color.White; ctrl_TxtParcelas.IsUserValidated = true; } else { i_Form.TxtParcelas.BackColor = colorInvalid; ctrl_TxtParcelas.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_Confirmar - case event_Confirmar: { //InitEventCode event_Confirmar i_Form.BtnConsultar.Enabled = false; DadosConsultaTransacao dct = new DadosConsultaTransacao(); dct.set_st_nsu(ctrl_TxtNSU.getTextBoxValue()); dct.set_st_cod_empresa(ctrl_TxtCodEmpresa.getTextBoxValue()); dct.set_st_cnpj_loja(ctrl_TxtCNPJLoja.getTextBoxValue()); dct.set_st_cod_loja(ctrl_TxtCodLoja.getTextBoxValue()); dct.set_st_terminal(ctrl_TxtTerminal.getTextBoxValue()); dct.set_tg_status((i_Form.CboStat.SelectedIndex - 1).ToString()); if (ctrl_TxtTelefone.IsUserValidated) { dct.set_st_telefone(ctrl_TxtTelefone.getTextBoxValue()); } if (ctrl_TxtCartao.IsUserValidated) { dct.set_st_cartao(ctrl_TxtCartao.getTextBoxValue()); } if (ctrl_TxtDataIni.IsUserValidated) { dct.set_dt_ini(var_util.GetDataBaseTimeFormat(ctrl_TxtDataIni.getTextBoxValue_Date())); } if (ctrl_TxtDataFim.IsUserValidated) { dct.set_dt_fim(var_util.GetDataBaseTimeFormat(ctrl_TxtDataFim.getTextBoxValue_Date().AddHours(23).AddMinutes(59).AddSeconds(59))); } if (ctrl_TxtValor.IsUserValidated) { dct.set_vr_valor(ctrl_TxtValor.getTextBoxValue_NumberStr()); } if (ctrl_TxtParcelas.IsUserValidated) { dct.set_nu_parcelas(ctrl_TxtParcelas.getTextBoxValue()); } if (i_Form.CboOper.SelectedIndex > 0) { dct.set_en_oper((i_Form.CboOper.SelectedIndex - 1).ToString()); } string st_csv_id = ""; i_Form.LstTrans.Items.Clear(); Application.DoEvents(); ArrayList desc = new OperacaoCartaoDesc().GetArray(); ArrayList desc_status = new TipoConfirmacaoDesc().GetArray(); i_Form.Cursor = Cursors.WaitCursor; if (var_exchange.fetch_consultaTransacao(ref dct, 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) { DadosConsultaTransacao dt = new DadosConsultaTransacao(full_memory[t] as DataPortable); try { int index = Convert.ToInt32(dt.get_en_oper()); string [] full_row = new string [] { dt.get_st_nsu().PadLeft(6, '0'), dt.get_st_cartao(), dt.get_st_cnpj_loja(), dt.get_st_terminal().PadLeft(8, '0'), "R$ " + new money().formatToMoney(dt.get_vr_valor()), dt.get_nu_parcelas(), dt.get_dt_transacao(), desc [index].ToString(), desc_status [Convert.ToInt32(dt.get_tg_status())].ToString(), dt.get_st_msg_erro() }; i_Form.LstTrans.Items.Add(var_util.GetListViewItem(dt.get_st_nsu(), full_row)); } catch (System.Exception ex) { ex.ToString(); MessageBox.Show(dt.get_st_nsu() + " - " + dt.get_st_cnpj_loja()); } } Application.DoEvents(); } i_Form.BtnConsultar.Enabled = true; i_Form.Cursor = Cursors.Default; //EndEventCode return(true); } #endregion #region - event_val_TxtDataIni - case event_val_TxtDataIni: { //InitEventCode event_val_TxtDataIni switch (arg as string) { case dateTextController.DATE_INVALID: { i_Form.TxtDataIni.BackColor = colorInvalid; ctrl_TxtDataIni.IsUserValidated = false; break; } case dateTextController.DATE_VALID: { i_Form.TxtDataIni.BackColor = Color.White; ctrl_TxtDataIni.IsUserValidated = true; break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtDataFim - case event_val_TxtDataFim: { //InitEventCode event_val_TxtDataFim switch (arg as string) { case dateTextController.DATE_INVALID: { i_Form.TxtDataFim.BackColor = colorInvalid; ctrl_TxtDataFim.IsUserValidated = false; break; } case dateTextController.DATE_VALID: { i_Form.TxtDataFim.BackColor = Color.White; ctrl_TxtDataFim.IsUserValidated = true; break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtCartao - case event_val_TxtCartao: { //InitEventCode event_val_TxtCartao switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (ctrl_TxtCartao.getTextBoxValue().Length > 0) { i_Form.TxtCartao.BackColor = Color.White; ctrl_TxtCartao.IsUserValidated = true; } else { i_Form.TxtCartao.BackColor = colorInvalid; ctrl_TxtCartao.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_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_TxtCodEmpresa - case event_val_TxtCodEmpresa: { //InitEventCode event_val_TxtCodEmpresa switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (ctrl_TxtCodEmpresa.getTextBoxValue().Length > 0) { i_Form.TxtCodEmpresa.BackColor = Color.White; ctrl_TxtCodEmpresa.IsUserValidated = true; } else { i_Form.TxtCodEmpresa.BackColor = colorInvalid; ctrl_TxtCodEmpresa.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtCodLoja - case event_val_TxtCodLoja: { //InitEventCode event_val_TxtCodLoja switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (ctrl_TxtCodLoja.getTextBoxValue().Length > 0) { i_Form.TxtCodLoja.BackColor = Color.White; ctrl_TxtCodLoja.IsUserValidated = true; } else { i_Form.TxtCodLoja.BackColor = colorInvalid; ctrl_TxtCodLoja.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_BtnConsultarClick - case event_BtnConsultarClick: { //InitEventCode event_BtnConsultarClick //EndEventCode return(true); } #endregion default: break; } return(false); }
protected void LnkHist_Click(object sender, EventArgs e) { GetConnection(); try { string st_csv = ""; if (!var_exchange.web_fetch_edu_emp_hist(Session["st_cartao"].ToString(), Session["st_senha"].ToString(), TxtCodEmpresa.Text, ref st_csv)) { var_exchange.m_Client.ExitSession(); Session["st_error"] = var_exchange.m_Client.GetServerMessage(); Session["st_error_dest"] = "VirtualEducard.aspx"; Response.Redirect("error.aspx", true); return; } ArrayList values = new ArrayList(); //string var_tmp_listCSV = ""; var_util.clearPortable(); var_util.indexCSV(st_csv); // var_util.setBatchAmount(var_util.max_pack / 250); ArrayList desc = new TipoConfirmacaoDesc().GetArray(); ArrayList desc_op = new OperacaoCartaoDesc().GetArray(); // while (var_util.nextBatch(ref var_tmp_listCSV) == true) { ArrayList list = new ArrayList(); /* * if (var_exchange.fetch_memory(var_tmp_listCSV, ref list)) * { * for (int t = 0; t < list.Count; ++t) * { * DadosMovEmpresaVirtual mov = new DadosMovEmpresaVirtual(list[t] as DataPortable); * PositionData_RendEmpresa bind = new PositionData_RendEmpresa(); * * bind.data = var_util.getDDMMYYYY_format(mov.get_dt_dia()).Substring(0, 10); * bind.nome = mov.get_st_nome(); * bind.rend = mov.get_vr_osc(); * * bool neg = false; * * if (bind.rend.IndexOf("-") >= 0) * neg = true; * * bind.rend = bind.rend.Replace("-", ""); * bind.rend = bind.rend.PadLeft(4, '0'); * * int len = bind.rend.Length; * * if (len == 4) * bind.rend = "0," + bind.rend; * else * bind.rend = bind.rend.Insert(len - 4, ","); * * if (neg) bind.rend = "-" + bind.rend; * * bind.rend += "%"; * * if (bind.rend == "0,0000%") bind.rend = "-"; * * values.Add(bind); * } * } * */ } RptHist.DataSource = values; RptHist.DataBind(); if (values.Count > 0) { RptHist.Visible = true; } 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); } } }
protected void BtnConfirmar(object sender, EventArgs e) { GetConnection(); money money_helper = new money(); try { DateTime t_start = (DateTime)DtIni.SelectedDate; DateTime t_end = (DateTime)DtFim.SelectedDate; t_start = new DateTime(t_start.Year, t_start.Month, t_start.Day); string st_csv = ""; string st_total_periodo = ""; GetConnection(); if (!var_exchange.web_fetch_rel_edu_extrato(Session["st_cartao"].ToString(), var_util.DESCript(TxtSenha.Value.PadLeft(8, '*'), "12345678"), var_util.GetDataBaseTimeFormat((DateTime)t_start), var_util.GetDataBaseTimeFormat((DateTime)t_end.AddHours(23).AddMinutes(59).AddSeconds(59)), SyCrafEngine.Context.TRUE, ref st_csv, ref st_total_periodo)) { var_exchange.m_Client.ExitSession(); Session["st_error"] = var_exchange.m_Client.GetServerMessage(); Session["st_error_dest"] = "RespExt.aspx"; Response.Redirect("error.aspx", true); return; } RptExtrato.Visible = true; LblExtrato.Visible = true; LblExtrato.Text = "Extrato de atividades do cartão: " + DtIni.SelectedDate.ToShortDateString() + " até " + DtFim.SelectedDate.ToShortDateString(); ArrayList values = new ArrayList(); ArrayList desc = new TipoConfirmacaoDesc().GetArray(); ArrayList desc_op = new OperacaoCartaoDesc().GetArray(); while (st_csv != "") { ArrayList list = new ArrayList(); var_exchange.fetch_memory(st_csv, "400", ref st_csv, ref list); for (int t = 0; t < list.Count; ++t) { EduExtrato rel_line = new EduExtrato(list[t] as DataPortable); PositionData_ExtratoEdu bind = new PositionData_ExtratoEdu(); bind.nsu = rel_line.get_st_nsu(); bind.data = var_util.getDDMMYYYY_format(rel_line.get_dt_trans()); bind.valor = money_helper.formatToMoney(rel_line.get_vr_valor()); bind.loja = rel_line.get_st_loja(); bind.saldo = money_helper.formatToMoney(rel_line.get_vr_disp()); bind.fundo = money_helper.formatToMoney(rel_line.get_vr_fundo()); bind.operacao = desc_op[Convert.ToInt32(rel_line.get_en_oper())].ToString(); values.Add(bind); } } RptExtrato.DataSource = values; RptExtrato.DataBind(); 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); } } }
public override bool doEvent(int event_number, object arg) { switch (event_number) { #region - event_Load - case event_Load: { //InitEventCode event_Load #if ROBOT var_util.execDefinedRobot(this, var_alias); #else doEvent(event_Translate, null); doEvent(event_FormIsOpening, null); #endif //EndEventCode return(true); } #endregion #region - event_Translate - case event_Translate: { //InitEventCode event_Translate //EndEventCode return(true); } #endregion #region - event_FormIsOpening - case event_FormIsOpening: { //InitEventCode event_FormIsOpening ctrl_TxtEmpresa.AcquireTextBox(i_Form.TxtEmpresa, this, event_val_TxtEmpresa, 6); ctrl_TxtCartao.AcquireTextBox(i_Form.TxtCartao, this, event_val_TxtCartao, 6); ctrl_TxtDiario.AcquireTextBox(i_Form.TxtDiario, this, event_val_TxtDiario, "R$", 8); ctrl_TxtMensal.AcquireTextBox(i_Form.TxtMensal, this, event_val_TxtMensal, "R$", 8); ctrl_TxtEdu.AcquireTextBox(i_Form.TxtEdu, this, event_val_TxtEdu, "R$", 8); ctrl_TxtExtra.AcquireTextBox(i_Form.TxtExtra, this, event_val_TxtExtra, "R$", 8); ctrl_TxtDin.AcquireTextBox(i_Form.TxtDin, this, event_val_TxtDin, "R$", 8); ctrl_TxtCartao.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtDiario.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtMensal.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtEdu.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtExtra.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtDin.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtCartao.IsUserValidated = false; ctrl_TxtDtIni.AcquireTextBox(i_Form.TxtDtIni, this, event_val_TxtDtIni, dateTextController.FORMAT_DDMMYYYY); ctrl_TxtDtFim.AcquireTextBox(i_Form.TxtDtFim, this, event_val_TxtDtFim, dateTextController.FORMAT_DDMMYYYY); ctrl_TxtDtIni.SetTextBoxText(DateTime.Now.AddDays(-7).Day.ToString().PadLeft(2, '0') + DateTime.Now.AddDays(-7).Month.ToString().PadLeft(2, '0') + DateTime.Now.AddDays(-7).Year.ToString().PadLeft(2, '0')); ctrl_TxtDtFim.SetTextBoxText(DateTime.Now.Day.ToString().PadLeft(2, '0') + DateTime.Now.Month.ToString().PadLeft(2, '0') + DateTime.Now.Year.ToString().PadLeft(2, '0')); if (header.get_tg_user_type() != TipoUsuario.SuperUser && header.get_tg_user_type() == TipoUsuario.OperadorEdu) { i_Form.TxtEmpresa.Text = header.get_st_empresa(); i_Form.TxtEmpresa.ReadOnly = true; } //EndEventCode return(true); } #endregion #region - robot_ShowDialog - case robot_ShowDialog: { //InitEventCode robot_ShowDialog //EndEventCode return(true); } #endregion #region - robot_CloseDialog - case robot_CloseDialog: { //InitEventCode robot_CloseDialog //EndEventCode return(true); } #endregion #region - event_Definir - case event_Definir: { //InitEventCode event_Definir if (!ctrl_TxtCartao.IsUserValidated) { return(false); } dlgAutorizacao autor = new dlgAutorizacao(); autor.ShowDialog(); Application.DoEvents(); if (autor.IsConfirmed) { var_exchange.exec_edu_alteraDiario(var_util.getMd5Hash(autor.senha), ctrl_TxtDiario.getTextBoxValue_NumberStr(), ctrl_TxtEmpresa.getTextBoxValue() + ctrl_TxtCartao.getTextBoxValue() + "01", ref header); } doEvent(event_BuscaDados, null); //EndEventCode return(true); } #endregion #region - event_Pagamento - case event_Pagamento: { //InitEventCode event_Pagamento if (!ctrl_TxtCartao.IsUserValidated) { return(false); } dlgAutorizacao autor = new dlgAutorizacao(); autor.ShowDialog(); Application.DoEvents(); if (autor.IsConfirmed) { var_exchange.exec_depotEduImediato(var_util.getMd5Hash(autor.senha), ctrl_TxtEdu.getTextBoxValue_NumberStr(), ctrl_TxtExtra.getTextBoxValue_NumberStr(), ctrl_TxtEmpresa.getTextBoxValue(), ctrl_TxtCartao.getTextBoxValue(), ref header); } doEvent(event_BuscaDados, null); //EndEventCode return(true); } #endregion #region - event_Vis - case event_Vis: { //InitEventCode event_Vis // ############################## // # SETUP LISTS ################ // ############################## ArrayList lstHeader = new ArrayList(); ArrayList lstContent = new ArrayList(); ArrayList lstTableSizes = new ArrayList(); ArrayList lstFooter = new ArrayList(); ArrayList lstMessages = new ArrayList(); ArrayList lstFilters = new ArrayList(); ArrayList lstFooterSub1 = new ArrayList(); ArrayList lstHeaderSub1 = new ArrayList(); ArrayList lstContentSub1 = new ArrayList(); lstHeader.Add(lstHeaderSub1); lstFooter.Add(lstFooterSub1); lstContent.Add(lstContentSub1); // ############################## // # CUSTOMIZE // ############################## string st_csv = ""; string st_empresa = ""; string st_total_periodo = ""; if (!var_exchange.fetch_rel_edu_extrato(var_util.GetDataBaseTimeFormat(ctrl_TxtDtIni.getTextBoxValue_Date()), var_util.GetDataBaseTimeFormat(ctrl_TxtDtFim.getTextBoxValue_Date().AddDays(1)), ctrl_TxtEmpresa.getTextBoxValue(), ctrl_TxtCartao.getTextBoxValue(), ref header, ref st_csv, ref st_empresa, ref st_total_periodo)) { return(false); } lstMessages.Add("Extrato do aluno: " + i_Form.TxtAluno.Text); lstTableSizes.Add(950); lstHeaderSub1.Add("NSU"); lstHeaderSub1.Add("Data"); lstHeaderSub1.Add("Valor R$"); lstHeaderSub1.Add("Loja"); lstHeaderSub1.Add("Saldo R$"); lstHeaderSub1.Add("Fundo R$"); lstHeaderSub1.Add("Operação"); money money_helper = new money(); ArrayList full_memory = new ArrayList(); while (st_csv != "") { ArrayList tmp_memory = new ArrayList(); if (var_exchange.fetch_memory(st_csv, "400", ref st_csv, ref tmp_memory)) { for (int t = 0; t < tmp_memory.Count; ++t) { full_memory.Add(tmp_memory[t]); } } } ArrayList desc = new TipoConfirmacaoDesc().GetArray(); ArrayList desc_op = new OperacaoCartaoDesc().GetArray(); for (int t = 0; t < full_memory.Count; ++t) { EduExtrato rel_line = new EduExtrato(full_memory[t] as DataPortable); ArrayList lstLine1 = new ArrayList(); lstLine1.Add(rel_line.get_st_nsu()); lstLine1.Add(var_util.getDDMMYYYY_format(rel_line.get_dt_trans())); lstLine1.Add(money_helper.formatToMoney(rel_line.get_vr_valor())); lstLine1.Add(rel_line.get_st_loja()); lstLine1.Add(money_helper.formatToMoney(rel_line.get_vr_disp())); lstLine1.Add(money_helper.formatToMoney(rel_line.get_vr_fundo())); if (rel_line.get_en_oper() == OperacaoCartao.VENDA_EMPRESARIAL) { lstLine1.Add("Utilização do cartão"); } else { lstLine1.Add(desc_op [Convert.ToInt32(rel_line.get_en_oper())].ToString()); } lstContentSub1.Add(lstLine1); } SyCrafReport rel = new SyCrafReport("Extrado de Transações por cartão", "ETC", st_empresa, ctrl_TxtDtIni.getTextBoxValue(), ctrl_TxtDtFim.getTextBoxValue(), ref lstHeader, ref lstContent, ref lstTableSizes, ref lstFooter, ref lstMessages, ref lstFilters); //EndEventCode return(true); } #endregion #region - event_val_TxtCartao - case event_val_TxtCartao: { //InitEventCode event_val_TxtCartao switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (i_Form.TxtCartao.Text.Length == 6) { i_Form.TxtCartao.BackColor = Color.White; ctrl_TxtCartao.IsUserValidated = true; ctrl_TxtCartao.CleanError(); } else { i_Form.TxtCartao.BackColor = colorInvalid; ctrl_TxtCartao.IsUserValidated = false; } break; } default: break; } if (ctrl_TxtCartao.IsUserValidated) { if (ctrl_TxtCartao.GetEnterPressed()) { doEvent(event_BuscaDados, null); } } //EndEventCode return(true); } #endregion #region - event_val_TxtDiario - case event_val_TxtDiario: { //InitEventCode event_val_TxtDiario //EndEventCode return(true); } #endregion #region - event_val_TxtMensal - case event_val_TxtMensal: { //InitEventCode event_val_TxtMensal if (!ctrl_TxtCartao.IsUserValidated) { return(false); } long val = ctrl_TxtMensal.getTextBoxValue_Long(); if (val > 0) { ctrl_TxtDiario.SetTextBoxLong(val / 31); } //EndEventCode return(true); } #endregion #region - event_val_TxtEdu - case event_val_TxtEdu: { //InitEventCode event_val_TxtEdu if (!ctrl_TxtCartao.IsUserValidated) { return(false); } long val = ctrl_TxtEdu.getTextBoxValue_Long() + ctrl_TxtExtra.getTextBoxValue_Long(); ctrl_TxtDin.SetTextBoxLong(val); //EndEventCode return(true); } #endregion #region - event_val_TxtExtra - case event_val_TxtExtra: { //InitEventCode event_val_TxtExtra if (!ctrl_TxtCartao.IsUserValidated) { return(false); } long val = ctrl_TxtEdu.getTextBoxValue_Long() + ctrl_TxtExtra.getTextBoxValue_Long(); ctrl_TxtDin.SetTextBoxLong(val); //EndEventCode return(true); } #endregion #region - event_val_TxtDoc - case event_val_TxtDoc: { //InitEventCode event_val_TxtDoc /*if ( !ctrl_TxtCartao.IsUserValidated ) * return false; * * if ( ctrl_TxtDoc.getTextBoxValue_Long() > 0 ) * { * long diario = ctrl_TxtDoc.getTextBoxValue_Long() / 31; * * i_Form.rb1.Text = "Em Fundo Educacional, definindo R$ " + * new money().formatToMoney ( diario.ToString() ) + * " diário"; * } */ //EndEventCode return(true); } #endregion #region - event_BuscaDados - case event_BuscaDados: { //InitEventCode event_BuscaDados if (!ctrl_TxtEmpresa.IsUserValidated || !ctrl_TxtCartao.IsUserValidated) { return(false); } DadosCartaoEdu dce = new DadosCartaoEdu(); if (var_exchange.fetch_dadosAluno(ctrl_TxtEmpresa.getTextBoxValue() + ctrl_TxtCartao.getTextBoxValue() + "01", ref header, ref dce)) { i_Form.TxtAluno.Text = dce.get_st_aluno(); ctrl_TxtDiario.SetTextBoxString(dce.get_vr_diario().PadLeft(6, '0')); int diario = Convert.ToInt32(dce.get_vr_diario()); int calc_mes = diario * 31; i_Form.TxtMensal.Text = "R$ " + new money().formatToMoney(calc_mes.ToString()); i_Form.TxtVrDisp.Text = "R$ " + new money().formatToMoney(dce.get_vr_disp()); i_Form.TxtVrDispDiario.Text = "R$ " + new money().formatToMoney(diario.ToString()); i_Form.TxtVrDispMensal.Text = "R$ " + new money().formatToMoney(calc_mes.ToString()); i_Form.TxtSaldoTotal.Text = "R$ " + new money().formatToMoney(dce.get_vr_depot()); DateTime tim = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(1); long dias = tim.Subtract(DateTime.Now).Days; long prev_mes = dias * diario; i_Form.TxtVrSaldoMes.Text = "R$ " + new money().formatToMoney(prev_mes.ToString()); } //EndEventCode return(true); } #endregion #region - event_val_TxtDin - case event_val_TxtDin: { //InitEventCode event_val_TxtDin //EndEventCode return(true); } #endregion #region - event_val_TxtDtIni - case event_val_TxtDtIni: { //InitEventCode event_val_TxtDtIni switch (arg as string) { case dateTextController.DATE_INVALID: { i_Form.TxtDtIni.BackColor = colorInvalid; ctrl_TxtDtIni.IsUserValidated = false; break; } case dateTextController.DATE_VALID: { i_Form.TxtDtIni.BackColor = Color.White; ctrl_TxtDtIni.IsUserValidated = true; ctrl_TxtDtIni.CleanError(); break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtDtFim - case event_val_TxtDtFim: { //InitEventCode event_val_TxtDtFim switch (arg as string) { case dateTextController.DATE_INVALID: { i_Form.TxtDtFim.BackColor = colorInvalid; ctrl_TxtDtFim.IsUserValidated = false; break; } case dateTextController.DATE_VALID: { i_Form.TxtDtFim.BackColor = Color.White; ctrl_TxtDtFim.IsUserValidated = true; ctrl_TxtDtIni.CleanError(); break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtEmpresa - case event_val_TxtEmpresa: { //InitEventCode event_val_TxtEmpresa switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (i_Form.TxtEmpresa.Text.Length == 6) { i_Form.TxtEmpresa.BackColor = Color.White; ctrl_TxtEmpresa.IsUserValidated = true; ctrl_TxtEmpresa.CleanError(); } else { i_Form.TxtEmpresa.BackColor = colorInvalid; ctrl_TxtEmpresa.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_BtnAlterarClick - case event_BtnAlterarClick: { //InitEventCode event_BtnAlterarClick //EndEventCode return(true); } #endregion #region - event_BtnPagamentoClick - case event_BtnPagamentoClick: { //InitEventCode event_BtnPagamentoClick //EndEventCode return(true); } #endregion #region - event_BtnExtratoClick - case event_BtnExtratoClick: { //InitEventCode event_BtnExtratoClick //EndEventCode return(true); } #endregion default: break; } return(false); }