Example #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Desviaciones desviaciones = db.Desviaciones.Find(id);

            db.Desviaciones.Remove(desviaciones);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #2
0
        // GET: Desviaciones/Details/5
        public ActionResult Details(int?id)
        {
            TempData["Message"] = Convert.ToString(id);

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Desviaciones desviaciones = db.Desviaciones.Find(id);

            DesviacionModel desviacion = new DesviacionModel
            {
                IdDesviacion                   = Convert.ToInt32(id),
                NumeroDeParte                  = desviaciones.Componentes.DescripcionComponente,
                IdCliente                      = desviaciones.IdCliente,
                Cliente                        = desviaciones.Clientes.DescripcionDelCliente,
                NumeroDesviacion               = desviaciones.NumeroDesviacion,
                FechaDesviacion                = Convert.ToDateTime(desviaciones.FechaDesviacion),
                RequeridoPor                   = desviaciones.RequeridoPor,
                DescripcionProcesoCorrecto     = desviaciones.DescripcionProcesoCorrecto,
                DescripcionCondicionComponente = desviaciones.DescripcionCondicionComponente,
                DescripcionRazonDesviacion     = desviaciones.DescripcionRazonDesviacion,
                DescripcionPlanDeAccion        = desviaciones.DescripcionPlanDeAccion,
                DescripcionFechaDesviacion     = desviaciones.DescripcionFechaDesviacion,
                DescripcionResponsable         = desviaciones.DescripcionResponsable,
                CriterioAceptado               = desviaciones.CriterioAceptado,
                DetalleCriterioAceptado        = desviaciones.DetalleCriterioAceptado,
                Vencimiento                    = desviaciones.Vencimiento,
                FechaVencimiento               = desviaciones.FechaVencimiento ?? new DateTime(),
                CantidadDePiezas               = desviaciones.CantidadDePiezas,
                IdTipoDesviacion               = desviaciones.IdTipoDesviacion,
                TipoDesviacion                 = desviaciones.TipoDesviacion.DescripcionTipoDesviacion,
                LstAreas                       = desviaciones.ResultadoDeAreaInvolucrada.Where(x => x.EstadoArea).Select(x => x.AreaInvolucrada.DescripcionAreaInvolucrada).ToList(),
                LstDocumentos                  = desviaciones.ResultadoDeDocumentosRelacionados.Where(x => x.EstadoDocumento).Select(x => x.DocumentosRelacionados.DescripcionDocumentosRelacionados).ToList(),
                //Areas = desviaciones.ResultadoDeAreaInvolucrada.Where(x => x.EstadoArea).Select(x =>new ListaAreasDeshabilitar{IdArea=x.IdArea,DescripcionAreaInvolucrada=x.AreaInvolucrada.DescripcionAreaInvolucrada}).ToList(),
                //ListaAreas = desviaciones.ResultadoDeAreaInvolucrada.Select(x => x.IdAreasInvolucradas).ToList(),
                //ListaDocumentos = desviaciones.ResultadoDeDocumentosRelacionados.Select(x => x.IdDocumentoRealizado).ToList()
                SelectListAreas      = desviaciones.ResultadoDeAreaInvolucrada.Where(x => x.EstadoArea == true).Select(x => x.IdAreasInvolucradas).ToArray(),
                SelectListDocumentos = desviaciones.ResultadoDeDocumentosRelacionados.Where(x => x.EstadoDocumento == true).Select(x => x.IdDocumentoRealizado).ToArray()
            };

            if (desviacion == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ListaArea = db.AreaInvolucrada.Where(x => x.EstadoAreaInvolucrada).Select(x => new SelectListItem {
                Value = x.IdAreasInvolucradas.ToString(), Text = x.DescripcionAreaInvolucrada
            }).ToList();
            ViewBag.ListaDocumento = db.DocumentosRelacionados.Where(x => x.EstadoDocumentoRelacionado).Select(x => new SelectListItem {
                Value = x.IdDocumentosRelacionados.ToString(), Text = x.DescripcionDocumentosRelacionados
            }).ToList();
            return(View(desviacion));
        }
Example #3
0
        // GET: Desviaciones/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Desviaciones desviaciones = db.Desviaciones.Find(id);

            if (desviaciones == null)
            {
                return(HttpNotFound());
            }
            return(View(desviaciones));
        }