Beispiel #1
0
        public EstruturaCotasInfo getQuantidadesComprasInternet(EstruturaCotaItemReserva cota, int apresentacaoID, int apresentacaoSetorID, int ingressoID, int cotaItemID, int donoID)
        {
            try
            {
                IngressoCliente oIngressoCliente = new IngressoCliente();
                if (apresentacaoID == 0)
                {
                    apresentacaoSetorID = Convert.ToInt32(bd.ConsultaValor("SELECT ApresentacaoSetorID FROM tIngresso (NOLOCK) WHERE ID = " + ingressoID + " AND ApresentacaoID = " + apresentacaoID));
                    bd.FecharConsulta();
                }
                EstruturaCotasInfo cotaInfo = new EstruturaCotasInfo();

                int[] qtds = this.getQuantidade(cotaItemID, apresentacaoID, apresentacaoSetorID);
                cotaInfo.QuantidadeApresentacao      = qtds[0];
                cotaInfo.QuantidadeApresentacaoSetor = qtds[1];
                cotaInfo.QuantidadePorClienteCota    = qtds[2];

                if (cota.QuantidadePorCliente > 0 || cota.QuantidadePorClienteApresentacao > 0 || cota.QuantidadePorClienteApresentacaoSetor > 0)
                {
                    //Preenche o OBJ de IngressoCliente e retorna as quantidades ja compradas
                    oIngressoCliente.ApresentacaoID.Valor      = apresentacaoID;
                    oIngressoCliente.ApresentacaoSetorID.Valor = apresentacaoSetorID;
                    oIngressoCliente.DonoID.Valor     = donoID;
                    oIngressoCliente.CotaItemID.Valor = cotaItemID;

                    qtds = oIngressoCliente.QuantidadeJaComprada();

                    cotaInfo.QuantidadePorClienteApresentacao      = qtds[0];
                    cotaInfo.QuantidadePorClienteApresentacaoSetor = qtds[1];
                    cotaInfo.QuantidadePorClienteCota = qtds[2];
                }
                else
                {
                    cotaInfo.QuantidadePorClienteApresentacao      = 0;
                    cotaInfo.QuantidadePorClienteApresentacaoSetor = 0;
                    cotaInfo.QuantidadePorClienteCota = 0;
                }

                return(cotaInfo);
            }

            catch (Exception)
            {
                throw;
            }
            finally
            {
                bd.Fechar();
            }
        }
Beispiel #2
0
        public EstruturaCotaItemReserva getCotaItemPorID(int cotaItemID, int apresentacaoID, int setorID, int apresentacaoSetorID)
        {
            try
            {
                EstruturaCotaItemReserva Item   = new EstruturaCotaItemReserva();
                StringBuilder            stbSQL = new StringBuilder();

                stbSQL.Append("SELECT aps.SetorID, aps.ApresentacaoID, it.PrecoIniciaCom, it.Quantidade, it.QuantidadePorCliente, it.Nominal, it.ParceiroID, it.ValidaBin, it.QuantidadePorCodigo,  ");
                stbSQL.Append("IsNull(aps.Quantidade, 0) AS QuantidadeAPS, IsNull(aps.QuantidadePorCliente, 0) AS QuantidadePorClienteAPS ");
                stbSQL.Append("FROM tCotaItem it (NOLOCK) ");
                if (apresentacaoSetorID > 0)
                {
                    stbSQL.Append("INNER JOIN tApresentacaoSetor aps (NOLOCK) ON aps.CotaID = it.CotaID ");
                    stbSQL.Append("WHERE it.ID = " + cotaItemID + " AND aps.ID = " + apresentacaoSetorID);
                }
                else
                {
                    stbSQL.Append("INNER JOIN tApresentacaoSetor aps (NOLOCK) ON aps.CotaID = it.CotaID ");
                    stbSQL.Append("WHERE it.ID =" + cotaItemID + " AND aps.ApresentacaoID =" + apresentacaoID + " AND aps.SetorID = " + setorID);
                }

                bd.Consulta(stbSQL.ToString());
                if (bd.Consulta().Read())
                {
                    Item.ID                                    = cotaItemID;
                    Item.ApresentacaoID                        = bd.LerInt("ApresentacaoID");
                    Item.SetorID                               = bd.LerInt("SetorID");
                    Item.PrecoIniciaCom                        = bd.LerString("PrecoIniciaCom");
                    Item.Quantidade                            = bd.LerInt("Quantidade");
                    Item.QuantidadePorCliente                  = bd.LerInt("QuantidadePorCliente");
                    Item.ParceiroID                            = bd.LerInt("ParceiroID");
                    Item.ValidaBin                             = bd.LerBoolean("ValidaBin");
                    Item.QuantidadeApresentacaoSetor           = bd.LerInt("QuantidadeAPS");
                    Item.QuantidadePorClienteApresentacaoSetor = bd.LerInt("QuantidadePorClienteAPS");
                    Item.QuantidadePorCodigo                   = bd.LerInt("QuantidadePorCodigo");
                    Item.Nominal                               = bd.LerBoolean("Nominal");
                }
                return(Item);
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                bd.Fechar();
            }
        }
Beispiel #3
0
        public EstruturaCotaItemReserva getCotaItemPorID(int cotaItemID)
        {
            try
            {
                EstruturaCotaItemReserva Item   = new EstruturaCotaItemReserva();
                StringBuilder            stbSQL = new StringBuilder();

                stbSQL.Append(
                    @"SELECT it.PrecoIniciaCom,
                            it.Quantidade, it.QuantidadePorCliente, it.ParceiroID,
                            it.ValidaBin, TextoValidacao, CPFResponsavel,
                            CASE WHEN Termo <> ''
                                THEN 'T'
                                ELSE 'F'
                            END AS TemTermo ");
                stbSQL.Append("FROM tCotaItem it (NOLOCK) ");
                stbSQL.Append("WHERE it.ID =" + cotaItemID);

                bd.Consulta(stbSQL.ToString());
                if (bd.Consulta().Read())
                {
                    Item.ID                   = cotaItemID;
                    Item.TextoValidacao       = bd.LerString("TextoValidacao");
                    Item.PrecoIniciaCom       = bd.LerString("PrecoIniciaCom");
                    Item.Quantidade           = bd.LerInt("Quantidade");
                    Item.QuantidadePorCliente = bd.LerInt("QuantidadePorCliente");
                    Item.ParceiroID           = bd.LerInt("ParceiroID");
                    Item.ValidaBin            = bd.LerBoolean("ValidaBin");
                    Item.CPFResponsavel       = bd.LerBoolean("CPFResponsavel");
                    Item.TemTermo             = bd.LerBoolean("TemTermo");
                }
                return(Item);
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                bd.Fechar();
            }
        }
Beispiel #4
0
        public List <EstruturaCotaItemReserva> getListaCotaItemReserva(int cotaID, int cotaIDAPS)
        {
            try
            {
                List <EstruturaCotaItemReserva> lista = new List <EstruturaCotaItemReserva>();
                EstruturaCotaItemReserva        item;
                StringBuilder stbSQL = new StringBuilder();
                stbSQL.Append("SELECT ID, CotaID, PrecoIniciaCom, Quantidade, QuantidadePorCliente, ValidaBin,ParceiroID, Nominal ");
                stbSQL.Append("FROM tCotaItem (NOLOCK) ");
                stbSQL.Append("WHERE CotaID IN (" + cotaID + ", " + cotaIDAPS + ") ");
                stbSQL.Append("ORDER BY PrecoIniciaCom");

                bd.Consulta(stbSQL.ToString());
                while (bd.Consulta().Read())
                {
                    item                      = new EstruturaCotaItemReserva();
                    item.ID                   = bd.LerInt("ID");
                    item.PrecoIniciaCom       = bd.LerString("PrecoIniciaCom");
                    item.Quantidade           = bd.LerInt("Quantidade");
                    item.QuantidadePorCliente = bd.LerInt("QuantidadePorCliente");
                    item.ValidaBin            = bd.LerBoolean("ValidaBin");
                    item.ParceiroID           = bd.LerInt("ParceiroID");
                    item.Nominal              = bd.LerBoolean("Nominal");

                    if (bd.LerInt("CotaID") == cotaID)
                    {
                        item.isApresentacao = true;
                    }

                    lista.Add(item);
                }
                return(lista);
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                bd.Fechar();
            }
        }
Beispiel #5
0
        public void ValidarCotaInformacoes(int apresentacaoID, int setorID, EstruturaCotaItemReserva item, EstruturaPrecoReservaSite preco, int BIN, int formaPagamentoID, int clienteID, string sessionID, ref string[] msgCota, bool somenteVIR)
        {
            CotaItemControle oCotaItemControle = new CotaItemControle();
            ValeIngresso     oValeIngresso     = new ValeIngresso();

            try
            {
                int[] quantidades = new int[2] {
                    0, 0
                };
                int apresentacaoSetorID = new ApresentacaoSetor().ApresentacaoSetorID(apresentacaoID, setorID);
                quantidades = oCotaItemControle.getQuantidade(item.ID, apresentacaoID, apresentacaoSetorID);
                if (((quantidades[0] + preco.Quantidade > item.Quantidade || quantidades[1] + preco.Quantidade > item.Quantidade) && item.Quantidade != 0) ||
                    (quantidades[0] + preco.Quantidade > item.QuantidadeApresentacao && item.QuantidadeApresentacao != 0) ||
                    (quantidades[1] + preco.Quantidade > item.QuantidadeApresentacaoSetor && item.QuantidadeApresentacaoSetor != 0))
                {
                    msgCota[0] = "4";
                    msgCota[1] = "O Limite de venda do preço especial: " + preco.PrecoNome + " foi excedido";
                }
                if (string.IsNullOrEmpty(msgCota[0]) && item.ValidaBin)
                {
                    if (item.ValidaBin && BIN == 0)
                    {
                        msgCota[0] = "1";

                        if (somenteVIR)
                        {
                            msgCota[1] = "Atenção, O Preço: " + preco.PrecoNome + " requer que o ingresso seja pago com um cartão válido para a promoção <br /> Não será possivel comprar somente com Vale Ingressos";
                        }

                        else
                        {
                            msgCota[1] = "Atenção, O Preço: " + preco.PrecoNome + " requer que o ingresso seja pago com um cartão válido para a promoção. <br /> Compras com Visa Electron, ItauShopLine e Somente Vale Ingressos não serão aceitas";
                        }
                    }
                    else if (!this.ValidarBin(BIN, item.ID, item.ParceiroID))
                    {
                        msgCota[0] = "1";
                        msgCota[1] = "Atenção, o BIN do cartão digitado não corresponde a um BIN válido para o preço: " + preco.PrecoNome + ".";
                    }
                }
                else if (string.IsNullOrEmpty(msgCota[0]))
                {
                    if (somenteVIR)
                    {
                        formaPagamentoID = oValeIngresso.FormaDePagamentoID;
                    }
                    if (!this.ValidarFormaPagamento(formaPagamentoID, item.ID))
                    {
                        msgCota[0] = "2";

                        if (somenteVIR)
                        {
                            msgCota[1] = "A Forma de Pagamento Somente Vale Ingresso não é válida para o Preço: " + preco.PrecoNome;
                        }
                        else
                        {
                            msgCota[1] = "A Forma de Pagamento selecionada é válida para o Preço: " + preco.PrecoNome;
                        }
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }