public JsonResult ObtenerAgendaXFecha(string FechaInicio, string FechaFin) { try { DateTime fecini = FormatDate(FechaInicio); DateTime fecfin = FormatDate(FechaFin); var usuarioActual = ObtenerUsuarioEnSesion(System.Web.HttpContext.Current); List <Plan_Capacitacion> planactividad = db.Tbl_PlanCapacitacion.Where(x => x.NitEmpresa == usuarioActual.NitEmpresa).ToList(); List <FechaProgModel> objfechaprog = new List <FechaProgModel>(); foreach (var item in planactividad) { FechaProgModel fechaprog = new FechaProgModel(); fechaprog.pk_id_actividad = item.pk_id_plan_capacitacion; fechaprog.NombreActividad = ObtenerActividad(item.fk_id_tipo_actividad); fechaprog.Tema = item.tema; fechaprog.FechaProgTemp = FormatDate(item.fecha_programada); fechaprog.HoraIni = item.hora_inicio; fechaprog.HoraFin = item.hora_fin; objfechaprog.Add(fechaprog); } var fechas = objfechaprog.Where(x => x.FechaProgTemp >= fecini && x.FechaProgTemp <= fecfin).ToList(); List <PlanEmpresaModel> calmod = new List <PlanEmpresaModel>(); foreach (var item in fechas) { PlanEmpresaModel mod = new PlanEmpresaModel(); mod.Id = 1; mod.name = item.NombreActividad; mod.brief = item.Tema; mod.DateFrom = FormatDates(item.FechaProgTemp); mod.DateTo = FormatDates(item.FechaProgTemp); mod.HoraInicio = FormatHH(item.HoraIni); mod.HoraFin = FormatHH(item.HoraFin); calmod.Add(mod); } return(Json(calmod, JsonRequestBehavior.AllowGet)); } catch (Exception e) { return(Json(true, JsonRequestBehavior.AllowGet)); } }
public JsonResult ObtenerAgendaXFecha(int pk_id_plan_empresa, string FechaInicio, string FechaFin) { DateTime fecini = FormatDate(FechaInicio); DateTime fecfin = FormatDate(FechaFin); var usuarioActual = ObtenerUsuarioEnSesion(System.Web.HttpContext.Current); List <PlanEmpresaActividad> planactividad = db.Tbl_Plan_Empresa_Actividad.Where(x => (x.pk_plan_empresa == pk_id_plan_empresa && x.NitEmpresa == usuarioActual.NitEmpresa)).ToList(); List <FechaProgModel> objfechaprog = new List <FechaProgModel>(); foreach (var item in planactividad) { FechaProgModel fechaprog = new FechaProgModel(); fechaprog.pk_id_actividad = item.pk_id_actividad; fechaprog.NombreActividad = item.Actividad; fechaprog.Tema = ObtenerObjetivosById(item.ObjetivosDescripcion); fechaprog.FechaProgTemp = FormatDate(item.FechaProg); fechaprog.HoraIni = item.HoraProgIni; fechaprog.HoraFin = item.HoraProgFin; objfechaprog.Add(fechaprog); } var fechas = objfechaprog.Where(x => x.FechaProgTemp >= fecini && x.FechaProgTemp <= fecfin).ToList(); List <PlanEmpresaModel> calmod = new List <PlanEmpresaModel>(); foreach (var item in fechas) { PlanEmpresaModel mod = new PlanEmpresaModel(); mod.Id = 1; mod.name = item.NombreActividad; mod.brief = item.Tema; mod.DateFrom = FormatDates(item.FechaProgTemp); mod.DateTo = FormatDates(item.FechaProgTemp); mod.HoraInicio = FormatHH(item.HoraIni); mod.HoraFin = FormatHH(item.HoraFin); calmod.Add(mod); } return(Json(calmod, JsonRequestBehavior.AllowGet)); }