예제 #1
0
        public ActionResult DetalleArticuloRevisor(int id)
        {
            string correo = HttpContext.Session.GetString("Correo");
            string pass   = HttpContext.Session.GetString("pass");
            int    tipo   = (int)HttpContext.Session.GetInt32("tipo");
            int    idper  = (int)HttpContext.Session.GetInt32("id");

            var context = HttpContext.RequestServices.GetService(typeof(proyecto_r_mcynContext)) as proyecto_r_mcynContext;
            var c       = HttpContext.RequestServices.GetService(typeof(proyecto_r_mcynContext)) as proyecto_r_mcynContext;
            DetalleArticulos articulo = context.DetalleArticulos.Find(new object[] { id });

            var id_ar = articulo.IdArticulo;
            var list  = context.DetalleArticulos.Where(da => da.IdArticulo == id_ar);
            DetalleArticulos articulod = null;

            foreach (DetalleArticulos d in list)
            {
                d.IdPersonalNavigation = context.Personal.Where(pi => pi.IdPersonal == d.IdPersonal).First();
                if (d.IdPersonalNavigation.TipoP == 2 || d.IdPersonalNavigation.TipoP == 5)
                {
                    articulod = d;
                }
            }

            articulod.IdArticuloNavigation = context.Articulo.Where(ar => ar.IdArticulo == articulod.IdArticulo).First();
            articulod.StatusNavigation     = context.Estados.Where(e => e.IdEstado == articulod.Status).First();
            articulod.IdArticuloNavigation.RAutorNavigation = context.Autores.Where(au => au.IdAutores == articulod.IdArticuloNavigation.RAutor).First();

            ViewData["id"]     = idper;
            ViewData["correo"] = correo;
            ViewData["tipo"]   = tipo;

            return(View(articulod));
        }
예제 #2
0
        public ActionResult Asignacion(int id, Articulo articulo, string textcoment)
        {
            string correo = HttpContext.Session.GetString("Correo");
            string pass   = HttpContext.Session.GetString("pass");
            int    tipo   = (int)HttpContext.Session.GetInt32("tipo");
            int    idper  = (int)HttpContext.Session.GetInt32("id");

            try
            {
                // TODO: Add update logic here

                var context = HttpContext.RequestServices.GetService(typeof(proyecto_r_mcynContext)) as proyecto_r_mcynContext;
                var arti    = context.Articulo.Find(new object[] { id });

                DetalleArticulos detalleArticulo = new DetalleArticulos();
                detalleArticulo.IdPersonal = idper;
                detalleArticulo.IdArticulo = id;
                DateTime dateNow     = DateTime.Now.Date;
                string   formatMysql = dateNow.ToString("dd-MM-yyyy");
                detalleArticulo.FechaRevision           = formatMysql;
                detalleArticulo.ComentariosRetroaliment = textcoment;
                detalleArticulo.Status = 7;

                context.DetalleArticulos.Add(detalleArticulo);
                context.SaveChanges();

                if (articulo.Status == 10)
                {
                    arti.Status = articulo.Status;
                    context.Update(arti);
                    context.SaveChanges();

                    return(RedirectToAction(nameof(Listado)));
                }

                arti.Status = articulo.Status;
                context.Update(arti);
                context.SaveChanges();
                if (textcoment != null)
                {
                    HttpContext.Session.SetString("coment", textcoment);
                }
                if (id != 0)
                {
                    HttpContext.Session.SetInt32("idArti", id);
                }

                return(RedirectToAction(nameof(RevisoresDisponibles)));
            }
            catch
            {
                return(RedirectToAction(nameof(Asignacion)));
            }
        }
예제 #3
0
        public async Task <IActionResult> Revisar(DetalleArticulos detalleArticulos, IFormFile comentario)
        {
            try
            {
                var context = HttpContext.RequestServices.GetService(typeof(proyecto_r_mcynContext)) as proyecto_r_mcynContext;
                var detalle = context.DetalleArticulos.Find(new object[] { detalleArticulos.IdDetalleArt });

                if (comentario != null)
                {
                    var ComentName     = ContentDispositionHeaderValue.Parse(comentario.ContentDisposition.ToString()).FileName.Trim('"');
                    var RootPath       = _hostingEnv.WebRootPath;
                    var ComentFullPath = Path.Combine(RootPath, "ComentsUploaded");

                    if (!Directory.Exists(ComentFullPath))
                    {
                        Directory.CreateDirectory(ComentFullPath);
                    }

                    var ComentFullName = ComentFullPath + Path.DirectorySeparatorChar + ComentName;
                    using (var stream = new FileStream(ComentFullName, FileMode.Create))
                        await comentario.CopyToAsync(stream);

                    detalle.ComentariosRetroaliment = ComentFullName;
                    detalle.Status = detalleArticulos.Status;

                    DateTime dateNow     = DateTime.Now.Date;
                    string   formatMysql = dateNow.ToString("dd-MM-yyyy");

                    detalle.FechaRevision = formatMysql;
                    context.Update(detalle);
                    context.SaveChanges();

                    return(RedirectToAction(nameof(ListadoRevisores)));
                }
                return(RedirectToAction(nameof(Revisar)));
            }
            catch
            {
                return(RedirectToAction(nameof(Revisar)));
            }
        }
예제 #4
0
        public ActionResult AsignacionRevisores(int id_per, int id_articulo, string comentariomemo)
        {
            try
            {
                // TODO: Add delete logic here
                var context = HttpContext.RequestServices.GetService(typeof(proyecto_r_mcynContext)) as proyecto_r_mcynContext;

                var articulo = context.Articulo.Find(new object[] { id_articulo });
                articulo.Status = 7;
                context.Update(articulo);
                context.SaveChanges();

                DetalleArticulos detalle = new DetalleArticulos();

                detalle.Status     = 7;
                detalle.IdPersonal = id_per;
                detalle.IdArticulo = id_articulo;

                context.DetalleArticulos.Add(detalle);
                context.SaveChanges();

                if (comentariomemo != null)
                {
                    HttpContext.Session.SetString("comentariomemo", comentariomemo);
                }

                return(RedirectToAction(nameof(Listado)));
            }
            catch
            {
                HttpContext.Session.SetInt32("idArti", id_articulo);
                HttpContext.Session.SetString("coment", comentariomemo);

                return(RedirectToAction(nameof(RevisoresDisponibles)));
            }
        }