public override bool doEvent(int event_number, object arg) { switch (event_number) { #region - event_Load - case event_Load: { //InitEventCode event_Load #if ROBOT var_util.execDefinedRobot(this, var_alias); #else doEvent(event_Translate, null); doEvent(event_FormIsOpening, null); #endif //EndEventCode return(true); } #endregion #region - event_Translate - case event_Translate: { //InitEventCode event_Translate //EndEventCode return(true); } #endregion #region - event_FormIsOpening - case event_FormIsOpening: { //InitEventCode event_FormIsOpening ctrl_TxtLimMensal.AcquireTextBox(i_Form.TxtLimMensal, this, event_val_TxtLimMensal, "R$", 8); ctrl_TxtLimTotal.AcquireTextBox(i_Form.TxtLimTotal, this, event_val_TxtLimTotal, "R$", 8); ctrl_TxtLimRotativo.AcquireTextBox(i_Form.TxtLimRotativo, this, event_val_TxtLimRotativo, "R$", 8); ctrl_TxtCotaExtra.AcquireTextBox(i_Form.TxtCotaExtra, this, event_val_TxtCotaExtra, "R$", 8); ctrl_TxtCpf.AcquireTextBox(i_Form.TxtCpf, this, event_val_TxtCpf, 11); ctrl_TxtLimMensal.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtLimTotal.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtLimRotativo.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtCotaExtra.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtLimTotal.IsUserValidated = false; ctrl_TxtLimMensal.IsUserValidated = false; ctrl_TxtLimRotativo.IsUserValidated = false; ctrl_TxtCotaExtra.IsUserValidated = false; //EndEventCode return(true); } #endregion #region - robot_ShowDialog - case robot_ShowDialog: { //InitEventCode robot_ShowDialog //EndEventCode return(true); } #endregion #region - robot_CloseDialog - case robot_CloseDialog: { //InitEventCode robot_CloseDialog //EndEventCode return(true); } #endregion #region - event_Confirmar - case event_Confirmar: { //InitEventCode event_Confirmar if (i_Form.LstCartoes.SelectedItems.Count > 0) { bool IsDone = true; if (!ctrl_TxtLimTotal.IsUserValidated) { ctrl_TxtLimTotal.SetErrorMessage("Valor deve estar preenchido"); IsDone = false; } if (!ctrl_TxtLimMensal.IsUserValidated) { ctrl_TxtLimMensal.SetErrorMessage("Valor deve estar preenchido"); IsDone = false; } if (!ctrl_TxtLimRotativo.IsUserValidated) { ctrl_TxtLimRotativo.SetErrorMessage("Valor deve estar preenchido"); IsDone = false; } if (!ctrl_TxtCotaExtra.IsUserValidated) { ctrl_TxtCotaExtra.SetErrorMessage("Valor deve estar preenchido"); IsDone = false; } if (!IsDone) { return(false); } if (ctrl_TxtLimMensal.getTextBoxValue_Long() > ctrl_TxtLimTotal.getTextBoxValue_Long()) { ctrl_TxtLimMensal.SetErrorMessage("Valor mensal deve ser menor que o valor total"); return(false); } string tag = var_util.getSelectedListViewItemTag(i_Form.LstCartoes); DataPortable tmp = var_util.retrievePortable(tag); DadosCartao dc = new DadosCartao(tmp); dc.set_vr_limiteTotal(ctrl_TxtLimTotal.getTextBoxValue_NumberStr()); dc.set_vr_limiteMensal(ctrl_TxtLimMensal.getTextBoxValue_NumberStr()); dc.set_vr_limiteRotativo(ctrl_TxtLimRotativo.getTextBoxValue_NumberStr()); dc.set_vr_extraCota(ctrl_TxtCotaExtra.getTextBoxValue_NumberStr()); var_exchange.exec_alteraCartao(ref dc, ref header); } //EndEventCode return(true); } #endregion #region - event_val_TxtCpf - case event_val_TxtCpf: { //InitEventCode event_val_TxtCpf if (ctrl_TxtCpf.getTextBoxValue().Length < 11) { i_Form.TxtCpf.BackColor = colorInvalid; ctrl_TxtCpf.IsUserValidated = false; i_Form.LstCartoes.Items.Clear(); i_Form.LblNome.Text = ""; } else { i_Form.TxtCpf.BackColor = Color.White; if (ctrl_TxtCpf.IsUserValidated == false) { string st_csv_id = ""; i_Form.LstCartoes.Items.Clear(); if (var_exchange.fetch_limitesCartao(ctrl_TxtCpf.getTextBoxValue(), ref header, ref st_csv_id)) { ArrayList full_memory = new ArrayList(); while (st_csv_id != "") { ArrayList tmp_memory = new ArrayList(); if (var_exchange.fetch_memory(st_csv_id, "400", ref st_csv_id, ref tmp_memory)) { for (int t = 0; t < tmp_memory.Count; ++t) { full_memory.Add(tmp_memory[t]); } } } ArrayList desc = new CartaoStatusDesc().GetArray(); for (int t = 0; t < full_memory.Count; ++t) { DadosCartao dc = new DadosCartao(full_memory[t] as DataPortable); string nu_cartao = dc.get_st_empresa() + dc.get_st_matricula(); int index = Convert.ToInt32(dc.get_tg_status()); string status = desc [index].ToString(); string venc = dc.get_st_vencimento().Substring(0, 2) + "/" + dc.get_st_vencimento().Substring(2, 2); string [] full_row = new string [] { nu_cartao, status, venc }; var_util.savePortable(nu_cartao, dc); i_Form.LstCartoes.Items.Add(var_util.GetListViewItem(nu_cartao, full_row)); i_Form.LblNome.Text = dc.get_st_proprietario(); } if (full_memory.Count > 0) { i_Form.LstCartoes.Items[0].Selected = true; doEvent(event_Click, null); } } } ctrl_TxtCpf.IsUserValidated = true; } //EndEventCode return(true); } #endregion #region - event_val_TxtLimTotal - case event_val_TxtLimTotal: { //InitEventCode event_val_TxtLimTotal //EndEventCode return(true); } #endregion #region - event_val_TxtLimMensal - case event_val_TxtLimMensal: { //InitEventCode event_val_TxtLimMensal //EndEventCode return(true); } #endregion #region - event_val_TxtLimRotativo - case event_val_TxtLimRotativo: { //InitEventCode event_val_TxtLimRotativo //EndEventCode return(true); } #endregion #region - event_val_TxtCotaExtra - case event_val_TxtCotaExtra: { //InitEventCode event_val_TxtCotaExtra //EndEventCode return(true); } #endregion #region - event_Click - case event_Click: { //InitEventCode event_Click if (i_Form.LstCartoes.SelectedItems.Count > 0) { string tag = var_util.getSelectedListViewItemTag(i_Form.LstCartoes); DataPortable tmp = var_util.retrievePortable(tag); DadosCartao dc = new DadosCartao(tmp); ctrl_TxtLimTotal.SetTextBoxString(dc.get_vr_limiteTotal()); ctrl_TxtLimMensal.SetTextBoxString(dc.get_vr_limiteMensal()); ctrl_TxtLimRotativo.SetTextBoxString(dc.get_vr_limiteRotativo()); ctrl_TxtCotaExtra.SetTextBoxString(dc.get_vr_extraCota()); ctrl_TxtLimTotal.IsUserValidated = true; ctrl_TxtLimMensal.IsUserValidated = true; ctrl_TxtLimRotativo.IsUserValidated = true; ctrl_TxtCotaExtra.IsUserValidated = true; } //EndEventCode return(true); } #endregion #region - event_LstCartoesClick - case event_LstCartoesClick: { //InitEventCode event_LstCartoesClick //EndEventCode return(true); } #endregion #region - event_BtnConfirmarClick - case event_BtnConfirmarClick: { //InitEventCode event_BtnConfirmarClick //EndEventCode return(true); } #endregion default: break; } return(false); }
public override bool doEvent(int event_number, object arg) { switch (event_number) { #region - event_Load - case event_Load: { //InitEventCode event_Load #if ROBOT var_util.execDefinedRobot(this, var_alias); #else doEvent(event_Translate, null); doEvent(event_FormIsOpening, null); #endif //EndEventCode return(true); } #endregion #region - event_Translate - case event_Translate: { //InitEventCode event_Translate //EndEventCode return(true); } #endregion #region - event_FormIsOpening - case event_FormIsOpening: { //InitEventCode event_FormIsOpening //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_Processar - case event_Processar: { //InitEventCode event_Processar if (i_Form.TxtFile.Text == "") { return(false); } i_Form.BtnProcessar.Enabled = false; ArrayList lstLines = new ArrayList(); string id_archive = ""; string line = ""; string line_final = ""; long sizeInfo = 100; long max = Convert.ToInt64(new InstallData().maxPacket) / sizeInfo; long index = 0; StreamReader file = new StreamReader(i_Form.TxtFile.Text); line = file.ReadLine(); bool debitoConta = false; if (line [0] == '1') { debitoConta = true; } while (!file.EndOfStream) { line = file.ReadLine(); if (debitoConta) // deb em conta { if (line [0] == 'Z') { break; } line_final = line.Substring(1, 25) + line.Substring(67, 2) + " ".PadLeft(42, '0') + line.Substring(54, 13); } else // doc { if (line [0] == '9') { break; } line_final = line.Substring(37, 25) + line.Substring(108, 2) + line.Substring(110, 42) + line.Substring(253, 13); } // substring DataPortable port = new DataPortable(); port.setValue("line", line_final); lstLines.Add(port); if (++index == max) { var_exchange.upload_archive(id_archive, ref header, ref lstLines, ref id_archive); index = 0; lstLines.Clear(); } } if (index > 0) { var_exchange.upload_archive(id_archive, ref header, ref lstLines, ref id_archive); } file.Close(); var_exchange.exec_processaArqBancario(id_archive, ref header); MessageBox.Show("Arquivo processado"); i_Form.BtnProcessar.Enabled = true; //EndEventCode return(true); } #endregion #region - event_BtnProcurarClick - case event_BtnProcurarClick: { //InitEventCode event_BtnProcurarClick //EndEventCode return(true); } #endregion #region - event_BtnProcessarClick - case event_BtnProcessarClick: { //InitEventCode event_BtnProcessarClick //EndEventCode return(true); } #endregion default: break; } return(false); }
public override bool doEvent(int event_number, object arg) { switch (event_number) { #region - event_Load - case event_Load: { //InitEventCode event_Load #if ROBOT var_util.execDefinedRobot(this, var_alias); #else doEvent(event_Translate, null); doEvent(event_FormIsOpening, null); #endif //EndEventCode return(true); } #endregion #region - event_Translate - case event_Translate: { //InitEventCode event_Translate //EndEventCode return(true); } #endregion #region - event_FormIsOpening - case event_FormIsOpening: { //InitEventCode event_FormIsOpening ctrl_TxtEmpresa.AcquireTextBox(i_Form.TxtEmpresa, this, event_val_TxtEmpresa, 6); ctrl_TxtCartao.AcquireTextBox(i_Form.TxtCartao, this, event_val_TxtCartao, 6); if (header.get_tg_user_type() == TipoUsuario.VendedorGift || header.get_tg_user_type() == TipoUsuario.AdminGift || header.get_tg_user_type() == TipoUsuario.Operador || header.get_tg_user_type() == TipoUsuario.Administrador) { ctrl_TxtEmpresa.SetTextBoxText(header.get_st_empresa()); i_Form.TxtEmpresa.ReadOnly = true; } //EndEventCode return(true); } #endregion #region - robot_ShowDialog - case robot_ShowDialog: { //InitEventCode robot_ShowDialog //EndEventCode return(true); } #endregion #region - robot_CloseDialog - case robot_CloseDialog: { //InitEventCode robot_CloseDialog //EndEventCode return(true); } #endregion #region - event_val_TxtEmpresa - case event_val_TxtEmpresa: { //InitEventCode event_val_TxtEmpresa switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (i_Form.TxtEmpresa.Text.Length > 0) { i_Form.TxtEmpresa.BackColor = Color.White; ctrl_TxtEmpresa.IsUserValidated = true; ctrl_TxtEmpresa.CleanError(); if (ctrl_TxtEmpresa.GetEnterPressed()) { doEvent(event_BuscaDados, null); } } else { i_Form.TxtEmpresa.BackColor = colorInvalid; ctrl_TxtEmpresa.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtCartao - case event_val_TxtCartao: { //InitEventCode event_val_TxtCartao switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (i_Form.TxtCartao.Text.Length > 0) { i_Form.TxtCartao.BackColor = Color.White; ctrl_TxtCartao.IsUserValidated = true; ctrl_TxtCartao.CleanError(); if (ctrl_TxtCartao.GetEnterPressed()) { doEvent(event_BuscaDados, null); } } else { i_Form.TxtCartao.BackColor = colorInvalid; ctrl_TxtCartao.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_Confirmar - case event_Confirmar: { //InitEventCode event_Confirmar PrintDocument pd = new PrintDocument(); PrintDialog pDialog = new PrintDialog(); pDialog.Document = pd; PrintPreviewDialog prevDialog = new PrintPreviewDialog(); prevDialog.Document = pd; pd.PrintPage += new PrintPageEventHandler(i_Form.Inven_Report); prevDialog.ShowDialog(); if (pDialog.ShowDialog() == DialogResult.OK) { pd.Print(); } //EndEventCode return(true); } #endregion #region - event_BuscaDados - case event_BuscaDados: { //InitEventCode event_BuscaDados if (!ctrl_TxtEmpresa.IsUserValidated && !ctrl_TxtCartao.IsUserValidated) { return(false); } ArrayList lstCred = new ArrayList(); ArrayList lstProd = new ArrayList(); ArrayList lstComprov = new ArrayList(); string nome = ""; string disp = ""; string sit = ""; if (!var_exchange.fetch_consultaCartaoGift(ctrl_TxtEmpresa.getTextBoxValue(), ctrl_TxtCartao.getTextBoxValue(), ref header, ref nome, ref disp, ref sit, ref lstCred, ref lstProd, ref lstComprov)) { return(false); } i_Form.TxtNome.Text = nome; i_Form.TxtSaldo.Text = new money().formatToMoney(disp); i_Form.TxtSit.Text = sit; for (int t = 0; t < lstComprov.Count; ++t) { DadosComprovGift dcg = new DadosComprovGift(lstComprov[t] as DataPortable); string [] full_row = new string [] { dcg.get_dt_venda(), "R$ " + new money().formatToMoney(dcg.get_vr_valor()), dcg.get_st_tipo() }; i_Form.LstComprov.Items.Add(var_util.GetListViewItem(dcg.get_id_venda(), full_row)); } if (i_Form.LstComprov.Items.Count > 0) { i_Form.LstComprov.Items[0].Selected = true; } //EndEventCode return(true); } #endregion #region - event_Print - case event_Print: { //InitEventCode event_Print ArrayList lst = new ArrayList(); string id_gift = var_util.getSelectedListViewItemTag(i_Form.LstComprov); if (id_gift == "") { return(false); } var_exchange.fetch_comprov_Gift(id_gift, Context.TRUE, ref header, ref lst); PrintPageEventArgs e = arg as PrintPageEventArgs; Graphics g = e.Graphics; int n = 0; Font myFont = new Font("Courier New", 10); try { for (int t = 0; t < lst.Count; ++t) { DataPortable port = lst[t] as DataPortable; g.DrawString(port.getValue("linha"), myFont, Brushes.Black, 10, 10 + (n * 20)); ++n; } myFont.Dispose(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } //EndEventCode return(true); } #endregion #region - event_BtnConfirmarClick - case event_BtnConfirmarClick: { //InitEventCode event_BtnConfirmarClick //EndEventCode return(true); } #endregion default: break; } return(false); }
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_TxtMatricula.AcquireTextBox(i_Form.TxtMatricula, this, event_val_TxtMatricula, 6); ctrl_TxtTitularidade.AcquireTextBox(i_Form.TxtTitularidade, this, event_val_TxtTitularidade, 4); ctrl_TxtValor.AcquireTextBox(i_Form.TxtValor, this, event_val_TxtValor, "R$", 9); ctrl_TxtCodAcesso.AcquireTextBox(i_Form.TxtCodAcesso, this, event_val_TxtCodAcesso, 4); ctrl_TxtEmpresa.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtMatricula.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtTitularidade.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtValor.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); if (header.get_tg_user_type() == TipoUsuario.VendedorGift || header.get_tg_user_type() == TipoUsuario.AdminGift || header.get_tg_user_type() == TipoUsuario.Operador || header.get_tg_user_type() == TipoUsuario.Administrador) { ctrl_TxtEmpresa.SetTextBoxText(header.get_st_empresa()); i_Form.TxtEmpresa.ReadOnly = true; } DadosConsultaLoja dcl = new DadosConsultaLoja(); dcl.set_st_empresa(header.get_st_empresa()); string st_csv_id = ""; if (var_exchange.fetch_consultaLojasGift(header.get_st_empresa(), ref header, ref st_csv_id)) { ArrayList tmp_memory = new ArrayList(); while (st_csv_id != "") { if (var_exchange.fetch_memory(st_csv_id, "120", ref st_csv_id, ref tmp_memory)) { for (int t = 0; t < tmp_memory.Count; ++t) { lstLojas.Add(tmp_memory[t]); } } } for (int t = 0; t < lstLojas.Count; ++t) { DadosLoja dl = new DadosLoja(lstLojas[t] as DataPortable); i_Form.LstLojas.Items.Add(dl.get_st_nome()); } } //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("O código da empresa deve ser informado"); IsDone = false; } if (!ctrl_TxtMatricula.IsUserValidated) { ctrl_TxtMatricula.SetErrorMessage("O código da matricula deve ser informado"); IsDone = false; } if (!ctrl_TxtTitularidade.IsUserValidated) { ctrl_TxtTitularidade.SetErrorMessage("A titularidade do cartão deve ser informada"); IsDone = false; } if (!ctrl_TxtValor.IsUserValidated) { ctrl_TxtValor.SetErrorMessage("O valor da venda deve ser informado"); IsDone = false; } if (!ctrl_TxtCodAcesso.IsUserValidated) { ctrl_TxtValor.SetErrorMessage("O código de acesso deve ser informado"); IsDone = false; } if (i_Form.LstLojas.SelectedIndex == -1) { MessageBox.Show("Selecione a loja"); return(false); } if (!IsDone) { return(false); } if (MessageBox.Show("Confirma venda no valor de R$ " + ctrl_TxtValor.getTextBoxValue() + " para " + i_Form.LstLojas.SelectedItem.ToString() + " ?", "Aviso", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No) { return(false); } string cript_senha = new ApplicationUtil().DESCript("9999".PadLeft(8, '*'), "12345678"); DadosLoja dl = new DadosLoja(lstLojas [i_Form.LstLojas.SelectedIndex] as DataPortable); POS_Entrada pe = new POS_Entrada(); pe.set_st_senha(cript_senha); pe.set_st_empresa(ctrl_TxtEmpresa.getTextBoxValue().PadLeft(6, '0')); pe.set_st_matricula(ctrl_TxtMatricula.getTextBoxValue().PadLeft(6, '0')); pe.set_st_titularidade("01"); pe.set_vr_valor(ctrl_TxtValor.getTextBoxValue_NumberStr().PadLeft(12, '0')); pe.set_st_terminal(dl.get_st_obs()); pe.set_nu_parcelas("1"); pe.set_st_valores(ctrl_TxtValor.getTextBoxValue_NumberStr().PadLeft(12, '0')); POS_Resposta resp = new POS_Resposta(); string msg = ""; var_exchange.m_Client.QuietMode = true; string codAc = var_util.calculaCodigoAcesso(ctrl_TxtEmpresa.getTextBoxValue().PadLeft(6, '0'), ctrl_TxtMatricula.getTextBoxValue().PadLeft(6, '0'), ctrl_TxtTitularidade.getTextBoxValue()); if (codAc != ctrl_TxtCodAcesso.getTextBoxValue()) { MessageBox.Show("Cartão inválido", "Aviso"); return(false); } if (var_exchange.exec_pos_vendaEmpresarial(ref pe, ref msg, ref resp)) { nsu_venda = resp.get_st_nsuRcb(); if (var_exchange.exec_pos_confirmaVendaEmpresarial(nsu_venda, ref pe, ref msg, ref resp)) { var_exchange.m_Client.QuietMode = false; MessageBox.Show("NSU: " + nsu_venda, "Transação confirmada"); PrintDocument pd = new PrintDocument(); PrintDialog pDialog = new PrintDialog(); pDialog.Document = pd; PrintPreviewDialog prevDialog = new PrintPreviewDialog(); prevDialog.Document = pd; pd.PrintPage += new PrintPageEventHandler(i_Form.Inven_Report); prevDialog.ShowDialog(); if (pDialog.ShowDialog() == DialogResult.OK) { pd.Print(); } } else { MessageBox.Show(msg, "Erro na transação"); } } else { MessageBox.Show(msg, "Erro na transação"); } var_exchange.m_Client.QuietMode = false; //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(); } else { i_Form.TxtEmpresa.BackColor = colorInvalid; ctrl_TxtEmpresa.IsUserValidated = false; } break; } default: break; } if (ctrl_TxtEmpresa.GetEnterPressed()) { doEvent(event_BuscaDados, null); } //EndEventCode return(true); } #endregion #region - event_val_TxtMatricula - case event_val_TxtMatricula: { //InitEventCode event_val_TxtMatricula switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (i_Form.TxtMatricula.Text.Length > 0) { i_Form.TxtMatricula.BackColor = Color.White; ctrl_TxtMatricula.IsUserValidated = true; ctrl_TxtMatricula.CleanError(); } else { i_Form.TxtMatricula.BackColor = colorInvalid; ctrl_TxtMatricula.IsUserValidated = false; } break; } default: break; } if (ctrl_TxtMatricula.GetEnterPressed()) { doEvent(event_BuscaDados, null); } //EndEventCode return(true); } #endregion #region - event_val_TxtTitularidade - case event_val_TxtTitularidade: { //InitEventCode event_val_TxtTitularidade switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (i_Form.TxtTitularidade.Text.Length == 4) { i_Form.TxtTitularidade.BackColor = Color.White; ctrl_TxtTitularidade.IsUserValidated = true; ctrl_TxtTitularidade.CleanError(); } else { i_Form.TxtTitularidade.BackColor = colorInvalid; ctrl_TxtTitularidade.IsUserValidated = false; } break; } default: break; } if (ctrl_TxtTitularidade.GetEnterPressed()) { doEvent(event_BuscaDados, null); } //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; ctrl_TxtValor.CleanError(); } //EndEventCode return(true); } #endregion #region - event_BuscaDados - case event_BuscaDados: { //InitEventCode event_BuscaDados string st_nu_maxParcelas = ""; string st_vr_dispMes = ""; string st_vr_dispTotal = ""; string st_nome = ""; if (var_exchange.fetch_dadosCartao(ctrl_TxtEmpresa.getTextBoxValue(), ctrl_TxtMatricula.getTextBoxValue(), "01", ref header, ref st_nu_maxParcelas, ref st_vr_dispMes, ref st_vr_dispTotal, ref st_nome)) { i_Form.TxtVrDispTotal.Text = new money().formatToMoney(st_vr_dispTotal); i_Form.TxtNome.Text = st_nome; } else { i_Form.TxtVrDispTotal.Text = ""; } //EndEventCode return(true); } #endregion #region - event_Print - case event_Print: { //InitEventCode event_Print ArrayList lst = new ArrayList(); var_exchange.fetch_reciboVendaGift(nsu_venda, ref header, ref lst); PrintPageEventArgs e = arg as PrintPageEventArgs; Graphics g = e.Graphics; int n = 0; Font myFont = new Font("Courier New", 10); try { for (int t = 0; t < lst.Count; ++t) { DataPortable port = lst[t] as DataPortable; g.DrawString(port.getValue("linha"), myFont, Brushes.Black, 10, 10 + (n * 20)); ++n; } myFont.Dispose(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } //EndEventCode return(true); } #endregion #region - event_val_TxtCodAcesso - case event_val_TxtCodAcesso: { //InitEventCode event_val_TxtCodAcesso switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (i_Form.TxtCodAcesso.Text.Length == 4) { i_Form.TxtCodAcesso.BackColor = Color.White; ctrl_TxtCodAcesso.IsUserValidated = true; ctrl_TxtCodAcesso.CleanError(); } else { i_Form.TxtCodAcesso.BackColor = colorInvalid; ctrl_TxtCodAcesso.IsUserValidated = false; } break; } default: break; } if (ctrl_TxtCodAcesso.GetEnterPressed()) { doEvent(event_BuscaDados, null); } //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_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.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtDtFim.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_Confirmar - case event_Confirmar: { //InitEventCode event_Confirmar bool bOk = true; if (!ctrl_TxtDtFim.IsUserValidated) { ctrl_TxtDtFim.SetErrorMessage("Informe o dia final"); bOk = false; } if (!ctrl_TxtDtIni.IsUserValidated) { ctrl_TxtDtIni.SetErrorMessage("Informe o dia inicial"); bOk = false; } if (i_Form.TxtFile.Text == "") { MessageBox.Show("Informe o arquivo de saída", "Aviso"); bOk = false; } if (i_Form.CboOption.SelectedIndex == -1) { MessageBox.Show("Informe a opção de cobrança", "Aviso"); bOk = false; } if (!bOk) { return(false); } i_Form.BtnConfirmar.Enabled = false; string st_block = ""; string nu_nsFat = ""; dlgStatus stat = new dlgStatus("Faturamento"); stat.LblActivity.Text = "Processando dados no servidor"; stat.pgStatus.Maximum = 1; stat.pgStatus.Minimum = 0; stat.Show(); Application.DoEvents(); if (var_exchange.fetch_arquivoFat(var_util.GetDataBaseTimeFormat(ctrl_TxtDtIni.getTextBoxValue_Date()), var_util.GetDataBaseTimeFormat(ctrl_TxtDtFim.getTextBoxValue_Date().AddDays(1)), i_Form.CboOption.SelectedIndex.ToString(), ref header, ref st_block, ref nu_nsFat)) { ArrayList full_memory = new ArrayList(); while (st_block != "") { ArrayList tmp_memory = new ArrayList(); if (var_exchange.fetch_memory(st_block, "600", ref st_block, ref tmp_memory)) { for (int t = 0; t < tmp_memory.Count; ++t) { full_memory.Add(tmp_memory[t]); } } } string file = i_Form.TxtFile.Text.Replace("ZZ", nu_nsFat.PadLeft(2, '0')); StreamWriter sw = new StreamWriter(file, false, Encoding.Default); for (int t = 0; t < full_memory.Count; ++t) { DataPortable port = full_memory[t] as DataPortable; sw.WriteLine(port.getValue("line")); } sw.Close(); MessageBox.Show("Arquivo '" + file + "' gerado com sucesso", "Aviso"); } stat.Close(); Application.DoEvents(); i_Form.BtnConfirmar.Enabled = true; //EndEventCode return(true); } #endregion #region - event_Dir - case event_Dir: { //InitEventCode event_Dir //EndEventCode return(true); } #endregion #region - event_val_TxtDtFim - case event_val_TxtDtFim: { //InitEventCode event_val_TxtDtFim switch (arg as string) { case dateTextController.DATE_VALID: { i_Form.TxtDtFim.BackColor = Color.White; ctrl_TxtDtFim.IsUserValidated = true; ctrl_TxtDtFim.CleanError(); break; } case dateTextController.DATE_INVALID: { i_Form.TxtDtFim.BackColor = colorInvalid; ctrl_TxtDtFim.IsUserValidated = false; break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtDtIni - case event_val_TxtDtIni: { //InitEventCode event_val_TxtDtIni switch (arg as string) { case dateTextController.DATE_VALID: { i_Form.TxtDtIni.BackColor = Color.White; ctrl_TxtDtIni.IsUserValidated = true; ctrl_TxtDtIni.CleanError(); break; } case dateTextController.DATE_INVALID: { i_Form.TxtDtIni.BackColor = colorInvalid; ctrl_TxtDtIni.IsUserValidated = false; break; } default: break; } //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 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_TxtCodEmpresa.AcquireTextBox(i_Form.TxtCodEmpresa, this, event_val_TxtCodEmpresa, 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_Processar - case event_Processar: { //InitEventCode event_Processar if (!ctrl_TxtCodEmpresa.IsUserValidated) { return(false); } if (i_Form.TxtFile.Text == "") { return(false); } i_Form.BtnProc.Enabled = false; ArrayList lstLines = new ArrayList(); string id_archive = ""; long sizeInfo = 100; long max = Convert.ToInt64(new InstallData().maxPacket) / sizeInfo; long index = 0; StreamReader file = new StreamReader(i_Form.TxtFile.Text); while (!file.EndOfStream) { DataPortable port = new DataPortable(); port.setValue("line", file.ReadLine()); lstLines.Add(port); if (++index == max) { var_exchange.upload_archive(id_archive, ref header, ref lstLines, ref id_archive); index = 0; lstLines.Clear(); } } if (index > 0) { var_exchange.upload_archive(id_archive, ref header, ref lstLines, ref id_archive); } file.Close(); if (var_exchange.exec_processaArqConvenio(id_archive, ctrl_TxtCodEmpresa.getTextBoxValue(), ref header)) { MessageBox.Show("Arquivo processado"); } i_Form.BtnProc.Enabled = true; //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 (i_Form.TxtCodEmpresa.Text.Length > 0) { i_Form.TxtCodEmpresa.BackColor = Color.White; ctrl_TxtCodEmpresa.IsUserValidated = true; ctrl_TxtCodEmpresa.CleanError(); } else { i_Form.TxtCodEmpresa.BackColor = colorInvalid; ctrl_TxtCodEmpresa.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_BtnBuscarClick - case event_BtnBuscarClick: { //InitEventCode event_BtnBuscarClick //EndEventCode return(true); } #endregion #region - event_BtnProcClick - case event_BtnProcClick: { //InitEventCode event_BtnProcClick //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.LblTotal.Text = "Total: R$ " + new money().formatToMoney(total.ToString()); i_Form.rbDinheiro.Checked = true; ctrl_TxtIdent.AcquireTextBox(i_Form.TxtIdent, this, event_val_TxtIdent, 20); i_Form.CboTipoCart.SelectedIndex = 0; if (recarga) { i_Form.Text = "Efetuar pagamento para recarga de cartão Gift"; } //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.rbCheque.Checked) { if (i_Form.TxtIdent.Text.Length == 0) { MessageBox.Show("Informe a identificação do cheque", "Aviso"); return(false); } } else if (i_Form.rbCartao.Checked) { if (i_Form.TxtIdent.Text.Length == 0) { MessageBox.Show("Informe a identificação da venda pelo cartão", "Aviso"); return(false); } if (i_Form.CboTipoCart.SelectedIndex == -1) { MessageBox.Show("Escolha o tipo de cartão", "Aviso"); return(false); } } dc.set_vr_dispTotal(carga.ToString()); string tipoPag = TipoPagamento.Dinheiro; string info = i_Form.TxtIdent.Text;; if (i_Form.rbCheque.Checked) { tipoPag = TipoPagamento.Cheque; } else if (i_Form.rbCartao.Checked) { tipoPag = TipoPagamento.Cartao; } else { info = ""; } ArrayList lst = new ArrayList(); for (int t = 0; t < lstProdsNome.Count; ++t) { DadosProdutoGift dpg = new DadosProdutoGift(); dpg.set_st_nome(lstProdsNome[t].ToString()); dpg.set_vr_valor(lstProdsValor[t].ToString()); lst.Add(dpg); } string tg_adesao = Context.TRUE; if (recarga) { tg_adesao = Context.FALSE; } var_exchange.exec_recargaGift(dc.get_st_empresa(), dc.get_st_matricula(), carga.ToString(), tipoPag, i_Form.CboTipoCart.SelectedIndex.ToString(), info, tg_adesao, ref header, ref lst, ref id_gift); if (!recarga) { if (!var_exchange.ins_cartaoProprietario("", ref dc, ref dp, ref da, ref header)) { return(false); } } IsTerm = true; bool Finish = false; while (!Finish) { PrintDocument pd = new PrintDocument(); PrintDialog pDialog = new PrintDialog(); pDialog.Document = pd; PrintPreviewDialog prevDialog = new PrintPreviewDialog(); prevDialog.Document = pd; pd.PrintPage += new PrintPageEventHandler(i_Form.Inven_Report); prevDialog.ShowDialog(); if (pDialog.ShowDialog() == DialogResult.OK) { pd.Print(); } if (MessageBox.Show("Impressão bem sucedida?", "Aviso", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { Finish = true; } } i_Form.Close(); //EndEventCode return(true); } #endregion #region - event_FormIsClosing - case event_FormIsClosing: { //InitEventCode event_FormIsClosing if (MessageBox.Show("Confirma cancelamento de cadastro de cartão GiftCard?", "Aviso", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { return(false); } //EndEventCode return(true); } #endregion #region - event_val_TxtIdent - case event_val_TxtIdent: { //InitEventCode event_val_TxtIdent //EndEventCode return(true); } #endregion #region - event_Print - case event_Print: { //InitEventCode event_Print ArrayList lst = new ArrayList(); var_exchange.fetch_comprov_Gift(id_gift, Context.FALSE, ref header, ref lst); PrintPageEventArgs e = arg as PrintPageEventArgs; Graphics g = e.Graphics; int n = 0; Font myFont = new Font("Courier New", 10); try { for (int t = 0; t < lst.Count; ++t) { DataPortable port = lst[t] as DataPortable; g.DrawString(port.getValue("linha"), myFont, Brushes.Black, 10, 10 + (n * 20)); ++n; } myFont.Dispose(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } //EndEventCode return(true); } #endregion #region - event_BtnConfirmarClick - case event_BtnConfirmarClick: { //InitEventCode event_BtnConfirmarClick //EndEventCode return(true); } #endregion default: break; } return(false); }
public override bool doEvent(int event_number, object arg) { switch (event_number) { #region - event_Load - case event_Load: { //InitEventCode event_Load doEvent(event_Translate, null); doEvent(event_FormIsOpening, null); //EndEventCode return(true); } #endregion #region - event_Translate - case event_Translate: { //InitEventCode event_Translate //EndEventCode return(true); } #endregion #region - event_FormIsOpening - case event_FormIsOpening: { //InitEventCode event_FormIsOpening ctrl_TxtDt_Ini.AcquireTextBox(i_Form.TxtDt_Ini, this, event_val_TxtDt_Ini, dateTextController.FORMAT_DDMMYYYY); ctrl_TxtDt_Fim.AcquireTextBox(i_Form.TxtDt_Fim, this, event_val_TxtDt_Fim, dateTextController.FORMAT_DDMMYYYY); ctrl_TxtDt_Ini.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtDt_Fim.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); doEvent(event_BuscaDados, null); //EndEventCode return(true); } #endregion #region - robot_ShowDialog - case robot_ShowDialog: { //InitEventCode robot_ShowDialog //EndEventCode return(true); } #endregion #region - robot_CloseDialog - case robot_CloseDialog: { //InitEventCode robot_CloseDialog //EndEventCode return(true); } #endregion #region - event_val_TxtDt_Ini - case event_val_TxtDt_Ini: { //InitEventCode event_val_TxtDt_Ini switch (arg as string) { case dateTextController.DATE_INVALID: { i_Form.TxtDt_Ini.BackColor = Color.Lavender;; ctrl_TxtDt_Ini.IsUserValidated = false; break; } case dateTextController.DATE_VALID: { i_Form.TxtDt_Ini.BackColor = Color.White; ctrl_TxtDt_Ini.IsUserValidated = true; ctrl_TxtDt_Ini.CleanError(); break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtDt_Fim - case event_val_TxtDt_Fim: { //InitEventCode event_val_TxtDt_Fim switch (arg as string) { case dateTextController.DATE_INVALID: { i_Form.TxtDt_Fim.BackColor = Color.Lavender;; ctrl_TxtDt_Fim.IsUserValidated = false; break; } case dateTextController.DATE_VALID: { i_Form.TxtDt_Fim.BackColor = Color.White; ctrl_TxtDt_Fim.IsUserValidated = true; ctrl_TxtDt_Fim.CleanError(); break; } default: break; } //EndEventCode return(true); } #endregion #region - event_BuscaDados - case event_BuscaDados: { //InitEventCode event_BuscaDados i_Form.LstMsg.Items.Clear(); var_util.clearPortable(); string st_csv_content = ""; if (!var_exchange.fetch_edu_messages(ref header, ref st_csv_content)) { return(false); } ArrayList full_memory = new ArrayList(); while (st_csv_content != "") { ArrayList tmp_memory = new ArrayList(); if (var_exchange.fetch_memory(st_csv_content, "1000", ref st_csv_content, ref tmp_memory)) { for (int t = 0; t < tmp_memory.Count; ++t) { full_memory.Add(tmp_memory[t] as DataPortable); } } } for (int t = 0; t < full_memory.Count; ++t) { DadosEduMessage dem = new DadosEduMessage(full_memory[t] as DataPortable); string time = var_util.getDDMMYYYY_format(dem.get_dt_start()).Replace(" 00:00:00", "") + " - " + var_util.getDDMMYYYY_format(dem.get_dt_end()).Replace(" 23:59:59", ""); string [] full_row = new string [] { dem.get_st_msg(), time }; var_util.savePortable(dem.get_id_mem(), dem); i_Form.LstMsg.Items.Add(var_util.GetListViewItem(dem.get_id_mem(), full_row)); } //EndEventCode return(true); } #endregion #region - event_LstMsgDoubleClick - case event_LstMsgDoubleClick: { //InitEventCode event_LstMsgDoubleClick id = var_util.getSelectedListViewItemTag(i_Form.LstMsg); DadosEduMessage dem = new DadosEduMessage(var_util.retrievePortable(id) as DataPortable); i_Form.txtMsg.Text = dem.get_st_msg(); DateTime tim = Convert.ToDateTime(dem.get_dt_start()); ctrl_TxtDt_Ini.SetTextBoxText(tim.Day.ToString().PadLeft(2, '0') + tim.Month.ToString().PadLeft(2, '0') + tim.Year.ToString()); DateTime tim2 = Convert.ToDateTime(dem.get_dt_end()); ctrl_TxtDt_Fim.SetTextBoxText(tim2.Day.ToString().PadLeft(2, '0') + tim2.Month.ToString().PadLeft(2, '0') + tim2.Year.ToString()); //EndEventCode return(true); } #endregion #region - event_BtnNovoClick - case event_BtnNovoClick: { //InitEventCode event_BtnNovoClick dlgAutorizacao autor = new dlgAutorizacao(); autor.ShowDialog(); Application.DoEvents(); if (autor.IsConfirmed) { DadosEduMessage dem = new DadosEduMessage(); dem.set_dt_start(var_util.GetDataBaseTimeFormat(ctrl_TxtDt_Ini.getTextBoxValue_Date())); dem.set_dt_end(var_util.GetDataBaseTimeFormat(ctrl_TxtDt_Fim.getTextBoxValue_Date().AddHours(23).AddMinutes(59).AddSeconds(59))); dem.set_st_msg(i_Form.txtMsg.Text); var_exchange.ins_edu_msg(ref dem, ref header); doEvent(event_BuscaDados, null); } //EndEventCode return(true); } #endregion #region - event_BtnAtualizarClick - case event_BtnAtualizarClick: { //InitEventCode event_BtnAtualizarClick dlgAutorizacao autor = new dlgAutorizacao(); autor.ShowDialog(); Application.DoEvents(); if (autor.IsConfirmed) { DadosEduMessage dem = new DadosEduMessage(); dem.set_dt_start(var_util.GetDataBaseTimeFormat(ctrl_TxtDt_Ini.getTextBoxValue_Date())); dem.set_dt_end(var_util.GetDataBaseTimeFormat(ctrl_TxtDt_Fim.getTextBoxValue_Date().AddHours(23).AddMinutes(59).AddSeconds(59))); dem.set_st_msg(i_Form.txtMsg.Text); dem.set_id_mem(id); var_exchange.exec_change_edu_msg(ref dem, ref header); doEvent(event_BuscaDados, null); } //EndEventCode return(true); } #endregion #region - event_BtnRemoverClick - case event_BtnRemoverClick: { //InitEventCode event_BtnRemoverClick if (MessageBox.Show("Remover mensagem?", "Aviso", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No) { return(false); } string tag = var_util.getSelectedListViewItemTag(i_Form.LstMsg); DataPortable tmp = var_util.retrievePortable(tag); id = ""; DadosEduMessage dem = new DadosEduMessage(tmp); var_exchange.del_edu_msg(dem.get_id_mem(), ref header); doEvent(event_BuscaDados, null); //EndEventCode return(true); } #endregion default: break; } return(false); }
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_TxtSenha.AcquireTextBox(i_Form.TxtSenha, this, event_val_TxtSenha, 4); ctrl_TxtCartao.AcquireTextBox(i_Form.TxtCartao, this, event_val_TxtCartao, 15); ctrl_TxtValor.AcquireTextBox(i_Form.TxtValor, this, event_val_TxtValor, "R$", 9); ctrl_TxtParcelas.AcquireTextBox(i_Form.TxtParcelas, this, event_val_TxtParcelas, 2); ctrl_TxtSenha.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtCartao.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtParcelas.SetTextBoxText("1"); //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_TxtSenha - case event_val_TxtSenha: { //InitEventCode event_val_TxtSenha switch (arg as string) { case pinpadTextController.PINPAD_INCOMPLETE: case pinpadTextController.PINPAD_COMPLETE: { if (i_Form.TxtSenha.Text.Length > 3) { i_Form.TxtSenha.BackColor = Color.White; ctrl_TxtSenha.IsUserValidated = true; ctrl_TxtSenha.CleanError(); } else { i_Form.TxtSenha.BackColor = colorInvalid; ctrl_TxtSenha.IsUserValidated = false; } break; } case pinpadTextController.PINPAD_ENTRA: { doEvent(event_Confirmar, null); break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtCartao - case event_val_TxtCartao: { //InitEventCode event_val_TxtCartao switch (arg as string) { case pincardTextController.PINCARD_INCOMPLETE: { i_Form.TxtCartao.BackColor = colorInvalid; ctrl_TxtCartao.IsUserValidated = false; break; } case pincardTextController.PINCARD_COMPLETE: { i_Form.TxtCartao.BackColor = Color.White; ctrl_TxtCartao.IsUserValidated = true; ctrl_TxtCartao.CleanError(); if (ctrl_TxtCartao.IsTermInput) { i_Form.TxtSenha.Focus(); } 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; ctrl_TxtValor.CleanError(); } //EndEventCode return(true); } #endregion #region - event_Confirmar - case event_Confirmar: { //InitEventCode event_Confirmar if (!ctrl_TxtValor.IsUserValidated) { return(false); } var_exchange.m_Client.QuietMode = true; POS_Entrada pe = new POS_Entrada(); string cript_senha = new ApplicationUtil().DESCript(ctrl_TxtSenha.getTextBoxValue().PadLeft(8, '*'), "12345678"); pe.set_st_senha(cript_senha); pe.set_st_empresa(ctrl_TxtCartao.getTextBoxValue().Substring(0, 6)); pe.set_st_matricula(ctrl_TxtCartao.getTextBoxValue().Substring(6, 6)); pe.set_st_titularidade(ctrl_TxtCartao.getTextBoxValue().Substring(12, 2)); pe.set_vr_valor(ctrl_TxtValor.getTextBoxValue_NumberStr().PadLeft(12, '0')); pe.set_st_terminal(header.get_nu_terminal()); pe.set_nu_parcelas(ctrl_TxtParcelas.getTextBoxValue()); if (ctrl_TxtParcelas.getTextBoxValue_Long() == 1) { pe.set_st_valores(ctrl_TxtValor.getTextBoxValue_NumberStr().PadLeft(12, '0')); } else { string st_lst_val = ""; for (int t = 0; t < lstPar.Count; ++t) { st_lst_val += lstPar[t].ToString().PadLeft(12, '0'); } pe.set_st_valores(st_lst_val); } POS_Resposta resp = new POS_Resposta(); string msg = ""; if (var_exchange.exec_pos_vendaEmpresarial(ref pe, ref msg, ref resp)) { nsu_venda = resp.get_st_nsuRcb(); if (var_exchange.exec_pos_confirmaVendaEmpresarial(nsu_venda, ref pe, ref msg, ref resp)) { var_exchange.m_Client.QuietMode = false; MessageBox.Show("NSU: " + nsu_venda, "Transação confirmada"); PrintDocument pd = new PrintDocument(); PrintDialog pDialog = new PrintDialog(); pDialog.Document = pd; PrintPreviewDialog prevDialog = new PrintPreviewDialog(); prevDialog.Document = pd; pd.PrintPage += new PrintPageEventHandler(i_Form.Inven_Report); prevDialog.ShowDialog(); if (pDialog.ShowDialog() == DialogResult.OK) { pd.Print(); } } else { MessageBox.Show(msg, "Erro na transação"); } } else { MessageBox.Show(msg, "Erro na transação"); } var_exchange.m_Client.QuietMode = false; //EndEventCode return(true); } #endregion #region - event_Print - case event_Print: { //InitEventCode event_Print ArrayList lst = new ArrayList(); var_exchange.fetch_reciboVendaLojista(nsu_venda, ref header, ref lst); PrintPageEventArgs e = arg as PrintPageEventArgs; Graphics g = e.Graphics; int n = 0; Font myFont = new Font("Courier New", 10); try { for (int t = 0; t < lst.Count; ++t) { DataPortable port = lst[t] as DataPortable; g.DrawString(port.getValue("linha"), myFont, Brushes.Black, 10, 10 + (n * 20)); ++n; } myFont.Dispose(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } i_Form.Close(); //EndEventCode return(true); } #endregion #region - event_Definir - case event_Definir: { //InitEventCode event_Definir event_dlgVendaParcelada ev_call = new event_dlgVendaParcelada(var_util, var_exchange); ev_call.header = header; ev_call.lstPar = lstPar; ev_call.tot_parcs = ctrl_TxtParcelas.getTextBoxValue_Long(); ev_call.tot_valor = ctrl_TxtValor.getTextBoxValue_Long(); ev_call.i_Form.ShowDialog(); //EndEventCode return(true); } #endregion #region - event_val_TxtParcelas - case event_val_TxtParcelas: { //InitEventCode event_val_TxtParcelas //EndEventCode return(true); } #endregion #region - event_BtnConfirmarClick - case event_BtnConfirmarClick: { //InitEventCode event_BtnConfirmarClick //EndEventCode return(true); } #endregion #region - event_BtnDivisaoClick - case event_BtnDivisaoClick: { //InitEventCode event_BtnDivisaoClick //EndEventCode return(true); } #endregion default: break; } return(false); }