public override bool doEvent(int event_number, object arg) { switch (event_number) { #region - event_Load - case event_Load: { //InitEventCode event_Load doEvent(event_Translate, null); doEvent(event_FormIsOpening, null); //EndEventCode return(true); } #endregion #region - event_Translate - case event_Translate: { //InitEventCode event_Translate //EndEventCode return(true); } #endregion #region - event_FormIsOpening - case event_FormIsOpening: { //InitEventCode event_FormIsOpening doEvent(event_CalDateChanged, null); //EndEventCode return(true); } #endregion #region - event_CalDateChanged - case event_CalDateChanged: { //InitEventCode event_CalDateChanged string oper = ""; string vendas = ""; string canc = ""; var_exchange.fetch_financ_lojista(var_util.GetDataBaseTimeFormat(i_Form.cal.SelectionStart), ref header, ref oper, ref vendas, ref canc); i_Form.LblOper.Text = oper; i_Form.LblVendas.Text = "R$ " + new money().formatToMoney(vendas); i_Form.LblVendasCanc.Text = "R$ " + new money().formatToMoney(canc); //EndEventCode return(true); } #endregion #region - event_CalDateSelected - case event_CalDateSelected: { //InitEventCode event_CalDateSelected //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_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 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 doEvent(event_Translate, null); doEvent(event_FormIsOpening, null); //EndEventCode return(true); } #endregion #region - event_Translate - case event_Translate: { //InitEventCode event_Translate //EndEventCode return(true); } #endregion #region - event_FormIsOpening - case event_FormIsOpening: { //InitEventCode event_FormIsOpening string st_content = ""; if (var_exchange.fetch_canc_dia_lojista(ref header, ref st_content)) { while (st_content != "") { ArrayList tmp_memory = new ArrayList(); if (var_exchange.fetch_memory(st_content, "200", ref st_content, ref tmp_memory)) { for (int t = 0; t < tmp_memory.Count; ++t) { DadosConsultaTransacao dct = new DadosConsultaTransacao(tmp_memory [t] as DataPortable); string [] full_row = new string [] { dct.get_st_cartao(), "R$ " + new money().formatToMoney(dct.get_vr_valor()), var_util.getDDMMYYYY_format(dct.get_dt_transacao()), dct.get_st_nsu() }; i_Form.LstVendas.Items.Add(var_util.GetListViewItem(null, full_row)); } } } } //EndEventCode return(true); } #endregion #region - event_BtnCancelarClick - case event_BtnCancelarClick: { //InitEventCode event_BtnCancelarClick if (i_Form.LstVendas.SelectedItems.Count == 0) { return(false); } string dtax = i_Form.LstVendas.SelectedItems[0].SubItems[2].Text; string nsu = i_Form.LstVendas.SelectedItems[0].SubItems[3].Text; string dta = var_util.GetDataBaseTimeFormat( new DateTime(Convert.ToInt32(dtax.Substring(6, 4)), Convert.ToInt32(dtax.Substring(3, 2)), Convert.ToInt32(dtax.Substring(0, 2)))); if (!var_exchange.fetch_dadosNSU(nsu, dta, TipoConfirmacao.Confirmada, ref header, ref dn)) { return(false); } POS_Entrada pe = new POS_Entrada(); POS_Resposta pr = new POS_Resposta(); pe.set_st_terminal(dn.get_st_terminal()); pe.set_st_empresa(dn.get_st_empresa()); pe.set_st_matricula(dn.get_st_matricula()); pe.set_st_titularidade(dn.get_st_titularidade()); pe.set_nu_parcelas("0"); string st_msg = ""; var_exchange.m_Client.QuietMode = true; if (var_exchange.exec_pos_cancelaVendaEmpresarial(nsu, dta, header.get_st_user_id(), ref pe, ref st_msg, ref pr)) { MessageBox.Show("Sucesso no cancelamento", "Aviso"); } else { MessageBox.Show(st_msg, "Erro"); } var_exchange.m_Client.QuietMode = false; doEvent(event_FormIsOpening, null); //EndEventCode return(true); } #endregion default: break; } return(false); }
public override bool doEvent(int event_number, object arg) { switch (event_number) { #region - event_Load - case event_Load: { //InitEventCode event_Load #if ROBOT var_util.execDefinedRobot(this, var_alias); #else doEvent(event_Translate, null); doEvent(event_FormIsOpening, null); #endif //EndEventCode return(true); } #endregion #region - event_Translate - case event_Translate: { //InitEventCode event_Translate //EndEventCode return(true); } #endregion #region - event_FormIsOpening - case event_FormIsOpening: { //InitEventCode event_FormIsOpening ctrl_TxtNSU.AcquireTextBox(i_Form.TxtNSU, this, event_val_TxtNSU, 6); ctrl_TxtDtIni.AcquireTextBox(i_Form.TxtDtIni, this, event_val_TxtDtIni, dateTextController.FORMAT_DDMMYYYY); ctrl_TxtDtIni.SetTextBoxText(DateTime.Now.Day.ToString().PadLeft(2, '0') + DateTime.Now.Month.ToString().PadLeft(2, '0') + DateTime.Now.Year.ToString().PadLeft(2, '0')); ctrl_TxtNSU.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_TxtNSU.IsUserValidated) { ctrl_TxtNSU.SetErrorMessage("O numerode NSU deve ser informado"); IsDone = false; } if (!IsDone) { return(false); } if (!doEvent(event_BuscaDados, null)) { return(false); } if (MessageBox.Show("Confirmar esta transação pendente?", "Aviso", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { var_exchange.exec_resolvePend(ctrl_TxtNSU.getTextBoxValue(), var_util.GetDataBaseTimeFormat(ctrl_TxtDtIni.getTextBoxValue_Date()), TipoConfirmacao.Confirmada, ref header); } //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 (i_Form.TxtNSU.Text.Length > 0) { i_Form.TxtNSU.BackColor = Color.White; ctrl_TxtNSU.IsUserValidated = true; ctrl_TxtNSU.CleanError(); if (ctrl_TxtNSU.GetEnterPressed()) { doEvent(event_BuscaDados, null); } } else { i_Form.TxtNSU.BackColor = colorInvalid; ctrl_TxtNSU.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtDtIni - case event_val_TxtDtIni: { //InitEventCode event_val_TxtDtIni switch (arg as string) { case dateTextController.DATE_INVALID: { i_Form.TxtDtIni.BackColor = colorInvalid; ctrl_TxtDtIni.IsUserValidated = false; break; } case dateTextController.DATE_VALID: { i_Form.TxtDtIni.BackColor = Color.White; ctrl_TxtDtIni.IsUserValidated = true; ctrl_TxtDtIni.CleanError(); if (ctrl_TxtDtIni.GetEnterPressed()) { doEvent(event_BuscaDados, null); } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_BuscaDados - case event_BuscaDados: { //InitEventCode event_BuscaDados if (var_exchange.fetch_dadosNSU(ctrl_TxtNSU.getTextBoxValue(), var_util.GetDataBaseTimeFormat(ctrl_TxtDtIni.getTextBoxValue_Date()), TipoConfirmacao.Pendente, ref header, ref dn)) { i_Form.TxtNome.Text = dn.get_st_nome(); i_Form.TxtCartao.Text = dn.get_st_cartao(); i_Form.TxtData.Text = dn.get_dt_operacao(); i_Form.TxtValor.Text = "R$ " + new money().formatToMoney(dn.get_vr_valor()); ctrl_TxtNSU.SetTextBoxText(ctrl_TxtNSU.getTextBoxValue().PadLeft(6, '0')); } else { return(false); } //EndEventCode return(true); } #endregion #region - event_Cancelar - case event_Cancelar: { //InitEventCode event_Cancelar bool IsDone = true; if (!ctrl_TxtNSU.IsUserValidated) { ctrl_TxtNSU.SetErrorMessage("O numerode NSU deve ser informado"); IsDone = false; } if (!IsDone) { return(false); } if (!doEvent(event_BuscaDados, null)) { return(false); } if (MessageBox.Show("Confirma cancelamento de transação pendente?", "Aviso", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { var_exchange.exec_resolvePend(ctrl_TxtNSU.getTextBoxValue(), var_util.GetDataBaseTimeFormat(ctrl_TxtDtIni.getTextBoxValue_Date()), TipoConfirmacao.Cancelada, ref header); } //EndEventCode return(true); } #endregion #region - event_BtnConfirmarClick - case event_BtnConfirmarClick: { //InitEventCode event_BtnConfirmarClick //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_TxtNSU.AcquireTextBox(i_Form.TxtNSU, this, event_val_TxtNSU, 6); ctrl_TxtDtIni.AcquireTextBox(i_Form.TxtDtIni, this, event_val_TxtDtIni, dateTextController.FORMAT_DDMMYYYY); ctrl_TxtDtIni.SetTextBoxText(DateTime.Now.Day.ToString().PadLeft(2, '0') + DateTime.Now.Month.ToString().PadLeft(2, '0') + DateTime.Now.Year.ToString().PadLeft(2, '0')); ctrl_TxtNSU.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_val_TxtNSU - case event_val_TxtNSU: { //InitEventCode event_val_TxtNSU switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (i_Form.TxtNSU.Text.Length > 0) { i_Form.TxtNSU.BackColor = Color.White; ctrl_TxtNSU.IsUserValidated = true; ctrl_TxtNSU.CleanError(); if (ctrl_TxtNSU.GetEnterPressed()) { doEvent(event_BuscaDados, null); } } else { i_Form.TxtNSU.BackColor = colorInvalid; ctrl_TxtNSU.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_Confirmar - case event_Confirmar: { //InitEventCode event_Confirmar bool IsDone = true; if (!ctrl_TxtNSU.IsUserValidated) { ctrl_TxtNSU.SetErrorMessage("O numerode NSU deve ser informado"); IsDone = false; } if (!IsDone) { return(false); } if (!doEvent(event_BuscaDados, null)) { return(false); } POS_Entrada pe = new POS_Entrada(); POS_Resposta pr = new POS_Resposta(); pe.set_st_terminal(dn.get_st_terminal()); pe.set_st_empresa(dn.get_st_empresa()); pe.set_st_matricula(dn.get_st_matricula()); pe.set_st_titularidade(dn.get_st_titularidade()); pe.set_nu_parcelas("0"); string st_msg = ""; var_exchange.m_Client.QuietMode = true; if (var_exchange.exec_pos_cancelaVendaEmpresarial(ctrl_TxtNSU.getTextBoxValue(), var_util.GetDataBaseTimeFormat(ctrl_TxtDtIni.getTextBoxValue_Date()), header.get_st_user_id(), ref pe, ref st_msg, ref pr)) { MessageBox.Show("Sucesso no cancelamento", "Aviso"); } else { MessageBox.Show(st_msg, "Erro"); } var_exchange.m_Client.QuietMode = false; //EndEventCode return(true); } #endregion #region - event_BuscaDados - case event_BuscaDados: { //InitEventCode event_BuscaDados if (var_exchange.fetch_dadosNSU(ctrl_TxtNSU.getTextBoxValue(), var_util.GetDataBaseTimeFormat(ctrl_TxtDtIni.getTextBoxValue_Date()), TipoConfirmacao.Confirmada, ref header, ref dn)) { i_Form.TxtNome.Text = dn.get_st_nome(); i_Form.TxtCartao.Text = dn.get_st_cartao(); i_Form.TxtData.Text = dn.get_dt_operacao(); i_Form.TxtValor.Text = "R$ " + new money().formatToMoney(dn.get_vr_valor()); ctrl_TxtNSU.SetTextBoxText(ctrl_TxtNSU.getTextBoxValue().PadLeft(6, '0')); } else { return(false); } //EndEventCode return(true); } #endregion #region - event_val_TxtDtIni - case event_val_TxtDtIni: { //InitEventCode event_val_TxtDtIni switch (arg as string) { case dateTextController.DATE_INVALID: { i_Form.TxtDtIni.BackColor = colorInvalid; ctrl_TxtDtIni.IsUserValidated = false; break; } case dateTextController.DATE_VALID: { i_Form.TxtDtIni.BackColor = Color.White; ctrl_TxtDtIni.IsUserValidated = true; ctrl_TxtDtIni.CleanError(); if (ctrl_TxtDtIni.GetEnterPressed()) { doEvent(event_BuscaDados, 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 i_Form.CboOper.Items.AddRange(new TipoOperacaoDesc().GetArray().ToArray()); ctrl_TxtDtIni.AcquireTextBox(i_Form.TxtDtIni, this, event_val_TxtDtIni, dateTextController.FORMAT_DDMMYYYY); ctrl_TxtDtFim.AcquireTextBox(i_Form.TxtDtFim, this, event_val_TxtDtFim, dateTextController.FORMAT_DDMMYYYY); ctrl_TxtDtIni.SetTextBoxText(DateTime.Now.Day.ToString().PadLeft(2, '0') + DateTime.Now.Month.ToString().PadLeft(2, '0') + DateTime.Now.Year.ToString().PadLeft(2, '0')); ctrl_TxtDtFim.SetTextBoxText(DateTime.Now.Day.ToString().PadLeft(2, '0') + DateTime.Now.Month.ToString().PadLeft(2, '0') + DateTime.Now.Year.ToString().PadLeft(2, '0')); ctrl_TxtNome.AcquireTextBox(i_Form.TxtNome, this, event_val_TxtNome, 20); ctrl_TxtObs.AcquireTextBox(i_Form.TxtObs, this, event_val_TxtObs, 30, alphaTextController.ENABLE_NUMBERS); //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; DadosConsultaAuditoria dca = new DadosConsultaAuditoria(); if (i_Form.CboOper.SelectedIndex > 0) { dca.set_nu_oper((i_Form.CboOper.SelectedIndex + 1).ToString()); } dca.set_st_user(ctrl_TxtNome.getTextBoxValue()); dca.set_st_obs(ctrl_TxtObs.getTextBoxValue()); if (ctrl_TxtDtIni.getTextBoxValue().Length > 0) { dca.set_dt_ini(var_util.GetDataBaseTimeFormat(ctrl_TxtDtIni.getTextBoxValue_Date())); } if (ctrl_TxtDtFim.getTextBoxValue().Length > 0) { dca.set_dt_fim(var_util.GetDataBaseTimeFormat(ctrl_TxtDtFim.getTextBoxValue_Date().AddHours(23).AddMinutes(59))); } string st_csv_id = ""; i_Form.LstAuditoria.Items.Clear(); if (var_exchange.fetch_consultaAuditoria(ref dca, ref header, ref st_csv_id)) { ArrayList full_memory = new ArrayList(); while (st_csv_id != "") { ArrayList tmp_memory = new ArrayList(); if (var_exchange.fetch_memory(st_csv_id, "400", ref st_csv_id, ref tmp_memory)) { for (int t = 0; t < tmp_memory.Count; ++t) { full_memory.Add(tmp_memory[t]); } } } ArrayList desc = new TipoOperacaoDesc().GetArray(); for (int t = 0; t < full_memory.Count; ++t) { DadosAuditoria da = new DadosAuditoria(full_memory[t] as DataPortable); int index = Convert.ToInt32(da.get_nu_oper()) - 1; string [] full_row = new string [] { da.get_dt_operacao(), da.get_st_usuario(), desc[index].ToString(), da.get_st_obs(), da.get_id_link() }; i_Form.LstAuditoria.Items.Add(var_util.GetListViewItem("", full_row)); } Application.DoEvents(); } i_Form.BtnConsultar.Enabled = true; //EndEventCode return(true); } #endregion #region - event_val_TxtDtIni - case event_val_TxtDtIni: { //InitEventCode event_val_TxtDtIni switch (arg as string) { case dateTextController.DATE_INVALID: { i_Form.TxtDtIni.BackColor = colorInvalid; ctrl_TxtDtIni.IsUserValidated = false; break; } case dateTextController.DATE_VALID: { i_Form.TxtDtIni.BackColor = Color.White; ctrl_TxtDtIni.IsUserValidated = true; ctrl_TxtDtIni.CleanError(); break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtDtFim - case event_val_TxtDtFim: { //InitEventCode event_val_TxtDtFim switch (arg as string) { case dateTextController.DATE_INVALID: { i_Form.TxtDtFim.BackColor = colorInvalid; ctrl_TxtDtFim.IsUserValidated = false; break; } case dateTextController.DATE_VALID: { i_Form.TxtDtFim.BackColor = Color.White; ctrl_TxtDtFim.IsUserValidated = true; ctrl_TxtDtFim.CleanError(); break; } default: break; } //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; ctrl_TxtNome.CleanError(); } else { i_Form.TxtNome.BackColor = colorInvalid; ctrl_TxtNome.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtObs - case event_val_TxtObs: { //InitEventCode event_val_TxtObs switch (arg as string) { case alphaTextController.ALPHA_COMPLETE: case alphaTextController.ALPHA_INCOMPLETE: { if (ctrl_TxtObs.getTextBoxValue().Length > 0) { i_Form.TxtObs.BackColor = Color.White; ctrl_TxtObs.IsUserValidated = true; ctrl_TxtObs.CleanError(); } else { i_Form.TxtObs.BackColor = colorInvalid; ctrl_TxtObs.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 ctrl_TxtCpf.AcquireTextBox(i_Form.TxtCpf, this, event_val_TxtCpf); ctrl_TxtNome.AcquireTextBox(i_Form.TxtNome, this, event_val_TxtNome, 40, false); ctrl_TxtEndereco.AcquireTextBox(i_Form.TxtEndereco, this, event_val_TxtEndereco, 40, ""); ctrl_TxtNumero.AcquireTextBox(i_Form.TxtNumero, this, event_val_TxtNumero, 6); ctrl_TxtComplemento.AcquireTextBox(i_Form.TxtComplemento, this, event_val_TxtComplemento, 40, alphaTextController.ENABLE_NUMBERS); ctrl_TxtBairro.AcquireTextBox(i_Form.TxtBairro, this, event_val_txtBairro, 40, false); 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_TxtCEP.AcquireTextBox(i_Form.TxtCEP, this, event_val_TxtCEP, 6); ctrl_TxtDDD.AcquireTextBox(i_Form.TxtDDD, this, event_val_TxtDDD, 2); ctrl_TxtTelefone.AcquireTextBox(i_Form.TxtTelefone, this, event_val_TxtTelefone, 8); ctrl_TxtDtNasc.AcquireTextBox(i_Form.TxtDtNasc, this, event_val_TxtDtNasc, dateTextController.FORMAT_DDMMYYYY); ctrl_TxtEmail.AcquireTextBox(i_Form.TxtEmail, this, event_val_TxtEmail, 40); ctrl_TxtRenda.AcquireTextBox(i_Form.TxtRenda, this, event_val_TxtRenda, "R$", 8); ctrl_TxtCpf.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtNome.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtEndereco.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtNumero.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtComplemento.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtBairro.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtCidade.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtEstado.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtCEP.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtDDD.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtTelefone.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtDtNasc.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtEmail.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtRenda.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtCpf.SetTextBoxText(cpf_cnpj); ctrl_TxtCpf.forceValidation(); if (cpf_cnpj != "") { ctrl_TxtEndereco.SetTextBoxText(dp.get_st_endereco()); ctrl_TxtNumero.SetTextBoxText(dp.get_st_numero()); ctrl_TxtComplemento.SetTextBoxText(dp.get_st_complemento()); ctrl_TxtBairro.SetTextBoxText(dp.get_st_bairro()); ctrl_TxtCidade.SetTextBoxText(dp.get_st_cidade()); ctrl_TxtEstado.SetTextBoxText(dp.get_st_UF()); ctrl_TxtCEP.SetTextBoxText(dp.get_st_CEP()); ctrl_TxtDDD.SetTextBoxText(dp.get_st_ddd()); ctrl_TxtTelefone.SetTextBoxText(dp.get_st_telefone()); ctrl_TxtDtNasc.SetTextBoxText(dp.get_dt_nasc()); ctrl_TxtEmail.SetTextBoxText(dp.get_st_email()); ctrl_TxtRenda.SetTextBoxString(dp.get_vr_renda()); ctrl_TxtNome.SetTextBoxText(dp.get_st_nome()); } else { i_Form.TxtCpf.ReadOnly = 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_Alterar - case event_Alterar: { //InitEventCode event_Alterar bool IsDone = true; if (!ctrl_TxtNome.IsUserValidated) { ctrl_TxtNome.SetErrorMessage("O nome deve ser informado"); IsDone = false; } if (!ctrl_TxtEndereco.IsUserValidated) { ctrl_TxtEndereco.SetErrorMessage("O endereço deve ser informado"); IsDone = false; } if (!ctrl_TxtNumero.IsUserValidated) { ctrl_TxtNumero.SetErrorMessage("O número deve ser informado"); IsDone = false; } if (!ctrl_TxtComplemento.IsUserValidated) { ctrl_TxtComplemento.SetErrorMessage("O complemento deve ser informado"); IsDone = false; } if (!ctrl_TxtBairro.IsUserValidated) { ctrl_TxtBairro.SetErrorMessage("O bairro deve ser informado"); IsDone = false; } if (!ctrl_TxtCidade.IsUserValidated) { ctrl_TxtCidade.SetErrorMessage("A cidade deve ser informada"); IsDone = false; } if (!ctrl_TxtEstado.IsUserValidated) { ctrl_TxtEstado.SetErrorMessage("O estado deve ser informado"); IsDone = false; } if (!ctrl_TxtCEP.IsUserValidated) { ctrl_TxtCEP.SetErrorMessage("O CEP deve ser informado"); IsDone = false; } if (!ctrl_TxtDDD.IsUserValidated) { ctrl_TxtDDD.SetErrorMessage("O DDD deve ser informado"); IsDone = false; } if (!ctrl_TxtTelefone.IsUserValidated) { ctrl_TxtTelefone.SetErrorMessage("O telefone deve ser informado"); IsDone = false; } if (!ctrl_TxtDtNasc.IsUserValidated) { ctrl_TxtDtNasc.SetErrorMessage("A data de nascimento deve ser informada"); IsDone = false; } if (!IsDone) { MessageBox.Show("Existem pendências de cadastro", "Aviso"); return(false); } DadosProprietario dp = new DadosProprietario(); dp.set_st_nome(ctrl_TxtNome.getTextBoxValue()); dp.set_st_endereco(ctrl_TxtEndereco.getTextBoxValue()); dp.set_st_numero(ctrl_TxtNumero.getTextBoxValue()); dp.set_st_complemento(ctrl_TxtComplemento.getTextBoxValue()); dp.set_st_bairro(ctrl_TxtBairro.getTextBoxValue()); dp.set_st_cidade(ctrl_TxtCidade.getTextBoxValue()); dp.set_st_UF(ctrl_TxtEstado.getTextBoxValue()); dp.set_st_CEP(ctrl_TxtCEP.getTextBoxValue()); dp.set_st_ddd(ctrl_TxtDDD.getTextBoxValue()); dp.set_st_telefone(ctrl_TxtTelefone.getTextBoxValue()); dp.set_vr_renda(ctrl_TxtRenda.getTextBoxValue_NumberStr()); dp.set_st_email(ctrl_TxtEmail.getTextBoxValue()); dp.set_dt_nasc(var_util.GetDataBaseTimeFormat(ctrl_TxtDtNasc.getTextBoxValue_Date())); var_exchange.exec_alteraProprietario(ctrl_TxtCpf.getTextBoxValue(), ref dp, ref header); //EndEventCode return(true); } #endregion #region - event_val_TxtCpf - case event_val_TxtCpf: { //InitEventCode event_val_TxtCpf if (ctrl_TxtCpf.getTextBoxValue().Length == 11 || // cpf ctrl_TxtCpf.getTextBoxValue().Length == 14) // cnpj { DadosProprietario dp = new DadosProprietario(); if (var_exchange.fetch_proprietario(ctrl_TxtCpf.getTextBoxValue(), ref header, ref dp)) { if (dp.get_tg_found() == Context.TRUE) { ctrl_TxtEndereco.SetTextBoxText(dp.get_st_endereco()); ctrl_TxtNumero.SetTextBoxText(dp.get_st_numero()); ctrl_TxtComplemento.SetTextBoxText(dp.get_st_complemento()); ctrl_TxtBairro.SetTextBoxText(dp.get_st_bairro()); ctrl_TxtCidade.SetTextBoxText(dp.get_st_cidade()); ctrl_TxtEstado.SetTextBoxText(dp.get_st_UF()); ctrl_TxtCEP.SetTextBoxText(dp.get_st_CEP()); ctrl_TxtDDD.SetTextBoxText(dp.get_st_ddd()); ctrl_TxtTelefone.SetTextBoxText(dp.get_st_telefone()); ctrl_TxtDtNasc.SetTextBoxText(dp.get_dt_nasc()); ctrl_TxtEmail.SetTextBoxText(dp.get_st_email()); ctrl_TxtRenda.SetTextBoxString(dp.get_vr_renda()); ctrl_TxtNome.SetTextBoxText(dp.get_st_nome()); } } } //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_TxtEndereco - case event_val_TxtEndereco: { //InitEventCode event_val_TxtEndereco switch (arg as string) { case alphaTextController.ALPHA_COMPLETE: case alphaTextController.ALPHA_INCOMPLETE: { if (ctrl_TxtEndereco.getTextBoxValue().Length > 8) { i_Form.TxtEndereco.BackColor = Color.White; ctrl_TxtEndereco.IsUserValidated = true; ctrl_TxtEndereco.CleanError(); } else { i_Form.TxtEndereco.BackColor = colorInvalid; ctrl_TxtEndereco.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtNumero - case event_val_TxtNumero: { //InitEventCode event_val_TxtNumero switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (i_Form.TxtNumero.Text.Length > 0) { i_Form.TxtNumero.BackColor = Color.White; ctrl_TxtNumero.IsUserValidated = true; ctrl_TxtNumero.CleanError(); } else { i_Form.TxtNumero.BackColor = colorInvalid; ctrl_TxtNumero.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtComplemento - case event_val_TxtComplemento: { //InitEventCode event_val_TxtComplemento switch (arg as string) { case alphaTextController.ALPHA_COMPLETE: case alphaTextController.ALPHA_INCOMPLETE: { if (ctrl_TxtComplemento.getTextBoxValue().Length > 0) { i_Form.TxtComplemento.BackColor = Color.White; ctrl_TxtComplemento.IsUserValidated = true; ctrl_TxtComplemento.CleanError(); } else { i_Form.TxtComplemento.BackColor = colorInvalid; ctrl_TxtComplemento.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_txtBairro - case event_val_txtBairro: { //InitEventCode event_val_txtBairro switch (arg as string) { case alphaTextController.ALPHA_COMPLETE: case alphaTextController.ALPHA_INCOMPLETE: { if (ctrl_TxtBairro.getTextBoxValue().Length > 3) { i_Form.TxtBairro.BackColor = Color.White; ctrl_TxtBairro.IsUserValidated = true; ctrl_TxtBairro.CleanError(); } else { i_Form.TxtBairro.BackColor = colorInvalid; ctrl_TxtBairro.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 > 3) { i_Form.TxtCidade.BackColor = Color.White; ctrl_TxtCidade.IsUserValidated = true; ctrl_TxtCidade.CleanError(); } 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 == 2) { i_Form.TxtEstado.BackColor = Color.White; ctrl_TxtEstado.IsUserValidated = true; } else { i_Form.TxtEstado.BackColor = colorInvalid; ctrl_TxtEstado.IsUserValidated = false; ctrl_TxtEstado.CleanError(); } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtCEP - case event_val_TxtCEP: { //InitEventCode event_val_TxtCEP switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (i_Form.TxtCEP.Text.Length > 3) { i_Form.TxtCEP.BackColor = Color.White; ctrl_TxtCEP.IsUserValidated = true; } else { i_Form.TxtCEP.BackColor = colorInvalid; ctrl_TxtCEP.IsUserValidated = false; ctrl_TxtCEP.CleanError(); } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtDDD - case event_val_TxtDDD: { //InitEventCode event_val_TxtDDD switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (i_Form.TxtDDD.Text.Length > 1) { i_Form.TxtDDD.BackColor = Color.White; ctrl_TxtDDD.IsUserValidated = true; } else { i_Form.TxtDDD.BackColor = colorInvalid; ctrl_TxtDDD.IsUserValidated = false; ctrl_TxtDDD.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 < 8) { 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_TxtDtNasc - case event_val_TxtDtNasc: { //InitEventCode event_val_TxtDtNasc switch (arg as string) { case dateTextController.DATE_INVALID: { i_Form.TxtDtNasc.BackColor = colorInvalid; ctrl_TxtDtNasc.IsUserValidated = false; break; } case dateTextController.DATE_VALID: { i_Form.TxtDtNasc.BackColor = Color.White; ctrl_TxtDtNasc.IsUserValidated = true; ctrl_TxtDtNasc.CleanError(); break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtEmail - case event_val_TxtEmail: { //InitEventCode event_val_TxtEmail switch (arg as string) { case emailTextController.EMAIL_INVALID: { i_Form.TxtEmail.BackColor = colorInvalid; ctrl_TxtEmail.IsUserValidated = false; break; } case emailTextController.EMAIL_VALID: { i_Form.TxtEmail.BackColor = Color.White; ctrl_TxtEmail.IsUserValidated = true; ctrl_TxtEmail.CleanError(); break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtRenda - case event_val_TxtRenda: { //InitEventCode event_val_TxtRenda //EndEventCode return(true); } #endregion #region - event_BtnAlterarClick - case event_BtnAlterarClick: { //InitEventCode event_BtnAlterarClick //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_TxtEmpresa.AcquireTextBox(i_Form.TxtEmpresa, this, event_val_TxtEmpresa, 6); ctrl_TxtCodLoja.AcquireTextBox(i_Form.TxtCodLoja, this, event_val_TxtCodLoja, 6); ctrl_TxtDtFim.SetTextBoxText(DateTime.Now.Day.ToString().PadLeft(2, '0') + DateTime.Now.Month.ToString().PadLeft(2, '0') + DateTime.Now.Year.ToString().PadLeft(2, '0')); ctrl_TxtDtIni.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtDtFim.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtEmpresa.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtCodLoja.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); 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; i_Form.tabControl1.TabPages.RemoveAt(1); i_Form.tabControl1.TabPages.RemoveAt(1); } i_Form.CboTipo.SelectedIndex = 0; i_Form.CboGraph.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_GeraGrafico - case event_GeraGrafico: { //InitEventCode event_GeraGrafico if (i_Form.LstLines.Items.Count == 0) { return(false); } dlgGraph graph = new dlgGraph(); graph.Text = "Gráficos ConveyNET para desempenho financeiro"; GraphPane myPane = graph.zed.GraphPane; myPane.Title.Text = "Performance financeira comparativa de lojas"; myPane.XAxis.Title.Text = "Período requerido"; myPane.XAxis.Type = AxisType.Date; //myPane.XAxis.Scale.Format = "d"; myPane.YAxis.Title.Text = "Valores de compras nas lojas"; myPane.YAxis.Scale.Format = "c"; myPane.CurveList.Clear(); ArrayList lstInput = new ArrayList(); for (int t = 0; t < i_Form.LstLines.Items.Count; ++t) { DadosGraficoFinanceiro dgf = new DadosGraficoFinanceiro(); #region - format data - dgf.set_st_empresa(i_Form.LstLines.Items[t].SubItems[0].Text); string dt_ini = i_Form.LstLines.Items[t].SubItems[1].Text; dt_ini = dt_ini.Substring(6, 4) + "-" + dt_ini.Substring(3, 2) + "-" + dt_ini.Substring(0, 2); string dt_fim = i_Form.LstLines.Items[t].SubItems[2].Text; dt_fim = dt_fim.Substring(6, 4) + "-" + dt_fim.Substring(3, 2) + "-" + dt_fim.Substring(0, 2); dgf.set_dt_ini(dt_ini); dgf.set_dt_fim(dt_fim); string loja = i_Form.LstLines.Items[t].SubItems[3].Text; if (loja.StartsWith("L")) { dgf.set_st_loja(loja.Substring(1, loja.IndexOf(" ") - 1).Trim()); } dgf.set_nu_id(t.ToString()); #endregion lstInput.Add(dgf); } string st_csv_contents = ""; if (!var_exchange.graph_financeiro(i_Form.CboTipo.SelectedIndex.ToString(), ref header, ref lstInput, ref st_csv_contents)) { return(false); } ArrayList full_memory = new ArrayList(); while (st_csv_contents != "") { ArrayList tmp_memory = new ArrayList(); if (var_exchange.fetch_memory(st_csv_contents, "200", ref st_csv_contents, ref tmp_memory)) { for (int t = 0; t < tmp_memory.Count; ++t) { full_memory.Add(tmp_memory[t]); } } } Color col = Color.Green; for (int t = 0; t < lstInput.Count; ++t) { PointPairList list = new PointPairList(); switch (t) { case 0: col = Color.Green; break; case 1: col = Color.Red; break; case 2: col = Color.Blue; break; case 3: col = Color.Gray; break; case 4: col = Color.Orange; break; case 5: col = Color.Violet; break; default: break; } string name_curve = ""; string my_id = t.ToString(); for (int g = 0; g < full_memory.Count; ++g) { DadosGraficoFinanceiro dgf = new DadosGraficoFinanceiro(full_memory[g] as DataPortable); if (dgf.get_nu_id() != my_id) { continue; } if (name_curve == "") { name_curve = dgf.get_st_loja(); } string line = dgf.get_dt_point(); XDate x = new XDate(Convert.ToInt32(line.Substring(0, 4)), // ano Convert.ToInt32(line.Substring(5, 2)), // mes Convert.ToInt32(line.Substring(8, 2)), // dia Convert.ToInt32(line.Substring(11, 2)), // hora Convert.ToInt32(line.Substring(14, 2)), 0, 0); // minuto list.Add((double)x, Convert.ToDouble(dgf.get_vr_point()) / 100); } if (i_Form.CboGraph.SelectedIndex == 0) { myPane.AddBar(name_curve, (IPointList)list, col); } else { LineItem myCurve = myPane.AddCurve(name_curve, list, col, SymbolType.None); myCurve.Line.Fill = new Fill(Color.White, Color.FromArgb(60, col.R, col.G, col.B), 90F); } name_curve = ""; } myPane.Chart.Fill = new Fill(Color.White, Color.LightGoldenrodYellow, 45F); myPane.Fill = new Fill(Color.White, Color.FromArgb(220, 220, 255), 45F); graph.zed.AxisChange(); graph.ShowDialog(); //EndEventCode return(true); } #endregion #region - event_Adicionar - case event_Adicionar: { //InitEventCode event_Adicionar if (!ctrl_TxtDtIni.IsUserValidated) { MessageBox.Show("Informe o período inicial", "Aviso"); return(false); } if (!ctrl_TxtDtFim.IsUserValidated) { MessageBox.Show("Informe o período final", "Aviso"); return(false); } if (!ctrl_TxtEmpresa.IsUserValidated) { MessageBox.Show("Informe a empresa", "Aviso"); return(false); } if (ctrl_TxtCodLoja.IsUserValidated) { if (i_Form.TxtNome.Text == "") { MessageBox.Show("Confirmar a loja pressionando enter no campo de código", "Aviso"); return(false); } } if (i_Form.LstLines.Items.Count >= 5) { MessageBox.Show("Máximo de cinco items para gráfico", "Aviso"); return(false); } string nome = ""; if (ctrl_TxtCodLoja.IsUserValidated) { nome = "L" + ctrl_TxtCodLoja.getTextBoxValue() + " - " + i_Form.TxtNome.Text; } else { if (ctrl_TxtEmpresa.getTextBoxValue_Long() == 0) { nome = "ConveyNET"; } else { nome = "Todas as lojas"; } } string [] full_row = new string [] { ctrl_TxtEmpresa.getTextBoxValue(), ctrl_TxtDtIni.getTextBoxValue(), ctrl_TxtDtFim.getTextBoxValue(), nome }; i_Form.LstLines.Items.Add(var_util.GetListViewItem(null, full_row)); //EndEventCode return(true); } #endregion #region - event_val_TxtDtIni - case event_val_TxtDtIni: { //InitEventCode event_val_TxtDtIni switch (arg as string) { case dateTextController.DATE_INVALID: { i_Form.TxtDtIni.BackColor = colorInvalid; ctrl_TxtDtIni.IsUserValidated = false; break; } case dateTextController.DATE_VALID: { i_Form.TxtDtIni.BackColor = Color.White; ctrl_TxtDtIni.IsUserValidated = true; ctrl_TxtDtIni.CleanError(); break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtDtFim - case event_val_TxtDtFim: { //InitEventCode event_val_TxtDtFim switch (arg as string) { case dateTextController.DATE_INVALID: { i_Form.TxtDtFim.BackColor = colorInvalid; ctrl_TxtDtFim.IsUserValidated = false; break; } case dateTextController.DATE_VALID: { i_Form.TxtDtFim.BackColor = Color.White; ctrl_TxtDtFim.IsUserValidated = true; ctrl_TxtDtIni.CleanError(); break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtCodLoja - case event_val_TxtCodLoja: { //InitEventCode event_val_TxtCodLoja switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (i_Form.TxtCodLoja.Text.Length > 0) { i_Form.TxtCodLoja.BackColor = Color.White; ctrl_TxtCodLoja.IsUserValidated = true; ctrl_TxtCodLoja.CleanError(); if (length_cod_loja > 0) { if (length_cod_loja != i_Form.TxtCodLoja.Text.Length) { i_Form.TxtNome.Text = ""; } } length_cod_loja = i_Form.TxtCodLoja.Text.Length; if (ctrl_TxtCodLoja.GetEnterPressed()) { DadosLoja dl = new DadosLoja(); var_exchange.fetch_dadosLoja("", ctrl_TxtCodLoja.getTextBoxValue(), ref header, ref dl); i_Form.TxtNome.Text = dl.get_st_nome(); } } else { i_Form.TxtCodLoja.BackColor = colorInvalid; ctrl_TxtCodLoja.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 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_Remover - case event_Remover: { //InitEventCode event_Remover if (i_Form.LstLines.SelectedItems.Count == 0) { return(false); } i_Form.LstLines.Items.RemoveAt(i_Form.LstLines.SelectedIndices[0]); //EndEventCode return(true); } #endregion #region - event_BuscaListaLojasTransacao - case event_BuscaListaLojasTransacao: { //InitEventCode event_BuscaListaLojasTransacao if (!ctrl_TxtDtIni.IsUserValidated) { MessageBox.Show("Informe a data inicial", "Aviso"); return(false); } if (!ctrl_TxtDtFim.IsUserValidated) { MessageBox.Show("Informe a data final", "Aviso"); return(false); } i_Form.BtnBuscarLista.Enabled = false; i_Form.LstTransLojas.Items.Clear(); string st_csv_contents = ""; var_exchange.fetch_listaTransacoesLojas(var_util.GetDataBaseTimeFormat(ctrl_TxtDtIni.getTextBoxValue_Date()), var_util.GetDataBaseTimeFormat(ctrl_TxtDtFim.getTextBoxValue_Date()), ref header, ref st_csv_contents); ArrayList full_memory = new ArrayList(); while (st_csv_contents != "") { ArrayList tmp_memory = new ArrayList(); if (var_exchange.fetch_memory(st_csv_contents, "200", ref st_csv_contents, 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) { DadosConsultaGraficoTransLojas dl = new DadosConsultaGraficoTransLojas(full_memory[t] as DataPortable); string [] full_row = new string [] { dl.get_nu_trans(), dl.get_nu_cod(), dl.get_tg_tipo(), dl.get_st_nome() }; i_Form.LstTransLojas.Items.Add(var_util.GetListViewItem(null, full_row)); } i_Form.BtnBuscarLista.Enabled = true; //EndEventCode return(true); } #endregion #region - event_GeraGraficoTransacao - case event_GeraGraficoTransacao: { //InitEventCode event_GeraGraficoTransacao dlgGraph graph = new dlgGraph(); graph.Text = "Gráficos ConveyNET para quantidade de transações"; GraphPane myPane = graph.zed.GraphPane; myPane.Title.Text = "Performance em transações de associações e lojas"; myPane.XAxis.Title.Text = "Período requerido"; myPane.XAxis.Type = AxisType.Date; myPane.YAxis.Title.Text = "Quantidade de transações"; myPane.CurveList.Clear(); ArrayList lstInput = new ArrayList(); for (int t = 0; t < i_Form.LstTransLojas.Items.Count; ++t) { if (i_Form.LstTransLojas.Items[t].Checked) { DadosConsultaGraficoTransLojas dl = new DadosConsultaGraficoTransLojas(); dl.set_nu_cod(i_Form.LstTransLojas.Items[t].SubItems[1].Text); dl.set_tg_tipo(i_Form.LstTransLojas.Items[t].SubItems[2].Text); dl.set_st_nome(i_Form.LstTransLojas.Items[t].SubItems[3].Text); lstInput.Add(dl); } } string st_csv_contents = ""; if (!var_exchange.graph_transacoes(var_util.GetDataBaseTimeFormat(ctrl_TxtDtIni.getTextBoxValue_Date()), var_util.GetDataBaseTimeFormat(ctrl_TxtDtFim.getTextBoxValue_Date()), ref header, ref lstInput, ref st_csv_contents)) { return(false); } ArrayList full_memory = new ArrayList(); while (st_csv_contents != "") { ArrayList tmp_memory = new ArrayList(); if (var_exchange.fetch_memory(st_csv_contents, "200", ref st_csv_contents, ref tmp_memory)) { for (int t = 0; t < tmp_memory.Count; ++t) { full_memory.Add(tmp_memory[t]); } } } Color col = Color.Green; for (int t = 0; t < lstInput.Count; ++t) { DadosConsultaGraficoTransLojas dl = new DadosConsultaGraficoTransLojas(lstInput[t] as DataPortable); PointPairList list = new PointPairList(); switch (t) { case 0: col = Color.Green; break; case 1: col = Color.Red; break; case 2: col = Color.Blue; break; case 3: col = Color.Gray; break; case 4: col = Color.Orange; break; case 5: col = Color.Violet; break; default: break; } string name_curve = dl.get_st_nome(); string my_id = t.ToString(); for (int g = 0; g < full_memory.Count; ++g) { DadosConsultaGraficoTransLojas dgt = new DadosConsultaGraficoTransLojas(full_memory[g] as DataPortable); if (dgt.get_nu_id() != my_id) { continue; } string line = dgt.get_dt_trans(); XDate x = new XDate(Convert.ToInt32(line.Substring(0, 4)), // ano Convert.ToInt32(line.Substring(5, 2)), // mes Convert.ToInt32(line.Substring(8, 2)), // dia Convert.ToInt32(line.Substring(11, 2)), // hora Convert.ToInt32(line.Substring(14, 2)), 0, 0); // minuto list.Add((double)x, Convert.ToDouble(dgt.get_nu_trans())); } LineItem myCurve = myPane.AddCurve(name_curve, list, col, SymbolType.None); } myPane.Chart.Fill = new Fill(Color.White, Color.LightGoldenrodYellow, 45F); myPane.Fill = new Fill(Color.White, Color.FromArgb(220, 220, 255), 45F); graph.zed.AxisChange(); graph.ShowDialog(); //EndEventCode return(true); } #endregion #region - event_Ranking - case event_Ranking: { //InitEventCode event_Ranking //EndEventCode return(true); } #endregion #region - event_BtnRemoverClick - case event_BtnRemoverClick: { //InitEventCode event_BtnRemoverClick //EndEventCode return(true); } #endregion #region - event_BtnGraficoClick - case event_BtnGraficoClick: { //InitEventCode event_BtnGraficoClick //EndEventCode return(true); } #endregion #region - event_BtnAdicionarClick - case event_BtnAdicionarClick: { //InitEventCode event_BtnAdicionarClick //EndEventCode return(true); } #endregion #region - event_BtnBuscarListaClick - case event_BtnBuscarListaClick: { //InitEventCode event_BtnBuscarListaClick //EndEventCode return(true); } #endregion #region - event_BtnGeraTransClick - case event_BtnGeraTransClick: { //InitEventCode event_BtnGeraTransClick //EndEventCode return(true); } #endregion #region - event_BtnRankingClick - case event_BtnRankingClick: { //InitEventCode event_BtnRankingClick //EndEventCode return(true); } #endregion default: break; } return(false); }
public override bool doEvent(int event_number, object arg) { switch (event_number) { #region - event_Load - case event_Load: { //InitEventCode event_Load #if ROBOT var_util.execDefinedRobot(this, var_alias); #else doEvent(event_Translate, null); doEvent(event_FormIsOpening, null); #endif //EndEventCode return(true); } #endregion #region - event_Translate - case event_Translate: { //InitEventCode event_Translate //EndEventCode return(true); } #endregion #region - event_FormIsOpening - case event_FormIsOpening: { //InitEventCode event_FormIsOpening ctrl_TxtDtIni.AcquireTextBox(i_Form.TxtDtIni, this, event_val_TxtDtIni, dateTextController.FORMAT_DDMMYYYY); ctrl_TxtDtFim.AcquireTextBox(i_Form.TxtDtFim, this, event_val_TxtDtFim, dateTextController.FORMAT_DDMMYYYY); ctrl_TxtDtIni.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtDtFim.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); //EndEventCode return(true); } #endregion #region - robot_ShowDialog - case robot_ShowDialog: { //InitEventCode robot_ShowDialog //EndEventCode return(true); } #endregion #region - robot_CloseDialog - case robot_CloseDialog: { //InitEventCode robot_CloseDialog //EndEventCode return(true); } #endregion #region - event_Confirmar - case event_Confirmar: { //InitEventCode event_Confirmar bool bOk = true; if (!ctrl_TxtDtFim.IsUserValidated) { ctrl_TxtDtFim.SetErrorMessage("Informe o dia final"); bOk = false; } if (!ctrl_TxtDtIni.IsUserValidated) { ctrl_TxtDtIni.SetErrorMessage("Informe o dia inicial"); bOk = false; } if (i_Form.TxtFile.Text == "") { MessageBox.Show("Informe o arquivo de saída", "Aviso"); bOk = false; } if (i_Form.CboOption.SelectedIndex == -1) { MessageBox.Show("Informe a opção de cobrança", "Aviso"); bOk = false; } if (!bOk) { return(false); } i_Form.BtnConfirmar.Enabled = false; string st_block = ""; string nu_nsFat = ""; dlgStatus stat = new dlgStatus("Faturamento"); stat.LblActivity.Text = "Processando dados no servidor"; stat.pgStatus.Maximum = 1; stat.pgStatus.Minimum = 0; stat.Show(); Application.DoEvents(); if (var_exchange.fetch_arquivoFat(var_util.GetDataBaseTimeFormat(ctrl_TxtDtIni.getTextBoxValue_Date()), var_util.GetDataBaseTimeFormat(ctrl_TxtDtFim.getTextBoxValue_Date().AddDays(1)), i_Form.CboOption.SelectedIndex.ToString(), ref header, ref st_block, ref nu_nsFat)) { ArrayList full_memory = new ArrayList(); while (st_block != "") { ArrayList tmp_memory = new ArrayList(); if (var_exchange.fetch_memory(st_block, "600", ref st_block, ref tmp_memory)) { for (int t = 0; t < tmp_memory.Count; ++t) { full_memory.Add(tmp_memory[t]); } } } string file = i_Form.TxtFile.Text.Replace("ZZ", nu_nsFat.PadLeft(2, '0')); StreamWriter sw = new StreamWriter(file, false, Encoding.Default); for (int t = 0; t < full_memory.Count; ++t) { DataPortable port = full_memory[t] as DataPortable; sw.WriteLine(port.getValue("line")); } sw.Close(); MessageBox.Show("Arquivo '" + file + "' gerado com sucesso", "Aviso"); } stat.Close(); Application.DoEvents(); i_Form.BtnConfirmar.Enabled = true; //EndEventCode return(true); } #endregion #region - event_Dir - case event_Dir: { //InitEventCode event_Dir //EndEventCode return(true); } #endregion #region - event_val_TxtDtFim - case event_val_TxtDtFim: { //InitEventCode event_val_TxtDtFim switch (arg as string) { case dateTextController.DATE_VALID: { i_Form.TxtDtFim.BackColor = Color.White; ctrl_TxtDtFim.IsUserValidated = true; ctrl_TxtDtFim.CleanError(); break; } case dateTextController.DATE_INVALID: { i_Form.TxtDtFim.BackColor = colorInvalid; ctrl_TxtDtFim.IsUserValidated = false; break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtDtIni - case event_val_TxtDtIni: { //InitEventCode event_val_TxtDtIni switch (arg as string) { case dateTextController.DATE_VALID: { i_Form.TxtDtIni.BackColor = Color.White; ctrl_TxtDtIni.IsUserValidated = true; ctrl_TxtDtIni.CleanError(); break; } case dateTextController.DATE_INVALID: { i_Form.TxtDtIni.BackColor = colorInvalid; ctrl_TxtDtIni.IsUserValidated = false; break; } default: break; } //EndEventCode return(true); } #endregion #region - event_BtnDirClick - case event_BtnDirClick: { //InitEventCode event_BtnDirClick //EndEventCode return(true); } #endregion #region - event_BtnConfirmarClick - case event_BtnConfirmarClick: { //InitEventCode event_BtnConfirmarClick //EndEventCode return(true); } #endregion default: break; } return(false); }
public override bool doEvent(int event_number, object arg) { switch (event_number) { #region - event_Load - case event_Load: { //InitEventCode event_Load #if ROBOT var_util.execDefinedRobot(this, var_alias); #else doEvent(event_Translate, null); doEvent(event_FormIsOpening, null); #endif //EndEventCode return(true); } #endregion #region - event_Translate - case event_Translate: { //InitEventCode event_Translate //EndEventCode return(true); } #endregion #region - event_FormIsOpening - case event_FormIsOpening: { //InitEventCode event_FormIsOpening ctrl_TxtEmpresa.AcquireTextBox(i_Form.TxtEmpresa, this, event_val_TxtEmpresa, 6); ctrl_TxtCartao.AcquireTextBox(i_Form.TxtCartao, this, event_val_TxtCartao, 6); ctrl_TxtDiario.AcquireTextBox(i_Form.TxtDiario, this, event_val_TxtDiario, "R$", 8); ctrl_TxtMensal.AcquireTextBox(i_Form.TxtMensal, this, event_val_TxtMensal, "R$", 8); ctrl_TxtEdu.AcquireTextBox(i_Form.TxtEdu, this, event_val_TxtEdu, "R$", 8); ctrl_TxtExtra.AcquireTextBox(i_Form.TxtExtra, this, event_val_TxtExtra, "R$", 8); ctrl_TxtDin.AcquireTextBox(i_Form.TxtDin, this, event_val_TxtDin, "R$", 8); ctrl_TxtCartao.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtDiario.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtMensal.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtEdu.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtExtra.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtDin.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtCartao.IsUserValidated = false; ctrl_TxtDtIni.AcquireTextBox(i_Form.TxtDtIni, this, event_val_TxtDtIni, dateTextController.FORMAT_DDMMYYYY); ctrl_TxtDtFim.AcquireTextBox(i_Form.TxtDtFim, this, event_val_TxtDtFim, dateTextController.FORMAT_DDMMYYYY); ctrl_TxtDtIni.SetTextBoxText(DateTime.Now.AddDays(-7).Day.ToString().PadLeft(2, '0') + DateTime.Now.AddDays(-7).Month.ToString().PadLeft(2, '0') + DateTime.Now.AddDays(-7).Year.ToString().PadLeft(2, '0')); ctrl_TxtDtFim.SetTextBoxText(DateTime.Now.Day.ToString().PadLeft(2, '0') + DateTime.Now.Month.ToString().PadLeft(2, '0') + DateTime.Now.Year.ToString().PadLeft(2, '0')); if (header.get_tg_user_type() != TipoUsuario.SuperUser && header.get_tg_user_type() == TipoUsuario.OperadorEdu) { i_Form.TxtEmpresa.Text = header.get_st_empresa(); i_Form.TxtEmpresa.ReadOnly = true; } //EndEventCode return(true); } #endregion #region - robot_ShowDialog - case robot_ShowDialog: { //InitEventCode robot_ShowDialog //EndEventCode return(true); } #endregion #region - robot_CloseDialog - case robot_CloseDialog: { //InitEventCode robot_CloseDialog //EndEventCode return(true); } #endregion #region - event_Definir - case event_Definir: { //InitEventCode event_Definir if (!ctrl_TxtCartao.IsUserValidated) { return(false); } dlgAutorizacao autor = new dlgAutorizacao(); autor.ShowDialog(); Application.DoEvents(); if (autor.IsConfirmed) { var_exchange.exec_edu_alteraDiario(var_util.getMd5Hash(autor.senha), ctrl_TxtDiario.getTextBoxValue_NumberStr(), ctrl_TxtEmpresa.getTextBoxValue() + ctrl_TxtCartao.getTextBoxValue() + "01", ref header); } doEvent(event_BuscaDados, null); //EndEventCode return(true); } #endregion #region - event_Pagamento - case event_Pagamento: { //InitEventCode event_Pagamento if (!ctrl_TxtCartao.IsUserValidated) { return(false); } dlgAutorizacao autor = new dlgAutorizacao(); autor.ShowDialog(); Application.DoEvents(); if (autor.IsConfirmed) { var_exchange.exec_depotEduImediato(var_util.getMd5Hash(autor.senha), ctrl_TxtEdu.getTextBoxValue_NumberStr(), ctrl_TxtExtra.getTextBoxValue_NumberStr(), ctrl_TxtEmpresa.getTextBoxValue(), ctrl_TxtCartao.getTextBoxValue(), ref header); } doEvent(event_BuscaDados, null); //EndEventCode return(true); } #endregion #region - event_Vis - case event_Vis: { //InitEventCode event_Vis // ############################## // # SETUP LISTS ################ // ############################## ArrayList lstHeader = new ArrayList(); ArrayList lstContent = new ArrayList(); ArrayList lstTableSizes = new ArrayList(); ArrayList lstFooter = new ArrayList(); ArrayList lstMessages = new ArrayList(); ArrayList lstFilters = new ArrayList(); ArrayList lstFooterSub1 = new ArrayList(); ArrayList lstHeaderSub1 = new ArrayList(); ArrayList lstContentSub1 = new ArrayList(); lstHeader.Add(lstHeaderSub1); lstFooter.Add(lstFooterSub1); lstContent.Add(lstContentSub1); // ############################## // # CUSTOMIZE // ############################## string st_csv = ""; string st_empresa = ""; string st_total_periodo = ""; if (!var_exchange.fetch_rel_edu_extrato(var_util.GetDataBaseTimeFormat(ctrl_TxtDtIni.getTextBoxValue_Date()), var_util.GetDataBaseTimeFormat(ctrl_TxtDtFim.getTextBoxValue_Date().AddDays(1)), ctrl_TxtEmpresa.getTextBoxValue(), ctrl_TxtCartao.getTextBoxValue(), ref header, ref st_csv, ref st_empresa, ref st_total_periodo)) { return(false); } lstMessages.Add("Extrato do aluno: " + i_Form.TxtAluno.Text); lstTableSizes.Add(950); lstHeaderSub1.Add("NSU"); lstHeaderSub1.Add("Data"); lstHeaderSub1.Add("Valor R$"); lstHeaderSub1.Add("Loja"); lstHeaderSub1.Add("Saldo R$"); lstHeaderSub1.Add("Fundo R$"); lstHeaderSub1.Add("Operação"); money money_helper = new money(); ArrayList full_memory = new ArrayList(); while (st_csv != "") { ArrayList tmp_memory = new ArrayList(); if (var_exchange.fetch_memory(st_csv, "400", ref st_csv, ref tmp_memory)) { for (int t = 0; t < tmp_memory.Count; ++t) { full_memory.Add(tmp_memory[t]); } } } ArrayList desc = new TipoConfirmacaoDesc().GetArray(); ArrayList desc_op = new OperacaoCartaoDesc().GetArray(); for (int t = 0; t < full_memory.Count; ++t) { EduExtrato rel_line = new EduExtrato(full_memory[t] as DataPortable); ArrayList lstLine1 = new ArrayList(); lstLine1.Add(rel_line.get_st_nsu()); lstLine1.Add(var_util.getDDMMYYYY_format(rel_line.get_dt_trans())); lstLine1.Add(money_helper.formatToMoney(rel_line.get_vr_valor())); lstLine1.Add(rel_line.get_st_loja()); lstLine1.Add(money_helper.formatToMoney(rel_line.get_vr_disp())); lstLine1.Add(money_helper.formatToMoney(rel_line.get_vr_fundo())); if (rel_line.get_en_oper() == OperacaoCartao.VENDA_EMPRESARIAL) { lstLine1.Add("Utilização do cartão"); } else { lstLine1.Add(desc_op [Convert.ToInt32(rel_line.get_en_oper())].ToString()); } lstContentSub1.Add(lstLine1); } SyCrafReport rel = new SyCrafReport("Extrado de Transações por cartão", "ETC", st_empresa, ctrl_TxtDtIni.getTextBoxValue(), ctrl_TxtDtFim.getTextBoxValue(), ref lstHeader, ref lstContent, ref lstTableSizes, ref lstFooter, ref lstMessages, ref lstFilters); //EndEventCode return(true); } #endregion #region - event_val_TxtCartao - case event_val_TxtCartao: { //InitEventCode event_val_TxtCartao switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (i_Form.TxtCartao.Text.Length == 6) { i_Form.TxtCartao.BackColor = Color.White; ctrl_TxtCartao.IsUserValidated = true; ctrl_TxtCartao.CleanError(); } else { i_Form.TxtCartao.BackColor = colorInvalid; ctrl_TxtCartao.IsUserValidated = false; } break; } default: break; } if (ctrl_TxtCartao.IsUserValidated) { if (ctrl_TxtCartao.GetEnterPressed()) { doEvent(event_BuscaDados, null); } } //EndEventCode return(true); } #endregion #region - event_val_TxtDiario - case event_val_TxtDiario: { //InitEventCode event_val_TxtDiario //EndEventCode return(true); } #endregion #region - event_val_TxtMensal - case event_val_TxtMensal: { //InitEventCode event_val_TxtMensal if (!ctrl_TxtCartao.IsUserValidated) { return(false); } long val = ctrl_TxtMensal.getTextBoxValue_Long(); if (val > 0) { ctrl_TxtDiario.SetTextBoxLong(val / 31); } //EndEventCode return(true); } #endregion #region - event_val_TxtEdu - case event_val_TxtEdu: { //InitEventCode event_val_TxtEdu if (!ctrl_TxtCartao.IsUserValidated) { return(false); } long val = ctrl_TxtEdu.getTextBoxValue_Long() + ctrl_TxtExtra.getTextBoxValue_Long(); ctrl_TxtDin.SetTextBoxLong(val); //EndEventCode return(true); } #endregion #region - event_val_TxtExtra - case event_val_TxtExtra: { //InitEventCode event_val_TxtExtra if (!ctrl_TxtCartao.IsUserValidated) { return(false); } long val = ctrl_TxtEdu.getTextBoxValue_Long() + ctrl_TxtExtra.getTextBoxValue_Long(); ctrl_TxtDin.SetTextBoxLong(val); //EndEventCode return(true); } #endregion #region - event_val_TxtDoc - case event_val_TxtDoc: { //InitEventCode event_val_TxtDoc /*if ( !ctrl_TxtCartao.IsUserValidated ) * return false; * * if ( ctrl_TxtDoc.getTextBoxValue_Long() > 0 ) * { * long diario = ctrl_TxtDoc.getTextBoxValue_Long() / 31; * * i_Form.rb1.Text = "Em Fundo Educacional, definindo R$ " + * new money().formatToMoney ( diario.ToString() ) + * " diário"; * } */ //EndEventCode return(true); } #endregion #region - event_BuscaDados - case event_BuscaDados: { //InitEventCode event_BuscaDados if (!ctrl_TxtEmpresa.IsUserValidated || !ctrl_TxtCartao.IsUserValidated) { return(false); } DadosCartaoEdu dce = new DadosCartaoEdu(); if (var_exchange.fetch_dadosAluno(ctrl_TxtEmpresa.getTextBoxValue() + ctrl_TxtCartao.getTextBoxValue() + "01", ref header, ref dce)) { i_Form.TxtAluno.Text = dce.get_st_aluno(); ctrl_TxtDiario.SetTextBoxString(dce.get_vr_diario().PadLeft(6, '0')); int diario = Convert.ToInt32(dce.get_vr_diario()); int calc_mes = diario * 31; i_Form.TxtMensal.Text = "R$ " + new money().formatToMoney(calc_mes.ToString()); i_Form.TxtVrDisp.Text = "R$ " + new money().formatToMoney(dce.get_vr_disp()); i_Form.TxtVrDispDiario.Text = "R$ " + new money().formatToMoney(diario.ToString()); i_Form.TxtVrDispMensal.Text = "R$ " + new money().formatToMoney(calc_mes.ToString()); i_Form.TxtSaldoTotal.Text = "R$ " + new money().formatToMoney(dce.get_vr_depot()); DateTime tim = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(1); long dias = tim.Subtract(DateTime.Now).Days; long prev_mes = dias * diario; i_Form.TxtVrSaldoMes.Text = "R$ " + new money().formatToMoney(prev_mes.ToString()); } //EndEventCode return(true); } #endregion #region - event_val_TxtDin - case event_val_TxtDin: { //InitEventCode event_val_TxtDin //EndEventCode return(true); } #endregion #region - event_val_TxtDtIni - case event_val_TxtDtIni: { //InitEventCode event_val_TxtDtIni switch (arg as string) { case dateTextController.DATE_INVALID: { i_Form.TxtDtIni.BackColor = colorInvalid; ctrl_TxtDtIni.IsUserValidated = false; break; } case dateTextController.DATE_VALID: { i_Form.TxtDtIni.BackColor = Color.White; ctrl_TxtDtIni.IsUserValidated = true; ctrl_TxtDtIni.CleanError(); break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtDtFim - case event_val_TxtDtFim: { //InitEventCode event_val_TxtDtFim switch (arg as string) { case dateTextController.DATE_INVALID: { i_Form.TxtDtFim.BackColor = colorInvalid; ctrl_TxtDtFim.IsUserValidated = false; break; } case dateTextController.DATE_VALID: { i_Form.TxtDtFim.BackColor = Color.White; ctrl_TxtDtFim.IsUserValidated = true; ctrl_TxtDtIni.CleanError(); break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtEmpresa - case event_val_TxtEmpresa: { //InitEventCode event_val_TxtEmpresa switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (i_Form.TxtEmpresa.Text.Length == 6) { i_Form.TxtEmpresa.BackColor = Color.White; ctrl_TxtEmpresa.IsUserValidated = true; ctrl_TxtEmpresa.CleanError(); } else { i_Form.TxtEmpresa.BackColor = colorInvalid; ctrl_TxtEmpresa.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_BtnAlterarClick - case event_BtnAlterarClick: { //InitEventCode event_BtnAlterarClick //EndEventCode return(true); } #endregion #region - event_BtnPagamentoClick - case event_BtnPagamentoClick: { //InitEventCode event_BtnPagamentoClick //EndEventCode return(true); } #endregion #region - event_BtnExtratoClick - case event_BtnExtratoClick: { //InitEventCode event_BtnExtratoClick //EndEventCode return(true); } #endregion default: break; } return(false); }
public override bool doEvent(int event_number, object arg) { switch (event_number) { #region - event_Load - case event_Load: { //InitEventCode event_Load doEvent(event_Translate, null); doEvent(event_FormIsOpening, null); //EndEventCode return(true); } #endregion #region - event_Translate - case event_Translate: { //InitEventCode event_Translate //EndEventCode return(true); } #endregion #region - event_FormIsOpening - case event_FormIsOpening: { //InitEventCode event_FormIsOpening ctrl_TxtDt_Ini.AcquireTextBox(i_Form.TxtDt_Ini, this, event_val_TxtDt_Ini, dateTextController.FORMAT_DDMMYYYY); ctrl_TxtDt_Fim.AcquireTextBox(i_Form.TxtDt_Fim, this, event_val_TxtDt_Fim, dateTextController.FORMAT_DDMMYYYY); ctrl_TxtDt_Ini.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtDt_Fim.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); doEvent(event_BuscaDados, null); //EndEventCode return(true); } #endregion #region - robot_ShowDialog - case robot_ShowDialog: { //InitEventCode robot_ShowDialog //EndEventCode return(true); } #endregion #region - robot_CloseDialog - case robot_CloseDialog: { //InitEventCode robot_CloseDialog //EndEventCode return(true); } #endregion #region - event_val_TxtDt_Ini - case event_val_TxtDt_Ini: { //InitEventCode event_val_TxtDt_Ini switch (arg as string) { case dateTextController.DATE_INVALID: { i_Form.TxtDt_Ini.BackColor = Color.Lavender;; ctrl_TxtDt_Ini.IsUserValidated = false; break; } case dateTextController.DATE_VALID: { i_Form.TxtDt_Ini.BackColor = Color.White; ctrl_TxtDt_Ini.IsUserValidated = true; ctrl_TxtDt_Ini.CleanError(); break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtDt_Fim - case event_val_TxtDt_Fim: { //InitEventCode event_val_TxtDt_Fim switch (arg as string) { case dateTextController.DATE_INVALID: { i_Form.TxtDt_Fim.BackColor = Color.Lavender;; ctrl_TxtDt_Fim.IsUserValidated = false; break; } case dateTextController.DATE_VALID: { i_Form.TxtDt_Fim.BackColor = Color.White; ctrl_TxtDt_Fim.IsUserValidated = true; ctrl_TxtDt_Fim.CleanError(); break; } default: break; } //EndEventCode return(true); } #endregion #region - event_BuscaDados - case event_BuscaDados: { //InitEventCode event_BuscaDados i_Form.LstMsg.Items.Clear(); var_util.clearPortable(); string st_csv_content = ""; if (!var_exchange.fetch_edu_messages(ref header, ref st_csv_content)) { return(false); } ArrayList full_memory = new ArrayList(); while (st_csv_content != "") { ArrayList tmp_memory = new ArrayList(); if (var_exchange.fetch_memory(st_csv_content, "1000", ref st_csv_content, ref tmp_memory)) { for (int t = 0; t < tmp_memory.Count; ++t) { full_memory.Add(tmp_memory[t] as DataPortable); } } } for (int t = 0; t < full_memory.Count; ++t) { DadosEduMessage dem = new DadosEduMessage(full_memory[t] as DataPortable); string time = var_util.getDDMMYYYY_format(dem.get_dt_start()).Replace(" 00:00:00", "") + " - " + var_util.getDDMMYYYY_format(dem.get_dt_end()).Replace(" 23:59:59", ""); string [] full_row = new string [] { dem.get_st_msg(), time }; var_util.savePortable(dem.get_id_mem(), dem); i_Form.LstMsg.Items.Add(var_util.GetListViewItem(dem.get_id_mem(), full_row)); } //EndEventCode return(true); } #endregion #region - event_LstMsgDoubleClick - case event_LstMsgDoubleClick: { //InitEventCode event_LstMsgDoubleClick id = var_util.getSelectedListViewItemTag(i_Form.LstMsg); DadosEduMessage dem = new DadosEduMessage(var_util.retrievePortable(id) as DataPortable); i_Form.txtMsg.Text = dem.get_st_msg(); DateTime tim = Convert.ToDateTime(dem.get_dt_start()); ctrl_TxtDt_Ini.SetTextBoxText(tim.Day.ToString().PadLeft(2, '0') + tim.Month.ToString().PadLeft(2, '0') + tim.Year.ToString()); DateTime tim2 = Convert.ToDateTime(dem.get_dt_end()); ctrl_TxtDt_Fim.SetTextBoxText(tim2.Day.ToString().PadLeft(2, '0') + tim2.Month.ToString().PadLeft(2, '0') + tim2.Year.ToString()); //EndEventCode return(true); } #endregion #region - event_BtnNovoClick - case event_BtnNovoClick: { //InitEventCode event_BtnNovoClick dlgAutorizacao autor = new dlgAutorizacao(); autor.ShowDialog(); Application.DoEvents(); if (autor.IsConfirmed) { DadosEduMessage dem = new DadosEduMessage(); dem.set_dt_start(var_util.GetDataBaseTimeFormat(ctrl_TxtDt_Ini.getTextBoxValue_Date())); dem.set_dt_end(var_util.GetDataBaseTimeFormat(ctrl_TxtDt_Fim.getTextBoxValue_Date().AddHours(23).AddMinutes(59).AddSeconds(59))); dem.set_st_msg(i_Form.txtMsg.Text); var_exchange.ins_edu_msg(ref dem, ref header); doEvent(event_BuscaDados, null); } //EndEventCode return(true); } #endregion #region - event_BtnAtualizarClick - case event_BtnAtualizarClick: { //InitEventCode event_BtnAtualizarClick dlgAutorizacao autor = new dlgAutorizacao(); autor.ShowDialog(); Application.DoEvents(); if (autor.IsConfirmed) { DadosEduMessage dem = new DadosEduMessage(); dem.set_dt_start(var_util.GetDataBaseTimeFormat(ctrl_TxtDt_Ini.getTextBoxValue_Date())); dem.set_dt_end(var_util.GetDataBaseTimeFormat(ctrl_TxtDt_Fim.getTextBoxValue_Date().AddHours(23).AddMinutes(59).AddSeconds(59))); dem.set_st_msg(i_Form.txtMsg.Text); dem.set_id_mem(id); var_exchange.exec_change_edu_msg(ref dem, ref header); doEvent(event_BuscaDados, null); } //EndEventCode return(true); } #endregion #region - event_BtnRemoverClick - case event_BtnRemoverClick: { //InitEventCode event_BtnRemoverClick if (MessageBox.Show("Remover mensagem?", "Aviso", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No) { return(false); } string tag = var_util.getSelectedListViewItemTag(i_Form.LstMsg); DataPortable tmp = var_util.retrievePortable(tag); id = ""; DadosEduMessage dem = new DadosEduMessage(tmp); var_exchange.del_edu_msg(dem.get_id_mem(), ref header); doEvent(event_BuscaDados, null); //EndEventCode return(true); } #endregion default: break; } return(false); }