public async Task <IActionResult> Create([Bind("Id,Title,Description,Indx,CourseChapterId,ContentType,FilePath,Duration,IsFree,IsDownloadable")] CourseChapterContent courseChapterContent, Guid cid, IFormFile myfile)
        {
            if (ModelState.IsValid)
            {
                courseChapterContent.FilePath = await UserFile.UploadeNewFileAsync(courseChapterContent.FilePath,
                                                                                   myfile, _environment.WebRootPath, Properties.Resources.Secured);

                if (courseChapterContent.ContentType == ContentType.youtube)
                {
                    int position = courseChapterContent.FilePath.IndexOf("=");
                    courseChapterContent.FilePath = courseChapterContent.FilePath.Substring(position + 1);
                }


                courseChapterContent.Description = courseChapterContent.Description.Replace("\n", "<br/>");


                courseChapterContent.Id = Guid.NewGuid();
                _context.Add(courseChapterContent);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Details", "CourseChapters", new { /* routeValues, for example: */ id = courseChapterContent.CourseChapterId }));
            }
            ViewData["CourseChapterId"] = new SelectList(_context.CourseChapters, "Id", "Name", courseChapterContent.CourseChapterId);
            return(View(courseChapterContent));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,ApplicationUserId,PublicationType,ArTitle,EnTitle,ArAuthors,EnAuthors,ArAbstract,EnAbstract,PublicationDate,Publisher,VolumeNo,IssueNo,ISSN,DOI,Pages,FileLink,ExternalLink,DownloadHits,Keywords")]
                                               Publication publication, IFormFile myfile)
        {
            if (id != publication.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    publication.FileLink = await UserFile.UploadeNewFileAsync(
                        _context.Publications.Where(m => m.Id == id).Select(c => c.FileLink).First(),
                        myfile, _environment.WebRootPath, Properties.Resources.PublicationFiles);

                    _context.Update(publication);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PublicationExists(publication.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(publication));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("Id,Name,Description,IsActive,ApplicationUserId,CreationDate,EmailContentId,ExpiryDate,EmailContentReminderId,IsEntBadgeRequired,ReminderDays,IsPdfInvitation,InvitationHeader,InvitationFooter,InvitationContext,EventDate")] RegistrationForm registrationForm, IFormFile myfile, IFormFile myfile1)
        {
            if (ModelState.IsValid)
            {
                registrationForm.InvitationHeader = await UserFile.UploadeNewFileAsync(registrationForm.InvitationHeader,
                                                                                       myfile, _environment.WebRootPath, Properties.Resources.Secured);

                registrationForm.InvitationFooter = await UserFile.UploadeNewFileAsync(registrationForm.InvitationFooter,
                                                                                       myfile1, _environment.WebRootPath, Properties.Resources.Secured);

                if (registrationForm.InvitationContext != null)
                {
                    registrationForm.InvitationContext = (System.Text.RegularExpressions.Regex.Replace(registrationForm.InvitationContext, @"(?></?\w+)(?>(?:[^>'""]+|'[^']*'|""[^""]*"")*)>", String.Empty)).Replace("\n", "<br/>");
                }
                registrationForm.ApplicationUserId = _userManager.GetUserId(User);
                registrationForm.CreationDate      = DateTime.Now;
                _context.Add(registrationForm);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ApplicationUserId"]      = new SelectList(_context.ApplicationUsers, "Id", "Id", registrationForm.ApplicationUserId);
            ViewData["EmailContentId"]         = new SelectList(_context.EmailContents, "Id", "ArSubject", registrationForm.EmailContentId);
            ViewData["EmailContentReminderId"] = new SelectList(_context.EmailContents, "Id", "ArSubject", registrationForm.EmailContentReminderId);
            return(View(registrationForm));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Create([Bind("Id,ApplicationUserId,Name,ShortName,BgImage,Logo,Description,CreationDate,CommunityType,SpecialityId,SecurityLevel,IsCommentsAllowed,IsFeatured,IsApproved,IsSuspended,Tags")] Community community, IFormFile myfile, IFormFile myfile1)
        {
            if (ModelState.IsValid)
            {
                community.ApplicationUserId = _userManager.GetUserId(User);
                community.BgImage           = await UserFile.UploadeNewFileAsync(community.BgImage,
                                                                                 myfile, _environment.WebRootPath, Properties.Resources.Community);

                community.Logo = await UserFile.UploadeNewImageAsync(community.Logo,
                                                                     myfile1, _environment.WebRootPath, Properties.Resources.Community, 50, 50);

                community.CreationDate      = DateTime.Now;
                community.IsFeatured        = false;
                community.IsSuspended       = false;
                community.IsApproved        = false;
                community.IsCommentsAllowed = true;
                community.SecurityLevel     = SecurityLevel.Open;
                community.CommunityType     = CommunityType.Community;
                _context.Add(community);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ApplicationUserId"] = new SelectList(_context.ApplicationUsers, "Id", "Id", community.ApplicationUserId);
            ViewData["SpecialityId"]      = new SelectList(_context.Specialities, "Id", "Name", community.SpecialityId);
            return(View(community));
        }
        public async Task <IActionResult> EditResubFile(int id, [Bind("Id,SubmissionId,JournalFileTypeId,FileName,Description")] SubmissionFile submissionFile, IFormFile myfile)
        {
            if (id != submissionFile.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    submissionFile.FileName = await UserFile.UploadeNewFileAsync(submissionFile.FileName,
                                                                                 myfile, _environment.WebRootPath, Properties.Resources.Secured);


                    _context.Update(submissionFile);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SubmissionFileExists(submissionFile.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("ResubmissionFiles", "SubmissionFiles", new { /* routeValues, for example: */ sid = submissionFile.SubmissionId }));
            }
            ViewData["JournalFileTypeId"] = new SelectList(_context.JournalFileTypes, "Id", "Id", submissionFile.JournalFileTypeId);
            ViewData["SubmissionId"]      = new SelectList(_context.Submissions, "Id", "CoverLetter", submissionFile.SubmissionId);
            return(View(submissionFile));
        }
Exemplo n.º 6
0
        public async Task <IActionResult> Create([Bind("Id,ArName,EnName,ArDescription,EnDescription,ShortName,Logo,PISSN,EISSN,Email,ActivationDate,CreatedByUserId,EiCId,JournalStatus,Visitors,ReviewerCertificateBackgroundFile,JournalHeader,AuthorCertificateBackgroundFile,PublisherId")] Journal journal, IFormFile myfile, IFormFile myfile1, IFormFile myfile2, IFormFile myfile3)
        {
            if (ModelState.IsValid)
            {
                journal.Logo = await UserFile.UploadeNewImageAsync(journal.Logo,
                                                                   myfile, _environment.WebRootPath, Properties.Resources.Images, 500, 500);

                journal.JournalHeader = await UserFile.UploadeNewImageAsync(journal.JournalHeader,
                                                                            myfile1, _environment.WebRootPath, Properties.Resources.Images, 500, 500);

                journal.ReviewerCertificateBackgroundFile = await UserFile.UploadeNewFileAsync(journal.ReviewerCertificateBackgroundFile,
                                                                                               myfile2, _environment.WebRootPath, Properties.Resources.Images);

                journal.AuthorCertificateBackgroundFile = await UserFile.UploadeNewFileAsync(journal.AuthorCertificateBackgroundFile,
                                                                                             myfile3, _environment.WebRootPath, Properties.Resources.Images);

                journal.CreatedByUserId = _userManager.GetUserId(User);
                journal.ArDescription   = journal.ArDescription.Replace("\n", "<br/>");
                journal.EnDescription   = journal.EnDescription.Replace("\n", "<br/>");
                journal.ActivationDate  = DateTime.Now;
                journal.JournalStatus   = JournalStatus.UnderReview;


                _context.Add(journal);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ApplicantUserId"] = new SelectList(_context.ApplicationUsers, "Id", "Id", journal.CreatedByUserId);
            ViewData["EditorinChiefId"] = new SelectList(_context.ApplicationUsers, "Id", "Id", journal.EiCId);
            ViewData["PublisherId"]     = new SelectList(_context.Publishers, "Id", "ArName", journal.PublisherId);
            return(View(journal));
        }
        public async Task <IActionResult> TechnicalCreate(int sid, [Bind("Id,SubmissionId,JournalFileTypeId,FileName,Description")] SubmissionFile submissionFile, IFormFile myfile)
        {
            var sub          = _context.Submissions.SingleOrDefault(a => a.Id == submissionFile.SubmissionId);
            var ManuscriptId = sub.ManuscriptId;
            var journalfile  = _context.JournalFileTypes.SingleOrDefault(a => a.Id == submissionFile.JournalFileTypeId);

            if (ModelState.IsValid)
            {
                if (submissionFile.Description != null)
                {
                    submissionFile.Description = submissionFile.Description.Replace("\n", "<br/>");
                }
                if (journalfile.FileTypeId == 4)
                {
                    submissionFile.FileName = await UserFile.UploadeNewFileAsync(submissionFile.FileName,
                                                                                 myfile, _environment.WebRootPath, Properties.Resources.PublicationFiles);
                }
                else
                {
                    submissionFile.FileName = await UserFile.UploadeNewFileAsync(submissionFile.FileName,
                                                                                 myfile, _environment.WebRootPath, Properties.Resources.Secured);
                }

                _context.Add(submissionFile);
                await _context.SaveChangesAsync();

                return(RedirectToAction("TechnicalEditorDetails", "Manuscripts", new { /* routeValues, for example: */ id = ManuscriptId }));
            }
            ViewData["JournalFileTypeId"] = new SelectList(_context.JournalFileTypes, "Id", "Id", submissionFile.JournalFileTypeId);
            ViewData["SubmissionId"]      = new SelectList(_context.Submissions, "Id", "CoverLetter", submissionFile.SubmissionId);
            return(View(submissionFile));
        }
Exemplo n.º 8
0
        public async Task <IActionResult> Create([Bind("Id,ApplicationUserId,PublicationType,ArTitle,EnTitle,ArAuthors,EnAuthors,ArAbstract,EnAbstract,PublicationDate,Publisher,VolumeNo,IssueNo,ISSN,DOI,Pages,FileLink,ExternalLink,DownloadHits,Keywords")]
                                                 Publication publication, IFormFile myfile)
        {
            if (ModelState.IsValid)
            {
                publication.FileLink = await UserFile.UploadeNewFileAsync(publication.FileLink,
                                                                          myfile, _environment.WebRootPath, Properties.Resources.PublicationFiles);

                _context.Add(publication);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ApplicationUserId"] = _userManager.GetUserId(User);
            return(View(publication));
        }
Exemplo n.º 9
0
        public async Task <IActionResult> CreateBlog(int?cid, [Bind("Id,Title,Body,DateTime,IsCommentsAllowed,Image,File,IsApproved,IsHidden,IsFeatured,Reads,IsDeleted,CommunityId,ApplicationUserId,Tags,PostType,IsPublishRequest,PublishRequestStatus,IsGifted,GiftType")] Post post, IFormFile myfile, IFormFile myfile1)
        {
            if (ModelState.IsValid)
            {
                post.Image = await UserFile.UploadeNewImageAsync(post.Image,
                                                                 myfile, _environment.WebRootPath, Properties.Resources.Community, 500, 500);

                post.File = await UserFile.UploadeNewFileAsync(post.File,
                                                               myfile1, _environment.WebRootPath, Properties.Resources.Community);

                post.ApplicationUserId = _userManager.GetUserId(User);
                post.DateTime          = DateTime.Now;
                post.Reads             = 0;
                post.IsApproved        = true;
                post.IsDeleted         = false;
                post.IsHidden          = false;
                post.IsFeatured        = false;
                post.IsGifted          = false;
                post.Body = (System.Text.RegularExpressions.Regex.Replace(post.Body, @"(?></?\w+)(?>(?:[^>'""]+|'[^']*'|""[^""]*"")*)>", String.Empty)).Replace("\n", "<br/>");
                //post.Title = RemoveSpecialChars(post.Title.Replace("/", " "));
                //  post.Title = post.Title.Replace("/", "");
                //  post.Title = post.Title.Replace(@"\", string.Empty);
                //if (_context.Community.SingleOrDefault(a => a.Id == cid).CommunityType == CommunityType.Community)
                //{
                post.PostType = GroupPostType.QA;
                //}
                //else
                //{ post.PostType = PostType.Article; }

                post.Id = Guid.NewGuid();
                _context.Add(post);
                _context.ScoreLogs.Add(new ScoreLog
                {
                    Id = Guid.NewGuid(),
                    ApplicationUserId = _userManager.GetUserId(User),
                    PostId            = post.Id,
                    Date         = DateTime.Now,
                    ScoreValueId = 2
                });

                await _context.SaveChangesAsync();

                return(RedirectToAction("Details", new { id = post.Id }));
            }
            ViewData["CommunityId"] = new SelectList(_context.Communities.Where(a => a.Id == post.CommunityId), "Id", "Name", cid);
            return(View(post));
        }
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,Title,Description,Indx,CourseChapterId,ContentType,FilePath,Duration,IsFree,IsDownloadable")] CourseChapterContent courseChapterContent, IFormFile myfile)
        {
            if (id != courseChapterContent.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    if (courseChapterContent.ContentType == ContentType.youtube)
                    {
                        int position = courseChapterContent.FilePath.LastIndexOf("=");
                        courseChapterContent.FilePath = courseChapterContent.FilePath.Substring(position + 1);
                    }
                    if (courseChapterContent.ContentType == ContentType.vimeo)
                    {
                        int position = courseChapterContent.FilePath.LastIndexOf("/");
                        courseChapterContent.FilePath = courseChapterContent.FilePath.Substring(position + 1);
                    }

                    courseChapterContent.FilePath = await UserFile.UploadeNewFileAsync(courseChapterContent.FilePath,
                                                                                       myfile, _environment.WebRootPath, Properties.Resources.ScientificEvent);


                    _context.Update(courseChapterContent);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CourseChapterContentExists(courseChapterContent.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                var coursechapter = _context.CourseChapters.Include(c => c.Course).SingleOrDefault(c => c.Id == courseChapterContent.CourseChapterId);
                return(RedirectToAction("Details", "Courses", new { /* routeValues, for example: */ id = coursechapter.CourseId }));
            }
            ViewData["CourseChapterId"] = new SelectList(_context.CourseChapters, "Id", "Name", courseChapterContent.CourseChapterId);
            return(View(courseChapterContent));
        }
Exemplo n.º 11
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,ArName,EnName,ArDescription,EnDescription,ShortName,Logo,PISSN,EISSN,Email,ActivationDate,CreatedByUserId,EiCId,JournalStatus,Visitors,ReviewerCertificateBackgroundFile,JournalHeader,AuthorCertificateBackgroundFile,PublisherId")] Journal journal, IFormFile myfile, IFormFile myfile1, IFormFile myfile2, IFormFile myfile3)
        {
            if (id != journal.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                journal.Logo = await UserFile.UploadeNewImageAsync(journal.Logo,
                                                                   myfile, _environment.WebRootPath, Properties.Resources.Images, 500, 500);

                journal.JournalHeader = await UserFile.UploadeNewImageAsync(journal.JournalHeader,
                                                                            myfile1, _environment.WebRootPath, Properties.Resources.Images, 500, 500);

                journal.ReviewerCertificateBackgroundFile = await UserFile.UploadeNewFileAsync(journal.ReviewerCertificateBackgroundFile,
                                                                                               myfile2, _environment.WebRootPath, Properties.Resources.Images);

                journal.AuthorCertificateBackgroundFile = await UserFile.UploadeNewFileAsync(journal.AuthorCertificateBackgroundFile,
                                                                                             myfile3, _environment.WebRootPath, Properties.Resources.Images);



                try
                {
                    _context.Update(journal);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!JournalExists(journal.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ApplicantUserId"] = new SelectList(_context.ApplicationUsers, "Id", "Id", journal.CreatedByUserId);
            ViewData["EditorinChiefId"] = new SelectList(_context.ApplicationUsers, "Id", "Id", journal.EiC);
            ViewData["PublisherId"]     = new SelectList(_context.Publishers, "Id", "ArName", journal.PublisherId);
            return(View(journal));
        }
        public async Task <IActionResult> ResubmissionFiles([Bind("Id,SubmissionId,JournalFileTypeId,FileName,Description")] SubmissionFile submissionFile, IFormFile myfile)
        {
            if (ModelState.IsValid)
            {
                submissionFile.Description = submissionFile.Description.Replace("\n", "<br/>");
                submissionFile.FileName    = await UserFile.UploadeNewFileAsync(submissionFile.FileName,
                                                                                myfile, _environment.WebRootPath, Properties.Resources.Secured);


                _context.Add(submissionFile);
                await _context.SaveChangesAsync();

                return(RedirectToAction("ResubmissionFiles", "SubmissionFiles", new { /* routeValues, for example: */ sid = submissionFile.SubmissionId }));
            }
            ViewData["JournalFileTypeId"] = new SelectList(_context.JournalFileTypes, "Id", "Id", submissionFile.JournalFileTypeId);
            ViewData["SubmissionId"]      = new SelectList(_context.Submissions, "Id", "CoverLetter", submissionFile.SubmissionId);
            return(View(submissionFile));
        }
        public async Task <IActionResult> Create(int jid, [Bind("Name,Releasedate,Cover,Pdf,Number,JournalId,VolumeId,IsPublished,IsOpen,Visitors,PdfDownloadCounter")] JournalIssue journalIssue, IFormFile myfile, IFormFile myfile1)
        {
            if (ModelState.IsValid)
            {
                journalIssue.Pdf = await UserFile.UploadeNewFileAsync(journalIssue.Pdf,
                                                                      myfile, _environment.WebRootPath, Properties.Resources.Secured);

                journalIssue.Cover = await UserFile.UploadeNewImageAsync(journalIssue.Cover,
                                                                         myfile1, _environment.WebRootPath, Properties.Resources.Images, 100, 150);

                _context.Add(journalIssue);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index", new { id = jid }));
            }
            ViewData["JournalId"] = new SelectList(_context.Journals.Where(a => a.Id == jid), "Id", "ArName", journalIssue.JournalId);
            ViewData["VolumeId"]  = new SelectList(_context.Volumes.Where(a => a.JournalId == jid), "Id", "Id", journalIssue.VolumeId);
            return(View(journalIssue));
        }
Exemplo n.º 14
0
        public async Task <IActionResult> EditBlog(Guid id, [Bind("Id,Title,Body,DateTime,IsCommentsAllowed,Image,File,IsApproved,IsHidden,IsFeatured,Reads,IsDeleted,CommunityId,ApplicationUserId,Tags,PostType,IsPublishRequest,PublishRequestStatus,IsGifted,GiftType")] Post post, IFormFile myfile, IFormFile myfile1)
        {
            if (id != post.Id)
            {
                return(NotFound());
            }
            if (ModelState.IsValid)
            {
                try
                {
                    // var postitem = _context.Posts.SingleOrDefault(m => m.Id == id);
                    post.Image = await UserFile.UploadeNewImageAsync(post.Image,
                                                                     myfile, _environment.WebRootPath, Properties.Resources.Community, 500, 500);

                    post.File = await UserFile.UploadeNewFileAsync(post.File,
                                                                   myfile1, _environment.WebRootPath, Properties.Resources.Community);

                    post.ApplicationUserId = _userManager.GetUserId(User);
                    post.DateTime          = DateTime.Now;
                    post.IsHidden          = post.IsHidden;
                    post.Body = (System.Text.RegularExpressions.Regex.Replace(post.Body, @"(?></?\w+)(?>(?:[^>'""]+|'[^']*'|""[^""]*"")*)>", String.Empty)).Replace("\n", "<br/>");
                    //  post.Title = post.Title.Replace("/", "-");

                    _context.Update(post);
                    _context.SaveChanges();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PostExists(post.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Details), new { id = post.Id }));
            }
            ViewData["ApplicationUserId"] = new SelectList(_context.ApplicationUsers, "Id", "Id", post.ApplicationUserId);
            ViewData["CommunityId"]       = new SelectList(_context.Set <Community>(), "Id", "BgImage", post.CommunityId);
            return(View(post));
        }
Exemplo n.º 15
0
        public async Task <IActionResult> CreateGroupPost(int?cid, [Bind("Id,Title,Body,DateTime,IsCommentsAllowed,Image,File,IsApproved,IsHidden,IsFeatured,Reads,IsDeleted,CommunityId,ApplicationUserId,Tags,PostType,IsPublishRequest,PublishRequestStatus,IsGifted,GiftType")] Post post, IFormFile myfile, IFormFile myfile1)
        {
            if (ModelState.IsValid)
            {
                post.Image = await UserFile.UploadeNewImageAsync(post.Image,
                                                                 myfile, _environment.WebRootPath, Properties.Resources.Secured, 700, 500);

                post.File = await UserFile.UploadeNewFileAsync(post.File,
                                                               myfile1, _environment.WebRootPath, Properties.Resources.Secured);

                post.ApplicationUserId = _userManager.GetUserId(User);
                post.DateTime          = DateTime.Now;
                post.Reads             = 0;
                post.IsApproved        = true;
                post.IsDeleted         = false;
                post.IsHidden          = false;
                post.IsFeatured        = false;
                post.IsGifted          = false;
                //if (_context.Community.SingleOrDefault(a => a.Id == cid).CommunityType == CommunityType.Community)
                //{
                post.PostType = GroupPostType.QA;
                //}
                //else
                //{ post.PostType = PostType.Article; }

                post.Id = Guid.NewGuid();
                _context.Add(post);
                _context.ScoreLogs.Add(new ScoreLog
                {
                    Id = Guid.NewGuid(),
                    ApplicationUserId = _userManager.GetUserId(User),
                    PostId            = post.Id,
                    Date         = DateTime.Now,
                    ScoreValueId = 1
                });

                await _context.SaveChangesAsync();

                return(RedirectToAction("Details", new { id = post.Id }));
            }
            ViewData["CommunityId"] = new SelectList(_context.Communities.Where(a => a.Id == post.CommunityId), "Id", "Name", cid);
            return(View(post));
        }
Exemplo n.º 16
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,ArName,EnName,ApplicationUserId,StartingDate,EndingDate,DateOfRecord,LastUpdate,Image,IntroductoryVideo,Flyer,FilePdf,Effort,IsPaid,CourseFees,Certificate,CertificateCost,IsAdminApproved,IsActive,IsFeatured,Overview,Introduction,LearningOutcomes,Requirements,Tags,SpecialityId,TargetStudents,ImportantDates,Language")] Course course, IFormFile myfile, IFormFile myfile1, IFormFile myfile2)
        {
            if (id != course.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    course.LastUpdate = DateTime.Now;
                    course.Image      = await UserFile.UploadeNewImageAsync(course.Image,
                                                                            myfile, _environment.WebRootPath, Properties.Resources.ScientificEvent, 500, 500);

                    course.Flyer = await UserFile.UploadeNewImageAsync(course.Flyer,
                                                                       myfile1, _environment.WebRootPath, Properties.Resources.ScientificEvent, 500, 500);

                    course.FilePdf = await UserFile.UploadeNewFileAsync(course.FilePdf,
                                                                        myfile2, _environment.WebRootPath, Properties.Resources.ScientificEvent);


                    _context.Update(course);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CourseExists(course.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ApplicationUserId"] = new SelectList(_context.ApplicationUsers, "Id", "Id", course.ApplicationUserId);
            ViewData["SpecialityId"]      = new SelectList(_context.Specialities, "Id", "EnSpecialityName", course.SpecialityId);
            return(View(course));
        }
        public async Task <IActionResult> AddReplyDetails(IFormFile file, string reply, int mid)
        {
            if (mid != 0)
            {
                Message message = _context.Messages.SingleOrDefault(m => m.Id == mid);
                message.LastActivitydate = DateTime.Now;
                message.IsRead           = false;
                _context.Messages.Update(message);
            }
            if (file != null)
            {
                _context.MessageReplies.Add(new MessageReply
                {
                    ApplicationUserId = _userManager.GetUserId(User),
                    Content           = reply,
                    Attachment        = await UserFile.UploadeNewFileAsync("", file, _environment.WebRootPath, Properties.Resources.Secured),
                    MessageId         = mid,
                    DateOfRecord      = DateTime.Now,
                    IsRead            = false,
                    IsDeleted         = false,
                    IsReported        = false,
                });
            }
            else
            {
                _context.MessageReplies.Add(new MessageReply
                {
                    ApplicationUserId = _userManager.GetUserId(User),
                    Content           = reply,
                    MessageId         = mid,
                    DateOfRecord      = DateTime.Now,
                    IsRead            = false,
                    IsDeleted         = false,
                    IsReported        = false,
                });
            }
            _context.SaveChanges();

            return(RedirectToAction("Details", "Messages", new { id = mid }));
        }
Exemplo n.º 18
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,ApplicationUserId,Name,ShortName,BgImage,Logo,Description,CreationDate,CommunityType,SpecialityId,SecurityLevel,IsCommentsAllowed,IsFeatured,IsApproved,IsSuspended,Tags")] Community community, IFormFile myfile, IFormFile myfile1)
        {
            if (id != community.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    community.BgImage = await UserFile.UploadeNewFileAsync(community.BgImage,
                                                                           myfile, _environment.WebRootPath, Properties.Resources.Community);

                    community.Logo = await UserFile.UploadeNewImageAsync(community.Logo,
                                                                         myfile1, _environment.WebRootPath, Properties.Resources.Community, 50, 50);



                    community.SpecialityId = 1;
                    _context.Update(community);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CommunityExists(community.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ApplicationUserId"] = new SelectList(_context.ApplicationUsers, "Id", "Id", community.ApplicationUserId);
            ViewData["SpecialityId"]      = new SelectList(_context.Specialities, "Id", "EnSpecialityName", community.SpecialityId);
            return(View(community));
        }
Exemplo n.º 19
0
        public async Task <IActionResult> Create([Bind("Id,ApplicationUserId,Title,Skills,Description,ExternalLink,Image,File,Likes,Views,DateOfRecord,DateOfAchievement")] FreelancerPortfolio freelancerPortfolio, IFormFile myfile, IFormFile myfile2)
        {
            if (ModelState.IsValid)
            {
                freelancerPortfolio.Image = await UserFile.UploadeNewImageAsync(freelancerPortfolio.Image,
                                                                                myfile, _environment.WebRootPath, Properties.Resources.Images, 500, 500);

                freelancerPortfolio.File = await UserFile.UploadeNewFileAsync(freelancerPortfolio.File,
                                                                              myfile2, _environment.WebRootPath, Properties.Resources.Files);


                freelancerPortfolio.DateOfRecord = DateTime.Now;

                _context.Add(freelancerPortfolio);
                await _context.SaveChangesAsync();

                //return RedirectToAction(nameof(Index));
                return(RedirectToAction("FreelancerDetails", "ApplicationUsers", new { /* routeValues, for example: */ id = freelancerPortfolio.ApplicationUserId }));
            }
            ViewData["ApplicationUserId"] = new SelectList(_context.ApplicationUsers, "Id", "Id", freelancerPortfolio.ApplicationUserId);
            return(View(freelancerPortfolio));
        }
Exemplo n.º 20
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,ApplicationUserId,Title,Skills,Description,ExternalLink,Image,File,Likes,Views,DateOfRecord,DateOfAchievement")] FreelancerPortfolio freelancerPortfolio, IFormFile myfile, IFormFile myfile2)
        {
            if (id != freelancerPortfolio.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    freelancerPortfolio.Image = await UserFile.UploadeNewImageAsync(freelancerPortfolio.Image,
                                                                                    myfile, _environment.WebRootPath, Properties.Resources.Images, 500, 500);

                    freelancerPortfolio.File = await UserFile.UploadeNewFileAsync(freelancerPortfolio.File,
                                                                                  myfile2, _environment.WebRootPath, Properties.Resources.Files);



                    _context.Update(freelancerPortfolio);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!FreelancerPortfolioExists(freelancerPortfolio.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ApplicationUserId"] = new SelectList(_context.ApplicationUsers, "Id", "Id", freelancerPortfolio.ApplicationUserId);
            return(View(freelancerPortfolio));
        }
Exemplo n.º 21
0
        public async Task <IActionResult> Create([Bind("Id,ArName,EnName,ApplicationUserId,StartingDate,EndingDate,DateOfRecord,LastUpdate,Image,IntroductoryVideo,Flyer,FilePdf,Effort,IsPaid,CourseFees,Certificate,CertificateCost,IsAdminApproved,IsActive,IsFeatured,Overview,Introduction,LearningOutcomes,Requirements,Tags,SpecialityId,TargetStudents,ImportantDates,Language,IsPrerecorded,IsDeleted,Ishidden,IsReported,IsPrivate,AccessPassword,PassingMark")] Course course, IFormFile myfile, IFormFile myfile1, IFormFile myfile2, IFormFile myfile3)
        {
            if (ModelState.IsValid)
            {
                course.ApplicationUserId = _userManager.GetUserId(User);
                course.DateOfRecord      = DateTime.Now;
                course.Image             = await UserFile.UploadeNewImageAsync(course.Image,
                                                                               myfile, _environment.WebRootPath, Properties.Resources.ScientificEvent, 500, 500);

                course.Flyer = await UserFile.UploadeNewImageAsync(course.Flyer,
                                                                   myfile1, _environment.WebRootPath, Properties.Resources.ScientificEvent, 500, 500);

                course.FilePdf = await UserFile.UploadeNewFileAsync(course.FilePdf,
                                                                    myfile2, _environment.WebRootPath, Properties.Resources.ScientificEvent);

                course.IntroductoryVideo = await UserFile.UploadeNewFileAsync(course.IntroductoryVideo,
                                                                              myfile3, _environment.WebRootPath, Properties.Resources.ScientificEvent);

                course.Effort           = course.Effort.Replace("\n", "<br/>");
                course.Overview         = course.Overview.Replace("\n", "<br/>");
                course.Introduction     = course.Introduction.Replace("\n", "<br/>");
                course.LearningOutcomes = course.LearningOutcomes.Replace("\n", "<br/>");
                course.Requirements     = course.Requirements.Replace("\n", "<br/>");
                course.ImportantDates   = course.ImportantDates.Replace("\n", "<br/>");
                course.IsActive         = true;



                _context.Add(course);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ApplicationUserId"] = new SelectList(_context.ApplicationUsers, "Id", "Id", course.ApplicationUserId);
            ViewData["SpecialityId"]      = new SelectList(_context.Specialities, "Id", "EnSpecialityName", course.SpecialityId);
            return(View(course));
        }
Exemplo n.º 22
0
        public async Task <IActionResult> Process(int id, int maid, [Bind("Id,SubmissionId,ReviewerUserId,DueDate,ReviewerStatus,IsCertificateOfReviewingGranted,DateRevisionCertificae,EICInstructions,ReviewerInstructionsToEIC,ReviewerInstructionsToAuthor,DateOfRecord,ReviewDate,CieAeUserId,DecisionDate,ReviewerDecisionToReview,IsAccess,IsNewInfo,IsWithinJournalScope,AbstractCompatibility,IsFormsAccepted,IsPublishedPreviously,IsValuable,IsRepeatedInfo,ResearchLength,TheoreticalResults,Method,IsCommitted,IsMatchTitleContent,IsModernSourcesAdopted,IsDiscussionDocumentedJustified,IsInterpretedResult,Evaluation,RecommendationToPublish,NotForPublicationReason,Adjustments,PublishLocation,ReviewReportFile")] SubmissionReviewer submissionReviewer, IFormFile myfile)
        {
            if (id != submissionReviewer.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    submissionReviewer.ReviewReportFile = await UserFile.UploadeNewFileAsync(submissionReviewer.ReviewReportFile,
                                                                                             myfile, _environment.WebRootPath, Properties.Resources.ScientificEvent);

                    submissionReviewer.ReviewDate = DateTime.Now;

                    _context.Update(submissionReviewer);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SubmissionReviewerExists(submissionReviewer.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
            }
            ViewData["CieAeUserId"]    = new SelectList(_context.ApplicationUsers, "Id", "Id", submissionReviewer.CieAeUserId);
            ViewData["ReviewerUserId"] = new SelectList(_context.ApplicationUsers, "Id", "Id", submissionReviewer.ReviewerUserId);
            ViewData["SubmissionId"]   = new SelectList(_context.Submissions, "Id", "CoverLetter", submissionReviewer.SubmissionId);
            return(RedirectToAction("Process", "SubmissionReviewers", new { /* routeValues, for example: */ id = submissionReviewer.Id, mid = maid }));
        }
Exemplo n.º 23
0
        public async Task <IActionResult> Index(IndexViewModel model, IFormFile myfile1, IFormFile myfile2)
        {
            var user = await _userManager.GetUserAsync(User);

            if (user == null)
            {
                throw new ApplicationException($"Unable to load user with ID '{_userManager.GetUserId(User)}'.");
            }

            if (!ModelState.IsValid)
            {
                if (CultureInfo.CurrentCulture.Name.Contains("ar"))
                {
                    ViewData["CountryId"]    = new SelectList(_context.Countries, "Id", "ArCountryName", model.CountryId);
                    ViewData["CityId"]       = new SelectList(_context.Cities.Where(c => c.CountryId == model.CountryId), "Id", "ArCityName", model.CityId);
                    ViewData["UniversityId"] = new SelectList(_context.Universities.Where(c => c.CountryId == model.CountryId && c.IsIndexed == true), "Id", "ArUniversityName", model.UniversityId);
                    ViewData["FacultyId"]    = new SelectList(_context.Faculties.Where(c => c.UniversityId == model.UniversityId), "Id", "ArFacultyName", model.FacultyId);
                    ViewData["ReferredById"] = new SelectList(_context.ApplicationUsers, "Id", "Id", model.ReferredById);
                }
                else
                {
                    ViewData["CountryId"]    = new SelectList(_context.Countries, "Id", "EnCountryName", model.CountryId);
                    ViewData["CityId"]       = new SelectList(_context.Cities.Where(c => c.CountryId == model.CountryId), "Id", "EnCityName", model.CityId);
                    ViewData["UniversityId"] = new SelectList(_context.Universities.Where(c => c.CountryId == model.CountryId && c.IsIndexed == true), "Id", "EnUniversityName", model.UniversityId);
                    ViewData["FacultyId"]    = new SelectList(_context.Faculties.Where(c => c.UniversityId == model.UniversityId), "Id", "EnFacultyName", model.FacultyId);
                    ViewData["ReferredById"] = new SelectList(_context.ApplicationUsers, "Id", "Id", model.ReferredById);
                }
                var requestCulture = HttpContext.Features.Get <IRequestCultureFeature>();
                List <CultureInfo> cultureItems = ((RouteDataRequestCultureProvider)requestCulture.Provider).Options.SupportedCultures.ToList();
                ViewData["UILanguageId"] = new SelectList(cultureItems, "Name", "NativeName", model.UILanguage);
                return(View(model));
            }



            var email = user.Email;

            if (model.Email != email)
            {
                var setEmailResult = await _userManager.SetEmailAsync(user, model.Email);

                if (!setEmailResult.Succeeded)
                {
                    throw new ApplicationException($"Unexpected error occurred setting email for user with ID '{user.Id}'.");
                }
            }

            var phoneNumber = user.PhoneNumber;

            if (model.PhoneNumber != phoneNumber)
            {
                var setPhoneResult = await _userManager.SetPhoneNumberAsync(user, model.PhoneNumber);

                if (!setPhoneResult.Succeeded)
                {
                    throw new ApplicationException($"Unexpected error occurred setting phone number for user with ID '{user.Id}'.");
                }
            }

            if (model.IsNotUniversity == true)
            {
                user.UniversityId = 1;
                user.FacultyId    = 1;
            }
            else
            {
                user.UniversityId = model.UniversityId;
                user.FacultyId    = model.FacultyId;
            }

            //------------------------------------------
            //user.RegDate = model.RegDate;
            //user.Status = model.Status;
            //user.ARID = model.ARID;
            //user.ARIDDate = model.ARIDDate;
            //user.ReferredById = model.ReferredById;
            if (user.ARID == 0)
            {
                int maxARID = _context.ApplicationUsers.Max(a => a.ARID);
                user.ARID     = maxARID + 1;
                user.ARIDDate = DateTime.Now;
                user.Status   = StatusType.Active;
            }

            user.SecondEmail     = model.SecondEmail;
            user.ArName          = model.ArName;
            user.EnName          = model.EnName;
            user.OtherNames      = model.OtherNames;
            user.DateofBirth     = model.DateofBirth;
            user.Gender          = model.Gender;
            user.UILanguage      = model.UILanguage;
            user.CountryId       = model.CountryId;
            user.CityId          = model.CityId;
            user.FeaturedImage   = model.FeaturedImage;
            user.Summary         = model.Summary;
            user.ContactMeDetail = model.ContactMeDetail;
            model.ProfileImage   = await UserFile.UploadeNewImageAsync(user.ProfileImage, myfile1, _environment.WebRootPath, Properties.Resources.ProfileImageFolder, 400, 300);

            user.ProfileImage = model.ProfileImage;
            model.CVURL       = await UserFile.UploadeNewFileAsync(user.CVURL, myfile2, _environment.WebRootPath, Properties.Resources.CVFileFolder);

            user.CVURL = model.CVURL;
            //user.Visitors = model.Visitors;
            user.DAL             = model.DAL;
            user.DALEnabled      = true;
            user.IsFreelancer    = model.IsFreelancer;
            user.LastLogin       = DateTime.Now;
            user.FirmName        = model.FirmName;
            user.IsNotUniversity = model.IsNotUniversity;

            await _userManager.UpdateAsync(user);

            _context.SaveChanges();
            //------------------------------------------

            StatusMessage = _localizer["Updated"];
            return(RedirectToAction(nameof(Index)));
        }
        public async Task <IActionResult> AddReply(IFormFile file, string reply, int messageid)
        {
            Message message = _context.Messages.SingleOrDefault(m => m.Id == messageid);

            if (messageid != 0)
            {
                message.LastActivitydate = DateTime.Now;
                message.IsRead           = false;
                _context.Messages.Update(message);
            }
            if (file != null)
            {
                _context.MessageReplies.Add(new MessageReply
                {
                    ApplicationUserId = _userManager.GetUserId(User),
                    Content           = reply,
                    Attachment        = await UserFile.UploadeNewFileAsync("", file, _environment.WebRootPath, Properties.Resources.Secured),
                    MessageId         = messageid,
                    DateOfRecord      = DateTime.Now,
                    IsRead            = false,
                    IsDeleted         = false,
                    IsReported        = false,
                });
            }
            else
            {
                _context.MessageReplies.Add(new MessageReply
                {
                    ApplicationUserId = _userManager.GetUserId(User),
                    Content           = reply,
                    MessageId         = messageid,
                    DateOfRecord      = DateTime.Now,
                    IsRead            = false,
                    IsDeleted         = false,
                    IsReported        = false,
                });
            }
            _context.SaveChanges();

            ApplicationUser currentUser = _context.ApplicationUsers.SingleOrDefault(a => a.Id == message.ToApplicationUserId);
            StringBuilder   Welcome     = new StringBuilder("<h3 align ='right'>سعادة ");

            Welcome.AppendFormat(string.Format(currentUser.ArName));
            Welcome.Append("</h3>");
            Welcome.Append("</br>");

            StringBuilder Footer = new StringBuilder("<h3 align ='right'>أطيب التحيات</h3>");

            Footer.Append("<h3 align ='right'>فريق منصة اريد");

            Footer.Append("</h3>");

            EmailContent content2 = _context.EmailContents.Where(m => m.UniqueName.ToString() == "3a6ac0b2-304f-49f0-8db8-87a11f76e63a").SingleOrDefault();
            //BackgroundJob.Schedule(() => _emailSender.SendEmailAsync(email, content2.ArSubject, content2.ArContent), TimeSpan.FromSeconds(1));


            //         StringBuilder MyStringBuilder = new StringBuilder("");
            //MyStringBuilder.AppendFormat(string.Format("<h2 align ='center'><a href='https://portal.arid.my/ar-LY/Account/Register/' >"));
            //MyStringBuilder.Append("اضغط هنا للتسجيل في منصة اريد ");
            //MyStringBuilder.Append("</a></h2>");

            string link = "https://portal.arid.my/ar-LY/Account/DAL/" + currentUser.DAL;

            BackgroundJob.Schedule(() => _emailSender.SendEmailAsync(currentUser.Email, "رد جديد:" + message.Subject, Welcome.ToString() + content2.ArContent +
                                                                     $"<center><b><a href='{HtmlEncoder.Default.Encode(link)}'>رابط الدخول المباشر الى حسابكم في منصة أُريد </a> </p></b></center> <br/>" + Footer.ToString()), TimeSpan.FromSeconds(3));


            return(RedirectToAction("Index", "Messages", new { id = messageid }));
        }
Exemplo n.º 25
0
        public async Task <IActionResult> AddChapterContent(IFormFile file, string title, string desc, string duration, string vimeo, string youtube, string link, bool isfree, bool isdownload, int indx, ContentType contenttype, Guid coursechid)
        {
            if (contenttype == ContentType.file)
            {
                _context.CourseChapterContents.Add(new CourseChapterContent
                {
                    Title           = title,
                    FilePath        = await UserFile.UploadeNewFileAsync("", file, _environment.WebRootPath, Properties.Resources.Secured),
                    Description     = desc,
                    Duration        = duration,
                    Indx            = indx,
                    ContentType     = contenttype,
                    CourseChapterId = coursechid,
                    IsFree          = isfree,
                    IsDownloadable  = isdownload,
                    IsDeleted       = false,
                    Ishidden        = false,
                    IsReported      = false,
                });
            }
            else
            {
                if (youtube != null)
                {
                    int position = youtube.LastIndexOf("=");
                    _context.CourseChapterContents.Add(new CourseChapterContent
                    {
                        FilePath        = youtube.Substring(position + 1),
                        Title           = title,
                        Description     = desc,
                        Duration        = duration,
                        Indx            = indx,
                        ContentType     = contenttype,
                        CourseChapterId = coursechid,
                        IsFree          = isfree,
                        IsDownloadable  = isdownload,
                        IsDeleted       = false,
                        Ishidden        = false,
                        IsReported      = false,
                    });
                }
                else if (vimeo != null)
                {
                    int position = vimeo.LastIndexOf("/");
                    _context.CourseChapterContents.Add(new CourseChapterContent
                    {
                        FilePath        = vimeo.Substring(position + 1),
                        Title           = title,
                        Description     = desc,
                        Duration        = duration,
                        Indx            = indx,
                        ContentType     = contenttype,
                        CourseChapterId = coursechid,
                        IsFree          = isfree,
                        IsDownloadable  = isdownload,
                        IsDeleted       = false,
                        Ishidden        = false,
                        IsReported      = false,
                    });
                }
                else
                {
                    _context.CourseChapterContents.Add(new CourseChapterContent
                    {
                        FilePath        = link,
                        Title           = title,
                        Description     = desc,
                        Duration        = duration,
                        Indx            = indx,
                        ContentType     = contenttype,
                        CourseChapterId = coursechid,
                        IsFree          = isfree,
                        IsDownloadable  = isdownload,
                        IsDeleted       = false,
                        Ishidden        = false,
                        IsReported      = false,
                    });
                }
            }
            _context.SaveChanges();

            return(RedirectToAction("Details", "FreelancerProjects", new { id = coursechid }));
        }