示例#1
0
文件: Serie.cs 项目: icaroferj/ir-api
        private EstruturaPreenchimentoSerie PreencherCanaisIR(int SerieID)
        {
            try
            {
                EstruturaPreenchimentoSerie ePreenchimento = new EstruturaPreenchimentoSerie();

                string sql = string.Empty;

                //Consultando Canais IR Distribuídos
                sql = string.Format(@"SELECT 
                                        CASE WHEN cs.SerieID IS NOT NULL 
                                            THEN 'T'
                                            ELSE 'F'
                                        END AS Disponivel,
                                        c.ID AS CanalID
                                    FROM tEmpresa e (NOLOCK)
	                                INNER JOIN tCanal c (NOLOCK) ON e.ID = c.EmpresaID
	                                LEFT JOIN tCanalSerie cs (NOLOCK) ON cs.CanalID = c.ID AND cs.SerieID = {0}
                                    WHERE e.EmpresaVende = 'T' AND e.EmpresaPromove = 'F'", SerieID);


                bd.Consulta(sql);

                int canalID    = 0;
                int Internet   = Canal.CANAL_INTERNET;
                int Callcenter = Canal.CANAL_CALL_CENTER;
                while (bd.Consulta().Read())
                {
                    canalID = bd.LerInt("CanalID");
                    if (bd.LerBoolean("Disponivel"))
                    {
                        if (canalID == Internet)
                        {
                            ePreenchimento.eCanaisIR.DisponivelInternet = true;
                        }
                        else if (canalID == Callcenter)
                        {
                            ePreenchimento.eCanaisIR.DisponivelCallcenter = true;
                        }


                        ePreenchimento.eCanaisIR.QuantidadeDisponivelIR++;
                    }
                    ePreenchimento.eCanaisIR.QuantidadeMaximaIR++;
                }

                return(ePreenchimento);
            }
            finally
            {
                //Não precisa fechar o BD aqui!
                bd.FecharConsulta();
            }
        }
示例#2
0
文件: Serie.cs 项目: icaroferj/ir-api
        /// <summary>
        /// Carregar os dados desta Serie apartir do ID,
        /// Serão Carregados: Canais Próprios, Canais IR, Disponibilidade Site/CC
        ///                   Precos Disponíveis, Preços
        /// </summary>
        /// <param name="ID"></param>
        public EstruturaPreenchimentoSerie CarregarCanaisPrecosFormaPagamento(int SerieID, Enumerators.TipoPerfil tipoPerfil, int ID)
        {
            try
            {
                bool Alterar = true;

                EstruturaPreenchimentoSerie ePreenchimentoSerie = this.PreencherCanaisIR(SerieID);
                ePreenchimentoSerie.lstCanaisDisponiveis          = this.PreencherCanais(SerieID);
                ePreenchimentoSerie.lstPrecosDisponiveis          = this.PreencherPrecos(SerieID, tipoPerfil, ID, ref Alterar);
                ePreenchimentoSerie.lstFormasPagamentoDisponiveis = this.PreencherFormasPagamento(SerieID);


                ePreenchimentoSerie.HabilitarEdicao = Alterar;

                return(ePreenchimentoSerie);
            }
            finally
            {
                bd.Fechar();
            }
        }
示例#3
0
文件: Serie.cs 项目: icaroferj/ir-api
        public void GerarGerenciador(EstruturaSerie eSerie, EstruturaPreenchimentoSerie ePreenchimentoSerie)
        {
            try
            {
                bd.IniciarTransacao();

                this.Nome.Valor   = eSerie.Nome;
                this.Titulo.Valor = eSerie.Titulo;
                this.Tipo.Valor   = eSerie.Tipo;

                this.QuantidadeMaximaGrupo.Valor = eSerie.QuantidadeMaximaGrupo;
                this.QuantidadeMinimaGrupo.Valor = eSerie.QuantidadeMinimaGrupo;

                this.QuantidadeMaximaApresentacao.Valor = eSerie.QuantidadeMaximaApresentacao;
                this.QuantidadeMinimaApresentacao.Valor = eSerie.QuantidadeMinimaApresentacao;

                this.QuantidadeMinimaIngressosPorApresentacao.Valor = eSerie.QuantidadeMinimaIngressosPorApresentacao;
                this.QuantidadeMaximaIngressosPorApresentacao.Valor = eSerie.QuantidadeMaximaIngressosPorApresentacao;

                this.Regras.Valor     = eSerie.Regras;
                this.Descricao.Valor  = eSerie.Descricao;
                this.LocalID.Valor    = eSerie.LocalID;
                this.RegionalID.Valor = eSerie.RegionalID;


                //Registro antigo
                if (eSerie.ID > 0)
                {
                    this.Control.ID = eSerie.ID;
                    if (!this.Atualizar(bd))
                    {
                        throw new Exception("Não foi possível atualizar o registro da Série.");
                    }
                }
                //Novo Registro
                else
                if (!this.Inserir(bd))
                {
                    throw new Exception("Não foi possível inserir o registro da Série.");
                }


                SerieItem si = new SerieItem(this.Control.UsuarioID);
                si.GerenciarItems(bd, this.Control.ID, ePreenchimentoSerie.lstPrecosDisponiveis);

                CanalSerie cs = new CanalSerie(this.Control.UsuarioID);
                cs.GerenciarCanais(bd, this.Control.ID, ePreenchimentoSerie.eCanaisIR, ePreenchimentoSerie.lstCanaisDisponiveis);

                FormaPagamentoSerie fps = new FormaPagamentoSerie(this.Control.UsuarioID);
                fps.GerenciarFormasDePagamento(bd, this.Control.ID, ePreenchimentoSerie.lstFormasPagamentoDisponiveis);

                bd.FinalizarTransacao();
            }
            catch (Exception ex)
            {
                bd.DesfazerTransacao();
                throw ex;
            }
            finally
            {
                bd.Fechar();
            }
        }