private void CalcularFechaDesdeFechaHasta(IContextService context, IListados objeto, string empresa, string ejercicio) { if (!string.IsNullOrEmpty(ejercicio)) { var properties = objeto.GetType().GetProperties(); EjerciciosModel obj = null; if (properties.Any(f => f.Name == "FechaDesde") || properties.Any(f => f.Name == "FechaHasta")) { using (var ejercicioservice = FService.Instance.GetService(typeof(EjerciciosModel), context)) { obj = ejercicioservice.get(ejercicio) as EjerciciosModel; } } if (obj != null) { if (properties.Any(f => f.Name == "FechaDesde")) { objeto.GetType().GetProperty("FechaDesde").SetValue(objeto, obj.Desde); } if (properties.Any(f => f.Name == "FechaHasta")) { objeto.GetType().GetProperty("FechaHasta").SetValue(objeto, obj.Hasta); } } } }
// GET: Configuraciongraficas public ActionResult Index(string id) { using (var db = MarfilEntities.ConnectToSqlServer(ContextService.BaseDatos)) using (var service = FService.Instance.GetService(typeof(ConfiguraciongraficasModel), ContextService, db) as ConfiguraciongraficasService) { IListados listadoModel = null; if (id != null) { listadoModel = FListadosModel.Instance.GetModel(ContextService, id, ContextService.Empresa, ContextService.Ejercicio); } var model = new ConfiguraciongraficasWrapperModel(); model.Idlistado = id; if (id != null) { model.Titulo = string.Format("{0}: {1}", Rconfiguraciongraficas.TituloEntidad, listadoModel.TituloListado); } model.Lineas = service.GetConfiguracionesListado(id, ContextService.Id); if (id != null) { ((IToolbar)model).Toolbar = new ToolbarModel() { Titulo = model.Titulo, Operacion = TipoOperacion.Index, Acciones = IndexToolbar(model.Idlistado), CustomAction = true, CustomActionName = Url.Action("Index", new { id = "" }) }; } else { ((IToolbar)model).Toolbar = new ToolbarModel() { Titulo = General.LblGestionDeGraficas + ContextService.Usuario, Operacion = TipoOperacion.Index, Acciones = IndexToolbar(model.Idlistado), CustomAction = true, CustomActionName = Url.Action("Index", new { id = "" }) }; } Session[id] = model; return(View(model)); } }