Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
            }
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        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);
            }
        }