コード例 #1
0
 // passar o Usuario logado no sistema
 public CotaItemControleLista_B()
 {
     cotaItemControle = new CotaItemControle();
 }
コード例 #2
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;
            }
        }
コード例 #3
0
        public string[] ValidarCotaInformacoesNovo(EstruturaCotasInfo cotasInfo, string precoNome, int BIN, int formaPagamentoID, bool somenteVIR, bool somenteCortesias)
        {
            string[]         msgCota           = new string[2];
            CotaItemControle oCotaItemControle = new CotaItemControle();
            ValeIngresso     oValeIngresso     = new ValeIngresso();

            try
            {
                if (string.IsNullOrEmpty(msgCota[0]) && cotasInfo.ValidaBin)
                {
                    if (BIN == 0)
                    {
                        msgCota[0] = "1";

                        if (somenteVIR)
                        {
                            msgCota[1] = "Atenção, O preço: " + 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: " + 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, cotasInfo.CotaItemID > 0 ? cotasInfo.CotaItemID : cotasInfo.CotaItemID_APS, cotasInfo.ParceiroID))
                    {
                        msgCota[0] = "1";
                        msgCota[1] = "Atenção, o BIN digitado não corresponde a um BIN válido para o preço: " + precoNome + ".";
                    }
                }

                if (string.IsNullOrEmpty(msgCota[0]))
                {
                    if (somenteVIR)
                    {
                        formaPagamentoID = oValeIngresso.FormaDePagamentoID;
                    }
                    else if (somenteCortesias)
                    {
                        return(msgCota);
                    }

                    if (!this.ValidarFormaPagamento(formaPagamentoID, cotasInfo.CotaItemID > 0 ? cotasInfo.CotaItemID : cotasInfo.CotaItemID_APS))
                    {
                        msgCota[0] = "2";

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

                return(msgCota);
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #4
0
        public void SalvarItem(BD bd, List <EstruturaCotaItem> lista, int cotaID, bool gerarControle)
        {
            try
            {
                CotaItemFormaPagamento oCotaItemFormaPagamento = new CotaItemFormaPagamento();
                CotaItemControle       oCotaItemControle       = new CotaItemControle();
                Obrigatoriedade        oObrigatoriedade        = new Obrigatoriedade();

                for (int i = 0; i < lista.Count; i++)
                {
                    this.Limpar();

                    if (lista[i].Novo && !lista[i].Excluir)
                    {
                        oObrigatoriedade.Limpar();
                        int ObrigatoriedadeID = 0;

                        if (lista[i].obrigatoriedade != null)
                        {
                            #region Preenche o Obj obrigatoriedade


                            oObrigatoriedade.Nome.Valor            = lista[i].obrigatoriedade.Nome;
                            oObrigatoriedade.RG.Valor              = lista[i].obrigatoriedade.RG;
                            oObrigatoriedade.CPF.Valor             = lista[i].obrigatoriedade.CPF;
                            oObrigatoriedade.Telefone.Valor        = lista[i].obrigatoriedade.Telefone;
                            oObrigatoriedade.DataNascimento.Valor  = lista[i].obrigatoriedade.DataNascimento;
                            oObrigatoriedade.Email.Valor           = lista[i].obrigatoriedade.Email;
                            oObrigatoriedade.CPFResponsavel.Valor  = lista[i].obrigatoriedade.CPFResponsavel;
                            oObrigatoriedade.NomeResponsavel.Valor = lista[i].obrigatoriedade.NomeResponsavel;

                            #endregion
                            oObrigatoriedade.Inserir(bd);
                            ObrigatoriedadeID = oObrigatoriedade.Control.ID;
                        }


                        this.PrecoIniciaCom.Valor       = lista[i].precoIniciaCom;
                        this.Quantidade.Valor           = lista[i].quantidade;
                        this.QuantidadePorCliente.Valor = lista[i].quantidadePorCliente;
                        this.ParceiroID.Valor           = lista[i].parceiroID;
                        this.ValidaBin.Valor            = lista[i].validaBin;
                        this.ObrigatoriedadeID.Valor    = ObrigatoriedadeID;
                        this.CotaID.Valor = cotaID;

                        this.TextoValidacao.Valor = lista[i].textoValidacao;

                        this.TermoSite.Valor           = lista[i].TermoSite;
                        this.Termo.Valor               = lista[i].Termo;
                        this.TermoSite.Valor           = lista[i].TermoSite;
                        this.CPFResponsavel.Valor      = lista[i].CPFResponsavel;
                        this.Nominal.Valor             = lista[i].Nominal;
                        this.QuantidadePorCodigo.Valor = lista[i].QuantidadePorCodigo;
                        this.Inserir(bd);

                        for (int w = 0; w < lista[i].FormaPagamentoInserir.Count; w++)
                        {
                            oCotaItemFormaPagamento.Limpar();
                            oCotaItemFormaPagamento.CotaItemID.Valor       = this.Control.ID;
                            oCotaItemFormaPagamento.FormaPagamentoID.Valor = lista[i].FormaPagamentoInserir[w].FormaPagamentoID;
                            oCotaItemFormaPagamento.Inserir();
                        }

                        //Gera um novo Controle de Quantidade do CotaItem
                        if (gerarControle)
                        {
                            oCotaItemControle.CotaItemID.Valor = this.Control.ID;
                            oCotaItemControle.GerarControladorDeCotaAntiga(bd, cotaID, lista[i].precoIniciaCom);
                        }
                    }
                    else if (!lista[i].Novo && !lista[i].Excluir)
                    {
                        if (lista[i].obrigatoriedade != null && lista[i].obrigatoriedade.Mudou)
                        {
                            oObrigatoriedade.Limpar();
                            #region Preenche o Obj obrigatoriedade
                            oObrigatoriedade.Control.ID     = lista[i].obrigatoriedadeID;
                            oObrigatoriedade.Nome.Valor     = lista[i].obrigatoriedade.Nome;
                            oObrigatoriedade.RG.Valor       = lista[i].obrigatoriedade.RG;
                            oObrigatoriedade.CPF.Valor      = lista[i].obrigatoriedade.CPF;
                            oObrigatoriedade.Telefone.Valor = lista[i].obrigatoriedade.Telefone;

                            oObrigatoriedade.DataNascimento.Valor = lista[i].obrigatoriedade.DataNascimento;
                            oObrigatoriedade.Email.Valor          = lista[i].obrigatoriedade.Email;

                            oObrigatoriedade.CPFResponsavel.Valor  = lista[i].obrigatoriedade.CPFResponsavel;
                            oObrigatoriedade.NomeResponsavel.Valor = lista[i].obrigatoriedade.NomeResponsavel;

                            #endregion
                            oObrigatoriedade.Atualizar(bd);
                        }

                        this.Control.ID                 = lista[i].ID;
                        this.PrecoIniciaCom.Valor       = lista[i].precoIniciaCom;
                        this.Quantidade.Valor           = lista[i].quantidade;
                        this.QuantidadePorCliente.Valor = lista[i].quantidadePorCliente;
                        this.ParceiroID.Valor           = lista[i].parceiroID;
                        this.ValidaBin.Valor            = lista[i].validaBin;
                        this.ObrigatoriedadeID.Valor    = lista[i].obrigatoriedadeID;
                        this.CotaID.Valor               = cotaID;
                        this.TextoValidacao.Valor       = lista[i].textoValidacao;
                        this.Termo.Valor                = lista[i].Termo;
                        this.TermoSite.Valor            = lista[i].TermoSite;
                        this.CPFResponsavel.Valor       = lista[i].CPFResponsavel;
                        this.Nominal.Valor              = lista[i].Nominal;
                        this.QuantidadePorCodigo.Valor  = lista[i].QuantidadePorCodigo;
                        this.Atualizar(bd);

                        //Inclui novas formas de pagamento
                        for (int w = 0; w < lista[i].FormaPagamentoInserir.Count; w++)
                        {
                            oCotaItemFormaPagamento.Limpar();
                            oCotaItemFormaPagamento.CotaItemID.Valor       = this.Control.ID;
                            oCotaItemFormaPagamento.FormaPagamentoID.Valor = lista[i].FormaPagamentoInserir[w].FormaPagamentoID;
                            oCotaItemFormaPagamento.Inserir();
                        }
                        //Excluir formas de pagamento
                        for (int w = 0; w < lista[i].FormaPagamentoExcluir.Count; w++)
                        {
                            oCotaItemFormaPagamento.Limpar();
                            oCotaItemFormaPagamento.ExcluirPorIDs(bd, lista[i].FormaPagamentoExcluir[w].FormaPagamentoID, lista[i].ID);
                        }
                    }
                    else if (!lista[i].Novo)
                    {
                        oObrigatoriedade.Limpar();
                        oObrigatoriedade.Excluir(bd, lista[i].obrigatoriedadeID);

                        oCotaItemFormaPagamento.Limpar();
                        oCotaItemFormaPagamento.ExcluirPorCotaItemID(bd, lista[i].ID);

                        //Excluir o Controlador de Quantidade já vendidas
                        oCotaItemControle.CotaItemID.Valor = lista[i].ID;
                        oCotaItemControle.ExcluirControladorPorCotaItemID(bd);

                        this.Excluir(bd, lista[i].ID);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }