public ActionResult AddIngreso(Ingreso ing) { /* Ingreso ingreso = new Ingreso(); * ingreso.descripcion = ing.descripcion; * ingreso.monto = ing.monto; * ingreso.fechaDesde = ing.fechaDesde; * ingreso.fechaHasta = ing.fechaHasta;*/ try { if (ing.descripcion != null && ing.fechaDesde != null && ing.fechaHasta != null && ing.monto != 0) { ing.idEntidad = ((Usuario)Session["usuario"]).idEntidad.Value; IngresoDAO.getInstancia().add(ing); Mongo.MongoDB.insertarDocumento("Ingreso", "alta", ing.ToBsonDocument()); return(Json(Url.Action("Index", "Home"))); } else { throw new Exception("Necesita completar todos los campos para continuar"); } } catch (Exception e) { MyLogger.log(e.Message); return(View()); } }
public ActionResult ListIngresos() { int idEntidad = ((Usuario)Session["usuario"]).idEntidad.Value; List <Ingreso> ingresos = IngresoDAO.getInstancia().getIngresos(idEntidad); return(View(ingresos)); }
public ActionResult Vinculador(JsonCriterio criterio) { int idEntidad = ((Usuario)Session["usuario"]).idEntidad.Value; var entidad = EntidadDAO.getInstancia().getEntidad(idEntidad); Vinculador vinculador = new Vinculador(); if (criterio.idCriterio == 1) { OVPE ovpe = new OVPE(); vinculador.AsignarCriterioAlVinculador(ovpe); vinculador.ejecutar(entidad); } if (criterio.idCriterio == 2) { OVPI ovpi = new OVPI(); vinculador.AsignarCriterioAlVinculador(ovpi); vinculador.ejecutar(entidad); } if (criterio.idCriterio == 3) { OF of = new OF(); vinculador.AsignarCriterioAlVinculador(of); vinculador.ejecutar(entidad); } ViewBag.egresos = EgresoDAO.getInstancia().getEgresos(idEntidad); ViewBag.ingresos = IngresoDAO.getInstancia().getIngresos(idEntidad); return(Json(Url.Action("Index", "Home"))); }
public ActionResult AsociarIngreso(int idProyecto) { int idEntidad = ((Usuario)Session["usuario"]).idEntidad.Value; ViewBag.ingresos = IngresoDAO.getInstancia().getIngresosSinProyecto(idEntidad); ViewBag.idProyecto = idProyecto; return(View()); }
public int create(IngresoDTO ingresoDTO) { int retorno = 0; IngresoDAO ingresoDAO = new IngresoDAO(); retorno = ingresoDAO.create(ingresoDTO); return(retorno); }
public ActionResult VinculadorManual() { int idEntidad = ((Usuario)Session["usuario"]).idEntidad.Value; ViewBag.egresos = EgresoDAO.getInstancia().getEgresosSinVincular(); ViewBag.ingresos = IngresoDAO.getInstancia().getIngresos(idEntidad); return(View()); }
static void Main(string[] args) { int? selected; GastosContainer dbContainer = new GastosContainer(AppContext.BaseDirectory); Data data = new Data(dbContainer); do { selected = GenerateMenu <string>(Menu); MenuPrincipal(selected, data); } while (selected != Salir); IngresoDAO iDAO = new IngresoDAO(dbContainer); }
// GET: Ingreso/Delete/5 public ActionResult DeleteIngreso(int id) { try { IngresoDAO.getInstancia().deleteIngreso(id); return(RedirectToAction("ListIngresos")); } catch (Exception e) { MyLogger.log(e.Message); ViewBag.errorMsg = e.Message; return(RedirectToAction("ListIngresos")); } }
public ActionResult EditIngreso(Ingreso ing) { try { IngresoDAO.getInstancia().updateIngreso(ing); return(RedirectToAction("ListIngresos", "Ingreso")); } catch (Exception e) { //int idEntidad = ((Usuario)Session["usuario"]).idEntidad.Value; Ingreso pres = IngresoDAO.getInstancia().getIngreso(ing.idIngreso); MyLogger.log(e.Message); ViewBag.errorMsg = e.Message; return(View()); } }
public ActionResult AsociarIngreso(int idIngreso, int idProyecto) { try { if (idIngreso == 0) { throw new Exception("Seleccione un ingreso"); } IngresoDAO.getInstancia().asociarIngresoAProyecto(idProyecto, idIngreso); return(RedirectToAction("DetalleProyectos", "ProyectoFinanciamiento", new { id = idProyecto })); } catch (Exception e) { int idEntidad = ((Usuario)Session["usuario"]).idEntidad.Value; MyLogger.log(e.Message); ViewBag.ingresos = IngresoDAO.getInstancia().getIngresos(idEntidad); ViewBag.idProyecto = idProyecto; ViewBag.errorMsg = e.Message; return(View()); } }
public ActionResult VinculadorManual(int idIngreso, int idEgreso) { try { Ingreso ing = IngresoDAO.getInstancia().getIngreso(idIngreso); Egreso egre = EgresoDAO.getInstancia().getEgreso(idEgreso); if (ing.egresosAsociados.Sum(e => e.montoTotal) + egre.montoTotal > ing.monto) { throw new Exception("El ingreso no tiene sufuciente monto para cubrir el egreso que desea agregar."); } egre.idIngresoAsociado = idIngreso; return(RedirectToAction("Vinculador", "Ingreso")); } catch (Exception e) { int idEntidad = ((Usuario)Session["usuario"]).idEntidad.Value; ViewBag.egresos = EgresoDAO.getInstancia().getEgresosSinVincular(); ViewBag.ingresos = IngresoDAO.getInstancia().getIngresos(idEntidad); ViewBag.errorMsg = e.Message; return(View()); } }
public IngresoDTO read(IngresoDTO ingresoDTO) { IngresoDTO retornoDTO = new IngresoDTO(); IngresoDAO ingresoDAO = new IngresoDAO(); DataTable dt = new DataTable(); dt = ingresoDAO.read(ingresoDTO); foreach (DataRow row in dt.Rows) { retornoDTO.ingresoID = Convert.ToInt64(row["ingresoID"].ToString()); retornoDTO.estado = row["estado"].ToString(); retornoDTO.enfermedad = row["enfermedad"].ToString(); retornoDTO.unidadID = Convert.ToInt64(row["unidadID"].ToString()); if (retornoDTO.unidadID != 0) { UnidadDTO unidadDTO = new UnidadDTO(); UnidadNEG unidadNEG = new UnidadNEG(); unidadDTO.unidadID = retornoDTO.unidadID; retornoDTO.unidad = new UnidadDTO(); retornoDTO.unidad = unidadNEG.read(unidadDTO); } retornoDTO.salaID = Convert.ToInt64(row["salaID"].ToString()); if (retornoDTO.salaID != 0) { SalaDTO salaDTO = new SalaDTO(); SalaNEG salaNEG = new SalaNEG(); salaDTO.salaID = retornoDTO.salaID; retornoDTO.sala = new SalaDTO(); retornoDTO.sala = salaNEG.read(salaDTO); } retornoDTO.camaID = Convert.ToInt64(row["camaID"].ToString()); if (retornoDTO.camaID != 0) { CamaDTO camaDTO = new CamaDTO(); CamaNEG camaNEG = new CamaNEG(); camaDTO.camaID = retornoDTO.camaID; retornoDTO.cama = new CamaDTO(); retornoDTO.cama = camaNEG.read(camaDTO); } retornoDTO.descripcion = row["descripcion"].ToString(); retornoDTO.pacienteID = Convert.ToInt64(row["pacienteID"].ToString()); retornoDTO.fecha_ingreso = Convert.ToDateTime(row["fecha_ingreso"].ToString()); retornoDTO.hora_ingreso = row["hora_ingreso"].ToString(); } return(retornoDTO); }
// GET: Ingreso/Edit/5 public ActionResult EditIngreso(int id) { Ingreso pres = IngresoDAO.getInstancia().getIngreso(id); return(View(pres)); }
public ActionResult DetalleIngreso(int id) { Ingreso ingreso = IngresoDAO.getInstancia().getIngreso(id); return(View(ingreso)); }
public IngresoBO() { idao = new IngresoDAO(); }