예제 #1
0
        public ActionResult GetFileSubject(string subjectId)
        {
            var lectures = new List <Attachment>();

            foreach (var att in SubjectManagementService.GetLecturesAttachments(int.Parse(subjectId)))
            {
                lectures.AddRange(FilesManagementService.GetAttachments(att).ToList());
            }

            var labs = new List <Attachment>();

            foreach (var att in SubjectManagementService.GetLabsAttachments(int.Parse(subjectId)))
            {
                lectures.AddRange(FilesManagementService.GetAttachments(att).ToList());
            }

            var practicals = new List <Attachment>();

            foreach (var att in SubjectManagementService.GetPracticalsAttachments(int.Parse(subjectId)))
            {
                lectures.AddRange(FilesManagementService.GetAttachments(att).ToList());
            }

            return(new JsonResult()
            {
                Data = new
                {
                    Lectures = this.PartialViewToString("Subjects/Modules/_FilesUploaderNoAdd", lectures),
                    Labs = this.PartialViewToString("Subjects/Modules/_FilesUploaderNoAdd", labs),
                    Practicals = this.PartialViewToString("Subjects/Modules/_FilesUploaderNoAdd", practicals)
                },
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
예제 #2
0
        public FileResult GetStudentZipLabs(int id, int subjectId, int userId)
        {
            var zip = new ZipFile(Encoding.UTF8);

            var subGroups = SubjectManagementService.GetSubGroup(id);

            var subGroup = subGroups.SubjectStudents.FirstOrDefault(e => e.StudentId == userId);

            var model = SubjectManagementService.GetUserLabFiles(subGroup.StudentId, subjectId);

            var attachments = new List <Attachment>();

            foreach (var data in model)
            {
                attachments.AddRange(FilesManagementService.GetAttachments(data.Attachments));
            }

            UtilZip.CreateZipFile(ConfigurationManager.AppSettings["FileUploadPath"], zip, attachments, subGroup.Student.FullName.Replace(" ", "_"));

            var memoryStream = new MemoryStream();

            zip.Save(memoryStream);

            memoryStream.Seek(0, SeekOrigin.Begin);

            return(new FileStreamResult(memoryStream, "application/zip")
            {
                FileDownloadName = subGroup.Student.FullName.Replace(" ", "_") + ".zip"
            });
        }
예제 #3
0
 public LecturesDataViewModel(Lectures lectures)
 {
     Theme       = lectures.Theme;
     LecturesId  = lectures.Id;
     Duration    = lectures.Duration;
     SubjectId   = lectures.SubjectId;
     Order       = lectures.Order;
     PathFile    = lectures.Attachments;
     Attachments = FilesManagementService.GetAttachments(lectures.Attachments);
 }
예제 #4
0
 public PracticalsViewData(Practical practical)
 {
     Theme       = practical.Theme;
     PracticalId = practical.Id;
     Duration    = practical.Duration;
     SubjectId   = practical.SubjectId;
     Order       = practical.Order;
     PathFile    = practical.Attachments;
     ShortName   = practical.ShortName;
     Attachments = FilesManagementService.GetAttachments(practical.Attachments);
 }
예제 #5
0
 public LabsViewData(LMP.Models.Labs labs)
 {
     Theme       = labs.Theme;
     LabId       = labs.Id;
     Duration    = labs.Duration;
     SubjectId   = labs.SubjectId;
     Order       = labs.Order;
     PathFile    = labs.Attachments;
     ShortName   = labs.ShortName;
     Attachments = FilesManagementService.GetAttachments(labs.Attachments);
 }
예제 #6
0
        public ActionResult GetFilePracticals(int id)
        {
            if (id == 0)
            {
                return(PartialView("Common/_FilesUploader", new List <Attachment>()));
            }

            var model = SubjectManagementService.GetPractical(id);

            return(PartialView("Common/_FilesUploader", FilesManagementService.GetAttachments(model.Attachments).ToList()));
        }
예제 #7
0
        private AttachViewData GetNeighborConceptData(Int32 neighborId)
        {
            var neighbor = ConceptManagementService.GetById(neighborId);

            if (neighbor == null)
            {
                return(new AttachViewData(0, String.Empty, null));
            }
            var att = FilesManagementService.GetAttachments(neighbor.Container).FirstOrDefault();

            return(new AttachViewData(neighbor.Id, neighbor.Name, att));
        }
예제 #8
0
 public LecturesDataViewModel(int id, int subjectId)
 {
     SubjectId   = subjectId;
     Attachments = new List <Attachment>();
     if (id != 0)
     {
         var lectures = SubjectManagementService.GetLectures(id);
         Order       = lectures.Order;
         Theme       = lectures.Theme;
         Duration    = lectures.Duration;
         LecturesId  = id;
         PathFile    = lectures.Attachments;
         Attachments = FilesManagementService.GetAttachments(lectures.Attachments);
     }
 }
예제 #9
0
 public PracticalsDataViewModel(int id, int subjectId)
 {
     SubjectId   = subjectId;
     Attachments = new List <Attachment>();
     if (id != 0)
     {
         var practicals = SubjectManagementService.GetPractical(id);
         Order       = practicals.Order;
         Theme       = practicals.Theme;
         Duration    = practicals.Duration;
         PracticalId = id;
         ShortName   = practicals.ShortName;
         PathFile    = practicals.Attachments;
         Attachments = FilesManagementService.GetAttachments(practicals.Attachments);
     }
 }
예제 #10
0
        public AddOrEditConceptViewModel(Int32 currentAuthorId, Int32 id)
            : base(currentAuthorId, id)
        {
            if (!IsNew())
            {
                Container = SourceConcept.Container;
                if (!String.IsNullOrEmpty(Container))
                {
                    Attachments = FilesManagementService.GetAttachments(Container);
                }
                ParentId = SourceConcept.ParentId.GetValueOrDefault();
                IsGroup  = SourceConcept.IsGroup;
                Prev     = SourceConcept.PrevConcept;
                Next     = SourceConcept.NextConcept;
            }


            //Attachments = new List<Attachment>();
        }