Example #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();
            }
        }
Example #2
0
 // passar o Usuario logado no sistema
 public IngressoClienteLista_B()
 {
     ingressoCliente = new IngressoCliente();
 }
Example #3
0
        public List <EstruturaCotasInfo> ValidacaoQuantidadesCliente(List <EstruturaCotaValidacaoCliente> lstCotas)
        {
            IngressoCliente           oIngressoCliente = new IngressoCliente();
            List <EstruturaCotasInfo> lstRetorno       = new List <EstruturaCotasInfo>();
            EstruturaCotasInfo        cotaInfo;

            int apresentacaoSetorID = 0;

            try
            {
                for (int i = 0; i < lstCotas.Count; i++)
                {
                    if (lstCotas[i].ApresentacaoSetorID == 0)
                    {
                        apresentacaoSetorID = Convert.ToInt32(bd.ConsultaValor("SELECT ApresentacaoSetorID FROM tIngresso (NOLOCK) WHERE ID = " + lstCotas[i].IngressoID + " AND ApresentacaoID = " + lstCotas[i].ApresentacaoID));
                        bd.FecharConsulta();
                    }
                    else
                    {
                        apresentacaoSetorID = lstCotas[i].ApresentacaoSetorID;
                    }

                    cotaInfo = new EstruturaCotasInfo();

                    int[] qtds = this.getQuantidadeNovo(lstCotas[i].CotaItemID, lstCotas[i].CotaItemIDAPS, lstCotas[i].ApresentacaoID, apresentacaoSetorID);
                    cotaInfo.QuantidadeApresentacao      = qtds[0];
                    cotaInfo.QuantidadeApresentacaoSetor = qtds[1];
                    cotaInfo.QuantidadeCota    = qtds[2];
                    cotaInfo.QuantidadeCotaAPS = qtds[3];

                    //Eh um Ingresso Nominal e Tem quantidade Maxima?
                    if (lstCotas[i].Nominal && (lstCotas[i].QuantidadePorClienteApresentacao > 0 ||
                                                lstCotas[i].QuantidadePorClienteApresentacaoSetor > 0 ||
                                                lstCotas[i].QuantidadePorClienteCotaItem > 0 ||
                                                lstCotas[i].QuantidadeCotaItemAPS > 0))
                    {
                        //Preenche o OBJ de IngressoCliente e retorna as quantidades ja compradas
                        oIngressoCliente.ApresentacaoID.Valor      = lstCotas[i].ApresentacaoID;
                        oIngressoCliente.ApresentacaoSetorID.Valor = apresentacaoSetorID;
                        oIngressoCliente.DonoID.Valor     = lstCotas[i].DonoID;
                        oIngressoCliente.CotaItemID.Valor = lstCotas[i].CotaItemID;
                        oIngressoCliente.CPF.Valor        = lstCotas[i].CPF;

                        //Busca na Proc e retorna o Array
                        qtds = oIngressoCliente.QuantidadeJaCompradaNovo(lstCotas[i].CotaItemID, lstCotas[i].CotaItemIDAPS, lstCotas[i].IngressoID);

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

                    //Atribui as quantidades maximas
                    cotaInfo.MaximaApresentacao      = lstCotas[i].QuantidadeApresentacao;
                    cotaInfo.MaximaApresentacaoSetor = lstCotas[i].QuantidadeApresentacaoSetor;
                    cotaInfo.MaximaCotaItem          = lstCotas[i].QuantidadeCotaItem;
                    cotaInfo.MaximaCotaItemAPS       = lstCotas[i].QuantidadeCotaItemAPS;

                    cotaInfo.MaximaPorClienteApresentacao      = lstCotas[i].QuantidadePorClienteApresentacao;
                    cotaInfo.MaximaPorClienteApresentacaoSetor = lstCotas[i].QuantidadePorClienteApresentacaoSetor;
                    cotaInfo.MaximaPorClienteCotaItem          = lstCotas[i].QuantidadePorClienteCotaItem;
                    cotaInfo.MaximaPorClienteCotaItemAPS       = lstCotas[i].QuantidadePorClienteCotaItemAPS;

                    //Propriedades de continuidade
                    cotaInfo.ReservaID           = lstCotas[i].ReservaID;
                    cotaInfo.ApresentacaoID      = lstCotas[i].ApresentacaoID;
                    cotaInfo.ApresentacaoSetorID = apresentacaoSetorID;
                    cotaInfo.DonoID            = lstCotas[i].DonoID;
                    cotaInfo.IngressoID        = lstCotas[i].IngressoID;
                    cotaInfo.CotaItemID        = lstCotas[i].CotaItemID;
                    cotaInfo.CotaItemID_APS    = lstCotas[i].CotaItemIDAPS;
                    cotaInfo.CodigoPromocional = lstCotas[i].CodigoPromocional;
                    cotaInfo.CPF     = lstCotas[i].CPF;
                    cotaInfo.Nominal = lstCotas[i].Nominal;
                    lstRetorno.Add(cotaInfo);
                }

                return(lstRetorno);
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                bd.Fechar();
            }
        }