public Respuesta <InscripcionHospedaje> datosHospedaje()
        {
            Respuesta <InscripcionHospedaje> result = new Respuesta <InscripcionHospedaje>();

            result.codigo  = 1;
            result.mensaje = "Ocurrio un error en base de datos";
            result.data    = new InscripcionHospedaje();

            try
            {
                using (var db = new EntitiesEVE01())
                {
                    var datos = (from d in db.EVE01_INSCRIPCION_HOSPEDAJE
                                 where d.EVENTO == MvcApplication.idEvento &&
                                 d.PARTICIPANTE == this.idParticipante
                                 select d).SingleOrDefault();

                    if (datos != null)
                    {
                        dbModel = datos;
                    }
                }
                result.codigo  = 0;
                result.mensaje = "Ok";
                result.data    = this;
                return(result);
            }
            catch (Exception ex)
            {
                result.codigo       = -1;
                result.mensaje      = "Ocurrio una excepcion al obtener informacion del Hospedaje";
                result.mensajeError = ex.ToString();
                return(result);
            }
        }
        private Respuesta <Inscripcion> reInscribir()
        {
            Respuesta <Inscripcion> res = new Respuesta <Inscripcion>();

            res.codigo  = 1;
            res.mensaje = "Ocurrio un Error en base de datos";
            res.data    = new Inscripcion();

            try
            {
                using (var tr = new TransactionScope())
                {
                    using (var db = new EntitiesEVE01())
                    {
                        //SE ACTUALIZA EL CAMPO DEL ESTADO_REGISTRO AL VALOR "A"
                        var ob = db.EVE01_INSCRIPCION.
                                 Where(i => i.EVENTO == MvcApplication.idEvento &&
                                       i.PARTICIPANTE == this.idParticipante).
                                 Select(i => i).SingleOrDefault();

                        ob.ESTADO_REGISTRO  = "A";
                        ob.USUARIO_CREACION = MvcApplication.UserName;
                        ob.FECHA_CREACION   = DateTime.Now;

                        int re_ob = db.SaveChanges();

                        if (re_ob <= 0)
                        {
                            Transaction.Current.Rollback();
                            res.codigo  = 2;
                            res.mensaje = "No fue Posible Registrar la Inscripcion";
                            return(res);
                        }

                        //SE AGREGAN LAS OPCIONES A LA INSCRIPCION
                        InscripcionOpcion             agregar     = new InscripcionOpcion();
                        Respuesta <InscripcionOpcion> objOpciones = agregar.agregarOpcionesInscripcion(this);

                        if (objOpciones.codigo != 0)
                        {
                            Transaction.Current.Rollback();
                            res.codigo  = objOpciones.codigo;
                            res.mensaje = objOpciones.mensaje;
                            return(res);
                        }
                    }
                    tr.Complete();
                    res.codigo  = 0;
                    res.mensaje = "Se realizo la Inscripcion de Forma Correcta";
                    return(res);
                }
            }
            catch (Exception ex)
            {
                res.codigo       = -1;
                res.mensaje      = "Ocurrio una excepcion al momento de la inscripcion, Ref: " + ex.ToString();
                res.mensajeError = ex.ToString();
                return(res);
            }
        }
Esempio n. 3
0
        public List <Recibo> impresionRecibo()
        {
            List <Recibo> result = new List <Recibo>();

            try
            {
                using (var db = new EntitiesEVE01())
                {
                    StringBuilder strSQL = new StringBuilder();
                    strSQL.Append(_sqlinfoRecibo);

                    var info = db.Database.SqlQuery <Recibo>(strSQL.ToString(), new object[] { this.idMovimiento }).ToList <Recibo>();

                    if (info != null)
                    {
                        result = info;
                    }
                    else
                    {
                        result = new List <Recibo>();
                    }
                }
                return(result);
            }
            catch (Exception)
            {
                throw;
            }
        }
        public Respuesta <InscripcionBus> infoBusAsignado(Participante data)
        {
            Respuesta <InscripcionBus> result = new Respuesta <InscripcionBus>();

            result.codigo  = 1;
            result.mensaje = "Ocurrio un Error en Base de Datos";
            result.data    = new InscripcionBus();

            try
            {
                using (var db = new EntitiesEVE01())
                {
                    var info = (from b in db.EVE01_INSCRIPCION_BUS
                                where b.EVENTO == MvcApplication.idEvento &&
                                b.PARTICIPANTE == data.idParticipante
                                select b).SingleOrDefault();
                    if (info != null)
                    {
                        dbModel = info;
                    }
                }
                result.codigo  = 0;
                result.mensaje = "Ok";
                result.data    = this;
                return(result);
            }
            catch (Exception ex)
            {
                result.codigo       = -1;
                result.mensaje      = "Ocurrio una excepcion al tratar de consultar el No de Bus, ref; " + ex.ToString();
                result.mensajeError = ex.ToString();
                return(result);
            }
        }
Esempio n. 5
0
        public Respuesta <InscripcionSilla> infosillaAsignada()
        {
            Respuesta <InscripcionSilla> result = new Respuesta <InscripcionSilla>();

            result.codigo  = 1;
            result.mensaje = "Ocurrio un error en base de datos";
            result.data    = new InscripcionSilla();

            try
            {
                using (var db = new EntitiesEVE01())
                {
                    var infosilla = (from sa in db.EVE01_INSCRIPCION_SILLA
                                     where sa.EVENTO == MvcApplication.idEvento &&
                                     sa.PARTICIPANTE == this.idParticipante
                                     select sa).SingleOrDefault();

                    if (infosilla != null)
                    {
                        dbModel = infosilla;
                    }
                }
                result.codigo  = 0;
                result.mensaje = "OK";
                result.data    = this;
                return(result);
            }
            catch (Exception ex)
            {
                result.codigo       = -1;
                result.mensaje      = "Ocurrio una excepcion al obtener la informacion de la silla, ref: " + ex.ToString();
                result.mensajeError = ex.ToString();
                return(result);
            }
        }
        public Respuesta <SaldoParticipante> anulacionSaldos(Inscripcion data)
        {
            Respuesta <SaldoParticipante> result = new Respuesta <SaldoParticipante>();

            result.codigo  = 0;
            result.mensaje = "Ocurrio un Error en base de datos";
            result.data    = new SaldoParticipante();

            try
            {
                using (var db = new EntitiesEVE01())
                {
                    //SE OBTINE EL REGISTRO PARA SU ELIMINACION
                    var saldos = (from s in db.EVE01_PARTICIPANTE_SALDO
                                  where s.EVENTO == MvcApplication.idEvento &&
                                  s.PARTICIPANTE == data.idParticipante
                                  select s).SingleOrDefault();

                    db.EVE01_PARTICIPANTE_SALDO.Remove(saldos);
                    db.SaveChanges();
                }
                result.codigo  = 0;
                result.mensaje = "Ok";
                return(result);
            }
            catch (Exception ex)
            {
                result.codigo       = -1;
                result.mensaje      = "Ocurrio una excepcion al eliminar el Saldo Inicial, ref: " + ex.ToString();
                result.mensajeError = ex.ToString();
                return(result);
            }
        }
Esempio n. 7
0
        public Respuesta <Evento> SetEventoActivo()
        {
            Respuesta <Evento> result = new Respuesta <Evento>();

            result.data = new Evento();

            try
            {
                using (var db = new EntitiesEVE01())
                {
                    var nombre = db.EVE01_EVENTO.Where(e => e.EVENTO == this.idEvento).Select(e => e.NOMBRE_EVENTO).SingleOrDefault();
                    MvcApplication.EventoActivo = nombre;
                }
                MvcApplication.idEvento = this.idEvento;

                result.codigo  = 0;
                result.mensaje = ConfigurationManager.AppSettings["Mensaje_Ok_1"].ToString() + MvcApplication.EventoActivo + ConfigurationManager.AppSettings["Mensaje_Ok_2"].ToString();
                return(result);
            }
            catch (Exception ex)
            {
                result.codigo  = -1;
                result.mensaje = "Ocurrio un inconveniente al tratar de Iniciar el Evento: " + ex.ToString();
                return(result);
            }
        }
Esempio n. 8
0
        public bool ValidateUser(string username, string password)
        {
            using (var db = new EntitiesEVE01())
            {
                var result = from u in db.EVE01_USUARIO where (u.USUARIO.ToUpper() == username.ToUpper()) select u;

                if (result.Count() != 0)
                {
                    var dbuser = result.First();

                    if (SEG01_DO.Encriptor.validarPassword(password, dbuser.PASSWORD))
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
        }
        private Respuesta <Inscripcion> insertInscripcion()
        {
            Respuesta <Inscripcion> res = new Respuesta <Inscripcion>();

            res.codigo  = 1;
            res.mensaje = "Ocurrio un Error en base de datos";
            res.data    = new Inscripcion();

            try
            {
                using (var tr = new TransactionScope())
                {
                    using (var db = new EntitiesEVE01())
                    {
                        //SE INSERTA EN LA TABLA DE EVE01_INSCRIPCION PARA QUE SE CUMPLA LA INSCRIPCION
                        EVE01_INSCRIPCION ob = new EVE01_INSCRIPCION();
                        ob.EVENTO            = MvcApplication.idEvento;
                        ob.PARTICIPANTE      = this.idParticipante;
                        ob.FECHA_INSCRIPCION = DateTime.Now;
                        ob.ESTADO_REGISTRO   = "A";
                        ob.USUARIO_CREACION  = MvcApplication.UserName;
                        ob.FECHA_CREACION    = DateTime.Now;
                        db.EVE01_INSCRIPCION.Add(ob);
                        int re_ob = db.SaveChanges();

                        if (re_ob <= 0)
                        {
                            Transaction.Current.Rollback();
                            res.codigo  = 2;
                            res.mensaje = "No fue Posible Registrar la Inscripcion";
                            return(res);
                        }

                        //SE AGREGAN LAS OPCIONES A LA INSCRIPCION
                        InscripcionOpcion             agregar     = new InscripcionOpcion();
                        Respuesta <InscripcionOpcion> objOpciones = agregar.agregarOpcionesInscripcion(this);

                        if (objOpciones.codigo != 0)
                        {
                            Transaction.Current.Rollback();
                            res.codigo  = objOpciones.codigo;
                            res.mensaje = objOpciones.mensaje;
                            return(res);
                        }
                    }
                    tr.Complete();
                    res.codigo  = 0;
                    res.mensaje = "Se realizo la Inscripcion de Forma Correcta";
                    return(res);
                }
            }
            catch (Exception ex)
            {
                res.codigo       = -1;
                res.mensaje      = "Ocurrio una excepcion al momento de la inscripcion, Ref: " + ex.ToString();
                res.mensajeError = ex.ToString();
                return(res);
            }
        }
 private string infodescripcionTipoPago(decimal?idtipo)
 {
     using (var db = new EntitiesEVE01())
     {
         var des = (from d in db.EVE01_TIPO_PAGO
                    where d.TIPO_PAGO == idtipo
                    select d.DESCRIPCION).SingleOrDefault();
         return(des);
     }
 }
 private string infodescripcionTipoMovimiento(string idtipo)
 {
     using (var db = new EntitiesEVE01())
     {
         var des = (from d in db.EVE01_TIPO_MOVIMIENTO
                    where d.TIPO_MOVIMIENTO == idtipo
                    select d.DESCRIPCION).SingleOrDefault();
         return(des);
     }
 }
        public Respuesta <Participante> obtenerInformacionParticipante()
        {
            Respuesta <Participante> result = new Respuesta <Participante>();

            result.codigo  = 1;
            result.mensaje = "";
            result.data    = new Participante();

            try
            {
                using (var db = new EntitiesEVE01())
                {
                    if (MvcApplication.idEvento == 0)
                    {
                        result.codigo  = -1;
                        result.mensaje = "No se ha Iniciado un Evento para Inscripcion del Participante";
                        return(result);
                    }

                    var infoParticipante = (from p in db.EVE01_PARTICIPANTE
                                            where p.PARTICIPANTE == this.idParticipante
                                            select p).SingleOrDefault();

                    if (infoParticipante == null)
                    {
                        result.codigo  = -1;
                        result.mensaje = "No existe informacion para el Participante Indicado";
                        return(result);
                    }
                    else
                    {
                        dbModel = infoParticipante;
                    }

                    this.validaActualizacionEvento = validaActualizacionDatosEvento();
                    this.NombreCompleto            = apellidoNombreCompleto(this.idParticipante);
                    this.validaInscripcion         = validarInscripcion(this.idParticipante);
                    this.validaInscripcionbool     = validarInscripcionbool(this.idParticipante);
                    Estado objEstado = new Estado();
                    this.valorEstado = objEstado.valorEstado(infoParticipante.ESTADO_REGISTRO);
                }
                result.codigo  = 0;
                result.mensaje = "Ok";
                result.data    = this;
                return(result);
            }
            catch (Exception ex)
            {
                result.codigo  = -1;
                result.mensaje = "Ocurrio una excepcion al obtener la informacion del Participante " + ex.ToString();
                result.data    = null;
                return(result);
            }
        }
        public Respuesta <InscripcionHospedaje> registrarHospedaje()
        {
            Respuesta <InscripcionHospedaje> result = new Respuesta <InscripcionHospedaje>();

            result.codigo  = 1;
            result.mensaje = "Ocurrio un error en Base de datos";
            result.data    = new InscripcionHospedaje();

            try
            {
                using (var db = new EntitiesEVE01())
                {
                    var valhos = (from vh in db.EVE01_INSCRIPCION_HOSPEDAJE
                                  where vh.EVENTO == MvcApplication.idEvento &&
                                  vh.PARTICIPANTE == this.idParticipante
                                  select vh).SingleOrDefault();

                    if (valhos != null)
                    {
                        valhos.ENCARGADO            = this.encargado;
                        valhos.TELEFONO             = this.telefono;
                        valhos.DIRECCION            = this.direccion;
                        valhos.USUARIO_MODIFICACION = MvcApplication.UserName;
                        valhos.FECHA_MODIFICACION   = DateTime.Now;
                        db.SaveChanges();
                    }
                    else
                    {
                        EVE01_INSCRIPCION_HOSPEDAJE nuevo = new EVE01_INSCRIPCION_HOSPEDAJE();
                        nuevo.EVENTO           = MvcApplication.idEvento;
                        nuevo.PARTICIPANTE     = this.idParticipante;
                        nuevo.ENCARGADO        = this.encargado;
                        nuevo.TELEFONO         = this.telefono;
                        nuevo.DIRECCION        = this.direccion;
                        nuevo.ESTADO_REGISTRO  = "A";
                        nuevo.USUARIO_CREACION = MvcApplication.UserName;
                        nuevo.FECHA_CREACION   = DateTime.Now;

                        db.EVE01_INSCRIPCION_HOSPEDAJE.Add(nuevo);
                        db.SaveChanges();
                    }
                }
                result.codigo  = 0;
                result.mensaje = "Se ha registrado Correctamente el dato de Hospedaje del Participante";
                return(result);
            }
            catch (Exception ex)
            {
                result.codigo       = -1;
                result.mensaje      = "Ocurrio una excepcion al tratar de registrar Anotacion de Hospedaje, ref:  " + ex.ToString();
                result.mensajeError = ex.ToString();
                return(result);
            }
        }
Esempio n. 14
0
        private string nombre(decimal opcion)
        {
            using (var db = new EntitiesEVE01())
            {
                var res = (from op in db.EVE01_EVENTO_OPCION
                           where op.OPCION == opcion &&
                           op.EVENTO == MvcApplication.idEvento
                           select op.DESCRIPCION).SingleOrDefault();

                return(res);
            }
        }
Esempio n. 15
0
        private Nullable <decimal> precioopcion(decimal opcion)
        {
            using (var db = new EntitiesEVE01())
            {
                var res = (from op in db.EVE01_EVENTO_OPCION
                           where op.OPCION == opcion &&
                           op.EVENTO == MvcApplication.idEvento
                           select op.PRECIO).SingleOrDefault();

                return(res);
            }
        }
        public Respuesta <ReciboDetalle> guardarDetalle()
        {
            Respuesta <ReciboDetalle> result = new Respuesta <ReciboDetalle>();

            result.codigo  = 1;
            result.mensaje = "Ocurrio un error en base de datos";
            result.data    = new ReciboDetalle();

            try
            {
                using (var db = new EntitiesEVE01())
                {
                    var opcionesInscripcion = (from oi in db.EVE01_INSCRIPCION_OPCION
                                               where oi.EVENTO == MvcApplication.idEvento &&
                                               oi.PARTICIPANTE == this.idParticipante &&
                                               oi.ESTADO_REGISTRO == "A"
                                               select oi).ToList();

                    if (opcionesInscripcion.Count == 0)
                    {
                        result.codigo  = -1;
                        result.mensaje = "No se puede registrar el detalle del recibo ya que no tiene opciones asignadas";
                        return(result);
                    }
                    else
                    {
                        foreach (var item in opcionesInscripcion)
                        {
                            EVE01_RECIBO_DETALLE nuevo = new EVE01_RECIBO_DETALLE();
                            nuevo.RECIBO           = this.idRecibo;
                            nuevo.OPCION           = item.OPCION;
                            nuevo.DESCRIPCION      = descripcionOpcion(item.OPCION);
                            nuevo.PRECIO           = precioOpcion(item.OPCION);
                            nuevo.ESTADO_REGISTRO  = "A";
                            nuevo.USUARIO_CREACION = MvcApplication.UserName;
                            nuevo.FECHA_CREACION   = DateTime.Now;
                            db.EVE01_RECIBO_DETALLE.Add(nuevo);
                            db.SaveChanges();
                        }
                    }
                }
                result.codigo  = 0;
                result.mensaje = "Ok";
                return(result);
            }
            catch (Exception ex)
            {
                result.codigo       = -1;
                result.mensaje      = "Ocurrio una excepcion al regristrar el detalle del recibo, ref: " + ex.ToString();
                result.mensajeError = ex.ToString();
                return(result);
            }
        }
        public Respuesta <SaldoParticipante> registrarSaldoInicial(Inscripcion data)
        {
            Respuesta <SaldoParticipante> result = new Respuesta <SaldoParticipante>();

            result.codigo  = 0;
            result.mensaje = "Ocurrio un Error en base de datos";
            result.data    = new SaldoParticipante();

            try
            {
                using (var db = new EntitiesEVE01())
                {
                    //SE REALIZA LA SUMATORIA DEL PRECIO DE LAS OPCIONES OBLIGATORIAS
                    var total = (from io in db.EVE01_INSCRIPCION_OPCION
                                 join oe in db.EVE01_EVENTO_OPCION
                                 on new { io.EVENTO, io.OPCION } equals new { oe.EVENTO, oe.OPCION }
                                 where io.EVENTO == MvcApplication.idEvento &&
                                 io.PARTICIPANTE == data.idParticipante &&
                                 io.ESTADO_REGISTRO == "A"
                                 select oe.PRECIO).Sum();

                    //Y SE INSERTAN EN LA TABLA DE SALDOS
                    if (total > 0)
                    {
                        EVE01_PARTICIPANTE_SALDO nuevo = new EVE01_PARTICIPANTE_SALDO();
                        nuevo.EVENTO           = MvcApplication.idEvento;
                        nuevo.PARTICIPANTE     = data.idParticipante;
                        nuevo.TOTAL            = total;
                        nuevo.SALDO_ABONADO    = 0;
                        nuevo.SALDO_PENDIENTE  = total;
                        nuevo.ESTADO_REGISTRO  = "A";
                        nuevo.USUARIO_CREACION = MvcApplication.UserName.ToUpper();
                        nuevo.FECHA_CREACION   = DateTime.Now;

                        db.EVE01_PARTICIPANTE_SALDO.Add(nuevo);
                        db.SaveChanges();
                    }
                }
                result.codigo  = 0;
                result.mensaje = "Ok";
                return(result);
            }
            catch (Exception ex)
            {
                result.codigo       = -1;
                result.mensaje      = "Ocurrio una excepcion al registrar el Saldo Inicial, ref: " + ex.ToString();
                result.mensajeError = ex.ToString();
                return(result);
            }
        }
Esempio n. 18
0
        public Estado valorEstado(string estado)
        {
            Estado result;

            using (var db = new EntitiesEVE01())
            {
                var objEstado = (from e in db.EVE01_ESTADO
                                 where e.ESTADO == estado
                                 select e).SingleOrDefault();

                result = new Estado(objEstado);
            }
            return(result);
        }
        public Respuesta <List <EventoBus> > busesDisponiblesParticipante(Inscripcion data)
        {
            Respuesta <List <EventoBus> > result = new Respuesta <List <EventoBus> >();

            result.codigo  = 1;
            result.mensaje = "Ocurrio un Error en base de Datos";
            result.data    = new List <EventoBus>();

            try
            {
                using (var db = new EntitiesEVE01())
                {
                    var buses = (from b in db.EVE01_EVENTO_BUS
                                 where b.EVENTO == MvcApplication.idEvento &&
                                 b.ESTADO_REGISTRO == "A"
                                 select b).ToList();

                    if (buses.Count == 0)
                    {
                        result.codigo  = -1;
                        result.mensaje = "No Existen Buses registrados para este Evento";
                        return(result);
                    }
                    else
                    {
                        foreach (var item in buses)
                        {
                            if (item.DISPONIBLE != 0 || validaAsignacion(data.idParticipante, item.BUS)) //REVISA SI HAY LUGARES DISPONIBLES PARA LUEGO MOSTRAR EN INTERFACE GRAFICA
                            {
                                result.data.Add(new EventoBus(item)
                                {
                                    validabusasignado = validaAsignacion(data.idParticipante, item.BUS)
                                });
                            }
                        }
                    }
                }
                result.codigo  = 0;
                result.mensaje = "Ok";
                return(result);
            }
            catch (Exception ex)
            {
                result.codigo       = -1;
                result.mensaje      = "Ocurrio una excepcion al obtener el listado de buses disponibles, ref: " + ex.ToString();
                result.mensajeError = ex.ToString();
                return(result);
            }
        }
Esempio n. 20
0
        public Respuesta <List <InscripcionOpcion> > opcionesDeInscripcion(Participante data)
        {
            Respuesta <List <InscripcionOpcion> > result = new Respuesta <List <InscripcionOpcion> >();

            result.codigo  = 1;
            result.mensaje = "Ocurrio un error en Base de datos al obtener las opciones de la Inscripcion";
            result.data    = new List <InscripcionOpcion>();

            try
            {
                using (var db = new EntitiesEVE01())
                {
                    var opciones = (from o in db.EVE01_INSCRIPCION_OPCION
                                    orderby o.OPCION ascending
                                    where o.PARTICIPANTE == data.idParticipante &&
                                    o.EVENTO == MvcApplication.idEvento
                                    select o).ToList();

                    if (opciones.Count == 0)
                    {
                        result.codigo  = -1;
                        result.mensaje = "No existen Opciones Registrados en la Inscripcion";
                        return(result);
                    }
                    else
                    {
                        foreach (var item in opciones)
                        {
                            result.data.Add(new InscripcionOpcion(item)
                            {
                                es_obligatorio = obligatorio(item.OPCION),
                                es_transporte  = transporte(item.OPCION),
                                es_hospedaje   = hospedaje(item.OPCION),
                                descripcion    = nombre(item.OPCION),
                                estadoopcion   = item.ESTADO_REGISTRO == "A" ? true: false,
                                precio         = precioopcion(item.OPCION)
                            });
                        }
                    }
                }
                result.codigo  = 0;
                result.mensaje = "Ok";
                return(result);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        private string apellidoNombreCompleto(decimal id)
        {
            using (var db = new EntitiesEVE01())
            {
                var nombre = db.EVE01_PARTICIPANTE.
                             Where(p => p.PARTICIPANTE == id).
                             Select(p => new Participante()
                {
                    NombreCompleto = p.APELLIDO + ", " + p.NOMBRE
                }).
                             SingleOrDefault();

                return(nombre.NombreCompleto);
            }
        }
Esempio n. 22
0
        public Respuesta <List <Evento> > ListadoEventos()
        {
            Respuesta <List <Evento> > result = new Respuesta <List <Evento> >();

            result.codigo  = 1;
            result.mensaje = "Ocurrio un error en Base de datos, validar con el Administrador del Sistema";
            result.data    = new List <Evento>();

            try
            {
                using (var db = new EntitiesEVE01())
                {
                    Estado ObjEstado = new Estado();

                    var listadoEventos = db.EVE01_EVENTO
                                         .Select(e => e).OrderByDescending(e => e.EVENTO).ToList();

                    if (listadoEventos.Count > 0)
                    {
                        foreach (var item in listadoEventos)
                        {
                            result.data.Add(new Evento(item)
                            {
                                valorEstado = ObjEstado.valorEstado(item.ESTADO_REGISTRO)
                            });
                        }
                    }
                    else
                    {
                        result.codigo  = -1;
                        result.data    = new List <Evento>();
                        result.mensaje = "No existen registros de Eventos";
                        return(result);
                    }
                }
                result.codigo  = 0;
                result.mensaje = "OK";
                return(result);
            }
            catch (Exception ex)
            {
                result.codigo       = -1;
                result.mensaje      = "Ocurrio una Excepcion, Referencia: " + ex.ToString();
                result.mensajeError = ex.ToString();
                return(result);
            }
        }
        public Respuesta <Inscripcion> Inscribir()
        {
            Respuesta <Inscripcion> result = new Respuesta <Inscripcion>();

            result.codigo  = 1;
            result.mensaje = "Ocurrio un Error en Base de Datos";
            result.data    = new Inscripcion();

            try
            {
                using (var db = new EntitiesEVE01())
                {
                    var existeInscripcion = db.EVE01_INSCRIPCION.
                                            Where(i => i.EVENTO == MvcApplication.idEvento &&
                                                  i.PARTICIPANTE == this.idParticipante).
                                            Select(i => i).SingleOrDefault();

                    //SE VALIDA SI EXISTE EL REGISTRO DE LA INSCRIPCION
                    if (existeInscripcion == null)
                    {
                        //SI NO RETORNA VALOR, NO EXISTE EL REGISTRO POR LO QUE SE PROCEDE A INSERTAR LA INSCRIPCION
                        Respuesta <Inscripcion> objInscribir = this.insertInscripcion();
                        result.codigo       = objInscribir.codigo;
                        result.mensaje      = objInscribir.mensaje;
                        result.mensajeError = objInscribir.mensajeError;
                        return(result);
                    }
                    else
                    {
                        //SI RETORNA VALOR, EXISTE EL REGISTRO POR LO QUE SE PROCEDE A REACTIVAR LA INSCRIPCION
                        Respuesta <Inscripcion> objInscribir = this.reInscribir();
                        result.codigo       = objInscribir.codigo;
                        result.mensaje      = objInscribir.mensaje;
                        result.mensajeError = objInscribir.mensajeError;
                        return(result);
                    }
                }
            }
            catch (Exception ex)
            {
                result.codigo       = -1;
                result.mensaje      = "Ocurrio una Excepcion al momento de Inscribir, Ref: " + ex.ToString();
                result.mensajeError = ex.ToString();
                return(result);
            }
        }
        private bool validaActualizacionDatosEvento()
        {
            using (var db = new EntitiesEVE01())
            {
                var valida = db.EVE01_EVENTO_ACTUALIZACION.Where(v => v.PARTICIPANTE == this.idParticipante &&
                                                                 v.EVENTO == MvcApplication.idEvento).Select(v => v).SingleOrDefault();

                if (valida == null)
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
        }
Esempio n. 25
0
 private static string ObtenerNombreUsuario()
 {
     try
     {
         using (var db = new EntitiesEVE01())
         {
             var nombre = db.EVE01_USUARIO
                          .Where(us => us.USUARIO == HttpContext.Current.User.Identity.Name.ToUpper())
                          .Select(us => us.NOMBRE).SingleOrDefault();
             return(nombre.ToString());
         }
     }
     catch (Exception)
     {
         return("NO_USER");
     }
 }
        //METODO PARA ANULAR MOVIMIENTOS CUANDO SE ANULA INSCRIPCION
        public Respuesta <Movimiento> anularMovimientos(decimal participante)
        {
            Respuesta <Movimiento> result = new Respuesta <Movimiento>();

            result.codigo  = 1;
            result.mensaje = "Ocurrio un error en base de datos";
            result.data    = new Movimiento();

            try
            {
                using (var db = new EntitiesEVE01())
                {
                    var movimientos = (from m in db.EVE01_MOVIMIENTO
                                       where m.EVENTO == MvcApplication.idEvento &&
                                       m.PARTICIPANTE == participante &&
                                       m.TIPO_MOVIMIENTO == "AB"
                                       select m).ToList();

                    if (movimientos.Count > 0)
                    {
                        foreach (var item in movimientos)
                        {
                            var mov = (from mo in db.EVE01_MOVIMIENTO
                                       where mo.MOVIMIENTO == item.MOVIMIENTO &&
                                       mo.EVENTO == item.EVENTO &&
                                       mo.PARTICIPANTE == item.PARTICIPANTE
                                       select mo).SingleOrDefault();

                            mov.TIPO_MOVIMIENTO      = "AN";
                            mov.USUARIO_MODIFICACION = MvcApplication.UserName;
                            mov.FECHA_MODIFICACION   = DateTime.Now;
                            db.SaveChanges();
                        }
                    }
                }
                result.codigo  = 0;
                result.mensaje = "Ok";
                return(result);
            }
            catch (Exception ex)
            {
                result.codigo  = -1;
                result.mensaje = "Ocurrio una excepcion al momento de anular los movimientos, ref: " + ex.ToString();
                return(result);
            }
        }
Esempio n. 27
0
        public Respuesta <List <EventoBus> > informacionBuses()
        {
            Respuesta <List <EventoBus> > result = new Respuesta <List <EventoBus> >();

            result.codigo  = 1;
            result.mensaje = "Ocurrio un Error en base de Datos";
            result.data    = new List <EventoBus>();

            try
            {
                using (var db = new EntitiesEVE01())
                {
                    var buses = (from b in db.EVE01_EVENTO_BUS
                                 orderby b.BUS ascending
                                 where b.EVENTO == MvcApplication.idEvento &&
                                 b.ESTADO_REGISTRO == "A"
                                 select b).ToList();

                    if (buses.Count == 0)
                    {
                        result.codigo  = -1;
                        result.mensaje = "No Existen Buses registrados para este Evento";
                        return(result);
                    }
                    else
                    {
                        foreach (var item in buses)
                        {
                            result.data.Add(new EventoBus(item));
                        }
                    }
                }
                result.codigo  = 0;
                result.mensaje = "Ok";
                return(result);
            }
            catch (Exception ex)
            {
                result.codigo       = -1;
                result.mensaje      = "Ocurrio una excepcion al obtener el listado de buses disponibles, ref: " + ex.ToString();
                result.mensajeError = ex.ToString();
                return(result);
            }
        }
Esempio n. 28
0
        /// <summary>
        /// Metodo que retorna Listado de Eventos Activos
        /// </summary>
        /// <returns></returns>
        public Respuesta <List <Evento> > ListarEventosActivos()
        {
            Respuesta <List <Evento> > result = new Respuesta <List <Evento> >();

            result.codigo  = 1;
            result.mensaje = "Ocurrio un Error en base de datos al obtener el listado";
            result.data    = new List <Evento>();

            try
            {
                using (var db = new EntitiesEVE01())
                {
                    var listadoEvento = db.EVE01_EVENTO
                                        .Where(e => e.ESTADO_REGISTRO == "A")
                                        .Select(e => e).OrderByDescending(e => e.EVENTO).ToList();

                    if (listadoEvento.Count > 0)
                    {
                        foreach (var item in listadoEvento)
                        {
                            result.data.Add(new Evento(item));
                        }
                    }
                    else
                    {
                        result.codigo  = -1;
                        result.data    = new List <Evento>();
                        result.mensaje = "No existen registros de Eventos Activos";
                        return(result);
                    }
                }
                result.codigo  = 0;
                result.mensaje = "OK";
                return(result);
            }
            catch (Exception ex)
            {
                result.codigo       = -1;
                result.mensaje      = "Ocurrio una Excepcion, Referencia: " + ex.ToString();
                result.mensajeError = ex.ToString();
                return(result);
            }
        }
Esempio n. 29
0
        private bool hospedaje(decimal opcion)
        {
            using (var db = new EntitiesEVE01())
            {
                var res = (from op in db.EVE01_EVENTO_OPCION
                           where op.OPCION == opcion &&
                           op.EVENTO == MvcApplication.idEvento
                           select op).SingleOrDefault();

                if (res.ES_HOSPEDAJE == "S")
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
        public Respuesta <List <Movimiento> > listaMovimientosAnulados()
        {
            Respuesta <List <Movimiento> > result = new Respuesta <List <Movimiento> >();

            result.codigo  = 1;
            result.mensaje = "Ocurrio un error en Base de datos";
            result.data    = new List <Movimiento>();

            try
            {
                using (var db = new EntitiesEVE01())
                {
                    var movimientos = (from mov in db.EVE01_MOVIMIENTO
                                       orderby mov.MOVIMIENTO descending
                                       where mov.EVENTO == MvcApplication.idEvento &&
                                       mov.PARTICIPANTE == this.idParticipante &&
                                       mov.TIPO_MOVIMIENTO == "AN"
                                       select mov).ToList();

                    if (movimientos.Count > 0)
                    {
                        foreach (var item in movimientos)
                        {
                            result.data.Add(new Movimiento(item)
                            {
                                descripcionTipoPago       = infodescripcionTipoPago(item.TIPO_PAGO),
                                descripcionTipoMovimiento = infodescripcionTipoMovimiento(item.TIPO_MOVIMIENTO)
                            });
                        }
                    }
                }
                result.codigo  = 0;
                result.mensaje = "Ok";
                return(result);
            }
            catch (Exception ex)
            {
                result.codigo       = -1;
                result.mensaje      = "Ocurrio una excepcion al tratar de obtener los movimientos, ref: " + ex.ToString();
                result.mensajeError = ex.ToString();
                return(result);
            }
        }