コード例 #1
0
        public void AtualizarProgramacao(string codigoProgramacao)
        {
            BD bd = new BD();

            try
            {
                var programacao = Service.getProgramacao(oAutenticacao, new Filtros.GetProg()
                {
                    IDProg = codigoProgramacao,
                }).FirstOrDefault();

                int apresentacaoID = Convert.ToInt32(bd.ConsultaValor("SELECT ID FROM tApresentacao (NOLOCK) WHERE CodigoProgramacao = '" + codigoProgramacao + "'"));
                if (apresentacaoID == 0)
                {
                    throw new Exception("Não existe programação cadastrada com este código.");
                }

                Apresentacao oApresentacao = new Apresentacao();
                oApresentacao.Ler(apresentacaoID);
                oApresentacao.Horario.Valor = Convert.ToDateTime(programacao.DataSessao);
                oApresentacao.Atualizar();


                int apresentacaoSetorID = Convert.ToInt32(bd.ConsultaValor("SELECT TOP 1 ID FROM tApresentacaoSetor WHERE ApresentacaoID = " + apresentacaoID));
                ApresentacaoSetor oApresentacaoSetor = new ApresentacaoSetor();
                oApresentacaoSetor.Ler(apresentacaoSetorID);
                oApresentacaoSetor.NVendeLugar.Valor = Convert.ToBoolean(programacao.NVendLuga);
                oApresentacaoSetor.Atualizar();
            }
            finally
            {
                bd.Fechar();
            }
        }
コード例 #2
0
        /// <summary>
        /// Obtem uma tabela a ser jogada num relatorio
        /// </summary>
        /// <returns></returns>
        public override DataTable Relatorio()
        {
            try{
                DataTable tabela = new DataTable("RelatorioPacoteItem");

                if (this.Primeiro())
                {
                    tabela.Columns.Add("Evento", typeof(string));
                    tabela.Columns.Add("Horário", typeof(string));
                    tabela.Columns.Add("Setor", typeof(string));
                    tabela.Columns.Add("Preço", typeof(decimal));
                    tabela.Columns.Add("Qtd", typeof(int));
                    tabela.Columns.Add("Total", typeof(decimal));

                    do
                    {
                        DataRow linha = tabela.NewRow();
                        Preco   preco = new Preco();
                        preco.Ler(pacoteItem.PrecoID.Valor);

                        ApresentacaoSetor apresentacaoSetor = new ApresentacaoSetor();
                        apresentacaoSetor.Ler(preco.ApresentacaoSetorID.Valor);

                        Apresentacao apresentacao = new Apresentacao();
                        apresentacao.Ler(apresentacaoSetor.ApresentacaoID.Valor);

                        Setor setor = new Setor();
                        setor.Ler(apresentacaoSetor.SetorID.Valor);

                        Evento evento = new Evento();
                        evento.Ler(apresentacao.EventoID.Valor);

                        linha["Evento"]  = evento.Nome;
                        linha["Horário"] = apresentacao.Horario.Valor.ToString(Utilitario.FormatoDataHora);
                        linha["Setor"]   = setor.Nome;
                        linha["Preço"]   = preco.Valor.Valor;
                        linha["Qtd"]     = pacoteItem.Quantidade.Valor;
                        linha["Total"]   = (preco.Valor.Valor * pacoteItem.Quantidade.Valor);
                        tabela.Rows.Add(linha);
                    }while(this.Proximo());
                }
                else                   //erro: nao carregou a lista
                {
                    tabela = null;
                }

                return(tabela);
            }catch (Exception ex) {
                throw ex;
            }
        }
コード例 #3
0
ファイル: BorderoAvulso.cs プロジェクト: icaroferj/ir-api
        public IRLib.Paralela.Assinaturas.Relatorios.ModelBorderoAvulso BuscarRelatorio(int Eventos, int Apresentacoes)
        {
            try
            {
                ModelBorderoAvulso retorno       = new ModelBorderoAvulso();
                Evento             oEvento       = new Evento();
                Apresentacao       oApresentacao = new Apresentacao();

                oApresentacao.Ler(Apresentacoes);
                retorno.Apresentacao = oApresentacao.Horario.Valor.ToString("dd/MM/yyyy HH:mm");

                string[] infos = oEvento.EventoLocalNome(Eventos);

                retorno.Assinatura = infos[1];
                retorno.Local      = infos[0];

                string sql = string.Format(@"                                    
                SELECT s.Nome AS Setor, p.Nome AS Preco, 
                SUM(p.Valor) AS Faturamento, COUNT(DISTINCT i.ID) AS Quantidade
                FROM   tIngresso i (NOLOCK)
                INNER JOIN tPreco p (NOLOCK) ON p.ID = i.PrecoID
                INNER JOIN tSetor s (NOLOCK) ON s.ID = i.SetorID
                WHERE i.ApresentacaoID = {0} And i.EventoID = {1} AND (i.Status = 'V' OR i.Status= 'I' OR i.Status = 'E') 
                AND i.AssinaturaClienteID = 0
                AND i.CortesiaID = 0
                GROUP BY s.ID, s.Nome, p.Nome
                ORDER BY s.Nome, p.Nome 

                SELECT
                s.Nome AS Setor, s.ID, p.ID, p.Nome AS Preco, 
                SUM(p.Valor) AS Faturamento, COUNT(DISTINCT i.ID) AS Quantidade
                FROM   tIngresso i (NOLOCK)
                INNER JOIN tPreco p (NOLOCK) ON p.ID = i.PrecoID
                INNER JOIN tSetor s (NOLOCK) ON s.ID = i.SetorID
                WHERE i.ApresentacaoID = {0} And i.EventoID = {1} AND i.Status IN  ('V', 'I', 'E') 
                AND i.CortesiaID <> 0 AND i.AssinaturaClienteID = 0
                GROUP BY s.ID, s.Nome, p.Nome, p.ID
                ORDER BY s.Nome, p.Nome 

                SELECT
                s.Nome AS Setor,
                COUNT(i.ID) AS Lotacao, 
                        SUM(CASE WHEN i.AssinaturaClienteID > 0 AND i.CortesiaID <= 0
                            THEN 
                                CASE WHEN i.Status IN ('V', 'E', 'I')
                                THEN 1	
                                ELSE 0
                                END
                            ELSE
                                0
                            END) 
                        AS Assinante,
                        SUM(CASE WHEN i.AssinaturaClienteID <=0 AND i.CortesiaID <= 0
                            THEN 
                                CASE WHEN i.Status IN ('V', 'E', 'I')
                                THEN 1 
                                ELSE 0
                                END
                            ELSE
                                0
                            END) 
                        AS Avulso,
                        SUM(CASE WHEN  i.CortesiaID > 0
                            THEN 
                                CASE WHEN i.Status IN ('V', 'E', 'I')
                                THEN 1 
                                ELSE 0
                                END
                            ELSE
                                0
                            END) 
                    AS Cortesia,
                        SUM( 
			                CASE WHEN i.Status IN ('B')
			                THEN 1 
			                ELSE 0
			                END
                            ) 
                    AS Bloqueado
                FROM tIngresso i (NOLOCK)
                INNER JOIN tSetor s (NOLOCK) ON s.ID = i.SetorID
                WHERE i.ApresentacaoID = {0} And i.EventoID = {1}
                GROUP BY s.ID,s.Nome
                ORDER BY s.ID,s.Nome ", Apresentacoes, Eventos);

                bd.Consulta(sql);

                List <int> auxSetorID = new List <int>();

                int     quantidadeTotal  = 0;
                decimal faturamentoTotal = 0;

                while (bd.Consulta().Read())
                {
                    string  setor       = bd.LerString("Setor");
                    string  preco       = bd.LerString("Preco");
                    decimal faturamento = bd.LerDecimal("Faturamento");
                    int     quantidade  = bd.LerInt("Quantidade");
                    quantidadeTotal  += quantidade;
                    faturamentoTotal += faturamento;

                    retorno.ListaResultado.Add(new Resultado()
                    {
                        Setor       = setor,
                        Preco       = preco,
                        Qtd         = quantidade,
                        Faturamento = faturamento,
                    });
                }

                retorno.ListaResultado.Add(new Resultado()
                {
                    Setor       = "Total",
                    Preco       = "-",
                    Qtd         = quantidadeTotal,
                    Faturamento = faturamentoTotal,
                });

                retorno.Despesas.Bruto = faturamentoTotal;

                bd.Consulta().NextResult();

                quantidadeTotal  = 0;
                faturamentoTotal = 0;

                while (bd.Consulta().Read())
                {
                    string  setor       = bd.LerString("Setor");
                    string  preco       = bd.LerString("Preco");
                    decimal faturamento = bd.LerDecimal("Faturamento");
                    int     quantidade  = bd.LerInt("Quantidade");
                    quantidadeTotal  += quantidade;
                    faturamentoTotal += faturamento;

                    retorno.ListaResultadoCortesia.Add(new Resultado()
                    {
                        Setor       = setor,
                        Preco       = preco,
                        Qtd         = quantidade,
                        Faturamento = faturamento,
                    });
                }

                retorno.ListaResultadoCortesia.Add(new Resultado()
                {
                    Setor       = "Total",
                    Preco       = "-",
                    Qtd         = quantidadeTotal,
                    Faturamento = faturamentoTotal,
                });

                bd.Consulta().NextResult();

                int lotacaoTotal    = 0;
                int bloqueadosTotal = 0;
                int cortesiaTotal   = 0;
                int assinanteTotal  = 0;
                int avulsoTotal     = 0;

                while (bd.Consulta().Read())
                {
                    string setor      = bd.LerString("Setor");
                    int    lotacao    = bd.LerInt("Lotacao");
                    int    bloqueados = bd.LerInt("Bloqueado");
                    int    cortesia   = bd.LerInt("Cortesia");
                    int    assinante  = bd.LerInt("Assinante");
                    int    avulso     = bd.LerInt("Avulso");

                    lotacaoTotal    += lotacao;
                    bloqueadosTotal += bloqueados;
                    cortesiaTotal   += cortesia;
                    assinanteTotal  += assinante;
                    avulsoTotal     += avulso;

                    retorno.ListaResultadoSetor.Add(new ResultadoSetor()
                    {
                        Setor      = setor,
                        Lotacao    = lotacao,
                        Bloqueados = bloqueados,
                        Cortesia   = cortesia,
                        Assinante  = assinante,
                        Avulso     = avulso,
                    });
                }

                retorno.ListaResultadoSetor.Add(new ResultadoSetor()
                {
                    Setor      = "Total",
                    Lotacao    = lotacaoTotal,
                    Bloqueados = bloqueadosTotal,
                    Cortesia   = cortesiaTotal,
                    Assinante  = assinanteTotal,
                    Avulso     = avulsoTotal,
                });



                return(retorno);
            }
            finally
            {
                bd.Fechar();
            }
        }