public JsonResult IngresarMulta(FormCollection collection)
        {
            GastosDAL bd    = new GastosDAL();
            GASTO     multa = new GASTO();

            multa.NOMBRE_GASTO  = "Multa";
            multa.FECHA_GASTO   = DateTime.Now;
            multa.ID_TIPO_GASTO = 4;
            multa.ESTADO        = "NO PAGADO";
            multa.ID_VIVIENDA   = int.Parse(collection["Vivienda"].ToString());
            multa.DESCRIPCION   = collection["Descipcion"].ToString();
            multa.MONTO_GASTO   = int.Parse(collection["Monto"].ToString());
            var model = bd.IngresarNuevaMulta(multa);

            if (model)
            {
                var result = new { Success = true, Message = "Succes Message", model };
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            else
            {
                var result = new { Success = false, Message = "Error Message" };
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
        }
Пример #2
0
 public override void Save(List <GastosTO> gastosTO)
 {
     try
     {
         GastosDAL gastosDAL = new GastosDAL();
         gastosDAL.Save(gastosTO);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #3
0
        public override GastosTO SelectScalar(int id)
        {
            GastosDAL gastosDAL = new GastosDAL();

            try
            {
                return(gastosDAL.SelectScalar(id));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #4
0
        public override List <GastosTO> SelectAll(FiltroTelaTO filtroGastos)
        {
            GastosDAL gastosDAL = new GastosDAL();

            try
            {
                var listaGastos = gastosDAL.SelectAll(filtroGastos);
                return(listaGastos);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public JsonResult GetGastoPorID(FormCollection collection)
        {
            GastosDAL bd    = new GastosDAL();
            int       id    = int.Parse(collection["IdGasto"].ToString());
            var       model = bd.getGastoPorID(id);

            if (model != null)
            {
                var result = new { Success = true, Message = "Succes Message", model };
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            else
            {
                var result = new { Success = false, Message = "Error Message" };
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
        }
        public JsonResult BuscarMorosidadPorCondominio(FormCollection collection)
        {
            GastosDAL bd         = new GastosDAL();
            int       condominio = int.Parse(collection["Condominio"].ToString());
            var       model      = bd.ObtenerVistaMorosidadPorCondominio(condominio);

            if (model != null)
            {
                var result = new { Success = true, Message = "Succes Message", model };
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            else
            {
                var result = new { Success = false, Message = "Error Message" };
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
        }
        public JsonResult ObtenerGastosPorId(FormCollection collection)
        {
            GastosDAL bd    = new GastosDAL();
            int       gasto = int.Parse(collection["Gasto"].ToString());
            var       model = bd.GetGastoNoPagadoPorId(gasto);

            if (model != null)
            {
                var result = new { Success = true, Message = "Succes Message", model };
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            else
            {
                var result = new { Success = false, Message = "Error Message" };
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
        }
        public JsonResult ObtenerMultasPorVivienda(FormCollection collection)
        {
            GastosDAL bd       = new GastosDAL();
            int       vivienda = int.Parse(collection["Vivienda"].ToString());
            var       model    = bd.ObtenerVistaMultasPorVivienda(vivienda);

            if (model != null)
            {
                var result = new { Success = true, Message = "Succes Message", model };
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            else
            {
                var result = new { Success = false, Message = "Error Message" };
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
        }
        public JsonResult EliminarObervacionPorGasto(FormCollection collection)
        {
            GastosDAL bd    = new GastosDAL();
            int       id    = int.Parse(collection["Gasto"].ToString());
            string    texto = "";
            var       model = bd.ActualizarObervacionPorGasto(id, texto);

            if (model)
            {
                var result = new { Success = true, Message = "Succes Message", model };
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            else
            {
                var result = new { Success = false, Message = "Error Message" };
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
        }
        public JsonResult CargarGatosMasivos(FormCollection collection)
        {
            GastosDAL    db          = new GastosDAL();
            List <GASTO> listaGasto  = new List <GASTO>();
            var          _arreglo    = collection["Array"].ToString();
            var          arreglo     = _arreglo.Split(',');
            var          nombre      = collection["Nombre"].ToString();
            var          descripcion = collection["Descripcion"].ToString();
            var          fecha       = Convert.ToDateTime(collection["Fecha"].ToString());
            var          tipo        = int.Parse(collection["Tipo"].ToString());
            var          monto       = int.Parse(collection["Monto"].ToString());
            int          ulti        = db.ultimo();
            int          x           = arreglo.Count();

            for (int i = 0; i < x; i++)
            {
                ulti = ulti + 1;
                GASTO gas = new GASTO();
                gas.ID_GASTO      = ulti;
                gas.ID_TIPO_GASTO = tipo;
                gas.ID_VIVIENDA   = int.Parse(arreglo[i]);
                gas.MONTO_GASTO   = monto;
                gas.NOMBRE_GASTO  = nombre;
                gas.DESCRIPCION   = descripcion;
                gas.FECHA_GASTO   = fecha;
                gas.ESTADO        = "NO PAGADO";
                listaGasto.Add(gas);
            }

            var model = db.InsertarGastoMasivo(listaGasto);

            if (model)
            {
                var result = new { Success = true, Message = "Succes Message", model };
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            else
            {
                var result = new { Success = false, Message = "Error Message" };
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
        }
        public JsonResult ObtenerInfoGastoNoPagadaPorFechaPorVivienda(FormCollection collection)
        {
            GastosDAL bd         = new GastosDAL();
            string    fecha      = collection["Hasta"].ToString();
            DateTime  desde      = Convert.ToDateTime(collection["Desde"].ToString());
            DateTime  hasta      = Convert.ToDateTime(fecha + " 23:59:00");
            int       residencia = int.Parse(collection["Residencia"].ToString());
            var       model      = bd.ObtenerVistaGastoNoPagoPorCondominioPorFecha(residencia, desde, hasta);

            if (model != null)
            {
                var result = new { Success = true, Message = "Succes Message", model };
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            else
            {
                var result = new { Success = false, Message = "Error Message" };
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
        }
        public JsonResult BuscarGastoParaEditarObservacionPorRangoFechas(FormCollection collection)
        {
            GastosDAL bd       = new GastosDAL();
            string    fecha    = collection["Hasta"].ToString();
            DateTime  desde    = Convert.ToDateTime(collection["Desde"].ToString());
            DateTime  hasta    = Convert.ToDateTime(fecha + " 23:59:00");
            int       vivienda = int.Parse(collection["Vivienda"].ToString());
            var       model    = bd.GetGastosConObsPorVivienda(vivienda, desde, hasta);

            if (model != null)
            {
                var result = new { Success = true, Message = "Succes Message", model };
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            else
            {
                var result = new { Success = false, Message = "Error Message" };
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
        }
Пример #13
0
        public List <GastosTO> getSomatorioPorTipo(FiltroTelaTO filtroGastos)
        {
            GastosDAL gastosDAL = new GastosDAL();

            try
            {
                List <GastosTO> retorno = gastosDAL.SelectAll(filtroGastos);

                var listaAgrupada = retorno.GroupBy(x => x.TIPO).Select(g => new GastosTO()
                {
                    TIPO           = g.First().TIPO,
                    ID_TIPO_GASTOS = g.First().ID_TIPO_GASTOS,
                    VALOR          = g.Sum(s => s.VALOR),
                }).ToList();

                return(listaAgrupada);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public JsonResult UpdateGastoPorID(FormCollection collection)
        {
            GastosDAL bd         = new GastosDAL();
            GASTO     actualizar = new GASTO();

            actualizar.ID_GASTO      = int.Parse(collection["ID"].ToString());
            actualizar.NOMBRE_GASTO  = collection["Nombre"].ToString();
            actualizar.DESCRIPCION   = collection["Descripcion"].ToString();
            actualizar.ID_TIPO_GASTO = int.Parse(collection["Tipo"].ToString());
            actualizar.MONTO_GASTO   = int.Parse(collection["Monto"].ToString());
            var model = bd.updateGastoPorID(actualizar);

            if (model)
            {
                var result = new { Success = true, Message = "Succes Message", model };
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            else
            {
                var result = new { Success = false, Message = "Error Message" };
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
        }