コード例 #1
0
        /// <summary>
        /// Trae un evento como objeto Evento
        /// </summary>
        /// <param name="idEvento">id del evento a filtrar</param>
        /// <returns></returns>
        public EventoBEL traerEventoId(int idEvento)
        {
            try
            {
                Entidades conexion = ConexionBLL.getConexion();
                EVENTO    EvenDalc = (from tmpEvento in conexion.EVENTO
                                      where tmpEvento.ID_EVENTO == idEvento
                                      select tmpEvento).FirstOrDefault();
                if (EvenDalc != null)
                {
                    EventoBEL evBEL = new EventoBEL();
                    evBEL.IdEvento            = (int)EvenDalc.ID_EVENTO;
                    evBEL.IdRecinto           = (int)EvenDalc.ID_RECINTO;
                    evBEL.IdTipoEvento        = (int)EvenDalc.ID_TIPO_EVENTO;
                    evBEL.Nombre              = EvenDalc.NOMBRE;
                    evBEL.Rut                 = (int)evBEL.Rut;
                    evBEL.Estado              = EvenDalc.ESTADO;
                    evBEL.AsientosDisponibles = (int)EvenDalc.ASIENTOS_DISPONIBLES;
                    evBEL.Imagen              = EvenDalc.IMAGEN;
                    evBEL.Fecha               = EvenDalc.FECHA.Value;
                    evBEL.Descripcion         = EvenDalc.DESCRIPCION;
                    return(evBEL);
                }

                return(null);
            }
            catch
            {
                return(null);
            }
        }
コード例 #2
0
        /// <summary>
        /// Trae un evento como objeto Evento
        /// </summary>
        /// <param name="nombre", name="rut">nombre del evento y run del organizador a filtrar</param>
        /// <returns></returns>
        public EventoBEL traerEventoPorNombreRut(String nombre, int rut)
        {
            try
            {
                EVENTO EvenDalc = (from tmpEvento in ConexionBLL.getConexion().EVENTO
                                   where tmpEvento.NOMBRE.Equals(nombre) && tmpEvento.RUT == rut
                                   select tmpEvento).FirstOrDefault();
                if (EvenDalc != null)
                {
                    EventoBEL evBEL = new EventoBEL();
                    evBEL.IdEvento            = (int)EvenDalc.ID_EVENTO;
                    evBEL.IdRecinto           = (int)EvenDalc.ID_RECINTO;
                    evBEL.IdTipoEvento        = (int)EvenDalc.ID_TIPO_EVENTO;
                    evBEL.Nombre              = EvenDalc.NOMBRE;
                    evBEL.Rut                 = (int)evBEL.Rut;
                    evBEL.Estado              = EvenDalc.ESTADO;
                    evBEL.AsientosDisponibles = (int)EvenDalc.ASIENTOS_DISPONIBLES;
                    evBEL.Imagen              = EvenDalc.IMAGEN;
                    evBEL.Fecha               = EvenDalc.FECHA.Value;
                    evBEL.Descripcion         = EvenDalc.DESCRIPCION;
                    return(evBEL);
                }

                return(null);
            }
            catch
            {
                return(null);
            }
        }
コード例 #3
0
        /// <summary>
        /// Actualiza un evento en la base de datos
        /// </summary>
        /// <param name="Evento">objeto Evento</param>
        /// <returns></returns>
        public void actualizarEvento(EventoBEL Evento)
        {
            try
            {
                Entidades conexion   = ConexionBLL.getConexion();
                EVENTO    eventoDALC = (from tmpEvento in conexion.EVENTO
                                        where tmpEvento.ID_EVENTO == Evento.IdEvento
                                        select tmpEvento).FirstOrDefault();

                eventoDALC.ID_EVENTO            = Evento.IdEvento;
                eventoDALC.ASIENTOS_DISPONIBLES = Evento.AsientosDisponibles;
                eventoDALC.DESCRIPCION          = Evento.Descripcion;
                eventoDALC.ID_TIPO_EVENTO       = Evento.IdTipoEvento;
                eventoDALC.ID_RECINTO           = Evento.IdRecinto;
                eventoDALC.RUT    = Evento.Rut;
                eventoDALC.ESTADO = Evento.Estado;
                eventoDALC.NOMBRE = Evento.Nombre;
                eventoDALC.IMAGEN = Evento.Imagen;
                eventoDALC.FECHA  = Evento.Fecha;
                conexion.SaveChanges();
            }
            catch
            {
                return;
            }
        }
コード例 #4
0
        /// <summary>
        /// Agrega un evento en la base de datos
        /// </summary>
        /// <param name="Evento">objeto Evento</param>
        /// <returns></returns>
        public int agregarEvento(EventoBEL Evento)
        {
            try
            {
                Entidades conexion   = ConexionBLL.getConexion();
                EVENTO    eventoDALC = new EVENTO();
                eventoDALC.ASIENTOS_DISPONIBLES = Evento.AsientosDisponibles;
                eventoDALC.DESCRIPCION          = Evento.Descripcion;
                eventoDALC.ID_TIPO_EVENTO       = Evento.IdTipoEvento;
                eventoDALC.ID_RECINTO           = Evento.IdRecinto;
                eventoDALC.RUT    = Evento.Rut;
                eventoDALC.ESTADO = Evento.Estado;
                eventoDALC.NOMBRE = Evento.Nombre;
                eventoDALC.IMAGEN = Evento.Imagen;
                eventoDALC.FECHA  = Evento.Fecha;
                conexion.AddToEVENTO(eventoDALC);
                conexion.SaveChanges();
                conexion.Dispose();

                EventoBEL guardado = traerEventoPorNombreRut(Evento.Nombre, Evento.Rut);
                return(guardado.IdEvento);
            }
            catch
            {
                return(-1);
            }
        }
コード例 #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            /// <summary>
            /// Carga la pagina con los datos del evento a comprar
            /// </summary>
            if (!IsPostBack)
            {
                TiposTicketBLL bllTipos   = new TiposTicketBLL();
                EventoBLL      bllEvento  = new EventoBLL();
                RecintoBLL     bllRecinto = new RecintoBLL();
                AsientoBLL     bllAsiento = new AsientoBLL();
                /// <summary>
                /// El usuario debe estar registrado para comprar entradas
                /// </summary>
                if (Request.QueryString["evento"] != null)
                {
                    if (Session["usuarioConectado"] == null)
                    {
                        Response.Write("<script>alert('Necesitas iniciar sesión para comprar');window.location='Registro.aspx';</script>");
                        return;
                    }
                    int idEvento = Int32.Parse(Request.QueryString["evento"].ToString());

                    EventoBEL  evento  = bllEvento.traerEventoId(idEvento);
                    RecintoBEL recinto = bllRecinto.traerRecintoPorId(evento.IdRecinto);
                    this.listaAsientos       = new ArrayList();
                    this.listaGrilla         = new ArrayList();
                    Session["listaAsientos"] = this.listaAsientos;
                    Session["listaGrilla"]   = this.listaGrilla;

                    ddlTipoEntrada.DataSource     = bllTipos.traerTiposTicket(idEvento);
                    ddlTipoEntrada.DataValueField = "IdTipoTicket";
                    ddlTipoEntrada.DataTextField  = "Descripcion";
                    ddlTipoEntrada.DataBind();
                    ddlTipoEntrada.Items.Insert(0, new ListItem("..Seleccione..", "-1"));

                    lblTitulo.Text            = evento.Nombre;
                    imgEvento.ImageUrl        = evento.Imagen;
                    lblContenido.Text         = evento.Descripcion;
                    imgRecinto.ImageUrl       = recinto.ImagenRecinto;
                    lblIdEvento.Text          = idEvento.ToString();
                    lblIdRecinto.Text         = evento.IdRecinto.ToString();
                    btnAgregarAsiento.Enabled = false;
                    btnPagar.Enabled          = false;
                    lblErrCant.Visible        = false;
                    lblselect.Visible         = false;
                }
                else
                {
                    Response.Redirect("EventosSemana.aspx");
                }
            }
        }
コード例 #6
0
        public static string GetChartData(string idEvento)
        {
            var chartData = new object[3];

            chartData[0] = new object[] {
                "Product Category",
                "Asientos"
            };

            EventoBLL even              = new EventoBLL();
            EventoBEL evento            = even.traerEventoId(Int32.Parse(idEvento));
            int       cantTotal         = even.totalEntradasPorEventos(Int32.Parse(idEvento));
            int       cantTotalVendidas = even.totalEntradasVendidasPorEventos(Int32.Parse(idEvento));

            chartData[1] = new object[] { "Asientos Disponibles", cantTotal };
            chartData[2] = new object[] { "Asientos Vendidos", cantTotalVendidas };
            var jsonSerializator = new JavaScriptSerializer();

            return(jsonSerializator.Serialize(chartData));
        }
コード例 #7
0
        /// <summary>
        /// Trae un evento como objeto Evento
        /// </summary>
        /// <param name="idEvento">id del evento a filtrar</param>
        /// <returns></returns>
        public EventoBEL traerEventoRecintoNombre(int idEvento)
        {
            try
            {
                Entidades conexion = ConexionBLL.getConexion();
                RECINTO   EvenDalc = (from tmpEvento in conexion.EVENTO
                                      join tmpRec in conexion.RECINTO on tmpEvento.ID_RECINTO equals tmpRec.ID_RECINTO
                                      where tmpEvento.ID_EVENTO == idEvento
                                      select tmpRec).FirstOrDefault();
                if (EvenDalc != null)
                {
                    EventoBEL evBEL = new EventoBEL();

                    evBEL.NombreRecinto = EvenDalc.NOMBRE_RECINTO;
                    return(evBEL);
                }

                return(null);
            }
            catch
            {
                return(null);
            }
        }
コード例 #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            /// <summary>
            /// Crea la boleta y manda el correo electronico para el comprador y para la persona adicional si es que regalo las entradas
            /// </summary>
            if (!IsPostBack)
            {
                PerfilBEL usuario = (PerfilBEL)Session["usuarioConectado"];
                string    ru      = (usuario.Usuario);
                ru = ru.Substring(0, ru.Length - 2);
                int        rut    = Int32.Parse(ru);
                ClienteBLL cliBLL = new ClienteBLL();
                ClienteBEL cliBEL = new ClienteBEL();
                EventoBLL  evBLL  = new EventoBLL();
                cliBEL           = cliBLL.traerClientePorRut(rut);
                lblNombre.Text   = cliBEL.Nombre + " " + cliBEL.Apellido;
                lblNombr.Text    = cliBEL.Nombre + " " + cliBEL.Apellido;
                lblRut.Text      = cliBEL.Rut + "-" + cliBEL.Dv;
                lblTelefono.Text = cliBEL.Celular.ToString();
                lblCorreo.Text   = cliBEL.Correo;
                // lblDireccion.Text = cliBEL.Direccion;

                String[] arrayString = (String[])Session["detalle_compra"];
                lblCant.Text        = arrayString[0];
                lblTipoEntrada.Text = arrayString[2];
                lblPrecio.Text      = arrayString[1];
                lblTotal.Text       = arrayString[3];
                lblEvento.Text      = arrayString[4];

                int       IdEvento = Int32.Parse(arrayString[6]);
                EventoBEL even     = evBLL.traerEventoRecintoNombre(IdEvento);
                lblRecinto.Text = even.NombreRecinto;
                lblTran.Text    = arrayString[7];
                even            = evBLL.traerEventoId(IdEvento);
                lblFecha.Text   = even.Fecha.ToString();

                String correoParaMandar = String.Empty;

                if (arrayString[5] != "")
                {
                    correoParaMandar = arrayString[5];
                    /// <summary>
                    /// Crea un servidor de correo gmail para enviar el correo a la persona de regalo
                    /// </summary>
                    MailMessage email = new MailMessage();
                    email.To.Add(new MailAddress(correoParaMandar));
                    email.From       = new MailAddress(correoParaMandar);
                    email.Subject    = "E-Ticket : Entrada/s de Regalo ( " + DateTime.Now.ToString("dd / MMM / yyy hh:mm:ss") + " ) ";
                    email.Body       = "El cliente " + cliBEL.Nombre + " " + cliBEL.Apellido + " le regalo entrada/s para el evento " + arrayString[4] + " retira tus entradas en cualquiera de nuestras sucursales.\n\n Presenta el numero de transaccion para hacer valida la compra y retira tus entradas para el evento.\n\n El numero de transaccion es:  " + arrayString[7];
                    email.IsBodyHtml = true;
                    email.Priority   = MailPriority.Normal;

                    SmtpClient smtp = new SmtpClient();
                    smtp.Host                  = "smtp.gmail.com";
                    smtp.Port                  = 587;
                    smtp.EnableSsl             = true;
                    smtp.UseDefaultCredentials = false;
                    smtp.Credentials           = new NetworkCredential("*****@*****.**", "panchox77");


                    try
                    {
                        smtp.Send(email);
                        email.Dispose();
                    }
                    catch
                    {
                    }
                }
                correoParaMandar = cliBEL.Correo;

                /// <summary>
                /// Crea un servidor de correo gmail para enviar el correo al Cliente
                /// </summary>
                MailMessage email1 = new MailMessage();
                email1.To.Add(new MailAddress(correoParaMandar));
                email1.From       = new MailAddress(correoParaMandar);
                email1.Subject    = "E-Ticket : Detalle de Compra ( " + DateTime.Now.ToString("dd / MMM / yyy hh:mm:ss") + " ) ";
                email1.Body       = "Estimado/a " + cliBEL.Nombre + " " + cliBEL.Apellido + " su compra se realizo con exito. Evento " + arrayString[4] + " retira tus entradas en cualquiera de nuestras sucursales.\n\n Presenta el numero de transaccion para hacer valida la compra y retira tus entradas para el evento.\n\n El numero de transaccion es:  " + arrayString[7];
                email1.IsBodyHtml = true;
                email1.Priority   = MailPriority.Normal;

                SmtpClient smtp1 = new SmtpClient();
                smtp1.Host                  = "smtp.gmail.com";
                smtp1.Port                  = 587;
                smtp1.EnableSsl             = true;
                smtp1.UseDefaultCredentials = false;
                smtp1.Credentials           = new NetworkCredential("*****@*****.**", "panchox77");


                try
                {
                    smtp1.Send(email1);
                    email1.Dispose();
                }
                catch
                {
                }
            }
        }