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_TxtCodigo.AcquireTextBox(i_Form.TxtCodigo, this, event_val_TxtCodigo, 6); //EndEventCode return(true); } #endregion #region - robot_ShowDialog - case robot_ShowDialog: { //InitEventCode robot_ShowDialog //EndEventCode return(true); } #endregion #region - robot_CloseDialog - case robot_CloseDialog: { //InitEventCode robot_CloseDialog //EndEventCode return(true); } #endregion #region - event_val_TxtCodigo - case event_val_TxtCodigo: { //InitEventCode event_val_TxtCodigo switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (i_Form.TxtCodigo.Text.Length > 0) { i_Form.TxtCodigo.BackColor = Color.White; ctrl_TxtCodigo.IsUserValidated = true; ctrl_TxtCodigo.CleanError(); if (ctrl_TxtCodigo.GetEnterPressed()) { doEvent(event_buscaDados, null); } } else { i_Form.TxtCodigo.BackColor = colorInvalid; ctrl_TxtCodigo.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_Cancelar - case event_Cancelar: { //InitEventCode event_Cancelar var_exchange.exec_cancelaDespesa(var_util.getSelectedListViewItemTag(i_Form.LstDespesas), ref header); doEvent(event_buscaDados, null); //EndEventCode return(true); } #endregion #region - event_buscaDados - case event_buscaDados: { //InitEventCode event_buscaDados if (i_Form.CboTipo.SelectedIndex != -1) { ArrayList list = new ArrayList(); string nome = ""; string tg_emp = Context.FALSE; if (i_Form.CboTipo.SelectedIndex == 0) { tg_emp = Context.TRUE; } var_exchange.fetch_dadosDespesas(tg_emp, ctrl_TxtCodigo.getTextBoxValue(), ref header, ref nome, ref list); i_Form.TxtNome.Text = nome; i_Form.LstDespesas.Items.Clear(); for (int t = 0; t < list.Count; ++t) { DadosDespesas dd = new DadosDespesas(list [t] as DataPortable); string [] full_row = new string [] { dd.get_st_info(), new money().formatToMoney(dd.get_vr_cobrança()) }; i_Form.LstDespesas.Items.Add(var_util.GetListViewItem(dd.get_fk_faturadet(), full_row)); } Application.DoEvents(); } //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_TxtEmpresa.AcquireTextBox(i_Form.TxtEmpresa, this, event_val_TxtEmpresa, 6); ctrl_TxtTerminal.AcquireTextBox(i_Form.TxtTerminal, this, event_val_TxtTerminal, 6); ctrl_TxtTelefone.AcquireTextBox(i_Form.TxtTelefone, this, event_val_TxtTelefone, 10); ctrl_TxtEmpresa.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtTerminal.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtTelefone.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); if (header.get_tg_user_type() == TipoUsuario.Administrador || header.get_tg_user_type() == TipoUsuario.Operador) { 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(); } else { i_Form.TxtEmpresa.BackColor = colorInvalid; ctrl_TxtEmpresa.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_TxtTerminal - case event_val_TxtTerminal: { //InitEventCode event_val_TxtTerminal switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (i_Form.TxtTerminal.Text.Length > 0) { i_Form.TxtTerminal.BackColor = Color.White; ctrl_TxtTerminal.IsUserValidated = true; ctrl_TxtTerminal.CleanError(); } else { i_Form.TxtTerminal.BackColor = colorInvalid; ctrl_TxtTerminal.IsUserValidated = false; } break; } default: break; } if (i_Form.TxtTerminal.Text.Length == 0) { if (ctrl_TxtTerminal.GetEnterPressed()) { if (ctrl_TxtEmpresa.IsUserValidated) { event_dlgSelecionaTerminal ev_call = new event_dlgSelecionaTerminal(var_util, var_exchange); ev_call.header = header; ev_call.st_cod_empresa = ctrl_TxtEmpresa.getTextBoxValue(); ev_call.i_Form.ShowDialog(); ctrl_TxtTerminal.SetTextBoxText(ev_call.st_cod_terminal); } } } //EndEventCode return(true); } #endregion #region - event_Confirmar - case event_Confirmar: { //InitEventCode event_Confirmar bool IsDone = true; if (!ctrl_TxtEmpresa.IsUserValidated) { ctrl_TxtEmpresa.SetErrorMessage("Código de empresa deve possuir 6 caracteres"); IsDone = false; } if (!ctrl_TxtTerminal.IsUserValidated) { ctrl_TxtTerminal.SetErrorMessage("Terminal deve possuir 6 caracteres"); IsDone = false; } if (!ctrl_TxtTelefone.IsUserValidated) { ctrl_TxtTelefone.SetErrorMessage("Telefone deve possuir 10 caracteres"); IsDone = false; } if (!IsDone) { return(false); } var_exchange.ins_payFoneLojista(ctrl_TxtEmpresa.getTextBoxValue(), ctrl_TxtTerminal.getTextBoxValue(), ctrl_TxtTelefone.getTextBoxValue(), ref header); //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); ctrl_TxtDtIni.SetTextBoxText("01" + DateTime.Now.Month.ToString().PadLeft(2, '0') + DateTime.Now.Year.ToString().PadLeft(4, '0')); ctrl_TxtDtFim.SetTextBoxText("15" + DateTime.Now.Month.ToString().PadLeft(2, '0') + DateTime.Now.Year.ToString().PadLeft(4, '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_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_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_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.CboRelat.SelectedIndex == -1) { MessageBox.Show("Informe a opção de cobrança", "Aviso"); bOk = false; } if (!bOk) { return(false); } i_Form.BtnConfirmar.Enabled = false; if (i_Form.CboRelat.SelectedIndex == 0) { #region - pendentes com detalhe - // ############################## // # SETUP LISTS ################ // ############################## ArrayList lstHeader = new ArrayList(); ArrayList lstContent = new ArrayList(); ArrayList lstTableSizes = new ArrayList(); ArrayList lstFooter = new ArrayList(); ArrayList lstMessages = new ArrayList(); ArrayList lstFilters = new ArrayList(); // ############################## // # CUSTOMIZE // ############################## string output_st_total = ""; string output_st_total_desconto = ""; string output_st_csv_subtotal = ""; string output_st_csv_subtotal_desconto = ""; string output_st_content_block = ""; string output_st_emp_loj_block = ""; string output_CartaoAtiv = ""; string output_Extras = ""; string output_FixoTrans = ""; string output_Percent = ""; string output_TBM = ""; i_Form.Visible = false; dlgStatus stat = new dlgStatus("Relatório"); stat.LblActivity.Text = "Processando relatório no servidor"; stat.Show(); Application.DoEvents(); if (!var_exchange.fetch_rel_6_fat(var_util.GetDataBaseTimeFormat(ctrl_TxtDtIni.getTextBoxValue_Date()), var_util.GetDataBaseTimeFormat(ctrl_TxtDtFim.getTextBoxValue_Date().AddDays(1)), ref header, ref output_st_total, ref output_st_total_desconto, ref output_st_csv_subtotal, ref output_st_csv_subtotal_desconto, ref output_st_content_block, ref output_st_emp_loj_block, ref output_CartaoAtiv, ref output_Extras, ref output_FixoTrans, ref output_Percent, ref output_TBM)) { stat.Close(); return(false); } stat.LblActivity.Text = "Buscando detalhes de faturamento"; Application.DoEvents(); // index de todos os itens de cobrança Hashtable hsh_Memory = new Hashtable(); 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)) { for (int t = 0; t < tmp_memory.Count; ++t) { Rel_FAT f_t = new Rel_FAT(tmp_memory [t] as DataPortable); if (hsh_Memory [f_t.get_fk_fatura()] == null) { hsh_Memory [f_t.get_fk_fatura()] = new ArrayList(); } ArrayList tmp = hsh_Memory [f_t.get_fk_fatura()] as ArrayList; tmp.Add(f_t); } } } // lista de todas as empresas e lojas ArrayList full_memory_ent = new ArrayList(); stat.LblActivity.Text = "Buscando lista de lojas e empresas"; Application.DoEvents(); while (output_st_emp_loj_block != "") { ArrayList tmp_memory = new ArrayList(); if (var_exchange.fetch_memory(output_st_emp_loj_block, "200", ref output_st_emp_loj_block, ref tmp_memory)) { for (int t = 0; t < tmp_memory.Count; ++t) { Entidade ent = new Entidade(tmp_memory[t] as DataPortable); full_memory_ent.Add(ent); } } } stat.LblActivity.Text = "Gerando relatório para web"; Application.DoEvents(); stat.pgStatus.Maximum = full_memory_ent.Count; stat.pgStatus.Minimum = 0; money money_helper = new money(); // tradução do indice para texto ArrayList desc = new TipoFatDesc().GetArray(); // Passa por todas as empresas e lojas for (int g = 0; g < full_memory_ent.Count; ++g) { Entidade ent = full_memory_ent [g] as Entidade; stat.pgStatus.Value = g + 1; Application.DoEvents(); // Sub-título lstMessages.Add(ent.get_st_nome()); lstTableSizes.Add(500); ArrayList lst_sub_tbl_head = new ArrayList(); lst_sub_tbl_head.Add("Descrição de item faturado"); lst_sub_tbl_head.Add("Valor Cobrança R$"); lstHeader.Add(lst_sub_tbl_head); // Lista de items ArrayList my_cobranca = new ArrayList(); // Obtem index da memoria ArrayList lstMemory = hsh_Memory [ent.get_fk_fatura()] as ArrayList; if (lstMemory == null) { my_cobranca.Add(new ArrayList()); } else { for (int t = 0; t < lstMemory.Count; ++t) { Rel_FAT f_t = lstMemory [t] as Rel_FAT; // Lista de items para uma linha ArrayList lst_sub_content = new ArrayList(); string st_desc = ""; string vr_cob = ""; switch (f_t.get_tg_tipoFat()) { case TipoFat.Extras: st_desc = "Extra: " + f_t.get_st_extra(); break; case TipoFat.TBM: st_desc = "Tarifa básica mensal"; break; case TipoFat.CartaoAtiv: st_desc = "Tarifa por cartões ativos"; break; case TipoFat.FixoTrans: st_desc = "Valor sobre Transações"; break; case TipoFat.Percent: st_desc = "Percentual sobre Transações"; break; default: break; } if (f_t.get_tg_desconto() == Context.TRUE) { vr_cob = "-" + f_t.get_vr_cob(); } else { vr_cob = f_t.get_vr_cob(); } lst_sub_content.Add(st_desc); lst_sub_content.Add(money_helper.formatToMoney(vr_cob)); my_cobranca.Add(lst_sub_content); } } lstContent.Add(my_cobranca); ArrayList lst_sub_foot = new ArrayList(); var_util.indexCSV(output_st_csv_subtotal); lst_sub_foot.Add("Sub-Total: R$ " + money_helper.formatToMoney(var_util.getCSV(g))); var_util.indexCSV(output_st_csv_subtotal_desconto); lst_sub_foot.Add("Sub-Total desconto: R$ " + money_helper.formatToMoney(var_util.getCSV(g))); if (g == full_memory_ent.Count - 1) { lst_sub_foot.Add(""); lst_sub_foot.Add("Total de faturamento no período: R$ " + money_helper.formatToMoney(output_st_total)); lst_sub_foot.Add("Total em descontos no faturamento no período: R$ " + money_helper.formatToMoney(output_st_total_desconto)); lst_sub_foot.Add(""); lst_sub_foot.Add("Valor em cartões ativos: " + money_helper.formatToMoney(output_CartaoAtiv)); lst_sub_foot.Add("Valor em despesas extras: " + money_helper.formatToMoney(output_Extras)); lst_sub_foot.Add("Valor fixo por transações: " + money_helper.formatToMoney(output_FixoTrans)); lst_sub_foot.Add("Valor por percentual em transações: " + money_helper.formatToMoney(output_Percent)); lst_sub_foot.Add("Valor em mensalidades: " + money_helper.formatToMoney(output_TBM)); } lstFooter.Add(lst_sub_foot); } stat.Close(); SyCrafReport rel = new SyCrafReport("Relatório de faturamento pendente", "RFP", "", ctrl_TxtDtIni.getTextBoxValue(), ctrl_TxtDtFim.getTextBoxValue(), ref lstHeader, ref lstContent, ref lstTableSizes, ref lstFooter, ref lstMessages, ref lstFilters); #endregion } else { #region - pagos - // ############################## // # SETUP LISTS ################ // ############################## ArrayList lstHeader = new ArrayList(); ArrayList lstContent = new ArrayList(); ArrayList lstTableSizes = new ArrayList(); ArrayList lstFooter = new ArrayList(); ArrayList lstMessages = new ArrayList(); ArrayList lstFilters = new ArrayList(); // ############################## // # CUSTOMIZE // ############################## string output_st_total = ""; string output_st_content_block = ""; int sel = i_Form.CboRelat.SelectedIndex; string tg_type = ""; string st_rel = ""; switch (sel) { case 1: tg_type = TipoSitFat.EmCobrança; st_rel = "Relatório de faturamento em cobrança"; break; case 2: tg_type = TipoSitFat.PagoDoc; st_rel = "Relatório de faturamento pago com doc"; break; case 3: tg_type = TipoSitFat.PagoCC; st_rel = "Relatório de faturamento pago em débito em conta"; break; case 4: tg_type = TipoSitFat.BaixaCfeInst; st_rel = "Relatório de faturamento baixado conforme instrução banco"; break; } dlgStatus stat = new dlgStatus("Relatório"); stat.LblActivity.Text = "Processando relatório no servidor"; stat.Show(); Application.DoEvents(); if (!var_exchange.fetch_relFat(var_util.GetDataBaseTimeFormat(ctrl_TxtDtIni.getTextBoxValue_Date()), var_util.GetDataBaseTimeFormat(ctrl_TxtDtFim.getTextBoxValue_Date().AddDays(1)), tg_type, ref header, ref output_st_total, ref output_st_content_block)) { stat.Close(); i_Form.BtnConfirmar.Enabled = true; return(false); } stat.LblActivity.Text = "Buscando detalhes de faturamento"; Application.DoEvents(); ArrayList full_memory = new ArrayList(); ArrayList sortMem = new ArrayList(); while (output_st_content_block != "") { ArrayList tmp_memory = new ArrayList(); if (var_exchange.fetch_memory(output_st_content_block, "500", ref output_st_content_block, ref tmp_memory)) { for (int t = 0; t < tmp_memory.Count; ++t) { Rel_FatCompleto tmp = new Rel_FatCompleto(tmp_memory[t] as DataPortable); sortMem.Add(tmp.get_st_nome()); full_memory.Add(tmp); } } } sortMem.Sort(); stat.LblActivity.Text = "Gerando relatório para web"; Application.DoEvents(); stat.pgStatus.Maximum = full_memory.Count; stat.pgStatus.Minimum = 0; money money_helper = new money(); ArrayList lst_sub_tbl_head = new ArrayList(); lst_sub_tbl_head.Add("Empresa/Loja"); lst_sub_tbl_head.Add("Cobrança R$"); lst_sub_tbl_head.Add("Vencimento"); lst_sub_tbl_head.Add("Cód. Banco"); lst_sub_tbl_head.Add("Mensagem"); lst_sub_tbl_head.Add("Data Baixa"); lstHeader.Add(lst_sub_tbl_head); // Sub-título lstMessages.Add(""); lstTableSizes.Add(800); ArrayList lst_lines = new ArrayList(); for (int g = 0; g < sortMem.Count; ++g) { stat.pgStatus.Value = g + 1; Application.DoEvents(); for (int u = 0; u < full_memory.Count; ++u) { Rel_FatCompleto rel = full_memory [u] as Rel_FatCompleto; if (rel.get_st_nome() != sortMem[g].ToString()) { continue; } // Lista de items para uma linha ArrayList lst_sub_content = new ArrayList(); lst_sub_content.Add(rel.get_st_nome()); lst_sub_content.Add(money_helper.formatToMoney(rel.get_vr_cobranca())); lst_sub_content.Add(var_util.getDDMMYYYY_format(rel.get_dt_vencimento()).Substring(0, 10)); if (rel.get_dt_baixa() == "") { lst_sub_content.Add("-"); lst_sub_content.Add("-"); lst_sub_content.Add("-"); } else { lst_sub_content.Add(rel.get_cod_retBanco()); lst_sub_content.Add(rel.get_st_msgBanco()); lst_sub_content.Add(var_util.getDDMMYYYY_format(rel.get_dt_baixa()).Substring(0, 10)); } lst_lines.Add(lst_sub_content); if (g == full_memory.Count - 1) { ArrayList lst_sub_foot = new ArrayList(); lst_sub_foot.Add("Total contabilizado no período: R$ " + money_helper.formatToMoney(output_st_total)); lstFooter.Add(lst_sub_foot); } } } lstContent.Add(lst_lines); stat.Close(); Application.DoEvents(); SyCrafReport relat = new SyCrafReport(st_rel, "RFD", "Lista completa de empresas e lojas", ctrl_TxtDtIni.getTextBoxValue(), ctrl_TxtDtFim.getTextBoxValue(), ref lstHeader, ref lstContent, ref lstTableSizes, ref lstFooter, ref lstMessages, ref lstFilters); #endregion } i_Form.BtnConfirmar.Enabled = true; //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_TxtNSU.AcquireTextBox(i_Form.TxtNSU, this, event_val_TxtNSU, 6); ctrl_TxtTelefone.AcquireTextBox(i_Form.TxtTelefone, this, event_val_TxtTelefone, 10); ctrl_TxtTelLojista.AcquireTextBox(i_Form.TxtTelLojista, this, event_val_TelLojista, 10); ctrl_TxtNSU.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtTelefone.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtTelLojista.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 IsDone = true; if (!ctrl_TxtTelefone.IsUserValidated) { ctrl_TxtTelefone.SetErrorMessage("Telefone deve ter 10 caracteres"); IsDone = false; } if (!ctrl_TxtTelLojista.IsUserValidated) { ctrl_TxtTelLojista.SetErrorMessage("Telefone do lojista deve ter 10 caracteres"); IsDone = false; } if (!ctrl_TxtNSU.IsUserValidated) { ctrl_TxtNSU.SetErrorMessage("NSU deve estar preenchido"); IsDone = false; } if (!IsDone) { return(false); } StringBuilder sb_send_pend = new StringBuilder("05PFXV"); sb_send_pend.Append(ctrl_TxtTelefone.getTextBoxValue()); sb_send_pend.Append(ctrl_TxtTelLojista.getTextBoxValue()); sb_send_pend.Append(ctrl_TxtNSU.getTextBoxValue().PadLeft(6, '0')); sb_send_pend.Append(Context.FALSE); string buf_response = var_exchange.m_Client.WriteServerMsg(sb_send_pend.ToString()); string cod_resp = buf_response.Substring(0, 2); string msg = buf_response.Substring(2, 20); if (cod_resp == "00") { MessageBox.Show("Sucesso no cancelamento de venda", "Aviso"); } else { MessageBox.Show(cod_resp + " - " + msg, "Erro"); } //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 = colorInvalid; ctrl_TxtNSU.IsUserValidated = false; } else { i_Form.TxtNSU.BackColor = Color.White; ctrl_TxtNSU.IsUserValidated = true; ctrl_TxtNSU.CleanError(); } 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 (ctrl_TxtTelefone.getTextBoxValue().Length < 10) { i_Form.TxtTelefone.BackColor = colorInvalid; ctrl_TxtTelefone.IsUserValidated = false; } else { i_Form.TxtTelefone.BackColor = Color.White; ctrl_TxtTelefone.IsUserValidated = true; ctrl_TxtTelefone.CleanError(); } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TelLojista - case event_val_TelLojista: { //InitEventCode event_val_TelLojista switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (ctrl_TxtTelLojista.getTextBoxValue().Length < 10) { i_Form.TxtTelLojista.BackColor = colorInvalid; ctrl_TxtTelLojista.IsUserValidated = false; } else { i_Form.TxtTelLojista.BackColor = Color.White; ctrl_TxtTelLojista.IsUserValidated = true; ctrl_TxtTelLojista.CleanError(); } break; } default: break; } //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 InstallData inst_data = new InstallData(); i_Form.LblVersion.Text = inst_data.st_version; ctrl_TxtNome.AcquireTextBox(i_Form.TxtNome, this, event_val_TxtNome, 20, alphaTextController.ENABLE_NUMBERS); ctrl_TxtEmpresa.AcquireTextBox(i_Form.TxtEmpresa, this, event_val_TxtEmpresa, 8, alphaTextController.ENABLE_NUMBERS); ctrl_TxtSenha.AcquireTextBox(i_Form.TxtSenha, this, event_val_TxtSenha, 16, alphaTextController.ENABLE_NUMBERS, alphaTextController.ENABLE_SYMBOLS); ctrl_TxtNome.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtEmpresa.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtSenha.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); //EndEventCode return(true); } #endregion #region - robot_ShowDialog - case robot_ShowDialog: { //InitEventCode robot_ShowDialog if (i_Form.IsDisposed) { i_Form = new dlgLogin(this); } i_Form.Show(); //EndEventCode return(true); } #endregion #region - robot_CloseDialog - case robot_CloseDialog: { //InitEventCode robot_CloseDialog i_Form.Close(); //EndEventCode return(true); } #endregion #region - event_Confirmar - case event_Confirmar: { //InitEventCode event_Confirmar bool IsDone = true; if (!ctrl_TxtNome.IsUserValidated) { ctrl_TxtNome.SetErrorMessage("Nome incompleto"); IsDone = false; } if (!ctrl_TxtSenha.IsUserValidated) { ctrl_TxtSenha.SetErrorMessage("Senha incompleta"); IsDone = false; } if (!IsDone) { return(false); } string tg_trocaSenha = ""; string var_st_empresa = ctrl_TxtEmpresa.getTextBoxValue(); string st_senha_atual = var_util.getMd5Hash(ctrl_TxtSenha.getTextBoxValue()); if (var_exchange.exec_login(ctrl_TxtNome.getTextBoxValue(), var_st_empresa, st_senha_atual, ref tg_trocaSenha, ref header)) { if (tg_trocaSenha == Context.TRUE) { var_IsChangePass = true; } var_IsCanceled = false; var_st_nome = ctrl_TxtNome.getTextBoxValue(); i_Form.Close(); } else { if (!ctrl_TxtEmpresa.IsUserValidated) { ctrl_TxtEmpresa.SetErrorMessage("Código de empresa incompleto"); } } //EndEventCode return(true); } #endregion #region - event_val_TxtNome - case event_val_TxtNome: { //InitEventCode event_val_TxtNome switch (arg as string) { case alphaTextController.ALPHA_COMPLETE: case alphaTextController.ALPHA_INCOMPLETE: { if (ctrl_TxtNome.getTextBoxValue().Length > 3) { i_Form.TxtNome.BackColor = Color.White; ctrl_TxtNome.IsUserValidated = true; ctrl_TxtNome.CleanError(); } else { i_Form.TxtNome.BackColor = colorInvalid; ctrl_TxtNome.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtEmpresa - case event_val_TxtEmpresa: { //InitEventCode event_val_TxtEmpresa switch (arg as string) { case alphaTextController.ALPHA_COMPLETE: case alphaTextController.ALPHA_INCOMPLETE: { if (ctrl_TxtEmpresa.getTextBoxValue().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; } if (ctrl_TxtEmpresa.GetEnterPressed()) { doEvent(event_Confirmar, null); } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtSenha - case event_val_TxtSenha: { //InitEventCode event_val_TxtSenha switch (arg as string) { case alphaTextController.ALPHA_COMPLETE: case alphaTextController.ALPHA_INCOMPLETE: { if (ctrl_TxtSenha.getTextBoxValue().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; } if (ctrl_TxtSenha.GetEnterPressed()) { doEvent(event_Confirmar, null); } break; } default: break; } //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_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); }
public override bool doEvent(int event_number, object arg) { switch (event_number) { #region - event_Load - case event_Load: { //InitEventCode event_Load #if ROBOT var_util.execDefinedRobot(this, var_alias); #else doEvent(event_Translate, null); doEvent(event_FormIsOpening, null); #endif //EndEventCode return(true); } #endregion #region - event_Translate - case event_Translate: { //InitEventCode event_Translate //EndEventCode return(true); } #endregion #region - event_FormIsOpening - case event_FormIsOpening: { //InitEventCode event_FormIsOpening i_Form.Text = title; i_Form.LblObs.Text = message; ctrl_TxtMotivo.AcquireTextBox(i_Form.TxtMotivo, this, event_val_TxtMotivo, 80, alphaTextController.ENABLE_NUMBERS, alphaTextController.ENABLE_SYMBOLS); //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 i_Form.Close(); //EndEventCode return(true); } #endregion #region - event_val_TxtMotivo - case event_val_TxtMotivo: { //InitEventCode event_val_TxtMotivo switch (arg as string) { case alphaTextController.ALPHA_COMPLETE: case alphaTextController.ALPHA_INCOMPLETE: { if (ctrl_TxtMotivo.getTextBoxValue().Length > 0) { i_Form.TxtMotivo.BackColor = Color.White; ctrl_TxtMotivo.IsUserValidated = true; ctrl_TxtMotivo.CleanError(); } else { i_Form.TxtMotivo.BackColor = colorInvalid; ctrl_TxtMotivo.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_FormIsClosing - case event_FormIsClosing: { //InitEventCode event_FormIsClosing FormClosingEventArgs e = arg as FormClosingEventArgs; if (!ctrl_TxtMotivo.IsUserValidated) { e.Cancel = true; } //EndEventCode return(true); } #endregion #region - event_BtnConfirmarClick - case event_BtnConfirmarClick: { //InitEventCode event_BtnConfirmarClick //EndEventCode return(true); } #endregion #region - event_DlgObservacaoFormClosing - case event_DlgObservacaoFormClosing: { //InitEventCode event_DlgObservacaoFormClosing //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_TxtSenhaAtual.AcquireTextBox(i_Form.TxtSenhaAtual, this, event_val_TxtSenhaAtual, 16, alphaTextController.ENABLE_NUMBERS, alphaTextController.ENABLE_SYMBOLS); ctrl_TxtNovaSenha.AcquireTextBox(i_Form.TxtNovaSenha, this, event_val_TxtNovaSenha, 16, alphaTextController.ENABLE_NUMBERS, alphaTextController.ENABLE_SYMBOLS); ctrl_TxtConfirmaSenha.AcquireTextBox(i_Form.TxtConfirmaSenha, this, event_val_TxtConfirmaSenha, 16, alphaTextController.ENABLE_NUMBERS, alphaTextController.ENABLE_SYMBOLS); ctrl_TxtNovaSenha.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtConfirmaSenha.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 if (ctrl_TxtNovaSenha.getTextBoxValue() != ctrl_TxtConfirmaSenha.getTextBoxValue()) { ctrl_TxtConfirmaSenha.SetErrorMessage("Senha inválida"); return(false); } if (!ctrl_TxtNovaSenha.IsUserValidated) { ctrl_TxtNovaSenha.SetErrorMessage("Senha incompleta"); ctrl_TxtConfirmaSenha.SetErrorMessage("Senha incompleta"); return(false); } string st_senha_atual = var_util.getMd5Hash(ctrl_TxtSenhaAtual.getTextBoxValue()); string st_senha_nova = var_util.getMd5Hash(ctrl_TxtNovaSenha.getTextBoxValue()); if (var_exchange.exec_trocaSenha(st_senha_atual, st_senha_nova, ref header)) { var_IsCanceled = false; i_Form.Close(); } //EndEventCode return(true); } #endregion #region - event_val_TxtSenhaAtual - case event_val_TxtSenhaAtual: { //InitEventCode event_val_TxtSenhaAtual switch (arg as string) { case alphaTextController.ALPHA_COMPLETE: case alphaTextController.ALPHA_INCOMPLETE: { if (ctrl_TxtSenhaAtual.getTextBoxValue().Length > 3) { i_Form.TxtSenhaAtual.BackColor = Color.White; ctrl_TxtSenhaAtual.IsUserValidated = true; } else { i_Form.TxtSenhaAtual.BackColor = colorInvalid; ctrl_TxtSenhaAtual.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtNovaSenha - case event_val_TxtNovaSenha: { //InitEventCode event_val_TxtNovaSenha switch (arg as string) { case alphaTextController.ALPHA_COMPLETE: case alphaTextController.ALPHA_INCOMPLETE: { if (ctrl_TxtNovaSenha.getTextBoxValue().Length > 3) { i_Form.TxtNovaSenha.BackColor = Color.White; ctrl_TxtNovaSenha.IsUserValidated = true; ctrl_TxtNovaSenha.CleanError(); } else { i_Form.TxtNovaSenha.BackColor = colorInvalid; ctrl_TxtNovaSenha.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtConfirmaSenha - case event_val_TxtConfirmaSenha: { //InitEventCode event_val_TxtConfirmaSenha switch (arg as string) { case alphaTextController.ALPHA_COMPLETE: case alphaTextController.ALPHA_INCOMPLETE: { if (ctrl_TxtConfirmaSenha.getTextBoxValue().Length > 3) { i_Form.TxtConfirmaSenha.BackColor = Color.White; ctrl_TxtConfirmaSenha.IsUserValidated = true; ctrl_TxtConfirmaSenha.CleanError(); } else { i_Form.TxtConfirmaSenha.BackColor = colorInvalid; ctrl_TxtConfirmaSenha.IsUserValidated = false; } break; } default: break; } //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); if (header.get_tg_user_type() == TipoUsuario.Administrador || header.get_tg_user_type() == TipoUsuario.AdminGift) { ctrl_TxtEmpresa.SetTextBoxText(header.get_st_empresa()); i_Form.TxtEmpresa.ReadOnly = true; doEvent(event_BuscaDados, ctrl_TxtEmpresa.getTextBoxValue()); } else // root { ctrl_TxtEmpresa.SetTextBoxText("0"); doEvent(event_BuscaDados, null); } //EndEventCode return(true); } #endregion #region - robot_ShowDialog - case robot_ShowDialog: { //InitEventCode robot_ShowDialog //EndEventCode return(true); } #endregion #region - robot_CloseDialog - case robot_CloseDialog: { //InitEventCode robot_CloseDialog //EndEventCode return(true); } #endregion #region - event_Confirmar - case event_Confirmar: { //InitEventCode event_Confirmar if (i_Form.CboAcao.SelectedItem != null) { if (i_Form.LstUsuarios.SelectedItems.Count > 0) { var_exchange.exec_alteraUsuario(i_Form.CboAcao.SelectedIndex.ToString(), var_util.getSelectedListViewItemTag(i_Form.LstUsuarios), ref header); doEvent(event_BuscaDados, ctrl_TxtEmpresa.getTextBoxValue()); } } //EndEventCode return(true); } #endregion #region - event_Detalhes - case event_Detalhes: { //InitEventCode event_Detalhes //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, ctrl_TxtEmpresa.getTextBoxValue()); } } else { i_Form.TxtEmpresa.BackColor = colorInvalid; ctrl_TxtEmpresa.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_BuscaDados - case event_BuscaDados: { //InitEventCode event_BuscaDados i_Form.LstUsuarios.Items.Clear(); ArrayList list = new ArrayList(); string st_csv_id = ""; var_util.clearPortable(); // customiza header! CNetHeader head = new CNetHeader(header as DataPortable); head.set_st_empresa(arg as string); i_Form.LstUsuarios.Items.Clear(); if (var_exchange.fetch_listaUsuarios(ref head, 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, "200", 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 TipoUsuarioDesc().GetArray(); for (int t = 0; t < full_memory.Count; ++t) { DadosUsuario info = new DadosUsuario(full_memory[t] as DataPortable); string id = info.get_id_usuario(); string nome = info.get_st_nome(); string bloq = info.get_tg_bloqueio(); string nivel = desc [Convert.ToInt32(info.get_tg_nivel())].ToString(); string empresa = info.get_st_empresa(); if (bloq == Context.TRUE) { bloq = "Sim"; } else { bloq = "Não"; } if (empresa == "000000") { empresa = ""; } switch (nivel) { case TipoUsuario.SuperUser: nivel = "Super Usuário"; break; case TipoUsuario.Administrador: nivel = "Administrador"; break; case TipoUsuario.Operador: nivel = "Operador"; break; default: break; } string [] full_row = new string [] { nome, bloq, nivel, empresa }; i_Form.LstUsuarios.Items.Add(var_util.GetListViewItem(id, full_row)); } } //EndEventCode return(true); } #endregion #region - event_BtnConfirmarClick - case event_BtnConfirmarClick: { //InitEventCode event_BtnConfirmarClick //EndEventCode return(true); } #endregion default: break; } return(false); }
public override bool doEvent(int event_number, object arg) { switch (event_number) { #region - event_Load - case event_Load: { //InitEventCode event_Load #if ROBOT var_util.execDefinedRobot(this, var_alias); #else doEvent(event_Translate, null); doEvent(event_FormIsOpening, null); #endif //EndEventCode return(true); } #endregion #region - event_Translate - case event_Translate: { //InitEventCode event_Translate //EndEventCode return(true); } #endregion #region - event_FormIsOpening - case event_FormIsOpening: { //InitEventCode event_FormIsOpening ctrl_TxtNome.AcquireTextBox(i_Form.TxtNome, this, event_val_TxtNome, 40); ctrl_TxtCidade.AcquireTextBox(i_Form.TxtCidade, this, event_val_TxtCidade, 20, false); ctrl_TxtEstado.AcquireTextBox(i_Form.TxtEstado, this, event_val_TxtEstado, 2, false); ctrl_TxtQtdCartoes.AcquireTextBox(i_Form.TxtQtdCartoes, this, event_val_TxtQtdCartoes, 6); ctrl_TxtQtdParc.AcquireTextBox(i_Form.TxtQtdParc, this, event_val_TxtQtdParc, 6); ctrl_TxtQtdLojas.AcquireTextBox(i_Form.TxtQtdLojas, this, event_val_TxtQtdLojas, 6); ctrl_TxtVrMin.AcquireTextBox(i_Form.TxtVrMin, this, event_val_TxtVrMin, "R$", 6); ctrl_TxtVrMax.AcquireTextBox(i_Form.TxtVrMax, this, event_val_TxtVrMax, "R$", 6); //EndEventCode return(true); } #endregion #region - robot_ShowDialog - case robot_ShowDialog: { //InitEventCode robot_ShowDialog //EndEventCode return(true); } #endregion #region - robot_CloseDialog - case robot_CloseDialog: { //InitEventCode robot_CloseDialog //EndEventCode return(true); } #endregion #region - event_val_TxtNome - case event_val_TxtNome: { //InitEventCode event_val_TxtNome switch (arg as string) { case alphaTextController.ALPHA_COMPLETE: case alphaTextController.ALPHA_INCOMPLETE: { if (ctrl_TxtNome.getTextBoxValue().Length > 0) { i_Form.TxtNome.BackColor = Color.White; ctrl_TxtNome.IsUserValidated = true; } else { i_Form.TxtNome.BackColor = colorInvalid; ctrl_TxtNome.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtCidade - case event_val_TxtCidade: { //InitEventCode event_val_TxtCidade switch (arg as string) { case alphaTextController.ALPHA_COMPLETE: case alphaTextController.ALPHA_INCOMPLETE: { if (ctrl_TxtCidade.getTextBoxValue().Length > 0) { i_Form.TxtCidade.BackColor = Color.White; ctrl_TxtCidade.IsUserValidated = true; } else { i_Form.TxtCidade.BackColor = colorInvalid; ctrl_TxtCidade.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtEstado - case event_val_TxtEstado: { //InitEventCode event_val_TxtEstado switch (arg as string) { case alphaTextController.ALPHA_COMPLETE: case alphaTextController.ALPHA_INCOMPLETE: { if (ctrl_TxtEstado.getTextBoxValue().Length > 0) { i_Form.TxtEstado.BackColor = Color.White; ctrl_TxtEstado.IsUserValidated = true; } else { i_Form.TxtEstado.BackColor = colorInvalid; ctrl_TxtEstado.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtQtdCartoes - case event_val_TxtQtdCartoes: { //InitEventCode event_val_TxtQtdCartoes switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (ctrl_TxtQtdCartoes.getTextBoxValue().Length > 0) { i_Form.TxtQtdCartoes.BackColor = Color.White; ctrl_TxtQtdCartoes.IsUserValidated = true; } else { i_Form.TxtQtdCartoes.BackColor = colorInvalid; ctrl_TxtQtdCartoes.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtQtdParc - case event_val_TxtQtdParc: { //InitEventCode event_val_TxtQtdParc switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (ctrl_TxtQtdParc.getTextBoxValue().Length > 0) { i_Form.TxtQtdParc.BackColor = Color.White; ctrl_TxtQtdParc.IsUserValidated = true; } else { i_Form.TxtQtdParc.BackColor = colorInvalid; ctrl_TxtQtdParc.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtVrMin - case event_val_TxtVrMin: { //InitEventCode event_val_TxtVrMin if (ctrl_TxtVrMin.getTextBoxValue_Long() > 0) { i_Form.TxtVrMin.BackColor = Color.White; ctrl_TxtVrMin.IsUserValidated = true; } else { i_Form.TxtVrMin.BackColor = colorInvalid; ctrl_TxtVrMin.IsUserValidated = false; } //EndEventCode return(true); } #endregion #region - event_val_TxtVrMax - case event_val_TxtVrMax: { //InitEventCode event_val_TxtVrMax if (ctrl_TxtVrMax.getTextBoxValue_Long() > 0) { i_Form.TxtVrMax.BackColor = Color.White; ctrl_TxtVrMax.IsUserValidated = true; } else { i_Form.TxtVrMax.BackColor = colorInvalid; ctrl_TxtVrMax.IsUserValidated = false; } //EndEventCode return(true); } #endregion #region - event_Consultar - case event_Consultar: { //InitEventCode event_Consultar i_Form.BtnConsultar.Enabled = false; DadosConsultaEmpresa dce = new DadosConsultaEmpresa(); dce.set_st_nome(ctrl_TxtNome.getTextBoxValue()); dce.set_st_cidade(ctrl_TxtCidade.getTextBoxValue()); dce.set_st_estado(ctrl_TxtEstado.getTextBoxValue()); dce.set_nu_cartoes(ctrl_TxtQtdCartoes.getTextBoxValue()); dce.set_nu_parcelas(ctrl_TxtQtdParc.getTextBoxValue()); dce.set_vr_taxa_min(ctrl_TxtVrMin.getTextBoxValue_NumberStr()); dce.set_vr_taxa_max(ctrl_TxtVrMax.getTextBoxValue_NumberStr()); dce.set_nu_lojas(ctrl_TxtQtdLojas.getTextBoxValue()); string st_csv_id = ""; i_Form.LstEmpresas.Items.Clear(); Application.DoEvents(); if (var_exchange.fetch_consultaEmpresa(ref dce, ref header, ref st_csv_id)) { ArrayList full_memory = new ArrayList(); while (st_csv_id != "") { ArrayList tmp_memory = new ArrayList(); if (var_exchange.fetch_memory(st_csv_id, "400", ref st_csv_id, ref tmp_memory)) { for (int t = 0; t < tmp_memory.Count; ++t) { full_memory.Add(tmp_memory[t]); } } } for (int t = 0; t < full_memory.Count; ++t) { DadosEmpresa de = new DadosEmpresa(full_memory[t] as DataPortable); string [] full_row = new string [] { de.get_st_empresa(), de.get_st_fantasia(), de.get_st_cidade(), de.get_st_estado(), de.get_nu_cartoes(), de.get_nu_parcelas(), "R$ " + new money().formatToMoney(de.get_vr_mensalidade()), de.get_nu_lojas(), de.get_nu_CNPJ() }; i_Form.LstEmpresas.Items.Add(var_util.GetListViewItem(de.get_st_empresa(), full_row)); } } i_Form.BtnConsultar.Enabled = true; //EndEventCode return(true); } #endregion #region - event_Editar - case event_Editar: { //InitEventCode event_Editar if (i_Form.LstEmpresas.SelectedItems.Count > 0) { event_dlgNovaEmpresa ev_call = new event_dlgNovaEmpresa(var_util, var_exchange); ev_call.header = header; ev_call.IsMaintenance = true; ev_call.par_code = var_util.getSelectedListViewItemTag(i_Form.LstEmpresas); ev_call.i_Form.ShowDialog(); } //EndEventCode return(true); } #endregion #region - event_val_TxtQtdLojas - case event_val_TxtQtdLojas: { //InitEventCode event_val_TxtQtdLojas switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (ctrl_TxtQtdLojas.getTextBoxValue().Length > 0) { i_Form.TxtQtdLojas.BackColor = Color.White; ctrl_TxtQtdLojas.IsUserValidated = true; } else { i_Form.TxtQtdLojas.BackColor = colorInvalid; ctrl_TxtQtdLojas.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_Cancelar - case event_Cancelar: { //InitEventCode event_Cancelar if (i_Form.LstEmpresas.SelectedItems.Count > 0) { dlgAutorizacao autor = new dlgAutorizacao(); autor.ShowDialog(); Application.DoEvents(); var_exchange.exec_cancelaEmpresa(var_util.getMd5Hash(autor.senha), new ApplicationUtil().getSelectedListViewItemTag(i_Form.LstEmpresas), ref header); } //EndEventCode return(true); } #endregion #region - event_BtnConsultarClick - case event_BtnConsultarClick: { //InitEventCode event_BtnConsultarClick //EndEventCode return(true); } #endregion #region - event_LstEmpresasDoubleClick - case event_LstEmpresasDoubleClick: { //InitEventCode event_LstEmpresasDoubleClick //EndEventCode return(true); } #endregion #region - event_BtnCancelarClick - case event_BtnCancelarClick: { //InitEventCode event_BtnCancelarClick //EndEventCode return(true); } #endregion default: break; } return(false); }
public override bool doEvent(int event_number, object arg) { switch (event_number) { #region - event_Load - case event_Load: { //InitEventCode event_Load #if ROBOT var_util.execDefinedRobot(this, var_alias); #else doEvent(event_Translate, null); doEvent(event_FormIsOpening, null); #endif //EndEventCode return(true); } #endregion #region - event_Translate - case event_Translate: { //InitEventCode event_Translate //EndEventCode return(true); } #endregion #region - event_FormIsOpening - case event_FormIsOpening: { //InitEventCode event_FormIsOpening 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, 2); ctrl_TxtEmpresa.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtMatricula.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtTitularidade.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); if (header.get_tg_user_type() == TipoUsuario.Administrador || header.get_tg_user_type() == TipoUsuario.Operador) { 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_Confirmar - case event_Confirmar: { //InitEventCode event_Confirmar if (!ctrl_TxtEmpresa.IsUserValidated) { ctrl_TxtEmpresa.SetErrorMessage("Código de empresa deve estar preenchido"); return(false); } if (!ctrl_TxtMatricula.IsUserValidated) { ctrl_TxtMatricula.SetErrorMessage("Código de matrícula deve estar preenchido"); return(false); } if (!ctrl_TxtTitularidade.IsUserValidated) { ctrl_TxtTitularidade.SetErrorMessage("Código de titularidade deve estar preenchido"); return(false); } var_exchange.exec_segundaVia(ctrl_TxtEmpresa.getTextBoxValue(), ctrl_TxtMatricula.getTextBoxValue(), ctrl_TxtTitularidade.getTextBoxValue(), ref header); //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_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(); if (ctrl_TxtMatricula.GetEnterPressed()) { doEvent(event_BuscaDados, null); } } else { i_Form.TxtMatricula.BackColor = colorInvalid; ctrl_TxtMatricula.IsUserValidated = false; } break; } default: break; } //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 > 0) { i_Form.TxtTitularidade.BackColor = Color.White; ctrl_TxtTitularidade.IsUserValidated = true; ctrl_TxtTitularidade.CleanError(); if (ctrl_TxtTitularidade.GetEnterPressed()) { doEvent(event_BuscaDados, null); } } else { i_Form.TxtTitularidade.BackColor = colorInvalid; ctrl_TxtTitularidade.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_BuscaDados - case event_BuscaDados: { //InitEventCode event_BuscaDados string maxParc = ""; string dispMes = ""; string dispTot = ""; string st_nome = ""; var_exchange.fetch_dadosCartao(ctrl_TxtEmpresa.getTextBoxValue().PadLeft(6, '0'), ctrl_TxtMatricula.getTextBoxValue().PadLeft(6, '0'), ctrl_TxtTitularidade.getTextBoxValue().PadLeft(2, '0'), ref header, ref maxParc, ref dispMes, ref dispTot, ref st_nome); i_Form.TxtNome.Text = st_nome; //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_TxtValor.AcquireTextBox(i_Form.TxtValor, this, event_val_TxtValor, "R$", 9); i_Form.LblParc.Text += tot_parcs.ToString(); i_Form.LblVrTot.Text = "Valor Total: R$ " + new money().setMoneyFormat(tot_valor); i_Form.LblDiff.Text = "Diferença: R$ 0,00"; long parc = tot_valor / tot_parcs; if (lstPar.Count == 0) { for (int t = 0; t < tot_parcs; ++t) { i_Form.LstParcs.Items.Add(new money().setMoneyFormat(parc)); } } else { for (int t = 0; t < lstPar.Count; ++t) { i_Form.LstParcs.Items.Add(new money().formatToMoney(lstPar[t].ToString())); } } //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_Redefinir - case event_Redefinir: { //InitEventCode event_Redefinir //EndEventCode return(true); } #endregion #region - event_Confirmar - case event_Confirmar: { //InitEventCode event_Confirmar if (vr_diff != 0) { MessageBox.Show("Corrigir a diferença nas parcelas", "Aviso"); } else { lstPar.Clear(); for (int t = 0; t < i_Form.LstParcs.Items.Count; ++t) { lstPar.Add(i_Form.LstParcs.Items [t].ToString().Replace(",", "").Replace(".", "")); } i_Form.Close(); } //EndEventCode return(true); } #endregion #region - event_val_TxtValor - case event_val_TxtValor: { //InitEventCode event_val_TxtValor if (ctrl_TxtValor.GetEnterPressed()) { if (i_Form.LstParcs.SelectedIndex >= 0) { vr_diff = 0; i_Form.LstParcs.Items [i_Form.LstParcs.SelectedIndex] = ctrl_TxtValor.getTextBoxValue(); for (int t = 0; t < i_Form.LstParcs.Items.Count; ++t) { vr_diff += new money().getNumericValue(i_Form.LstParcs.Items [t].ToString()); } vr_diff = tot_valor - vr_diff; i_Form.LblDiff.Text = "Diferença: R$ " + new money().setMoneyFormat(vr_diff); } } //EndEventCode return(true); } #endregion #region - event_LstClick - case event_LstClick: { //InitEventCode event_LstClick if (i_Form.LstParcs.SelectedIndex >= 0) { ctrl_TxtValor.SetTextBoxString(i_Form.LstParcs.SelectedItem.ToString()); } //EndEventCode return(true); } #endregion #region - event_LstParcsClick - case event_LstParcsClick: { //InitEventCode event_LstParcsClick //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_TxtCodAcesso.AcquireTextBox(i_Form.TxtCodAcesso, this, event_val_TxtCodAcesso, 4); ctrl_TxtCarga.AcquireTextBox(i_Form.TxtCarga, this, event_val_TxtCarga, "R$", 6); i_Form.LstDados.Items.Add("-Nome "); i_Form.LstDados.Items.Add(dp.get_st_nome()); i_Form.LstDados.Items.Add("-Cpf "); i_Form.LstDados.Items.Add(dp.get_st_cpf()); i_Form.LstDados.Items.Add("-Telefone "); i_Form.LstDados.Items.Add(dp.get_st_telefone()); i_Form.LstDados.Items.Add("-Endereço "); i_Form.LstDados.Items.Add(dp.get_st_endereco()); ArrayList lst = new ArrayList(); var_exchange.fetch_extraGift(ref header, ref lst); i_Form.LstProd.Items.Clear(); for (int t = 0; t < lst.Count; ++t) { DadosProdutoGift dpg = new DadosProdutoGift(lst[t] as DataPortable); string [] full_row = new string [] { dpg.get_st_nome(), "R$ " + new money().formatToMoney(dpg.get_vr_valor()) }; i_Form.LstProd.Items.Add(var_util.GetListViewItem(dpg.get_id_produto(), full_row)); if (recarga) { if (t == 1) { i_Form.LstProd.Items[t].Checked = true; } } else { if (t == 0) { i_Form.LstProd.Items[t].Checked = true; } } } if (recarga) { i_Form.Text = "Confirmação para recarga de cartão Gift"; } doEvent(event_CalcTotal, 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 (ctrl_TxtCarga.getTextBoxValue_Long() == 0) { MessageBox.Show("Informe o valor de carga", "Aviso"); return(false); } string tg_recarga = Context.FALSE; if (recarga) { tg_recarga = Context.TRUE; } if (!var_exchange.exec_validGift(ctrl_TxtCodAcesso.getTextBoxValue(), dc.get_st_empresa(), dc.get_st_matricula(), tg_recarga, ref header)) { return(false); } event_dlgFinalGift ev_call = new event_dlgFinalGift(var_util, var_exchange); ev_call.header = header; ev_call.da = da; ev_call.dp = dp; ev_call.dc = dc; ev_call.total = total; ev_call.carga = ctrl_TxtCarga.getTextBoxValue_Long(); ev_call.recarga = recarga; for (int t = 0; t < i_Form.LstProd.Items.Count; ++t) { if (i_Form.LstProd.Items[t].Checked == true) { ev_call.lstProdsNome.Add(i_Form.LstProd.Items[t].SubItems[0].Text); ev_call.lstProdsValor.Add(new money().getNumericValue(i_Form.LstProd.Items[t].SubItems[1].Text.Replace("R$", "")).ToString()); } } ev_call.i_Form.ShowDialog(); i_Form.IsTerm = ev_call.IsTerm; i_Form.Close(); //EndEventCode return(true); } #endregion #region - event_val_TxtCarga - case event_val_TxtCarga: { //InitEventCode event_val_TxtCarga doEvent(event_CalcTotal, null); //EndEventCode return(true); } #endregion #region - event_CalcTotal - case event_CalcTotal: { //InitEventCode event_CalcTotal total = ctrl_TxtCarga.getTextBoxValue_Long(); for (int t = 0; t < i_Form.LstProd.Items.Count; ++t) { if (recarga) { if (t == 1) { if (i_Form.LstProd.Items[t].Checked == false) { i_Form.LstProd.Items[t].Checked = true; return(false); } } } else { if (t == 0) { if (i_Form.LstProd.Items[t].Checked == false) { i_Form.LstProd.Items[t].Checked = true; return(false); } } } if (i_Form.LstProd.Items[t].Checked == true) { total += new money().getNumericValue(i_Form.LstProd.Items[t].SubItems[1].Text.Replace("R$", "")); } } i_Form.LblTotal.Text = "Total: R$ " + new money().formatToMoney(total.ToString()); //EndEventCode return(true); } #endregion #region - event_FormIsClosing - case event_FormIsClosing: { //InitEventCode event_FormIsClosing //EndEventCode return(true); } #endregion #region - event_val_TxtCodAcesso - case event_val_TxtCodAcesso: { //InitEventCode event_val_TxtCodAcesso //EndEventCode return(true); } #endregion #region - event_BtnConfirmarClick - case event_BtnConfirmarClick: { //InitEventCode event_BtnConfirmarClick //EndEventCode return(true); } #endregion #region - event_LstProdItemChecked - case event_LstProdItemChecked: { //InitEventCode event_LstProdItemChecked //EndEventCode return(true); } #endregion #region - event_DlgConfGiftCardFormClosing - case event_DlgConfGiftCardFormClosing: { //InitEventCode event_DlgConfGiftCardFormClosing //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); 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_Confirmar - case event_Confirmar: { //InitEventCode event_Confirmar DadosProprietario dp = new DadosProprietario(); DadosCartao dc = new DadosCartao(); DadosAdicionais da = new DadosAdicionais(); if (var_exchange.fetch_proprietarioGift(ctrl_TxtMatricula.getTextBoxValue(), ref header, ref dp)) { dc.set_st_empresa(ctrl_TxtEmpresa.getTextBoxValue()); dc.set_st_matricula(ctrl_TxtMatricula.getTextBoxValue()); event_dlgConfGiftCard ev_call = new event_dlgConfGiftCard(var_util, var_exchange); ev_call.header = header; ev_call.dp = dp; ev_call.da = da; ev_call.dc = dc; ev_call.recarga = true; ev_call.i_Form.ShowDialog(); i_Form.Close(); } //EndEventCode return(true); } #endregion #region - event_val_TxtEmpresa - case event_val_TxtEmpresa: { //InitEventCode event_val_TxtEmpresa switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (i_Form.TxtEmpresa.Text.Length > 0) { i_Form.TxtEmpresa.BackColor = Color.White; ctrl_TxtEmpresa.IsUserValidated = true; ctrl_TxtEmpresa.CleanError(); if (ctrl_TxtEmpresa.GetEnterPressed()) { doEvent(event_val_TxtCartao, null); } } else { i_Form.TxtEmpresa.BackColor = colorInvalid; ctrl_TxtEmpresa.IsUserValidated = false; } break; } default: break; } //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(); if (ctrl_TxtMatricula.GetEnterPressed()) { doEvent(event_val_TxtCartao, null); } } else { i_Form.TxtMatricula.BackColor = colorInvalid; ctrl_TxtMatricula.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtTit - case event_val_TxtTit: { //InitEventCode event_val_TxtTit //EndEventCode return(true); } #endregion #region - event_val_TxtCartao - case event_val_TxtCartao: { //InitEventCode event_val_TxtCartao if (!ctrl_TxtEmpresa.IsUserValidated && !ctrl_TxtMatricula.IsUserValidated) { return(false); } string empresa = ctrl_TxtEmpresa.getTextBoxValue(); string matricula = ctrl_TxtMatricula.getTextBoxValue(); string titularidade = "01"; string output_nu_maxParcelas = ""; string output_vr_dispMes = ""; string output_vr_dispTotal = ""; string output_st_nome = ""; if (var_exchange.fetch_dadosCartao(empresa, matricula, titularidade, ref header, ref output_nu_maxParcelas, ref output_vr_dispMes, ref output_vr_dispTotal, ref output_st_nome)) { i_Form.TxtNome.Text = output_st_nome; } //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 if (header.get_tg_user_type() == TipoUsuario.Lojista) { ArrayList lst = new ArrayList(); var_exchange.fetch_lojistaEmpresas(header.get_st_empresa(), ref header, ref lst); for (int t = 0; t < lst.Count; ++t) { DadosEmpresa de = new DadosEmpresa(lst[t] as DataPortable); i_Form.LstEmp.Items.Add(de.get_st_empresa() + " " + de.get_st_fantasia()); } } //EndEventCode return(true); } #endregion #region - robot_ShowDialog - case robot_ShowDialog: { //InitEventCode robot_ShowDialog //EndEventCode return(true); } #endregion #region - robot_CloseDialog - case robot_CloseDialog: { //InitEventCode robot_CloseDialog //EndEventCode return(true); } #endregion #region - event_Confirmar - case event_Confirmar: { //InitEventCode event_Confirmar if (i_Form.LstEmp.SelectedIndex == -1) { return(false); } string st_empresa = i_Form.LstEmp.SelectedItem.ToString(); st_empresa = st_empresa.Substring(0, st_empresa.IndexOf(" ")); // ############################## // # SETUP LISTS ################ // ############################## ArrayList lstHeader = new ArrayList(); ArrayList lstContent = new ArrayList(); ArrayList lstTableSizes = new ArrayList(); ArrayList lstFooter = new ArrayList(); ArrayList lstMessages = new ArrayList(); ArrayList lstFilters = new ArrayList(); // ############################## // # CUSTOMIZE // ############################## string st_csv_contents = ""; dlgStatus stat = new dlgStatus("Relatório"); stat.LblActivity.Text = "Processando relatório no servidor"; stat.Show(); Application.DoEvents(); if (!var_exchange.fetch_rel_prevLojista(st_empresa, ref header, ref st_csv_contents)) { stat.Close(); return(false); } ArrayList full_memory = new ArrayList(); stat.LblActivity.Text = "Buscando detalhes..."; Application.DoEvents(); while (st_csv_contents != "") { ArrayList tmp_memory = new ArrayList(); if (var_exchange.fetch_memory(st_csv_contents, "400", ref st_csv_contents, ref tmp_memory)) { for (int t = 0; t < tmp_memory.Count; ++t) { full_memory.Add(tmp_memory[t]); } } } money money_helper = new money(); stat.LblActivity.Text = "Gerando relatório para web"; Application.DoEvents(); lstMessages.Add("Transações confirmadas para a loja: " + header.get_st_empresa()); lstTableSizes.Add(650); ArrayList lst_sub_tbl_head = new ArrayList(); lst_sub_tbl_head.Add("Cartão"); lst_sub_tbl_head.Add("NSU"); lst_sub_tbl_head.Add("Data e Hora"); lst_sub_tbl_head.Add("Parcela"); lst_sub_tbl_head.Add("Valor R$"); lst_sub_tbl_head.Add("Valor Repasse R$"); lstHeader.Add(lst_sub_tbl_head); long tot_repasse = 0; ArrayList my_line_container = new ArrayList(); for (int t = 0; t < full_memory.Count; ++t) { DadosRepasse dr = new DadosRepasse(full_memory[t] as DataPortable); ArrayList lst_line_content = new ArrayList(); lst_line_content.Add(dr.get_st_cartao()); lst_line_content.Add(dr.get_st_nsu()); lst_line_content.Add(var_util.getDDMMYYYY_format(dr.get_dt_trans())); lst_line_content.Add(dr.get_id_parcela()); lst_line_content.Add(money_helper.formatToMoney(dr.get_vr_total())); lst_line_content.Add(money_helper.formatToMoney(dr.get_vr_repasse())); tot_repasse += Convert.ToInt64(dr.get_vr_repasse()); my_line_container.Add(lst_line_content); } lstContent.Add(my_line_container); ArrayList lst_sub_foot = new ArrayList(); lst_sub_foot.Add("Total de repasse: " + money_helper.formatToMoney(tot_repasse.ToString())); lstFooter.Add(lst_sub_foot); stat.Close(); SyCrafReport rel = new SyCrafReport("Relatório de previsão de repasse ao lojista", "RPR", i_Form.LstEmp.SelectedItem.ToString(), var_util.getDDMMYYYY_format(DateTime.Now.ToString()), "", ref lstHeader, ref lstContent, ref lstTableSizes, ref lstFooter, ref lstMessages, ref lstFilters); //EndEventCode return(true); } #endregion #region - event_BtnConfirmarClick - case event_BtnConfirmarClick: { //InitEventCode event_BtnConfirmarClick //EndEventCode return(true); } #endregion default: break; } return(false); }
public override bool doEvent(int event_number, object arg) { switch (event_number) { #region - event_Load - case event_Load: { //InitEventCode event_Load #if ROBOT var_util.execDefinedRobot(this, var_alias); #else doEvent(event_Translate, null); doEvent(event_FormIsOpening, null); #endif //EndEventCode return(true); } #endregion #region - event_Translate - case event_Translate: { //InitEventCode event_Translate //EndEventCode return(true); } #endregion #region - event_FormIsOpening - case event_FormIsOpening: { //InitEventCode event_FormIsOpening ctrl_TxtValor.AcquireTextBox(i_Form.TxtValor, this, event_val_TxtValor, "R$", 8); ctrl_TxtNome.AcquireTextBox(i_Form.TxtNome, this, event_val_TxtNome, 40, alphaTextController.ENABLE_NUMBERS, alphaTextController.ENABLE_SYMBOLS); ctrl_TxtEmpresa.AcquireTextBox(i_Form.TxtEmpresa, this, event_val_TxtEmpresa, 6); if (header.get_tg_user_type() == TipoUsuario.AdminGift) { ctrl_TxtEmpresa.SetTextBoxText(header.get_st_empresa()); i_Form.TxtEmpresa.ReadOnly = true; 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_BuscaDados - case event_BuscaDados: { //InitEventCode event_BuscaDados ArrayList lst = new ArrayList(); if (header.get_tg_user_type() == TipoUsuario.SuperUser) { header.set_st_empresa(ctrl_TxtEmpresa.getTextBoxValue()); } var_exchange.fetch_extraGift(ref header, ref lst); if (header.get_tg_user_type() == TipoUsuario.SuperUser) { header.set_st_empresa("000000"); } i_Form.LstProd.Items.Clear(); for (int t = 0; t < lst.Count; ++t) { DadosProdutoGift dpg = new DadosProdutoGift(lst[t] as DataPortable); string [] full_row = new string [] { dpg.get_st_nome(), "R$ " + new money().formatToMoney(dpg.get_vr_valor()) }; i_Form.LstProd.Items.Add(var_util.GetListViewItem(dpg.get_id_produto(), full_row)); } //EndEventCode return(true); } #endregion #region - event_Remover - case event_Remover: { //InitEventCode event_Remover if (i_Form.LstProd.SelectedItems.Count == 0) { return(false); } if (MessageBox.Show("Confirma remoção de produto ?", "Aviso", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No) { return(false); } var_exchange.del_extraGift(var_util.getSelectedListViewItemTag(i_Form.LstProd), ref header); doEvent(event_BuscaDados, null); //EndEventCode return(true); } #endregion #region - event_Adicionar - case event_Adicionar: { //InitEventCode event_Adicionar if (!ctrl_TxtValor.IsUserValidated && !ctrl_TxtNome.IsUserValidated) { return(false); } DadosProdutoGift prod = new DadosProdutoGift(); prod.set_st_nome(ctrl_TxtNome.getTextBoxValue()); prod.set_vr_valor(ctrl_TxtValor.getTextBoxValue_NumberStr()); var_exchange.ins_extraGift(ref prod, ref header); doEvent(event_BuscaDados, null); //EndEventCode return(true); } #endregion #region - event_val_TxtNome - case event_val_TxtNome: { //InitEventCode event_val_TxtNome switch (arg as string) { case alphaTextController.ALPHA_COMPLETE: case alphaTextController.ALPHA_INCOMPLETE: { if (ctrl_TxtNome.getTextBoxValue().Length > 3) { i_Form.TxtNome.BackColor = Color.White; ctrl_TxtNome.IsUserValidated = true; ctrl_TxtNome.CleanError(); } else { i_Form.TxtNome.BackColor = colorInvalid; ctrl_TxtNome.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtValor - case event_val_TxtValor: { //InitEventCode event_val_TxtValor if (ctrl_TxtValor.getTextBoxValue_Long() == 0) { 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_Selecionar - case event_Selecionar: { //InitEventCode event_Selecionar if (i_Form.LstProd.SelectedItems.Count == 0) { return(false); } ctrl_TxtNome.SetTextBoxText(i_Form.LstProd.SelectedItems[0].SubItems[0].Text); ctrl_TxtValor.SetTextBoxLong(new money().getNumericValue(i_Form.LstProd.SelectedItems[0].SubItems[1].Text.Replace("R$ ", ""))); //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_LstProdClick - case event_LstProdClick: { //InitEventCode event_LstProdClick //EndEventCode return(true); } #endregion #region - event_BtnRemoverClick - case event_BtnRemoverClick: { //InitEventCode event_BtnRemoverClick //EndEventCode return(true); } #endregion #region - event_BtnAdicionarClick - case event_BtnAdicionarClick: { //InitEventCode event_BtnAdicionarClick //EndEventCode return(true); } #endregion 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_TxtVrAbatimento.AcquireTextBox(i_Form.TxtVrAbatimento, this, event_val_TxtVrAbatimento, "R$", 12); ctrl_TxtJuros.AcquireTextBox(i_Form.TxtJuros, this, event_val_TxtJuros, 5, 2); ctrl_TxtCodigo.AcquireTextBox(i_Form.TxtCodigo, this, event_val_TxtCodigo, 6); ctrl_TxtVrPago.AcquireTextBox(i_Form.TxtVrPago, this, event_val_TxtVrPago, "R$", 12); ctrl_TxtMotivo.AcquireTextBox(i_Form.TxtMotivo, this, event_val_TxtMotivo, 20); ctrl_TxtVrAbatimento.SetTextBoxString("0"); ctrl_TxtJuros.SetTextBoxText("1000"); i_Form.TxtTotal.Text = "R$ " + new money().formatToMoney(vr_total.ToString()); //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_TxtCodigo - case event_val_TxtCodigo: { //InitEventCode event_val_TxtCodigo switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (i_Form.TxtCodigo.Text.Length > 0) { i_Form.TxtCodigo.BackColor = Color.White; ctrl_TxtCodigo.IsUserValidated = true; ctrl_TxtCodigo.CleanError(); if (ctrl_TxtCodigo.GetEnterPressed()) { if (i_Form.CboTipo.SelectedIndex != -1) { string msg = ""; string tg_empresa = Context.FALSE; string vr_valor = ""; if (i_Form.CboTipo.SelectedIndex == 0) { tg_empresa = Context.TRUE; } if (var_exchange.fetch_dadosFaturamento(tg_empresa, ctrl_TxtCodigo.getTextBoxValue(), ref header, ref msg, ref vr_valor)) { vr_total = Convert.ToInt64(vr_valor); doEvent(event_CalcParcela, null); } } } } break; } } //EndEventCode return(true); } #endregion #region - event_val_TxtVrPago - case event_val_TxtVrPago: { //InitEventCode event_val_TxtVrPago doEvent(event_CalcParcela, null); //EndEventCode return(true); } #endregion #region - event_val_TxtJuros - case event_val_TxtJuros: { //InitEventCode event_val_TxtJuros doEvent(event_CalcParcela, null); //EndEventCode return(true); } #endregion #region - event_val_TxtVrAbatimento - case event_val_TxtVrAbatimento: { //InitEventCode event_val_TxtVrAbatimento doEvent(event_CalcParcela, null); //EndEventCode return(true); } #endregion #region - event_val_TxtMotivo - case event_val_TxtMotivo: { //InitEventCode event_val_TxtMotivo //EndEventCode return(true); } #endregion #region - event_BtnConfirmar - case event_BtnConfirmar: { //InitEventCode event_BtnConfirmar if (ctrl_TxtCodigo.getTextBoxValue().Length == 0) { return(false); } if (i_Form.TxtMotivo.Text.Length == 0) { MessageBox.Show("Informe o motivo corretamente", "Aviso"); return(false); } if (MessageBox.Show("Confirma o valor de despesa " + i_Form.TxtVrDevido.Text + "?", "Aviso", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No) { return(false); } string st_val_juro = i_Form.TxtVrDevido.Text.Replace("R$ ", ""); long valor_juro = new money().getNumericValue(st_val_juro); long valor_pago = ctrl_TxtVrPago.getTextBoxValue_Long(); string emp = Context.FALSE; string desconto = Context.FALSE; if (i_Form.CboTipo.SelectedIndex == 0) { emp = Context.TRUE; } if (!var_exchange.exec_fat_recManual(emp, ctrl_TxtCodigo.getTextBoxValue(), valor_pago.ToString(), ref header)) { return(false); } if (valor_juro > 0) { var_exchange.ins_despesa(valor_juro.ToString(), ctrl_TxtCodigo.getTextBoxValue(), emp, i_Form.TxtMotivo.Text, desconto, ref header); } //EndEventCode return(true); } #endregion #region - event_CalcParcela - case event_CalcParcela: { //InitEventCode event_CalcParcela if (i_Form.TxtVrPago.Text.Length == 0) { return(false); } if (i_Form.TxtJuros.Text.Length == 0) { return(false); } if (i_Form.TxtVrAbatimento.Text.Length == 0) { return(false); } i_Form.TxtTotal.Text = "R$ " + new money().formatToMoney(vr_total.ToString()); long desc = vr_total - ctrl_TxtVrPago.getTextBoxValue_Long(); i_Form.TxtVrDesc.Text = "R$ " + new money().formatToMoney(desc.ToString()); long jur = (long)ctrl_TxtJuros.getTextBoxValue_Double() * vr_total / 100; long abat = ctrl_TxtVrAbatimento.getTextBoxValue_Long(); i_Form.TxtVrDevido.Text = "R$ " + new money().formatToMoney((desc + jur - abat).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_TxtLocalizacao.AcquireTextBox(i_Form.TxtLocalizacao, this, event_val_TxtLocalizacao, 40, alphaTextController.ENABLE_NUMBERS, alphaTextController.ENABLE_SYMBOLS); ctrl_TxtLocalizacao.SetTextBoxText(var_TxtLocalizacao); //EndEventCode return(true); } #endregion #region - robot_ShowDialog - case robot_ShowDialog: { //InitEventCode robot_ShowDialog //EndEventCode return(true); } #endregion #region - robot_CloseDialog - case robot_CloseDialog: { //InitEventCode robot_CloseDialog //EndEventCode return(true); } #endregion #region - event_Confirmar - case event_Confirmar: { //InitEventCode event_Confirmar if (ctrl_TxtLocalizacao.IsUserValidated) { if (var_exchange.exec_alteraTerminal(var_TxtTerminal, ctrl_TxtLocalizacao.getTextBoxValue(), ref header)) { i_Form.Close(); } } //EndEventCode return(true); } #endregion #region - event_val_TxtLocalizacao - case event_val_TxtLocalizacao: { //InitEventCode event_val_TxtLocalizacao switch (arg as string) { case alphaTextController.ALPHA_COMPLETE: case alphaTextController.ALPHA_INCOMPLETE: { if (ctrl_TxtLocalizacao.getTextBoxValue().Length > 0) { i_Form.TxtLocalizacao.BackColor = Color.White; ctrl_TxtLocalizacao.IsUserValidated = true; } else { i_Form.TxtLocalizacao.BackColor = colorInvalid; ctrl_TxtLocalizacao.IsUserValidated = false; } break; } default: break; } //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_TxtLoja.AcquireTextBox(i_Form.TxtLoja, this, event_val_TxtLoja, 6); ctrl_TxtCNPJ.AcquireTextBox(i_Form.TxtCNPJ, this, event_val_TxtCNPJ); ctrl_TxtNome.AcquireTextBox(i_Form.TxtNome, this, event_val_TxtNome, 40); ctrl_TxtCidade.AcquireTextBox(i_Form.TxtCidade, this, event_val_TxtCidade, 20, false); ctrl_TxtEstado.AcquireTextBox(i_Form.TxtEstado, this, event_val_TxtEstado, 2, false); ctrl_TxtQtdTerm.AcquireTextBox(i_Form.TxtQtdTerm, this, event_val_TxtQtdTerm, 2); if (header.get_tg_user_type() == TipoUsuario.Administrador || header.get_tg_user_type() == TipoUsuario.AdminGift) { 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_Consultar - case event_Consultar: { //InitEventCode event_Consultar i_Form.BtnConsultar.Enabled = false; DadosConsultaLoja dcl = new DadosConsultaLoja(); dcl.set_st_empresa(ctrl_TxtEmpresa.getTextBoxValue()); dcl.set_st_nome(ctrl_TxtNome.getTextBoxValue()); dcl.set_st_cidade(ctrl_TxtCidade.getTextBoxValue()); dcl.set_st_estado(ctrl_TxtEstado.getTextBoxValue()); dcl.set_nu_qtd_term(ctrl_TxtQtdTerm.getTextBoxValue()); dcl.set_st_loja(ctrl_TxtLoja.getTextBoxValue()); dcl.set_st_cnpj(ctrl_TxtCNPJ.getTextBoxValue()); string st_csv_id = ""; i_Form.LstLojas.Items.Clear(); i_Form.LblQtd.Text = "Processando..."; Application.DoEvents(); if (var_exchange.fetch_consultaLoja(ref dcl, ref header, ref st_csv_id)) { full_memory.Clear(); 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]); } i_Form.LblQtd.Text = "Buscando " + full_memory.ToString() + " registros"; Application.DoEvents(); } } for (int t = 0; t < full_memory.Count; ++t) { DadosLoja dl = new DadosLoja(full_memory[t] as DataPortable); string [] full_row = new string [] { dl.get_st_loja(), dl.get_st_nome(), dl.get_st_cidade(), dl.get_st_estado(), dl.get_st_obs(), dl.get_nu_CNPJ(), dl.get_nu_diasRep(), dl.get_nu_pctRep(), dl.get_st_convenios() }; i_Form.LstLojas.Items.Add(var_util.GetListViewItem(dl.get_nu_CNPJ(), full_row)); } i_Form.LblQtd.Text = full_memory.Count.ToString() + " registros encontrados"; } else { i_Form.LblQtd.Text = ""; } i_Form.BtnConsultar.Enabled = true; //EndEventCode return(true); } #endregion #region - event_Editar - case event_Editar: { //InitEventCode event_Editar if (i_Form.LstLojas.SelectedItems.Count > 0) { if (header.get_tg_user_type() == TipoUsuario.SuperUser || header.get_tg_user_type() == TipoUsuario.Administrador || header.get_tg_user_type() == TipoUsuario.AdminGift) { event_dlgNovaLoja ev_call = new event_dlgNovaLoja(var_util, var_exchange); ev_call.header = header; ev_call.IsMaintenance = true; ev_call.par_code = var_util.getSelectedListViewItemTag(i_Form.LstLojas); ev_call.i_Form.ShowDialog(); } } //EndEventCode return(true); } #endregion #region - event_Remover - case event_Remover: { //InitEventCode event_Remover //EndEventCode return(true); } #endregion #region - event_val_TxtNome - case event_val_TxtNome: { //InitEventCode event_val_TxtNome switch (arg as string) { case alphaTextController.ALPHA_COMPLETE: case alphaTextController.ALPHA_INCOMPLETE: { if (ctrl_TxtNome.getTextBoxValue().Length > 0) { i_Form.TxtNome.BackColor = Color.White; ctrl_TxtNome.IsUserValidated = true; } else { i_Form.TxtNome.BackColor = colorInvalid; ctrl_TxtNome.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtCidade - case event_val_TxtCidade: { //InitEventCode event_val_TxtCidade switch (arg as string) { case alphaTextController.ALPHA_COMPLETE: case alphaTextController.ALPHA_INCOMPLETE: { if (ctrl_TxtCidade.getTextBoxValue().Length > 0) { i_Form.TxtCidade.BackColor = Color.White; ctrl_TxtCidade.IsUserValidated = true; } else { i_Form.TxtCidade.BackColor = colorInvalid; ctrl_TxtCidade.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtEstado - case event_val_TxtEstado: { //InitEventCode event_val_TxtEstado switch (arg as string) { case alphaTextController.ALPHA_COMPLETE: case alphaTextController.ALPHA_INCOMPLETE: { if (ctrl_TxtEstado.getTextBoxValue().Length > 0) { i_Form.TxtEstado.BackColor = Color.White; ctrl_TxtEstado.IsUserValidated = true; } else { i_Form.TxtEstado.BackColor = colorInvalid; ctrl_TxtEstado.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtRamo - case event_val_TxtRamo: { //InitEventCode event_val_TxtRamo //EndEventCode return(true); } #endregion #region - event_val_TxtQtdTerm - case event_val_TxtQtdTerm: { //InitEventCode event_val_TxtQtdTerm switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (ctrl_TxtQtdTerm.getTextBoxValue().Length > 0) { i_Form.TxtQtdTerm.BackColor = Color.White; ctrl_TxtQtdTerm.IsUserValidated = true; } else { i_Form.TxtQtdTerm.BackColor = colorInvalid; ctrl_TxtQtdTerm.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtEmpresa - case event_val_TxtEmpresa: { //InitEventCode event_val_TxtEmpresa if (header.get_tg_user_type() == TipoUsuario.Administrador || header.get_tg_user_type() == TipoUsuario.AdminGift) { return(false); } switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (ctrl_TxtEmpresa.getTextBoxValue().Length > 0) { i_Form.TxtEmpresa.BackColor = Color.White; ctrl_TxtEmpresa.IsUserValidated = true; } else { i_Form.TxtEmpresa.BackColor = colorInvalid; ctrl_TxtEmpresa.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtLoja - case event_val_TxtLoja: { //InitEventCode event_val_TxtLoja switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (ctrl_TxtLoja.getTextBoxValue().Length > 0) { i_Form.TxtLoja.BackColor = Color.White; ctrl_TxtLoja.IsUserValidated = true; } else { i_Form.TxtLoja.BackColor = colorInvalid; ctrl_TxtLoja.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtCNPJ - case event_val_TxtCNPJ: { //InitEventCode event_val_TxtCNPJ switch (arg as string) { case cnpjTextController.CNPJ_INCOMPLETE: case cnpjTextController.CNPJ_INVALID: { i_Form.TxtCNPJ.BackColor = colorInvalid; ctrl_TxtCNPJ.IsUserValidated = false; break; } case cnpjTextController.CNPJ_VALID: { i_Form.TxtCNPJ.BackColor = Color.White; ctrl_TxtCNPJ.IsUserValidated = true; ctrl_TxtCNPJ.CleanError(); break; } default: break; } //EndEventCode return(true); } #endregion #region - event_Print - case event_Print: { //InitEventCode event_Print //EndEventCode return(true); } #endregion #region - event_Report - case event_Report: { //InitEventCode event_Report ArrayList lstReport = new ArrayList(); lstReport.Add("RELATÓRIO COMPLETO DE LOJAS"); lstReport.Add(""); lstReport.Add("COD. NOME CIDADE CNPJ DIAS REP. PCT. REPASSE"); lstReport.Add("TELEFONE E ENDEREÇO"); lstReport.Add("CONVENIOS"); lstReport.Add("------------------------------------------------------------------------------------------------------------------------"); lstReport.Add(""); string line = ""; for (int t = 0; t < i_Form.LstLojas.Items.Count; ++t) { line = i_Form.LstLojas.Items[t].SubItems[0].Text.PadRight(8, ' ') + " "; line += i_Form.LstLojas.Items[t].SubItems[1].Text.PadRight(48, ' ').Substring(0, 48) + " "; line += i_Form.LstLojas.Items[t].SubItems[2].Text.Trim().PadLeft(18, ' ') + " "; line += i_Form.LstLojas.Items[t].SubItems[5].Text.PadLeft(14, ' ') + " "; line += i_Form.LstLojas.Items[t].SubItems[6].Text.PadLeft(11, ' ') + " "; line += i_Form.LstLojas.Items[t].SubItems[7].Text.PadLeft(11, ' ') + " "; lstReport.Add(line); for (int h = 0; h < full_memory.Count; ++h) { DadosLoja dl = new DadosLoja(full_memory[h] as DataPortable); if (dl.get_st_nome() != i_Form.LstLojas.Items[t].SubItems[1].Text) { continue; } lstReport.Add(dl.get_st_endereco()); break; } lstReport.Add("Convênios: " + i_Form.LstLojas.Items[t].SubItems[8].Text); lstReport.Add(""); } new ConveyPrinter("Courier New", 7, 10, ref lstReport); //EndEventCode return(true); } #endregion #region - event_BtnConsultarClick - case event_BtnConsultarClick: { //InitEventCode event_BtnConsultarClick //EndEventCode return(true); } #endregion #region - event_LstLojasDoubleClick - case event_LstLojasDoubleClick: { //InitEventCode event_LstLojasDoubleClick //EndEventCode return(true); } #endregion #region - event_BtnRelatorioClick - case event_BtnRelatorioClick: { //InitEventCode event_BtnRelatorioClick //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_TxtIdent.AcquireTextBox(i_Form.TxtIdent, this, event_val_TxtIdent, 20); //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_Cancelar - case event_Cancelar: { //InitEventCode event_Cancelar var_exchange.exec_cancelaChequeGift(ctrl_TxtIdent.getTextBoxValue(), ref header); string st_msg = ""; var_exchange.fetch_chequeGift(ctrl_TxtIdent.getTextBoxValue(), ref header, ref st_msg); i_Form.TxtCheque.Text = st_msg.Replace("@", "\r\n"); //EndEventCode return(true); } #endregion #region - event_Compensar - case event_Compensar: { //InitEventCode event_Compensar var_exchange.exec_compensaChequeGift(ctrl_TxtIdent.getTextBoxValue(), ref header); string st_msg = ""; var_exchange.fetch_chequeGift(ctrl_TxtIdent.getTextBoxValue(), ref header, ref st_msg); i_Form.TxtCheque.Text = st_msg.Replace("@", "\r\n"); //EndEventCode return(true); } #endregion #region - event_val_TxtIdent - case event_val_TxtIdent: { //InitEventCode event_val_TxtIdent i_Form.TxtCheque.Text = ""; switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (i_Form.TxtIdent.Text.Length > 0) { i_Form.TxtIdent.BackColor = Color.White; ctrl_TxtIdent.IsUserValidated = true; ctrl_TxtIdent.CleanError(); if (ctrl_TxtIdent.GetEnterPressed()) { string st_msg = ""; var_exchange.fetch_chequeGift(ctrl_TxtIdent.getTextBoxValue(), ref header, ref st_msg); i_Form.TxtCheque.Text = st_msg.Replace("@", "\r\n"); } } else { i_Form.TxtIdent.BackColor = colorInvalid; ctrl_TxtIdent.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_BtnCancelarClick - case event_BtnCancelarClick: { //InitEventCode event_BtnCancelarClick //EndEventCode return(true); } #endregion #region - event_BtnCompensarClick - case event_BtnCompensarClick: { //InitEventCode event_BtnCompensarClick //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 i_Form.Text += " " + st_cod_empresa.PadLeft(6, '0'); i_Form.CboReport.SelectedIndex = 0; ctrl_TxtMes.AcquireTextBox(i_Form.TxtMes, this, event_val_TxtMes, 2); ctrl_TxtAno.AcquireTextBox(i_Form.TxtAno, this, event_val_TxtAno, 4); ctrl_TxtMes.SetTextBoxText(DateTime.Now.Month.ToString()); ctrl_TxtAno.SetTextBoxText(DateTime.Now.Year.ToString()); ArrayList lst = new ArrayList(); string nome_emp = ""; var_exchange.fetch_empresasAfiliadas(st_cod_empresa, ref header, ref nome_emp, ref lst); for (int t = 0; t < lst.Count; ++t) { DadosEmpresa de = new DadosEmpresa(lst [t] as DataPortable); i_Form.CboAfiliada.Items.Add(de.get_st_empresa()); } if (lst.Count == 0) { i_Form.CboAfiliada.Items.Add(""); } i_Form.CboAfiliada.SelectedIndex = 0; //EndEventCode return(true); } #endregion #region - robot_ShowDialog - case robot_ShowDialog: { //InitEventCode robot_ShowDialog //EndEventCode return(true); } #endregion #region - robot_CloseDialog - case robot_CloseDialog: { //InitEventCode robot_CloseDialog //EndEventCode return(true); } #endregion #region - event_Confirmar - case event_Confirmar: { //InitEventCode event_Confirmar if (!ctrl_TxtAno.IsUserValidated && !ctrl_TxtMes.IsUserValidated) { return(false); } switch (i_Form.CboReport.SelectedIndex) { case 0: doEvent(event_PorEmpresa, null); break; case 1: doEvent(event_PorCartao, null); break; } //EndEventCode return(true); } #endregion #region - event_val_TxtMes - case event_val_TxtMes: { //InitEventCode event_val_TxtMes if (ctrl_TxtMes.getTextBoxValue() == "" || ctrl_TxtMes.getTextBoxValue_Long() > 12) { i_Form.TxtMes.BackColor = colorInvalid; ctrl_TxtMes.IsUserValidated = false; } else { i_Form.TxtMes.BackColor = Color.White; ctrl_TxtMes.IsUserValidated = true; } //EndEventCode return(true); } #endregion #region - event_val_TxtAno - case event_val_TxtAno: { //InitEventCode event_val_TxtAno if (ctrl_TxtAno.getTextBoxValue().Length < 4) { i_Form.TxtAno.BackColor = colorInvalid; ctrl_TxtAno.IsUserValidated = false; } else { i_Form.TxtAno.BackColor = Color.White; ctrl_TxtAno.IsUserValidated = true; } //EndEventCode return(true); } #endregion #region - event_PorEmpresa - case event_PorEmpresa: { //InitEventCode event_PorEmpresa // ############################## // # SETUP LISTS ################ // ############################## ArrayList lstHeader = new ArrayList(); ArrayList lstContent = new ArrayList(); ArrayList lstTableSizes = new ArrayList(); ArrayList lstFooter = new ArrayList(); ArrayList lstMessages = new ArrayList(); ArrayList lstFilters = new ArrayList(); string st_empresa = ""; string st_csv_cartao = ""; string st_csv_loja = ""; string st_csv_loja_content = ""; string st_csv_subtotal_loja = ""; string st_csv_subtotal_cartao = ""; string st_csv_cartao_content = ""; string st_total = ""; dlgStatus stat = new dlgStatus("Relatório"); stat.LblActivity.Text = "Processando relatório no servidor"; stat.Show(); Application.DoEvents(); if (!var_exchange.fetch_rel_3_fech("0", ctrl_TxtMes.getTextBoxValue(), ctrl_TxtAno.getTextBoxValue(), st_cod_empresa, i_Form.CboAfiliada.SelectedItem.ToString(), ref header, ref st_empresa, ref st_csv_cartao, ref st_csv_loja, ref st_csv_loja_content, ref st_csv_subtotal_loja, ref st_csv_subtotal_cartao, ref st_csv_cartao_content, ref st_total)) { stat.Close(); return(false); } money money_helper = new money(); Hashtable mem_Lojas = new Hashtable(); stat.LblActivity.Text = "Obtendo resultados"; Application.DoEvents(); #region Busca todos os registros de todos as lojas { ArrayList full_memory = new ArrayList(); while (st_csv_loja_content != "") { ArrayList tmp_memory = new ArrayList(); if (var_exchange.fetch_memory(st_csv_loja_content, "400", ref st_csv_loja_content, ref tmp_memory)) { for (int t = 0; t < tmp_memory.Count; ++t) { full_memory.Add(tmp_memory[t]); } } } for (int t = 0; t < full_memory.Count; ++t) { DadosFechamento df = new DadosFechamento(full_memory[t] as DataPortable); string tmp_loja = df.get_st_loja(); if (mem_Lojas [tmp_loja] == null) { mem_Lojas [tmp_loja] = new ArrayList(); } ArrayList memoryLoja = mem_Lojas [tmp_loja] as ArrayList; memoryLoja.Add(df); } } #endregion stat.LblActivity.Text = "Gerando relatório para web"; Application.DoEvents(); int tot_Lojas = var_util.indexCSV(st_csv_loja); long tot_repasse = 0; ApplicationUtil var_utilFooter = new ApplicationUtil(); var_utilFooter.indexCSV(st_csv_subtotal_loja); for (int h = 0; h < tot_Lojas; ++h) { string loja = var_util.getCSV(h); ArrayList memLojaList = mem_Lojas [loja] as ArrayList; ArrayList lstFooterSub = new ArrayList(); ArrayList lstHeaderSub = new ArrayList(); ArrayList lstContentSub = new ArrayList(); lstMessages.Add("Fechamento da loja: " + loja); lstTableSizes.Add(650); lstHeaderSub.Add("NSU"); lstHeaderSub.Add("Cartão"); lstHeaderSub.Add("Nome"); lstHeaderSub.Add("Data e Hora"); lstHeaderSub.Add("Valor R$"); lstHeaderSub.Add("Parcela"); lstHeaderSub.Add("Terminal"); long sub_repasse = 0; if (memLojaList != null) { for (int t = 0; t < memLojaList.Count; ++t) { DadosFechamento df = new DadosFechamento(memLojaList[t] as DataPortable); ArrayList lstLine = new ArrayList(); lstLine.Add(df.get_st_nsu().PadLeft(6, '0')); lstLine.Add(df.get_st_cartao()); lstLine.Add(df.get_st_nome()); lstLine.Add(var_util.getDDMMYYYY_format(df.get_dt_trans())); lstLine.Add(money_helper.formatToMoney(df.get_vr_valor())); lstLine.Add(df.get_nu_parcela()); lstLine.Add(df.get_st_terminal()); sub_repasse += Convert.ToInt64(df.get_vr_repasse()); lstContentSub.Add(lstLine); } } lstFooterSub.Add("Sub-Total: " + "R$ " + money_helper.formatToMoney(var_utilFooter.getCSV(h))); lstFooterSub.Add("Sub-Total repasse: " + "R$ " + money_helper.setMoneyFormat(sub_repasse)); tot_repasse += sub_repasse; lstHeader.Add(lstHeaderSub); lstFooter.Add(lstFooterSub); lstContent.Add(lstContentSub); if (h == tot_Lojas - 1) { lstFooterSub.Add(""); lstFooterSub.Add("Total de vendas nas lojas: " + "R$ " + money_helper.formatToMoney(st_total)); lstFooterSub.Add("Total de repasse para lojas: " + "R$ " + money_helper.setMoneyFormat(tot_repasse)); } } stat.Close(); SyCrafReport rel = new SyCrafReport("Relatório de Fechamento por loja", "RFE", st_empresa, "Mês " + ctrl_TxtMes.getTextBoxValue(), "Ano " + ctrl_TxtAno.getTextBoxValue(), ref lstHeader, ref lstContent, ref lstTableSizes, ref lstFooter, ref lstMessages, ref lstFilters); //EndEventCode return(true); } #endregion #region - event_PorCartao - case event_PorCartao: { //InitEventCode event_PorCartao // ############################## // # SETUP LISTS ################ // ############################## ArrayList lstHeader = new ArrayList(); ArrayList lstContent = new ArrayList(); ArrayList lstTableSizes = new ArrayList(); ArrayList lstFooter = new ArrayList(); ArrayList lstMessages = new ArrayList(); ArrayList lstFilters = new ArrayList(); string st_empresa = ""; string st_csv_cartao = ""; string st_csv_loja = ""; string st_csv_loja_content = ""; string st_csv_subtotal_loja = ""; string st_csv_subtotal_cartao = ""; string st_csv_cartao_content = ""; string st_total = ""; dlgStatus stat = new dlgStatus("Relatório"); stat.LblActivity.Text = "Processando relatório no servidor"; stat.Show(); Application.DoEvents(); if (!var_exchange.fetch_rel_3_fech("1", ctrl_TxtMes.getTextBoxValue(), ctrl_TxtAno.getTextBoxValue(), st_cod_empresa, i_Form.CboAfiliada.SelectedItem.ToString(), ref header, ref st_empresa, ref st_csv_cartao, ref st_csv_loja, ref st_csv_loja_content, ref st_csv_subtotal_loja, ref st_csv_subtotal_cartao, ref st_csv_cartao_content, ref st_total)) { stat.Close(); return(false); } money money_helper = new money(); Hashtable mem_Cartoes = new Hashtable(); stat.LblActivity.Text = "Obtendo resultados"; Application.DoEvents(); #region Busca todos os registros de todos os cartoes { ArrayList full_memory = new ArrayList(); while (st_csv_cartao_content != "") { ArrayList tmp_memory = new ArrayList(); if (var_exchange.fetch_memory(st_csv_cartao_content, "400", ref st_csv_cartao_content, ref tmp_memory)) { for (int t = 0; t < tmp_memory.Count; ++t) { full_memory.Add(tmp_memory[t]); } } } for (int t = 0; t < full_memory.Count; ++t) { DadosFechamento df = new DadosFechamento(full_memory[t] as DataPortable); string tmp_cartao = df.get_st_cartao(); if (mem_Cartoes [tmp_cartao] == null) { mem_Cartoes [tmp_cartao] = new ArrayList(); } ArrayList memoryCart = mem_Cartoes [tmp_cartao] as ArrayList; memoryCart.Add(df); } } #endregion stat.LblActivity.Text = "Gerando relatório para web"; Application.DoEvents(); int tot_Cartoes = var_util.indexCSV(st_csv_cartao); ApplicationUtil var_utilFooter = new ApplicationUtil(); var_utilFooter.indexCSV(st_csv_subtotal_cartao); for (int h = 0; h < tot_Cartoes; ++h) { string cart = var_util.getCSV(h); ArrayList lstFooterSub = new ArrayList(); ArrayList lstHeaderSub = new ArrayList(); ArrayList lstContentSub = new ArrayList(); lstMessages.Add("Fechamento do cartão: " + cart); lstTableSizes.Add(800); lstHeaderSub.Add("NSU"); lstHeaderSub.Add("Loja"); lstHeaderSub.Add("Data e Hora"); lstHeaderSub.Add("Valor R$"); lstHeaderSub.Add("Parcela"); ArrayList memCartList = mem_Cartoes [cart] as ArrayList; if (memCartList != null) { for (int t = 0; t < memCartList.Count; ++t) { DadosFechamento df = new DadosFechamento(memCartList[t] as DataPortable); ArrayList lstLine = new ArrayList(); lstLine.Add(df.get_st_nsu().PadLeft(6, '0')); lstLine.Add(df.get_st_loja()); lstLine.Add(var_util.getDDMMYYYY_format(df.get_dt_trans())); lstLine.Add(money_helper.formatToMoney(df.get_vr_valor())); lstLine.Add(df.get_nu_parcela()); lstContentSub.Add(lstLine); } } lstFooterSub.Add("Sub-Total: R$ " + money_helper.formatToMoney(var_utilFooter.getCSV(h))); lstHeader.Add(lstHeaderSub); lstFooter.Add(lstFooterSub); lstContent.Add(lstContentSub); if (h == tot_Cartoes - 1) { lstFooterSub.Add(""); lstFooterSub.Add("Total: " + "R$ " + money_helper.formatToMoney(st_total)); } } stat.Close(); SyCrafReport rel = new SyCrafReport("Relatório de Fechamento por cartões", "RFE", st_empresa, "Mês : " + ctrl_TxtMes.getTextBoxValue(), "Ano : " + ctrl_TxtAno.getTextBoxValue(), ref lstHeader, ref lstContent, ref lstTableSizes, ref lstFooter, ref lstMessages, ref lstFilters); //EndEventCode return(true); } #endregion #region - event_BDF - case event_BDF: { //InitEventCode event_BDF if (i_Form.CboReport.SelectedIndex != 1) { MessageBox.Show("Geração somente para relatório de cartões", "Aviso"); return(false); } event_dlgDBF_Fechamento ev_call = new event_dlgDBF_Fechamento(var_util, var_exchange); ev_call.header = header; ev_call.mes = ctrl_TxtMes.getTextBoxValue(); ev_call.ano = ctrl_TxtAno.getTextBoxValue(); ev_call.st_cod_empresa = st_cod_empresa; ev_call.i_Form.ShowDialog(); //EndEventCode return(true); } #endregion #region - event_BtnConfirmarClick - case event_BtnConfirmarClick: { //InitEventCode event_BtnConfirmarClick //EndEventCode return(true); } #endregion #region - event_BtnDBFClick - case event_BtnDBFClick: { //InitEventCode event_BtnDBFClick //EndEventCode return(true); } #endregion default: break; } return(false); }
public override bool doEvent(int event_number, object arg) { switch (event_number) { #region - event_Load - case event_Load: { //InitEventCode event_Load #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.TxtLoja.Text = st_loja; i_Form.TxtValor.Text = "R$ " + new money().formatToMoney(vr_valor); ctrl_TxtIdent.AcquireTextBox(i_Form.TxtIdent, this, event_val_TxtIdent, 20); string banco = ""; string ag = ""; string conta = ""; var_exchange.fetch_convenioLojaGift(st_codLoja, ref header, ref banco, ref ag, ref conta); i_Form.TxtBanco.Text = banco; i_Form.TxtAgencia.Text = ag; i_Form.TxtConta.Text = conta; //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 && !i_Form.rbDep.Checked && !i_Form.rbDinheiro.Checked) { return(false); } if (i_Form.rbCheque.Checked && !ctrl_TxtIdent.IsUserValidated) { MessageBox.Show("Preencha a identificação do cheque", "Aviso"); return(false); } string tg_opcao = "0"; // dinheiro if (i_Form.rbCheque.Checked) { tg_opcao = "1"; } if (i_Form.rbDep.Checked) { tg_opcao = "2"; } vr_valor = vr_valor.Replace("R$", ""); var_exchange.exec_repasseLoja(st_codLoja, tg_opcao, ctrl_TxtIdent.getTextBoxValue(), new money().getNumericValue(vr_valor).ToString(), ref header, ref lstParcelas, ref id_confRepasse); bool IsPrinted = false; while (!IsPrinted) { 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("Imprimiiu corretamente?", "Aviso", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { IsPrinted = true; } } i_Form.Close(); //EndEventCode return(true); } #endregion #region - event_val_TxtIdent - case event_val_TxtIdent: { //InitEventCode event_val_TxtIdent switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (i_Form.TxtIdent.Text.Length > 0) { i_Form.TxtIdent.BackColor = Color.White; ctrl_TxtIdent.IsUserValidated = true; ctrl_TxtIdent.CleanError(); } else { i_Form.TxtIdent.BackColor = colorInvalid; ctrl_TxtIdent.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_Print - case event_Print: { //InitEventCode event_Print DadosRepRecibo drr = new DadosRepRecibo(); ArrayList lstRec = new ArrayList(); var_exchange.fetch_reciboRepasse(id_confRepasse, ref header, ref drr, ref lstRec); PrintPageEventArgs e = arg as PrintPageEventArgs; Graphics g = e.Graphics; int n = 0; Font myFont = new Font("Courier New", 10); try { g.DrawString("RECIBO DE CONFIRMAÇÃO DO REPASSE FINANCEIRO", myFont, Brushes.Black, 10, 10 + (n * 20)); ++n; g.DrawString("", myFont, Brushes.Black, 10, 10 + (n * 20)); ++n; g.DrawString(DateTime.Now.ToLongDateString().ToUpper(), myFont, Brushes.Black, 10, 10 + (n * 20)); ++n; g.DrawString("", myFont, Brushes.Black, 10, 10 + (n * 20)); ++n; g.DrawString("Nome da loja: " + drr.get_loja(), myFont, Brushes.Black, 10, 10 + (n * 20)); ++n; g.DrawString("CNPJ: " + drr.get_cnpj(), myFont, Brushes.Black, 10, 10 + (n * 20)); ++n; if (drr.get_pagto() == TipoPagamento.Dinheiro) { g.DrawString("Forma pagamento: dinheiro ", myFont, Brushes.Black, 10, 10 + (n * 20)); ++n; } else if (drr.get_pagto() == TipoPagamento.Cheque) { g.DrawString("Forma pagamento: Cheque " + drr.get_st_extra(), myFont, Brushes.Black, 10, 10 + (n * 20)); ++n; } else { g.DrawString("Forma pagamento: Depósito " + drr.get_st_extra(), myFont, Brushes.Black, 10, 10 + (n * 20)); ++n; } string tipo_pag = ""; g.DrawString(tipo_pag, myFont, Brushes.Black, 10, 10 + (n * 20)); ++n; g.DrawString("", myFont, Brushes.Black, 10, 10 + (n * 20)); ++n; g.DrawString("Cartão Data e Hora NSU Valor Data Vencimento", myFont, Brushes.Black, 10, 10 + (n * 20)); ++n; g.DrawString("------------------------------------------------------------------------------------", myFont, Brushes.Black, 10, 10 + (n * 20)); ++n; for (int t = 0; t < lstRec.Count; ++t) { DadosRepasse port = new DadosRepasse(lstRec[t] as DataPortable); string line = port.get_st_cartao().PadRight(18, ' '); line += var_util.getDDMMYYYY_format(port.get_dt_trans()).PadRight(21, ' '); line += port.get_st_nsu().PadRight(10, ' '); line += new money().formatToMoney(port.get_vr_total()).PadRight(10, ' '); line += var_util.getDDMMYYYY_format(port.get_dt_repasse()).PadRight(21, ' '); g.DrawString(line, myFont, Brushes.Black, 10, 10 + (n * 20)); ++n; } g.DrawString("", myFont, Brushes.Black, 10, 10 + (n * 20)); ++n; g.DrawString("Valor das compras: R$ " + new money().formatToMoney(drr.get_vr_compras()), myFont, Brushes.Black, 10, 10 + (n * 20)); ++n; g.DrawString("Taxa de administração: " + drr.get_tx_admin(), myFont, Brushes.Black, 10, 10 + (n * 20)); ++n; g.DrawString("Desconto: R$ " + drr.get_vr_desc(), myFont, Brushes.Black, 10, 10 + (n * 20)); ++n; g.DrawString("Valor total do reembolso: " + new money().formatToMoney(drr.get_vr_tot_rep()), myFont, Brushes.Black, 10, 10 + (n * 20)); ++n; g.DrawString("", myFont, Brushes.Black, 10, 10 + (n * 20)); ++n; g.DrawString("", myFont, Brushes.Black, 10, 10 + (n * 20)); ++n; g.DrawString("", myFont, Brushes.Black, 10, 10 + (n * 20)); ++n; g.DrawString("", myFont, Brushes.Black, 10, 10 + (n * 20)); ++n; g.DrawString("", myFont, Brushes.Black, 10, 10 + (n * 20)); ++n; g.DrawString("____________________________________________", myFont, Brushes.Black, 10, 10 + (n * 20)); ++n; g.DrawString("Assinatura do responsável", 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_TxtCodigo.AcquireTextBox(i_Form.TxtCodigo, this, event_val_TxtCodigo, 6); ctrl_TxtCobranca.AcquireTextBox(i_Form.TxtCobranca, this, event_val_TxtCobranca, "R$", 6); //EndEventCode return(true); } #endregion #region - robot_ShowDialog - case robot_ShowDialog: { //InitEventCode robot_ShowDialog //EndEventCode return(true); } #endregion #region - robot_CloseDialog - case robot_CloseDialog: { //InitEventCode robot_CloseDialog //EndEventCode return(true); } #endregion #region - event_Confirmar - case event_Confirmar: { //InitEventCode event_Confirmar if (ctrl_TxtCodigo.getTextBoxValue().Length == 0) { return(false); } if (ctrl_TxtCobranca.getTextBoxValue_Long() == 0) { return(false); } string emp = Context.FALSE; string desconto = Context.FALSE; if (i_Form.CboTipo.SelectedIndex == 0) { emp = Context.TRUE; } if (i_Form.ChkDesconto.Checked) { desconto = Context.TRUE; } var_exchange.ins_despesa(ctrl_TxtCobranca.getTextBoxValue_NumberStr(), ctrl_TxtCodigo.getTextBoxValue(), emp, i_Form.TxtExtra.Text, desconto, ref header); //EndEventCode return(true); } #endregion #region - event_val_TxtCodigo - case event_val_TxtCodigo: { //InitEventCode event_val_TxtCodigo switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (i_Form.TxtCodigo.Text.Length > 0) { i_Form.TxtCodigo.BackColor = Color.White; ctrl_TxtCodigo.IsUserValidated = true; ctrl_TxtCodigo.CleanError(); if (ctrl_TxtCodigo.GetEnterPressed()) { if (i_Form.CboTipo.SelectedIndex != -1) { if (i_Form.CboTipo.SelectedIndex == 0) { DadosEmpresa de = new DadosEmpresa(); var_exchange.fetch_dadosEmpresa(ctrl_TxtCodigo.getTextBoxValue(), ref header, ref de); i_Form.TxtNome.Text = de.get_st_fantasia(); } else { DadosLoja dl = new DadosLoja(); var_exchange.fetch_dadosLoja("", ctrl_TxtCodigo.getTextBoxValue(), ref header, ref dl); i_Form.TxtNome.Text = dl.get_st_nome(); } } } } else { i_Form.TxtCodigo.BackColor = colorInvalid; ctrl_TxtCodigo.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtCobranca - case event_val_TxtCobranca: { //InitEventCode event_val_TxtCobranca if (ctrl_TxtCobranca.getTextBoxValue_Long() == 0) { i_Form.TxtCobranca.BackColor = colorInvalid; ctrl_TxtCobranca.IsUserValidated = false; } else { i_Form.TxtCobranca.BackColor = Color.White; ctrl_TxtCobranca.IsUserValidated = true; ctrl_TxtCobranca.CleanError(); } //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_TxtCodLoja.AcquireTextBox(i_Form.TxtCodLoja, this, event_val_TxtCodLoja, 8); // carregar list box com usuarios logistas sem vinculo ArrayList lst = new ArrayList(); var_exchange.fetch_user_lojista(ref header, ref lst); for (int t = 0; t < lst.Count; ++t) { DadosUsuario du = new DadosUsuario(lst [t] as DataPortable); i_Form.LstUsers.Items.Add(du.get_id_usuario() + " - " + du.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_Vincular - case event_Vincular: { //InitEventCode event_Vincular if (i_Form.LstUsers.SelectedIndex == -1) { MessageBox.Show("Selecione o usuário", "Aviso"); return(false); } if (i_Form.TxtNomeLoja.Text.Length == 0) { MessageBox.Show("Selecione o código da loja", "Aviso"); return(false); } string id_user = i_Form.LstUsers.SelectedItem.ToString(); id_user = id_user.Substring(0, id_user.IndexOf(" ")); var_exchange.exec_vincula_lojista(ctrl_TxtCodLoja.getTextBoxValue(), id_user, ref header); i_Form.Close(); //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; if (ctrl_TxtCodLoja.GetEnterPressed()) { DadosLoja dl = new DadosLoja(); var_exchange.fetch_dadosLoja("", ctrl_TxtCodLoja.getTextBoxValue(), ref header, ref dl); i_Form.TxtNomeLoja.Text = dl.get_st_nome(); } } else { i_Form.TxtCodLoja.BackColor = colorInvalid; ctrl_TxtCodLoja.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_BtnVincularClick - case event_BtnVincularClick: { //InitEventCode event_BtnVincularClick //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_TxtNovaSenha.AcquireTextBox(i_Form.TxtNovaSenha, this, event_val_TxtNovaSenha, 4); ctrl_TxtConfirmaSenha.AcquireTextBox(i_Form.TxtConfirmaSenha, this, event_val_TxtConfirmaSenha, 4); 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, 2); ctrl_TxtNovaSenha.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtConfirmaSenha.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtEmpresa.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtMatricula.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtTitularidade.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); if (header.get_tg_user_type() == TipoUsuario.Administrador || header.get_tg_user_type() == TipoUsuario.Operador) { 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_Confirmar - case event_Confirmar: { //InitEventCode event_Confirmar bool IsDone = true; if (!ctrl_TxtNovaSenha.IsUserValidated) { ctrl_TxtNovaSenha.SetErrorMessage("Senha deve possuir 4 caracteres numéricos"); IsDone = false; } if (!ctrl_TxtConfirmaSenha.IsUserValidated) { ctrl_TxtConfirmaSenha.SetErrorMessage("Senha deve possuir 4 caracteres numéricos"); IsDone = false; } if (!ctrl_TxtEmpresa.IsUserValidated) { ctrl_TxtEmpresa.SetErrorMessage("Código de empresa não está preenchido"); IsDone = false; } if (!ctrl_TxtMatricula.IsUserValidated) { ctrl_TxtMatricula.SetErrorMessage("Código de matricula não está preenchido"); IsDone = false; } if (!ctrl_TxtTitularidade.IsUserValidated) { ctrl_TxtTitularidade.SetErrorMessage("Titularidade não está preenchida"); IsDone = false; } if (!IsDone) { return(false); } var_exchange.exec_alteraSenhaCartao(ctrl_TxtEmpresa.getTextBoxValue(), ctrl_TxtMatricula.getTextBoxValue(), ctrl_TxtTitularidade.getTextBoxValue(), "", var_util.DESCript(ctrl_TxtNovaSenha.getTextBoxValue().PadLeft(8, '*'), "12345678"), ref header); //EndEventCode return(true); } #endregion #region - event_val_TxtSenha - case event_val_TxtSenha: { //InitEventCode event_val_TxtSenha //EndEventCode return(true); } #endregion #region - event_val_TxtNovaSenha - case event_val_TxtNovaSenha: { //InitEventCode event_val_TxtNovaSenha switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (i_Form.TxtNovaSenha.Text.Length == 4) { i_Form.TxtNovaSenha.BackColor = Color.White; ctrl_TxtNovaSenha.IsUserValidated = true; ctrl_TxtNovaSenha.CleanError(); } else { i_Form.TxtNovaSenha.BackColor = colorInvalid; ctrl_TxtNovaSenha.IsUserValidated = false; } break; } } //EndEventCode return(true); } #endregion #region - event_val_TxtConfirmaSenha - case event_val_TxtConfirmaSenha: { //InitEventCode event_val_TxtConfirmaSenha switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (i_Form.TxtConfirmaSenha.Text.Length == 4) { i_Form.TxtConfirmaSenha.BackColor = Color.White; ctrl_TxtConfirmaSenha.IsUserValidated = true; ctrl_TxtConfirmaSenha.CleanError(); } else { i_Form.TxtConfirmaSenha.BackColor = colorInvalid; ctrl_TxtConfirmaSenha.IsUserValidated = false; } break; } } //EndEventCode return(true); } #endregion #region - event_val_TxtEmpresa - case event_val_TxtEmpresa: { //InitEventCode event_val_TxtEmpresa switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (i_Form.TxtEmpresa.Text.Length > 0) { i_Form.TxtEmpresa.BackColor = Color.White; ctrl_TxtEmpresa.IsUserValidated = true; ctrl_TxtEmpresa.CleanError(); } else { i_Form.TxtEmpresa.BackColor = colorInvalid; ctrl_TxtEmpresa.IsUserValidated = false; } break; } default: break; } //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; } //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 > 0) { 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; } //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_TxtTelefone.AcquireTextBox(i_Form.TxtTelefone, this, event_val_TxtTelefone, 10); ctrl_TxtTelefone.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 IsDone = true; if (!ctrl_TxtTelefone.IsUserValidated) { ctrl_TxtTelefone.SetErrorMessage("O telefone deve ser preenchido"); IsDone = false; } if (!IsDone) { return(false); } StringBuilder sb_send_pend = new StringBuilder("05PFCP"); sb_send_pend.Append(ctrl_TxtTelefone.getTextBoxValue()); sb_send_pend.Append(Context.FALSE); string buf_response = var_exchange.m_Client.WriteServerMsg(sb_send_pend.ToString()); string cod_resp = buf_response.Substring(0, 2); string cod_nsu = buf_response.Substring(2, 6); string valor = buf_response.Substring(8, 12).TrimStart('0'); string nome_loja = buf_response.Substring(20, 25); string msg_erro = buf_response.Substring(45, 20); i_Form.LstPend.Items.Clear(); if (cod_resp == "00") { i_Form.LstPend.Items.Add(""); i_Form.LstPend.Items.Add(" Pendência cadastrada:"); i_Form.LstPend.Items.Add(""); i_Form.LstPend.Items.Add(" Loja " + nome_loja); i_Form.LstPend.Items.Add(" Valor R$" + new money().formatToMoney(valor)); i_Form.LstPend.Items.Add(""); i_Form.LstPend.Items.Add(" NSU " + cod_nsu); } else { MessageBox.Show("Nenhuma pendência encontrada", "Aviso"); } //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 (ctrl_TxtTelefone.getTextBoxValue().Length < 10) { i_Form.TxtTelefone.BackColor = colorInvalid; ctrl_TxtTelefone.IsUserValidated = false; } else { i_Form.TxtTelefone.BackColor = Color.White; ctrl_TxtTelefone.IsUserValidated = true; ctrl_TxtTelefone.CleanError(); if (ctrl_TxtTelefone.GetEnterPressed()) { doEvent(event_Confirmar, null); } } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_BtnConfirmaClick - case event_BtnConfirmaClick: { //InitEventCode event_BtnConfirmaClick //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_TxtLoja.AcquireTextBox(i_Form.TxtLoja, this, event_val_TxtLoja, 6); ctrl_TxtCNPJ.AcquireTextBox(i_Form.TxtCNPJ, this, event_val_TxtCNPJ); ctrl_TxtDtAbIni.AcquireTextBox(i_Form.TxtDtAbIni, this, event_val_TxtDtAbIni, dateTextController.FORMAT_DDMMYYYY); ctrl_TxtDtAbFim.AcquireTextBox(i_Form.TxtDtAbFim, this, event_val_TxtDtAbFim, dateTextController.FORMAT_DDMMYYYY); ctrl_TxtDtFechIni.AcquireTextBox(i_Form.TxtDtFechIni, this, event_val_TxtDtFechIni, dateTextController.FORMAT_DDMMYYYY); ctrl_TxtDtFechFim.AcquireTextBox(i_Form.TxtDtFechFim, this, event_val_TxtDtFechFim, dateTextController.FORMAT_DDMMYYYY); ctrl_TxtDtAbIni.SetTextBoxText(DateTime.Now.Day.ToString().PadLeft(2, '0') + DateTime.Now.Month.ToString().PadLeft(2, '0') + DateTime.Now.Year.ToString().PadLeft(2, '0')); ctrl_TxtDtAbFim.SetTextBoxText(DateTime.Now.Day.ToString().PadLeft(2, '0') + DateTime.Now.Month.ToString().PadLeft(2, '0') + DateTime.Now.Year.ToString().PadLeft(2, '0')); ArrayList lst = new ArrayList(); var_exchange.fetch_conveyUsuarios(ref header, ref lst); i_Form.CboOpers.Items.Clear(); i_Form.CboOpers.Items.Add("(Todos)"); i_Form.CboResp.Items.Add("(Todos)"); for (int t = 0; t < lst.Count; ++t) { DadosUsuario us = new DadosUsuario(lst[t] as DataPortable); i_Form.CboOpers.Items.Add(us.get_st_nome()); i_Form.CboResp.Items.Add(us.get_st_nome()); } i_Form.CboOpers.SelectedIndex = 0; i_Form.CboResp.SelectedIndex = 0; i_Form.CboCateg.SelectedIndex = 0; i_Form.CboPrioridade.SelectedIndex = 0; i_Form.CboSit.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_Procurar - case event_Procurar: { //InitEventCode event_Procurar string nu_categ = (i_Form.CboCateg.SelectedIndex - 1).ToString(); string nu_prioridade = (i_Form.CboPrioridade.SelectedIndex - 1).ToString(); string st_operador = ""; string st_resp = ""; string tg_closed = i_Form.CboSit.SelectedIndex.ToString(); string dt_ini_ab = ""; string dt_fim_ab = ""; string dt_ini_fech = ""; string dt_fim_fech = ""; string tg_tecnico = Context.FALSE; string st_loja = ""; if (i_Form.CboOpers.SelectedIndex > 0) { st_operador = i_Form.CboOpers.SelectedItem.ToString(); } if (i_Form.CboResp.SelectedIndex > 0) { st_resp = i_Form.CboResp.SelectedItem.ToString(); } if (ctrl_TxtLoja.IsUserValidated) { st_loja = ctrl_TxtLoja.getTextBoxValue(); } if (i_Form.ChkTecnico.Checked) { tg_tecnico = Context.TRUE; } if (ctrl_TxtDtAbIni.IsUserValidated) { dt_ini_ab = var_util.GetDataBaseTimeFormat(ctrl_TxtDtAbIni.getTextBoxValue_Date()); } if (ctrl_TxtDtAbFim.IsUserValidated) { dt_fim_ab = var_util.GetDataBaseTimeFormat(ctrl_TxtDtAbFim.getTextBoxValue_Date().AddDays(1)); } if (ctrl_TxtDtFechIni.IsUserValidated) { dt_ini_fech = var_util.GetDataBaseTimeFormat(ctrl_TxtDtFechIni.getTextBoxValue_Date()); } if (ctrl_TxtDtFechFim.IsUserValidated) { dt_fim_fech = var_util.GetDataBaseTimeFormat(ctrl_TxtDtFechFim.getTextBoxValue_Date().AddDays(1)); } string st_block = ""; var_exchange.fetch_chamados(nu_categ, nu_prioridade, st_operador, tg_closed, dt_ini_ab, dt_fim_ab, dt_ini_fech, dt_fim_fech, tg_tecnico, st_loja, st_resp, ref header, ref st_block); ArrayList full_memory = new ArrayList(); while (st_block != "") { ArrayList tmp_memory = new ArrayList(); if (var_exchange.fetch_memory(st_block, "400", ref st_block, ref tmp_memory)) { for (int t = 0; t < tmp_memory.Count; ++t) { full_memory.Add(tmp_memory[t]); } } } i_Form.LstChamados.Items.Clear(); for (int t = 0; t < full_memory.Count; ++t) { DadosChamado dc = new DadosChamado(full_memory[t] as DataPortable); string dt_ab = var_util.getDDMMYYYY_format(dc.get_dt_ab()); string dt_fech = dc.get_dt_fech(); if (dt_fech.Length > 0) { dt_fech = var_util.getDDMMYYYY_format(dt_fech); } string [] full_row = new string [] { dt_ab, dt_fech, dc.get_st_oper() + " (" + dc.get_st_resp() + ")", dc.get_st_motivo() }; i_Form.LstChamados.Items.Add(var_util.GetListViewItem(dc.get_id_chamado(), full_row)); } //EndEventCode return(true); } #endregion #region - event_val_TxtLoja - case event_val_TxtLoja: { //InitEventCode event_val_TxtLoja switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (ctrl_TxtLoja.getTextBoxValue().Length > 0) { i_Form.TxtLoja.BackColor = Color.White; ctrl_TxtLoja.IsUserValidated = true; if (ctrl_TxtLoja.GetEnterPressed()) { DadosLoja dl = new DadosLoja(); var_exchange.fetch_dadosLoja("", ctrl_TxtLoja.getTextBoxValue(), ref header, ref dl); i_Form.TxtNome.Text = dl.get_st_nome(); ctrl_TxtCNPJ.SetTextBoxText(dl.get_nu_CNPJ()); } } else { i_Form.TxtLoja.BackColor = colorInvalid; ctrl_TxtLoja.IsUserValidated = false; if (ctrl_TxtLoja.GetEnterPressed()) { event_dlgConsultaLoja ev_call = new event_dlgConsultaLoja(var_util, var_exchange); ev_call.header = header; ev_call.i_Form.Show(); } } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtDtAbIni - case event_val_TxtDtAbIni: { //InitEventCode event_val_TxtDtAbIni switch (arg as string) { case dateTextController.DATE_INVALID: { i_Form.TxtDtAbIni.BackColor = colorInvalid; ctrl_TxtDtAbIni.IsUserValidated = false; break; } case dateTextController.DATE_VALID: { i_Form.TxtDtAbIni.BackColor = Color.White; ctrl_TxtDtAbIni.IsUserValidated = true; break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtDtAbFim - case event_val_TxtDtAbFim: { //InitEventCode event_val_TxtDtAbFim switch (arg as string) { case dateTextController.DATE_INVALID: { i_Form.TxtDtAbFim.BackColor = colorInvalid; ctrl_TxtDtAbFim.IsUserValidated = false; break; } case dateTextController.DATE_VALID: { i_Form.TxtDtAbFim.BackColor = Color.White; ctrl_TxtDtAbFim.IsUserValidated = true; break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtDtFechIni - case event_val_TxtDtFechIni: { //InitEventCode event_val_TxtDtFechIni switch (arg as string) { case dateTextController.DATE_INVALID: { i_Form.TxtDtFechIni.BackColor = colorInvalid; ctrl_TxtDtFechIni.IsUserValidated = false; break; } case dateTextController.DATE_VALID: { i_Form.TxtDtFechIni.BackColor = Color.White; ctrl_TxtDtFechIni.IsUserValidated = true; break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtDtFechFim - case event_val_TxtDtFechFim: { //InitEventCode event_val_TxtDtFechFim switch (arg as string) { case dateTextController.DATE_INVALID: { i_Form.TxtDtFechFim.BackColor = colorInvalid; ctrl_TxtDtFechFim.IsUserValidated = false; break; } case dateTextController.DATE_VALID: { i_Form.TxtDtFechFim.BackColor = Color.White; ctrl_TxtDtFechFim.IsUserValidated = true; break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtCNPJ - case event_val_TxtCNPJ: { //InitEventCode event_val_TxtCNPJ switch (arg as string) { case cnpjTextController.CNPJ_INCOMPLETE: case cnpjTextController.CNPJ_INVALID: { i_Form.TxtCNPJ.BackColor = colorInvalid; ctrl_TxtCNPJ.IsUserValidated = false; if (ctrl_TxtCNPJ.GetEnterPressed()) { event_dlgConsultaLoja ev_call = new event_dlgConsultaLoja(var_util, var_exchange); ev_call.header = header; ev_call.i_Form.Show(); } break; } case cnpjTextController.CNPJ_VALID: { i_Form.TxtCNPJ.BackColor = Color.White; ctrl_TxtCNPJ.IsUserValidated = true; ctrl_TxtCNPJ.CleanError(); if (ctrl_TxtLoja.GetEnterPressed()) { DadosLoja dl = new DadosLoja(); var_exchange.fetch_dadosLoja(ctrl_TxtCNPJ.getTextBoxValue(), "", ref header, ref dl); ctrl_TxtLoja.SetTextBoxText(dl.get_st_loja()); i_Form.TxtNome.Text = dl.get_st_nome(); } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_Editar - case event_Editar: { //InitEventCode event_Editar if (i_Form.LstChamados.SelectedItems.Count > 0) { event_dlgEditaChamado ev_call = new event_dlgEditaChamado(var_util, var_exchange); ev_call.header = header; ev_call.id_chamado = var_util.getSelectedListViewItemTag(i_Form.LstChamados); ev_call.i_Form.ShowDialog(); } //EndEventCode return(true); } #endregion #region - event_Relatorio - case event_Relatorio: { //InitEventCode event_Relatorio ArrayList lstReport = new ArrayList(); lstReport.Add("RELATÓRIO DE CHAMADOS"); lstReport.Add(""); lstReport.Add("DT. ABERTURA DT. FECHAMENTO OPER (RESP)"); lstReport.Add("DESCRIÇÃO"); lstReport.Add("-------------------------------------------------------------------------------------------------------"); lstReport.Add(""); string line = ""; for (int t = 0; t < i_Form.LstChamados.Items.Count; ++t) { line = i_Form.LstChamados.Items[t].SubItems[0].Text.PadRight(29, ' ') + " "; line += i_Form.LstChamados.Items[t].SubItems[1].Text.PadRight(29, ' ') + " "; line += i_Form.LstChamados.Items[t].SubItems[2].Text.PadRight(32, ' ') + " "; lstReport.Add(line); line = i_Form.LstChamados.Items[t].SubItems[3].Text.PadRight(100, ' ').Substring(0, 100); lstReport.Add(line); lstReport.Add(""); } new ConveyPrinter("Courier New", 7, 10, ref lstReport); //EndEventCode return(true); } #endregion #region - event_Print - case event_Print: { //InitEventCode event_Print //EndEventCode return(true); } #endregion #region - event_LstChamadosDoubleClick - case event_LstChamadosDoubleClick: { //InitEventCode event_LstChamadosDoubleClick //EndEventCode return(true); } #endregion #region - event_BtnProcurarClick - case event_BtnProcurarClick: { //InitEventCode event_BtnProcurarClick //EndEventCode return(true); } #endregion #region - event_BtnReportClick - case event_BtnReportClick: { //InitEventCode event_BtnReportClick //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 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_TxtMesHor.AcquireTextBox(i_Form.TxtMesHor, this, event_val_TxtMesHor, dateTimeTextController.FORMAT_HHMM); ctrl_TxtSemHor.AcquireTextBox(i_Form.TxtSemHor, this, event_val_TxtSemHor, dateTimeTextController.FORMAT_HHMM); ctrl_TxtDiaHor.AcquireTextBox(i_Form.TxtDiaHor, this, event_val_TxtDiaHor, dateTimeTextController.FORMAT_HHMM); ctrl_TxtEmpresa.AcquireTextBox(i_Form.TxtEmpresa, this, event_val_TxtEmpresa, 6); ctrl_TxtDiaMes.AcquireTextBox(i_Form.TxtDiaMes, this, event_val_TxtDiaMes, 2); ctrl_TxtEmpresa.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); i_Form.CboAtiv.Items.AddRange(new TipoAtividadeDesc().GetArray().ToArray()); if (header.get_tg_user_type() != TipoUsuario.SuperUser && header.get_tg_user_type() == TipoUsuario.Operador) { ctrl_TxtEmpresa.SetTextBoxText(header.get_st_empresa()); } //EndEventCode return(true); } #endregion #region - robot_ShowDialog - case robot_ShowDialog: { //InitEventCode robot_ShowDialog //EndEventCode return(true); } #endregion #region - robot_CloseDialog - case robot_CloseDialog: { //InitEventCode robot_CloseDialog //EndEventCode return(true); } #endregion #region - event_Confirmar - case event_Confirmar: { //InitEventCode event_Confirmar if (i_Form.CboAtiv.SelectedIndex == -1) { MessageBox.Show("Selecione a atividade", "Aviso"); return(false); } if (!ctrl_TxtEmpresa.IsUserValidated) { ctrl_TxtEmpresa.SetErrorMessage("Código da empresa deve ser informado"); return(false); } string en_tipo_schedule = ""; string st_horario = ""; string st_aux = ""; if (ctrl_TxtDiaHor.IsUserValidated) { en_tipo_schedule = Scheduler.Daily; st_horario = ctrl_TxtDiaHor.getTextBoxValue(); } else if (ctrl_TxtSemHor.IsUserValidated) { if (i_Form.CboDiaSem.SelectedIndex == -1) { MessageBox.Show("Escolha o dia da semana para a atividade", "Aviso"); return(false); } en_tipo_schedule = Scheduler.Weekly; st_horario = ctrl_TxtSemHor.getTextBoxValue(); st_aux = i_Form.CboDiaSem.SelectedIndex.ToString(); } else if (ctrl_TxtMesHor.IsUserValidated) { if (!ctrl_TxtDiaMes.IsUserValidated) { MessageBox.Show("Escolha o dia do mês para a atividade", "Aviso"); return(false); } en_tipo_schedule = Scheduler.Monthly; st_horario = ctrl_TxtMesHor.getTextBoxValue(); st_aux = ctrl_TxtDiaMes.getTextBoxValue(); } var_exchange.ins_agenda(ctrl_TxtEmpresa.getTextBoxValue(), (i_Form.CboAtiv.SelectedIndex + 1).ToString(), en_tipo_schedule, st_horario.Replace(":", ""), st_aux, i_Form.CboAff.SelectedItem.ToString(), ref header); HouveCadastro = true; //EndEventCode return(true); } #endregion #region - event_val_TxtMesHor - case event_val_TxtMesHor: { //InitEventCode event_val_TxtMesHor switch (arg as string) { case dateTimeTextController.DATE_INVALID: { i_Form.TxtMesHor.BackColor = colorInvalid; ctrl_TxtMesHor.IsUserValidated = false; break; } case dateTimeTextController.DATE_VALID: { i_Form.TxtMesHor.BackColor = Color.White; ctrl_TxtMesHor.IsUserValidated = true; ctrl_TxtMesHor.CleanError(); ctrl_TxtSemHor.SetTextBoxText(""); ctrl_TxtDiaHor.SetTextBoxText(""); break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtSemHor - case event_val_TxtSemHor: { //InitEventCode event_val_TxtSemHor switch (arg as string) { case dateTimeTextController.DATE_INVALID: { i_Form.TxtSemHor.BackColor = colorInvalid; ctrl_TxtSemHor.IsUserValidated = false; break; } case dateTimeTextController.DATE_VALID: { i_Form.TxtSemHor.BackColor = Color.White; ctrl_TxtSemHor.IsUserValidated = true; ctrl_TxtSemHor.CleanError(); ctrl_TxtMesHor.SetTextBoxText(""); ctrl_TxtDiaHor.SetTextBoxText(""); break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtDiaHor - case event_val_TxtDiaHor: { //InitEventCode event_val_TxtDiaHor switch (arg as string) { case dateTimeTextController.DATE_INVALID: { i_Form.TxtDiaHor.BackColor = colorInvalid; ctrl_TxtDiaHor.IsUserValidated = false; break; } case dateTimeTextController.DATE_VALID: { i_Form.TxtDiaHor.BackColor = Color.White; ctrl_TxtDiaHor.IsUserValidated = true; ctrl_TxtDiaHor.CleanError(); ctrl_TxtMesHor.SetTextBoxText(""); ctrl_TxtSemHor.SetTextBoxText(""); break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtEmpresa - case event_val_TxtEmpresa: { //InitEventCode event_val_TxtEmpresa switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (i_Form.TxtEmpresa.Text.Length > 0) { i_Form.TxtEmpresa.BackColor = Color.White; ctrl_TxtEmpresa.IsUserValidated = true; ctrl_TxtEmpresa.CleanError(); if (ctrl_TxtEmpresa.GetEnterPressed()) { ArrayList lst = new ArrayList(); string nome_emp = ""; var_exchange.fetch_empresasAfiliadas(ctrl_TxtEmpresa.getTextBoxValue(), ref header, ref nome_emp, ref lst); i_Form.CboAff.Items.Clear(); i_Form.TxtNome.Text = nome_emp; for (int t = 0; t < lst.Count; ++t) { DadosEmpresa de = new DadosEmpresa(lst [t] as DataPortable); i_Form.CboAff.Items.Add(de.get_st_empresa()); } if (lst.Count == 0) { i_Form.CboAff.Items.Add(""); } i_Form.CboAff.SelectedIndex = 0; } } else { i_Form.TxtEmpresa.BackColor = colorInvalid; ctrl_TxtEmpresa.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtDiaMes - case event_val_TxtDiaMes: { //InitEventCode event_val_TxtDiaMes if (ctrl_TxtDiaMes.getTextBoxValue_Long() > 28 || ctrl_TxtDiaMes.getTextBoxValue_Long() < 1) { i_Form.TxtDiaMes.BackColor = colorInvalid; ctrl_TxtDiaMes.IsUserValidated = false; } else { i_Form.TxtDiaMes.BackColor = Color.White; ctrl_TxtDiaMes.IsUserValidated = true; } //EndEventCode return(true); } #endregion #region - event_BtnConfirmarClick - case event_BtnConfirmarClick: { //InitEventCode event_BtnConfirmarClick //EndEventCode return(true); } #endregion default: break; } return(false); }