private void OnMainUpdateClick(object sender, System.EventArgs e) { System.Data.DataRow v_row = this.v_maingrid.CurrentRow(); this.v_reportwindow = new Spartacus.Forms.Window( System.Configuration.ConfigurationManager.AppSettings["reportupdate.title"].ToString(), 600, 150, this.v_mainwindow ); this.v_reportname = new Spartacus.Forms.Textbox(this.v_reportwindow, System.Configuration.ConfigurationManager.AppSettings["reportupdate.name"].ToString()); this.v_reportname.SetValue(v_row["name"].ToString()); this.v_reportwindow.Add(this.v_reportname); this.v_reportxmlfile = new Spartacus.Forms.Filepicker( this.v_reportwindow, Spartacus.Forms.Filepicker.Type.OPEN, System.Configuration.ConfigurationManager.AppSettings["reportupdate.xmlfile"].ToString(), System.Configuration.ConfigurationManager.AppSettings["reportupdate.filter"].ToString() ); this.v_reportxmlfile.SetValue(v_row["xmlfile"].ToString()); this.v_reportwindow.Add(this.v_reportxmlfile); this.v_reportbuttons = new Spartacus.Forms.Buttons(this.v_reportwindow); this.v_reportbuttons.AddButton(System.Configuration.ConfigurationManager.AppSettings["reportupdate.save"].ToString(), this.OnReportUpdateSaveClick); this.v_reportbuttons.AddButton(System.Configuration.ConfigurationManager.AppSettings["reportupdate.cancel"].ToString(), this.OnReportUpdateCancelClick); this.v_reportwindow.Add(this.v_reportbuttons); this.v_reportwindow.Show(); }
public JanelaAgente(Spartacus.Database.Generic p_database, Spartacus.Forms.Window p_pai) : base("Edição de Agente", 300, 200, p_pai) { this.v_database = p_database; this.v_id = new Spartacus.Forms.Textbox(this, "Código"); this.v_id.Disable(); this.Add(this.v_id); this.v_nome = new Spartacus.Forms.Textbox(this, "Nome"); this.Add(this.v_nome); this.v_telefone = new Spartacus.Forms.Textbox(this, "Telefone"); this.Add(this.v_telefone); this.v_buttons = new Spartacus.Forms.Buttons(this); this.v_buttons.AddButton("Salvar", this.ClickSalvar); this.v_buttons.AddButton("Cancelar", this.ClickCancelar); this.Add(this.v_buttons); this.v_insert = new Spartacus.Database.Command(); this.v_insert.v_text = "insert into agentes (nome, telefone) values (#NOME#, #TELEFONE#)"; this.v_insert.AddParameter("NOME", Spartacus.Database.Type.STRING); this.v_insert.AddParameter("TELEFONE", Spartacus.Database.Type.STRING); this.v_update = new Spartacus.Database.Command(); this.v_update.v_text = "update agentes set nome = #NOME#, telefone = #TELEFONE# where id = #ID#"; this.v_update.AddParameter("NOME", Spartacus.Database.Type.STRING); this.v_update.AddParameter("TELEFONE", Spartacus.Database.Type.STRING); this.v_update.AddParameter("ID", Spartacus.Database.Type.INTEGER); }
public JanelaAgentes(Spartacus.Database.Generic p_database, Spartacus.Forms.Window p_pai) : base("Cadastro de Agentes", 600, 400, p_pai) { this.v_database = p_database; this.v_grid = new Spartacus.Forms.Grid(this, 330); this.v_grid.Populate( this.v_database, "select a.id, " + " a.nome, " + " a.telefone " + "from agentes a " + "order by a.id " ); this.Add(this.v_grid); this.v_buttons = new Spartacus.Forms.Buttons(this); this.v_buttons.AddButton("Novo", this.ClickNovo); this.v_buttons.AddButton("Editar", this.ClickEditar); this.v_buttons.AddButton("Remover", this.ClickRemover); this.Add(this.v_buttons); this.v_janelaagente = new JanelaAgente(this.v_database, this); this.v_delete = new Spartacus.Database.Command(); this.v_delete.v_text = "delete from agentes where id = #ID#"; this.v_delete.AddParameter("ID", Spartacus.Database.Type.INTEGER); }
public JanelaPrincipal(Spartacus.Database.Generic p_database) : base("Finanças Pessoais", 800, 600) { this.v_database = p_database; Spartacus.Forms.Menugroup v_group, v_group2; this.v_menu = new Spartacus.Forms.Menu(this); v_group = this.v_menu.AddGroup("Cadastro"); this.v_menu.AddItem(v_group, "Agentes", this.MenuAgentes); this.Add(this.v_menu); v_group = this.v_menu.AddGroup("Relatórios"); v_group2 = this.v_menu.AddGroup(v_group, "Listagem de Agentes"); this.v_menu.AddItem(v_group2, "Excel", this.MenuAgentesExcel); this.v_menu.AddItem(v_group2, "PDF", this.MenuAgentesPDF); v_group2 = this.v_menu.AddGroup(v_group, "Listagem de Movimentação"); this.v_menu.AddItem(v_group2, "Excel", this.MenuMovimentacaoExcel); this.v_menu.AddItem(v_group2, "PDF", this.MenuMovimentacaoPDF); this.v_grid = new Spartacus.Forms.Grid(this, 480); this.v_grid.Populate( this.v_database, "select m.id, " + " m.data, " + " a.nome, " + " m.descricao, " + " m.debito, " + " m.credito, " + " m.saldo " + "from movimentos m " + "inner join agentes a " + "on a.id = m.idagente " + "order by m.id desc " ); this.Add(this.v_grid); this.v_buttons = new Spartacus.Forms.Buttons(this); this.v_buttons.AddButton("Débito", this.ClickDebito); this.v_buttons.AddButton("Crédito", this.ClickCredito); this.v_buttons.AddButton("Estorno", this.ClickEstorno); this.v_buttons.AddButton("Atualizar", this.ClickAtualizar); this.Add(this.v_buttons); this.v_janelaagentes = new JanelaAgentes(this.v_database, this); this.v_janeladebito = new JanelaDebito(this.v_database, this); this.v_janelacredito = new JanelaCredito(this.v_database, this); this.v_cmd = new Spartacus.Database.Command(); this.v_cmd.v_text = "insert into movimentos (idagente, data, debito, credito, saldo, descricao) values (#IDAGENTE#, #DATA#, #DEBITO#, #CREDITO#, #SALDO#, #DESCRICAO#)"; this.v_cmd.AddParameter("IDAGENTE", Spartacus.Database.Type.INTEGER); this.v_cmd.AddParameter("DATA", Spartacus.Database.Type.INTEGER); this.v_cmd.AddParameter("DEBITO", Spartacus.Database.Type.REAL); this.v_cmd.SetLocale("DEBITO", Spartacus.Database.Locale.EUROPEAN); this.v_cmd.AddParameter("CREDITO", Spartacus.Database.Type.REAL); this.v_cmd.SetLocale("CREDITO", Spartacus.Database.Locale.EUROPEAN); this.v_cmd.AddParameter("SALDO", Spartacus.Database.Type.REAL); this.v_cmd.SetLocale("SALDO", Spartacus.Database.Locale.EUROPEAN); this.v_cmd.AddParameter("DESCRICAO", Spartacus.Database.Type.STRING); }
public void Initialize() { try { if (new System.IO.FileInfo(System.Configuration.ConfigurationManager.AppSettings["database"].ToString()).Exists) { this.v_database = new Spartacus.Database.Sqlite(System.Configuration.ConfigurationManager.AppSettings["database"].ToString()); } else { this.v_database = new Spartacus.Database.Sqlite(); this.v_database.CreateDatabase(System.Configuration.ConfigurationManager.AppSettings["database"].ToString()); this.v_database.Execute("create table reports (code integer primary key autoincrement, name text, xmlfile text not null);"); } this.v_mainwindow = new Spartacus.Forms.Window( System.Configuration.ConfigurationManager.AppSettings["main.title"].ToString(), 600, 400 ); this.v_maingrid = new Spartacus.Forms.Grid(this.v_mainwindow, 300); this.v_maingrid.Populate(this.v_database, "select * from reports"); this.v_mainwindow.Add(this.v_maingrid); this.v_editable = bool.Parse(System.Configuration.ConfigurationManager.AppSettings["editable"].ToString()); this.v_mainbuttons = new Spartacus.Forms.Buttons(this.v_mainwindow); this.v_mainbuttons.AddButton(System.Configuration.ConfigurationManager.AppSettings["main.execute"].ToString(), this.OnMainExecuteClick); this.v_mainbuttons.AddButton(System.Configuration.ConfigurationManager.AppSettings["main.insert"].ToString(), this.OnMainInsertClick, this.v_editable); this.v_mainbuttons.AddButton(System.Configuration.ConfigurationManager.AppSettings["main.update"].ToString(), this.OnMainUpdateClick, this.v_editable); this.v_mainbuttons.AddButton(System.Configuration.ConfigurationManager.AppSettings["main.delete"].ToString(), this.OnMainDeleteClick, this.v_editable); this.v_mainwindow.Add(this.v_mainbuttons); this.v_mainwindow.Run(); } catch (Spartacus.Database.Exception exc) { Spartacus.Forms.Messagebox.Show(exc.v_message, "Spartacus.Database.Exception", Spartacus.Forms.Messagebox.Icon.ERROR); System.Environment.Exit(-1); } catch (Spartacus.Forms.Exception exc) { Spartacus.Forms.Messagebox.Show(exc.v_message, "Spartacus.Forms.Exception", Spartacus.Forms.Messagebox.Icon.ERROR); System.Environment.Exit(-1); } catch (System.Exception exc) { Spartacus.Forms.Messagebox.Show(exc.Message, exc.GetType().ToString(), Spartacus.Forms.Messagebox.Icon.ERROR); System.Environment.Exit(-1); } }
private void OnMainInsertClick(object sender, System.EventArgs e) { try { this.v_reportwindow = new Spartacus.Forms.Window( System.Configuration.ConfigurationManager.AppSettings["reportinsert.title"].ToString(), 600, 150, this.v_mainwindow ); this.v_reportname = new Spartacus.Forms.Textbox(this.v_reportwindow, System.Configuration.ConfigurationManager.AppSettings["reportinsert.name"].ToString()); this.v_reportwindow.Add(this.v_reportname); this.v_reportxmlfile = new Spartacus.Forms.Filepicker( this.v_reportwindow, Spartacus.Forms.Filepicker.Type.OPEN, System.Configuration.ConfigurationManager.AppSettings["reportinsert.xmlfile"].ToString(), System.Configuration.ConfigurationManager.AppSettings["reportinsert.filter"].ToString() ); this.v_reportwindow.Add(this.v_reportxmlfile); this.v_reportbuttons = new Spartacus.Forms.Buttons(this.v_reportwindow); this.v_reportbuttons.AddButton(System.Configuration.ConfigurationManager.AppSettings["reportinsert.save"].ToString(), this.OnReportInsertSaveClick); this.v_reportbuttons.AddButton(System.Configuration.ConfigurationManager.AppSettings["reportinsert.cancel"].ToString(), this.OnReportInsertCancelClick); this.v_reportwindow.Add(this.v_reportbuttons); this.v_reportwindow.Show(); } catch (Spartacus.Forms.Exception exc) { Spartacus.Forms.Messagebox.Show(exc.v_message, "Spartacus.Forms.Exception", Spartacus.Forms.Messagebox.Icon.ERROR); System.Environment.Exit(-1); } catch (System.Exception exc) { Spartacus.Forms.Messagebox.Show(exc.Message, exc.GetType().ToString(), Spartacus.Forms.Messagebox.Icon.ERROR); System.Environment.Exit(-1); } }
public JanelaDebito(Spartacus.Database.Generic p_database, Spartacus.Forms.Window p_pai) : base("Novo Débito", 600, 300, p_pai) { this.v_database = p_database; this.v_agente = new Spartacus.Forms.Lookup(this, "Agente", 40, 60); this.v_agente.Populate( this.v_database, "select a.id, " + " a.nome " + "from agentes a " + "order by a.id " ); this.Add(this.v_agente); this.v_valor = new Spartacus.Forms.Textbox(this, "Valor"); this.Add(this.v_valor); this.v_descricao = new Spartacus.Forms.Memobox(this, "Descrição", 150); this.Add(this.v_descricao); this.v_buttons = new Spartacus.Forms.Buttons(this); this.v_buttons.AddButton("Salvar", this.ClickSalvar); this.v_buttons.AddButton("Cancelar", this.ClickCancelar); this.Add(this.v_buttons); this.v_cmd = new Spartacus.Database.Command(); this.v_cmd.v_text = "insert into movimentos (idagente, data, debito, credito, saldo, descricao) values (#IDAGENTE#, #DATA#, #DEBITO#, #CREDITO#, #SALDO#, #DESCRICAO#)"; this.v_cmd.AddParameter("IDAGENTE", Spartacus.Database.Type.INTEGER); this.v_cmd.AddParameter("DATA", Spartacus.Database.Type.INTEGER); this.v_cmd.AddParameter("DEBITO", Spartacus.Database.Type.REAL); this.v_cmd.SetLocale("DEBITO", Spartacus.Database.Locale.EUROPEAN); this.v_cmd.AddParameter("CREDITO", Spartacus.Database.Type.REAL); this.v_cmd.SetLocale("CREDITO", Spartacus.Database.Locale.EUROPEAN); this.v_cmd.AddParameter("SALDO", Spartacus.Database.Type.REAL); this.v_cmd.SetLocale("SALDO", Spartacus.Database.Locale.EUROPEAN); this.v_cmd.AddParameter("DESCRICAO", Spartacus.Database.Type.STRING); }
private void OnMainExecuteClick(object sender, System.EventArgs e) { System.Data.DataRow v_row = this.v_maingrid.CurrentRow(); try { this.v_currentcode = int.Parse(v_row["code"].ToString()); this.v_currentfile = v_row["xmlfile"].ToString(); this.v_report = new Spartacus.Reporting.Report(this.v_currentcode, this.v_currentfile); this.v_paramwindow = new Spartacus.Forms.Window( System.Configuration.ConfigurationManager.AppSettings["param.title"].ToString(), 500, 500, this.v_mainwindow ); for (int k = 0; k < this.v_report.v_cmd.v_parameters.Count; k++) { if (this.v_report.v_cmd.v_parameters[k].v_type == Spartacus.Database.Type.DATE) { Spartacus.Forms.Datetimepicker v_param = new Spartacus.Forms.Datetimepicker( this.v_paramwindow, this.v_report.v_cmd.v_parameters[k].v_description, "dd/MM/yyyy" ); this.v_paramwindow.Add(v_param); } else { if (this.v_report.v_cmd.v_parameters[k].v_lookup != null && this.v_report.v_cmd.v_parameters[k].v_lookup != "") { Spartacus.Forms.Lookup v_param = new Spartacus.Forms.Lookup( this.v_paramwindow, this.v_report.v_cmd.v_parameters[k].v_description ); v_param.Populate(this.v_report.v_database, this.v_report.v_cmd.v_parameters[k].v_lookup, "80;150"); this.v_paramwindow.Add(v_param); } else { Spartacus.Forms.Textbox v_param = new Spartacus.Forms.Textbox( this.v_paramwindow, this.v_report.v_cmd.v_parameters[k].v_description ); this.v_paramwindow.Add(v_param); } } } this.v_reportpdffile = new Spartacus.Forms.Filepicker( this.v_paramwindow, Spartacus.Forms.Filepicker.Type.SAVE, System.Configuration.ConfigurationManager.AppSettings["param.pdffile"].ToString(), System.Configuration.ConfigurationManager.AppSettings["param.filter"].ToString() ); this.v_paramwindow.Add(this.v_reportpdffile); this.v_parambuttons = new Spartacus.Forms.Buttons(this.v_paramwindow); this.v_parambuttons.AddButton(System.Configuration.ConfigurationManager.AppSettings["param.execute"].ToString(), this.OnParamExecuteClick); this.v_parambuttons.AddButton(System.Configuration.ConfigurationManager.AppSettings["param.cancel"].ToString(), this.OnParamCancelClick); this.v_paramwindow.Add(this.v_parambuttons); this.v_progressbar = new Spartacus.Forms.Progressbar(this.v_paramwindow); this.v_progressbar.SetValue("Aguardando início", 0); this.v_paramwindow.Add(this.v_progressbar); this.v_paramwindow.Show(); } catch (Spartacus.Database.Exception exc) { Spartacus.Forms.Messagebox.Show(exc.v_message, "Spartacus.Database.Exception", Spartacus.Forms.Messagebox.Icon.ERROR); System.Environment.Exit(-1); } catch (Spartacus.Reporting.Exception exc) { Spartacus.Forms.Messagebox.Show(exc.v_message, "Spartacus.Reporting.Exception", Spartacus.Forms.Messagebox.Icon.ERROR); System.Environment.Exit(-1); } catch (Spartacus.Forms.Exception exc) { Spartacus.Forms.Messagebox.Show(exc.v_message, "Spartacus.Forms.Exception", Spartacus.Forms.Messagebox.Icon.ERROR); System.Environment.Exit(-1); } catch (System.Exception exc) { Spartacus.Forms.Messagebox.Show(exc.Message, exc.GetType().ToString(), Spartacus.Forms.Messagebox.Icon.ERROR); System.Environment.Exit(-1); } }