예제 #1
0
        public bool InsertarPrestamo(int indice)
        {
            bool res = false;

            //int indice;
            if (this.ValidarDatos())
            {
                //indice = this.getMaximoIndice() + 1;
                string sql = "INSERT INTO tprestamo(codigo, valor, porcentaje, total, fecha_inicio, fecha_final, cuotas, valor_cuota, cedula_cliente, codigo_frecpag, saldo,  indice) ";
                sql += "VALUES ('" + Codigo + "',";
                sql += Valor.ToString().Replace(",", ".") + ",";
                sql += Porcentaje.ToString().Replace(",", ".") + ",";
                sql += Total.ToString().Replace(",", ".") + ",'";
                sql += FechaInicial + "','";
                sql += FechaFinal + "',";
                sql += Numcuota + ",";
                sql += ValorCuota.ToString().Replace(",", ".") + ",'";
                sql += CedulaCliente + "',";
                sql += Cod_FrePag + ", ";
                sql += Saldo.ToString().Replace(",", ".") + ", " + indice + ");";

                //SE EJECUTA LA CONSULTA
                res = conex.Ejecutar(sql);
            }
            else
            {
                msg.Getmensaje(TipoError.DATOS_INVALIDOS);
            }
            return(res);
        }
예제 #2
0
        public void LoadNextQuestion()
        {
            if (this.PreguntaActual >= 9)
            {
                return;
            }

            var rnd = new Random();

            this.PreguntaActual++;
            this.Categoria         = ((App)Application.Current).ListaPreguntasChoise[this.PreguntaActual].category;
            this.Pregunta          = ((App)Application.Current).ListaPreguntasChoise[this.PreguntaActual].question;
            this.RespuestaCorrecta = ((App)Application.Current).ListaPreguntasChoise[this.PreguntaActual].correct_answer;

            var lista_respuestas = new List <string>();

            foreach (var i in ((App)Application.Current).ListaPreguntasChoise[this.PreguntaActual].incorrect_answers)
            {
                lista_respuestas.Add(i);
            }
            ;
            lista_respuestas.Add(this.RespuestaCorrecta);

            //Las respuestas quedan organizadas aleatoriamente ↓↓↓
            var lista_mezclada = lista_respuestas.OrderBy(x => rnd.Next()).ToList();

            this.Respuesta1 = HttpUtility.HtmlDecode(lista_mezclada[0]);
            this.Respuesta2 = HttpUtility.HtmlDecode(lista_mezclada[1]);
            this.Respuesta3 = HttpUtility.HtmlDecode(lista_mezclada[2]);
            this.Respuesta4 = HttpUtility.HtmlDecode(lista_mezclada[3]);

            this.Porcentaje   += 0.1;
            this.PorcentajeBar = Porcentaje.ToString();
        }
        public ActionResult SetearPorcentajes()
        {
            GastoHelper helper     = new GastoHelper();
            Porcentaje  porcentaje = helper.getPorcentaje();

            return(PartialView("Porcentajes", porcentaje));
        }
예제 #4
0
        public Porcentaje getPorcentaje()
        {
            Porcentaje porcentaje = new Porcentaje();

            using (var db = new FinanzasContext())
            {
                porcentaje = (from p in db.Porcentajes select p).FirstOrDefault();
            }
            return(porcentaje);
        }
예제 #5
0
 public void updatePorcentaje(int obligatorio, int deseoso, int inversion)
 {
     using (var db = new FinanzasContext())
     {
         Porcentaje porcentaje = db.Porcentajes.FirstOrDefault();
         porcentaje.Obligatorio = obligatorio;
         porcentaje.Deseoso     = deseoso;
         porcentaje.Inversion   = inversion;
         db.SaveChanges();
     }
 }
예제 #6
0
 public Inmueble(Guid declaracionID, string direccion, string tipoDeInmueble, Porcentaje porcentajeParticipacion, decimal valorComercial, decimal saldoHipoteca, string banco)
 {
     ID                      = Guid.NewGuid();
     DeclaracionID           = declaracionID;
     Direccion               = direccion;
     TipoDeInmueble          = tipoDeInmueble;
     PorcentajeParticipacion = porcentajeParticipacion;
     ValorComercial          = valorComercial;
     SaldoHipoteca           = saldoHipoteca;
     Banco                   = banco;
 }
예제 #7
0
 public void addPorcentaje(int obligatorio, int deseoso, int inversion)
 {
     using (var db = new FinanzasContext())
     {
         Porcentaje porcentaje = new Porcentaje();
         porcentaje.Obligatorio = obligatorio;
         porcentaje.Deseoso     = deseoso;
         porcentaje.Inversion   = inversion;
         db.Porcentajes.Add(porcentaje);
         db.SaveChanges();
     }
 }
        public void LoadNextQuestion()
        {
            if (this.PreguntaActual >= 9)
            {
                return;
            }

            this.PreguntaActual++;
            this.Categoria         = ((App)Application.Current).ListaPreguntasBool[this.PreguntaActual].category;
            this.Pregunta          = ((App)Application.Current).ListaPreguntasBool[this.PreguntaActual].question;
            this.RespuestaCorrecta = ((App)Application.Current).ListaPreguntasBool[this.PreguntaActual].correct_answer;

            this.Porcentaje   += 0.1;
            this.PorcentajeBar = Porcentaje.ToString();
        }
        public ActionResult Save(int Obligatorio, int Deseoso, int inversion)
        {
            GastoHelper helper = new GastoHelper();

            if (Obligatorio + Deseoso + inversion == 100)
            {
                Porcentaje porcentaje = helper.getPorcentaje();
                if (porcentaje == null)
                {
                    helper.addPorcentaje(Obligatorio, Deseoso, inversion);
                }
                else
                {
                    helper.updatePorcentaje(Obligatorio, Deseoso, inversion);
                }
            }
            List <Gasto> gastos = helper.getByIdPersona((int)Session["PersonaId"]);

            return(View("Principal", gastos));
        }
        }                                       //update

        private Dictionary <string, string> prepareData(bool add)
        {
            string FECHA = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");

            Dictionary <string, string> dic = new Dictionary <string, string>();

            if (add)
            {
                dic.Add("ID_PERSONA", IdPersona.ToString());
                //dic.Add("ID_PENSIONADO", IdPensionado.ToString());
            }

            dic.Add("CUENTA", Cuenta);
            dic.Add("CLABE", Clabe);


            //   dic.Add("CUENTA", Cuenta.ToString());
            // dic.Add("CLABE", Clabe.ToString());



            dic.Add("BENEFICIARIO", Nombre);
            dic.Add("BENEFICIARIOP", ApellidoP);
            dic.Add("BENEFICIARIOM", ApellidoM);
            dic.Add("CVE_BANCO", Banco);//CVE_BANCO
            dic.Add("TIPODEPAGO", TipoPago);
            dic.Add("TIPOPENSION", TipoPension);
            dic.Add("PORCENTAJE", Porcentaje.ToString("F"));
            dic.Add("CUOTA", MontoFijo.ToString("F"));
            dic.Add("COMENTARIOS", Comentarios);


            /*if (add)
             *      dic.Add("FECHA_R", FECHA);
             * else
             *      dic.Add("FECHA_M", FECHA);*/
            dic.Add("IP", "0");
            dic.Add("USUARIO", sesion.nickName);
            dic.Add("ACTIVO", Activo ? "1" : "0");
            return(dic);
        }
예제 #11
0
        private static async Task <InmuebleCollection> ReadInmueblesCollection(Guid declaracionID, IDbConnection db)
        {
            var inmueblesCollection = new InmuebleCollection();
            var inmuebleSQL         = "SELECT * FROM Inmuebles WHERE DeclaracionID = @declaracionID";
            var inmuebles           = await db.QueryAsync <Entities.Inmueble>(inmuebleSQL, new { declaracionID });

            foreach (var item in inmuebles.ToList())
            {
                inmueblesCollection.AddItem(Inmueble.Load(item.ID, item.DeclaracionID, item.Direccion, item.TipoDeInmueble, Porcentaje.For(item.PorcentajeParticipacion), item.ValorComercial, item.SaldoHipoteca, item.Banco));
            }

            return(inmueblesCollection);
        }
예제 #12
0
 public async Task <InmuebleOutput> Execute(Guid inmuebleID, Guid declaracionID, string direccion, string tipoDeInmueble, decimal porcentajeParticipacion, decimal valorComercial, decimal saldoHipoteca, string banco)
 {
     if (inmuebleID == null || inmuebleID == Guid.Empty)
     {
         await _inmuebleWriteOnlyRepository.Add(new Inmueble(declaracionID, direccion, tipoDeInmueble, Porcentaje.For(porcentajeParticipacion), valorComercial, saldoHipoteca, banco));
     }
     else
     {
         await _inmuebleWriteOnlyRepository.Update(Inmueble.Load(inmuebleID, declaracionID, direccion, tipoDeInmueble, Porcentaje.For(porcentajeParticipacion), valorComercial, saldoHipoteca, banco));
     }
     return(new InmuebleOutput(inmuebleID, declaracionID, direccion, tipoDeInmueble, porcentajeParticipacion, valorComercial, saldoHipoteca, banco));
 }
예제 #13
0
        public static Inmueble Load(Guid id, Guid declaracionID, string direccion, string tipoDeInmueble, Porcentaje porcentajeParticipacion, decimal valorComercial, decimal saldoHipoteca, string banco)
        {
            var inmueble = new Inmueble
            {
                ID                      = id,
                DeclaracionID           = declaracionID,
                Direccion               = direccion,
                TipoDeInmueble          = tipoDeInmueble,
                PorcentajeParticipacion = porcentajeParticipacion,
                ValorComercial          = valorComercial,
                SaldoHipoteca           = saldoHipoteca,
                Banco                   = banco,
            };

            return(inmueble);
        }
예제 #14
0
        public async Task <ICollection <Inmueble> > GetByDeclaracion(Guid declaracionID)
        {
            using (IDbConnection db = new SqlConnection(connectionString))
            {
                string sqlCommand = "SELECT * FROM Inmuebles WHERE DeclaracionID = @declaracionID";

                var inmuebles = await db.QueryAsync <Entities.Inmueble>(sqlCommand, new { declaracionID });

                var outputResult = new List <Inmueble>();

                if (inmuebles == null)
                {
                    return(outputResult);
                }

                foreach (var inmueble in inmuebles)
                {
                    outputResult.Add(Inmueble.Load(inmueble.ID, inmueble.DeclaracionID, inmueble.Direccion, inmueble.TipoDeInmueble, Porcentaje.For(inmueble.PorcentajeParticipacion),
                                                   inmueble.ValorComercial, inmueble.SaldoHipoteca, inmueble.Banco));
                }
                return(outputResult);
            }
        }
예제 #15
0
        public async Task <Inmueble> Get(Guid inmuebleID)
        {
            using (IDbConnection db = new SqlConnection(connectionString))
            {
                string sqlCommand = "SELECT * FROM Inmuebles WHERE ID = @inmuebleID";

                var inmueble = await db.QueryFirstOrDefaultAsync <Entities.Inmueble>(sqlCommand, new { inmuebleID });

                if (inmueble == null)
                {
                    return(null);
                }
                return(Inmueble.Load(inmueble.ID, inmueble.DeclaracionID, inmueble.Direccion, inmueble.TipoDeInmueble, Porcentaje.For(inmueble.PorcentajeParticipacion),
                                     inmueble.ValorComercial, inmueble.SaldoHipoteca, inmueble.Banco));
            }
        }