private static string ultimoDiaDof() { string ultimoDia = string.Empty; using (entidad = new dofEntities()) { var res = entidad.sps_Diario_TheLast(); foreach (var ultimo in res) { ultimoDia = ultimo.Value.ToString("dd/MM/yyyy"); } } return(ultimoDia); }
public static List <Dof> getDof(DateTime?fecha) { DofView lstDof = new DofView(); if (!string.IsNullOrEmpty(fecha.ToString())) { sSelected = ultimoDiaDof(); } DateTime dSelected = Convert.ToDateTime(sSelected); string sYear = dSelected.Year.ToString(); string sMonth = dSelected.Month.ToString(); string sDay = dSelected.Day.ToString(); bool vCompleto = true; List <Dof> respuesta; string sUbicacion = string.Empty; string sDependencia = string.Empty; int ed_Id = 0; using (entidad = new dofEntities()) { var res = entidad.sps_Publicacion(Convert.ToDateTime(sSelected)); var query = from dofR in res select new Dof { Id = dofR.do_Id, Fecha = dofR.do_Fecha, Anio = dofR.do_Year, Mes = dofR.do_Month, MesText = dofR.do_MonthText, Dia = dofR.do_Day, Activo = dofR.do_Activo, Ed_Id = dofR.ed_Id, EdNombre = dofR.ed_Nombre, SeccId = dofR.secc_Id, SecNombre = dofR.secc_Nombre, PodId = dofR.pod_Id, PodNombre = dofR.pod_Nombre, PodOrden = dofR.pod_Orden, GobId = dofR.gob_Id, GobClave = dofR.gob_Clave, GobNombre = dofR.gob_Nombre, IndOrden = dofR.ind_Orden, IndParrafo = dofR.ind_Parrafo, ParrId = dofR.parr_Id, ParrTexto = dofR.parr_Texto, ParrPagina = dofR.parr_Pagina, ParrOrden = dofR.parr_Orden, GobClaveLg = dofR.gob_clave_LG }; respuesta = query.OrderBy(sec => sec.SeccId) .ThenBy(pod => pod.PodId) .ToList(); } return(respuesta); }