Ejemplo n.º 1
0
        public async Task <IActionResult> Create([Bind("ID,PaperTitle,PaperAbstract,PaperTypeID,PaperLength, StatusID")] PaperInfo paperInfo, string[] selectedOptions, IEnumerable <IFormFile> theFiles)
        //public async Task<IActionResult> Create([Bind("ID,PaperTitle,PaperAbstract,PaperTypeID,PaperLength,StatusID")] PaperInfo paperInfo, IEnumerable<IFormFile> theFiles, string[] selectedOptions)

        {
            try
            {
                UpdatePaperKeywords(selectedOptions, paperInfo);
                if (ModelState.IsValid)
                {
                    await AddDocuments(paperInfo, theFiles);

                    paperInfo.StatusID = 3;
                    _context.Add(paperInfo);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction(nameof(Index)));
                }
            }
            catch (Exception /* dex */)
            {
                ModelState.AddModelError("", "Unable to save changes after multiple attempts. Try again, and if the problem persists, see your system administrator.");
            }
            PopulateDropDownLists(paperInfo);

            PopulatePaperKeywordData(paperInfo);

            PopulateAssignedKeywordData(paperInfo);

            return(View(paperInfo));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("ID,RoleTitle")] Role role)
        {
            if (ModelState.IsValid)
            {
                _context.Add(role);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(role));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("ID,PaperTitle,PaperAbstract,PaperType,PaperLength,StatID")] PaperInfo paperInfo)
        {
            if (ModelState.IsValid)
            {
                _context.Add(paperInfo);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(paperInfo));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> Create([Bind("ID,StatName")] Status status)
        {
            if (ModelState.IsValid)
            {
                _context.Add(status);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(status));
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> Create([Bind("ID,ResTitle,ResFirst,ResMiddle,ResLast,ResEmail,ResBio")] Researcher researcher)
        {
            if (ModelState.IsValid)
            {
                _context.Add(researcher);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(researcher));
        }
Ejemplo n.º 6
0
        public async Task <IActionResult> Create([Bind("ID,Name")] PaperType paperType)
        {
            if (ModelState.IsValid)
            {
                _context.Add(paperType);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(paperType));
        }
Ejemplo n.º 7
0
        public async Task <IActionResult> Create([Bind("ID,KeyWord")] Keyword keyword)
        {
            if (ModelState.IsValid)
            {
                _context.Add(keyword);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(keyword));
        }
Ejemplo n.º 8
0
        public async Task <IActionResult> Create([Bind("ID,ReSponse")] ReviewAgain reviewAgain)
        {
            if (ModelState.IsValid)
            {
                _context.Add(reviewAgain);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(reviewAgain));
        }
Ejemplo n.º 9
0
        public async Task <IActionResult> Create([Bind("ID,RevID,ComAccess,Comtext")] Comment comment)
        {
            if (ModelState.IsValid)
            {
                _context.Add(comment);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(comment));
        }
Ejemplo n.º 10
0
        public async Task <IActionResult> Create([Bind("ID,FileName,TypeID")] File file)
        {
            if (ModelState.IsValid)
            {
                _context.Add(file);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(file));
        }
Ejemplo n.º 11
0
        public async Task <IActionResult> Create([Bind("Id,Name,PushEndpoint,PushP256DH,PushAuth,ResearcherID")] Sub sub)
        {
            if (ModelState.IsValid)
            {
                _context.Add(sub);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            PopulateSelectLists(sub);
            return(View(sub));
        }
Ejemplo n.º 12
0
        public async Task <IActionResult> Create([Bind("ID,PaperID,ResID,RoleID,RevContentReview,RevKeywordReview,RevLengthReview,RevFormatReview,RevCitationReview,RecID,ReRevID")] ReviewAssign reviewAssign)
        {
            if (ModelState.IsValid)
            {
                _context.Add(reviewAssign);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["RoleID"] = new SelectList(_context.Roles, "ID", "RoleTitle", reviewAssign.RoleID);
            return(View(reviewAssign));
        }
Ejemplo n.º 13
0
        public async Task <IActionResult> Create([Bind("ID,ResearcherID,RevID,ComAccess,Comtext")] Comment comment)
        {
            int userID = Convert.ToInt32(_userManager.GetUserId(User));
            var user   = await _userManager.GetUserAsync(User);

            if (ModelState.IsValid)
            {
                comment.ResearcherID = Convert.ToInt32(user.Id);
                _context.Add(comment);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(comment));
        }
Ejemplo n.º 14
0
        public async Task <IActionResult> Add([Bind("ID, PaperInfoID, ResearcherID, RolesID, RevContentReview, RevKeywordReview, RevLengthReview, RevFormatReview, RevCitationReview, EiCComment, AuthorComment, RecommendID, ReviewAgainID")] ReviewAssign reviewAssign, string[] selectedOptions, string PaperTitle)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    _context.Add(reviewAssign);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction("Index", new { reviewAssign.PaperInfoID }));
                }
            }

            catch (DbUpdateException)
            {
                ModelState.AddModelError("", "Unable to save changes");
            }
            PopulateDropDownLists(reviewAssign);
            ViewData["PaperTitle"] = PaperTitle;
            return(View(reviewAssign));
        }
Ejemplo n.º 15
0
        public async Task <IActionResult> Create([Bind("TitleID,ResFirst,ResMiddle,ResLast,ResEmail,ResBio,InstituteID")] Researcher researcher, string[] selectedOptions)
        {
            try
            {
                UpdateResearcherExpertises(selectedOptions, researcher);
                if (ModelState.IsValid)
                {
                    _context.Add(researcher);
                    await _context.SaveChangesAsync();

                    var url = "/details/" + researcher.ID;
                    return(RedirectToAction(url));
                }
            }
            catch (Exception /* dex */)
            {
                ModelState.AddModelError("", "Unable to save changes after multiple attempts. Try again, and if the problem persists, see your system administrator.");
            }
            PopulateAssignedExpertiseData(researcher);
            PopulateDropDownLists();
            return(RedirectToAction("~/Home/Index"));
        }
Ejemplo n.º 16
0
        public async Task <IActionResult> Create([Bind("ID, TitleID,ResFirst,ResLast,ResBio,InstituteID, ResEmail")] Researcher researcher, string[] selectedOptions)
        {
            researcher.ResEmail = User.Identity.Name;
            try
            {
                UpdateResearcherExpertises(selectedOptions, researcher);
                if (ModelState.IsValid)
                {
                    _context.Add(researcher);
                    await _context.SaveChangesAsync();

                    UpdateUserNameCookie(researcher.FullName);
                    return(RedirectToAction(nameof(Details)));
                }
            }
            catch (RetryLimitExceededException /* dex */)
            {
                ModelState.AddModelError("", "Unable to save changes after multiple attempts. Try again, and if the problem persists, see your system administrator.");
            }
            PopulateAssignedExpertiseData(researcher);
            PopulateDropDownLists();
            return(View(researcher));
        }
Ejemplo n.º 17
0
        public async Task <IActionResult> Add([Bind("ID,ReseacherID,RoleID,PaperInfoID")] ReviewAssign reviewAssign, string PaperTitle, int?PaperInfoID)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    _context.Add(reviewAssign);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction("Index", new { reviewAssign.PaperInfoID }));
                }
            }
            catch (DbUpdateException)
            {
                ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator.");
            }



            //PopulateDropDownLists(reviewAssign);
            ViewData["PaperTitle"] = PaperTitle;
            return(View(reviewAssign));
        }
Ejemplo n.º 18
0
        public async Task <IActionResult> Create(int id, [Bind("PaperInfoID, ResearcherID,RoleID,RevContentReview,RevKeywordReview,RevLengthReview,RevFormatReview,RevCitationReview, EiCComment, AuthorComment, RecommendID,ReviewAgainID")] ReviewAssign reviewAssign)
        {
            var reviewAssigns = from r in _context.ReviewAssigns
                                .Include(r => r.PaperInfo)
                                .ThenInclude(r => r.ID)
                                select r;

            try
            {
                if (ModelState.IsValid)
                {
                    _context.Add(reviewAssign);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction(nameof(Index)));
                }
            }
            catch (Exception)
            {
                ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator.");
            }
            PopulateDropDownLists();
            PopulateExpertiseDropDownList();

            ViewBag.ID = id;

            // Email coding
            //var researcher = await _context.Researchers
            //        .SingleOrDefaultAsync(m => m.ID == reviewAssign.ResearcherID);

            // Email coding
            //var researcher = await _context.Researchers
            //.SingleOrDefaultAsync(m => m.ID == reviewAssign.ResearcherID);

            //var resEmail = researcher.ResEmail.ToString();
            //var resName = researcher.FullName.ToString();



            //var message = new MimeMessage();
            //message.From.Add(new MailboxAddress("TRPR", "*****@*****.**"));
            //message.To.Add(new MailboxAddress(resName, "*****@*****.**"));
            //message.Subject = "TRPR - New Review";

            //message.Body = new TextPart("plain")
            //{
            //    Text = @"You've been assigned to a new review, head to TRPR to check it out!"
            //};

            //using (var client = new SmtpClient())
            //{
            //    // For demo-purposes, accept all SSL certificates (in case the server supports STARTTLS)
            //    client.ServerCertificateValidationCallback = (s, c, h, e) => true;


            //    client.Connect("smtp-relay.gmail.com", 587, false);

            //    // Note: only needed if the SMTP server requires authentication
            //    client.Authenticate("*****@*****.**", "Tq8uwocBDC");

            //    client.Send(message);
            //    client.Disconnect(true);
            //}
            try
            {
                _context.Add(reviewAssign);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }


            catch (Exception)
            {
                ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator.");
            }
            PopulateDropDownLists();
            PopulateExpertiseDropDownList();
            return(View(reviewAssign));
        }