protected void BtnRepasse_Click(object sender, EventArgs e) { if (TxtMes.Text == "") { Session["st_error"] = "Informar o mĂŞs desejado para consulta de repasse"; Session["st_error_dest"] = "default.aspx"; Response.Redirect("error.aspx", true); return; } if (TxtAno.Text.Length < 4) { Session["st_error"] = "Informar corretamente o ano desejado para consulta de repasse"; Session["st_error_dest"] = "default.aspx"; Response.Redirect("error.aspx", true); return; } GetConnection(); try { string output_st_content_block = ""; ArrayList desc_status = new TipoConfirmacaoDesc().GetArray(); string pass = Session["pass"].ToString(); string cnpj = Session["cnpj"].ToString(); if (var_exchange.fetch_consultaLojistaRep(cnpj, pass, TxtMes.Text, TxtAno.Text, CboEmp.SelectedItem.ToString(), ref output_st_content_block)) { ArrayList values = new ArrayList(); while (output_st_content_block != "") { ArrayList tmp_memory = new ArrayList(); if (var_exchange.fetch_memory(output_st_content_block, "200", ref output_st_content_block, ref tmp_memory)) { long vr_tot = 0; for (int t = 0; t < tmp_memory.Count; ++t) { DadosConsultaTransacao dct = new DadosConsultaTransacao(tmp_memory[t] as DataPortable); PositionData_ExtratoRepasse bind = new PositionData_ExtratoRepasse(); bind.data = var_util.getDDMMYYYY_format(dct.get_dt_transacao()); bind.nsu = dct.get_st_nsu(); bind.valor = new money().formatToMoney(dct.get_vr_valor()); bind.cartao = dct.get_st_cartao(); bind.indparc = dct.get_nu_parcelas(); bind.repasse = new money().formatToMoney(dct.get_vr_repasse()); vr_tot += Convert.ToInt64(dct.get_vr_repasse()); values.Add(bind); } LblTot.Text = "Total : R$ " + new money().formatToMoney(vr_tot.ToString()); } } string note = var_exchange.m_Client.GetServerMessage(); var_exchange.m_Client.ExitSession(); if (note == "") { RptRepassse.DataSource = values; RptRepassse.DataBind(); } else { Session["st_error"] = note; Session["st_error_dest"] = "rep.aspx"; Response.Redirect("error.aspx", true); } } 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); } } }
public override bool doEvent(int event_number, object arg) { switch (event_number) { #region - event_Load - case event_Load: { //InitEventCode event_Load doEvent(event_Translate, null); doEvent(event_FormIsOpening, null); //EndEventCode return(true); } #endregion #region - event_Translate - case event_Translate: { //InitEventCode event_Translate //EndEventCode return(true); } #endregion #region - event_FormIsOpening - case event_FormIsOpening: { //InitEventCode event_FormIsOpening string st_content = ""; if (var_exchange.fetch_canc_dia_lojista(ref header, ref st_content)) { while (st_content != "") { ArrayList tmp_memory = new ArrayList(); if (var_exchange.fetch_memory(st_content, "200", ref st_content, ref tmp_memory)) { for (int t = 0; t < tmp_memory.Count; ++t) { DadosConsultaTransacao dct = new DadosConsultaTransacao(tmp_memory [t] as DataPortable); string [] full_row = new string [] { dct.get_st_cartao(), "R$ " + new money().formatToMoney(dct.get_vr_valor()), var_util.getDDMMYYYY_format(dct.get_dt_transacao()), dct.get_st_nsu() }; i_Form.LstVendas.Items.Add(var_util.GetListViewItem(null, full_row)); } } } } //EndEventCode return(true); } #endregion #region - event_BtnCancelarClick - case event_BtnCancelarClick: { //InitEventCode event_BtnCancelarClick if (i_Form.LstVendas.SelectedItems.Count == 0) { return(false); } string dtax = i_Form.LstVendas.SelectedItems[0].SubItems[2].Text; string nsu = i_Form.LstVendas.SelectedItems[0].SubItems[3].Text; string dta = var_util.GetDataBaseTimeFormat( new DateTime(Convert.ToInt32(dtax.Substring(6, 4)), Convert.ToInt32(dtax.Substring(3, 2)), Convert.ToInt32(dtax.Substring(0, 2)))); if (!var_exchange.fetch_dadosNSU(nsu, dta, TipoConfirmacao.Confirmada, ref header, ref dn)) { return(false); } POS_Entrada pe = new POS_Entrada(); POS_Resposta pr = new POS_Resposta(); pe.set_st_terminal(dn.get_st_terminal()); pe.set_st_empresa(dn.get_st_empresa()); pe.set_st_matricula(dn.get_st_matricula()); pe.set_st_titularidade(dn.get_st_titularidade()); pe.set_nu_parcelas("0"); string st_msg = ""; var_exchange.m_Client.QuietMode = true; if (var_exchange.exec_pos_cancelaVendaEmpresarial(nsu, dta, header.get_st_user_id(), ref pe, ref st_msg, ref pr)) { MessageBox.Show("Sucesso no cancelamento", "Aviso"); } else { MessageBox.Show(st_msg, "Erro"); } var_exchange.m_Client.QuietMode = false; doEvent(event_FormIsOpening, null); //EndEventCode return(true); } #endregion default: break; } return(false); }
public override bool doEvent(int event_number, object arg) { switch (event_number) { #region - event_Load - case event_Load: { //InitEventCode event_Load #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 BtnConfirmar_Click(object sender, EventArgs e) { GetConnection(); try { string output_st_content_block = ""; ArrayList desc_status = new TipoConfirmacaoDesc().GetArray(); string pass = Session ["pass"].ToString(); string cnpj = Session ["cnpj"].ToString(); 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); if (var_exchange.fetch_consultaLojista(cnpj, var_util.GetDataBaseTimeFormat((DateTime)t_start), var_util.GetDataBaseTimeFormat((DateTime)t_end.AddHours(23).AddMinutes(59).AddSeconds(59)), pass, ref output_st_content_block)) { ArrayList values = new ArrayList(); while (output_st_content_block != "") { ArrayList tmp_memory = new ArrayList(); if (var_exchange.fetch_memory(output_st_content_block, "200", ref output_st_content_block, ref tmp_memory)) { long vr_tot = 0; for (int t = 0; t < tmp_memory.Count; ++t) { DadosConsultaTransacao dct = new DadosConsultaTransacao(tmp_memory[t] as DataPortable); PositionData_Extrato bind = new PositionData_Extrato(); bind.nsu = dct.get_st_nsu(); bind.data = var_util.getDDMMYYYY_format(dct.get_dt_transacao()); bind.valor = new money().formatToMoney(dct.get_vr_valor()); bind.cartao = dct.get_st_cartao(); bind.parcelas = dct.get_nu_parcelas(); bind.desc = desc_status[Convert.ToInt32(dct.get_tg_status())].ToString(); bind.assoc = dct.get_st_cod_empresa(); if (dct.get_tg_status() == TipoConfirmacao.Confirmada) // desfazimento { vr_tot += Convert.ToInt64(dct.get_vr_valor()); } values.Add(bind); } LblTot.Text = "Total : R$ " + new money().formatToMoney(vr_tot.ToString()); } } string note = var_exchange.m_Client.GetServerMessage(); var_exchange.m_Client.ExitSession(); if (note == "") { RptExtrato.DataSource = values; RptExtrato.DataBind(); } else { Session["st_error"] = note; Session["st_error_dest"] = "trans.aspx"; Response.Redirect("error.aspx", true); } } else { var_exchange.m_Client.ExitSession(); Session["st_error"] = var_exchange.m_Client.GetServerMessage(); Session["st_error_dest"] = "trans.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); } } }