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);
            }
        }
        public Respuesta <SaldoParticipante> saldo(Participante 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())
                {
                    var saldos = (from s in db.EVE01_PARTICIPANTE_SALDO
                                  where s.EVENTO == MvcApplication.idEvento &&
                                  s.PARTICIPANTE == data.idParticipante
                                  select s).SingleOrDefault();

                    if (saldos == null)
                    {
                        result.codigo  = -1;
                        result.mensaje = "No Hay Saldos para este Participante";
                        return(result);
                    }
                    else
                    {
                        dbModel = saldos;
                    }
                }
                result.codigo  = 0;
                result.mensaje = "Ok";
                result.data    = this;
                return(result);
            }
            catch (Exception ex)
            {
                result.codigo       = -1;
                result.mensaje      = "Ocurrio una excepcion al obtener los Saldos, ref: " + ex.ToString();
                result.mensajeError = ex.ToString();
                return(result);
            }
        }
 public SaldoParticipante(EVE01_PARTICIPANTE_SALDO datos)
 {
     dbModel = datos;
 }
 public SaldoParticipante()
 {
     dbModel = new EVE01_PARTICIPANTE_SALDO();
 }