/// <summary>
 /// Retorna um IBaseBD de ApresentacaoSetor especifico
 /// </summary>
 public override IBaseBD this[int indice]
 {
     get
     {
         if (indice < 0 || indice >= lista.Count)
         {
             return(null);
         }
         else
         {
             int id = (int)lista[indice];
             apresentacaoSetor.Ler(id);
             return(apresentacaoSetor);
         }
     }
 }
        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();
            }
        }
Exemple #3
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;
            }
        }