public async Task <IActionResult> Edit(int id, [Bind("IdHojaRutaDetalle,IdHojaRuta,IdUnidadEjecutora,IdUnidadEjecutoraDestino,IdUnidadEjecutoraCopia,IdUnidadEjecutoraCoordinar,Idbeneficiario,IdbeneficiarioDestino,IdbeneficiarioCopia,IdbeneficiarioCoordinar,PlazoDias,Proveido,IdEstadoRegistro,IdUsuario,FechaRegistro,HoraRegistro")] HojaRutaDetalle hojaRutaDetalle) { if (id != hojaRutaDetalle.IdHojaRutaDetalle) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(hojaRutaDetalle); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!HojaRutaDetalleExists(hojaRutaDetalle.IdHojaRutaDetalle)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(hojaRutaDetalle)); }
public async Task <IActionResult> Create([Bind("IdHojaRutaDetalle,IdHojaRuta,IdUnidadEjecutora,IdUnidadEjecutoraDestino,IdUnidadEjecutoraCopia,IdUnidadEjecutoraCoordinar,Idbeneficiario,IdbeneficiarioDestino,IdbeneficiarioCopia,IdbeneficiarioCoordinar,PlazoDias,Proveido,IdEstadoRegistro,IdUsuario,FechaRegistro,HoraRegistro")] HojaRutaDetalle hojaRutaDetalle) { if (ModelState.IsValid) { hojaRutaDetalle.FechaRegistro = DateTime.Now; hojaRutaDetalle.IdEstadoRegistro = '1'; _context.Add(hojaRutaDetalle); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(hojaRutaDetalle)); }
public HojaRuta populateDetalle(HojaRuta hr, int idUsuario, ApplicationDbContext DB) { ICollection <HojaRutaDetalle> detalle = new List <HojaRutaDetalle>(); if (hr.Id > 0) { detalle = hr.Derivaciones; } else { var parentHRDetalle = buildParent(hr, idUsuario); detalle.Add(parentHRDetalle); } foreach (var i in Instrucciones) { InstruccionDTO ins = JsonConvert.DeserializeObject <InstruccionDTO>(i); ICollection <HRDetalleInstrucciones> listDetIns = new List <HRDetalleInstrucciones>(); HojaRutaDetalle d = new HojaRutaDetalle(); d.AreaDestinoId = ins.areaId; d.AreaOrigenId = UnidadEjecutoraId; d.FunDstId = ins.funId; d.FunOrgId = OrigenId; d.PlazoDias = 1; d.Proveido = (ins.comentarios != null) ? ins.comentarios : "-"; d.IdEstadoRegistro = Constantes.Registrado; d.IdUsuario = idUsuario; d.FechaRegistro = DateTime.Now; d.DocumentoId = DocumentoId; d.Padre = Parent; foreach (var id in ins.instrucciones) { Instrucciones instruccion = DB.CorrespondenciaInstrucciones.Find(id); if (instruccion != null) { HRDetalleInstrucciones DetIns = new HRDetalleInstrucciones(); DetIns.HRDetalle = d; DetIns.Instruccion = instruccion; listDetIns.Add(DetIns); } } d.HRDetalleInstrucciones = listDetIns; detalle.Add(d); } hr.Derivaciones = detalle; return(hr); }
public HojaRutaDetalle buildParent(HojaRuta hr, int idUsuario) { HojaRutaDetalle parent = new HojaRutaDetalle(); parent.AreaDestinoId = hr.UnidadEjecutoraId; parent.AreaOrigenId = hr.UnidadEjecutoraId; parent.FunDstId = hr.OrigenId; parent.FunOrgId = hr.OrigenId; parent.PlazoDias = 1; parent.Proveido = "-"; parent.IdEstadoRegistro = Constantes.Registrado; parent.IdUsuario = idUsuario; parent.FechaRegistro = DateTime.Now; parent.DocumentoId = DocumentoId; parent.Padre = -1; return(parent); }
public static IHojaRutaDetalle GetHojaRutaDetalle() { HojaRutaDetalle hojaRutaDetalle = new HojaRutaDetalle(); return((IHojaRutaDetalle)hojaRutaDetalle); }