Пример #1
0
        /// <summary>
        /// The actual Work to be done.
        /// </summary>
        protected override void Execute()
        {
            List <CollectionModel> newlist         = new List <CollectionModel>();
            CollectionModel        collectionModel = new CollectionModel();

            List <repository> repositories = RepositoryRepository.GetRepositoriess();

            if (this.Request.CollectionId > 0)
            {
                collection collection = CollectionRepository.FirstOrDefault(c => c.Id == this.Request.CollectionId);

                collectionModel = Util.ConvertToCollectionModel(
                    collection, repositories.First(c => c.Id == collection.RepositoryId).RepositoryName);
            }
            else
            {
                foreach (collection item in CollectionRepository.GetCollections().OrderBy(c => c.CollectionName))
                {
                    newlist.Add(Util.ConvertToCollectionModel(item, repositories.First(c => c.Id == item.RepositoryId).RepositoryName));
                }
            }

            Response = new ResponseModel()
            {
                Collection         = collectionModel,
                Collections        = newlist,
                IsOperationSuccess = true
            };
        }
        /// <summary
        /// The actual Work to be done.
        /// </summary>
        protected override void Execute()
        {
            List <CollectionModel> newlist          = new List <CollectionModel>();
            List <SubseryModel>    newSubseriesList = new List <SubseryModel>();
            SubseryModel           subseryModel     = new SubseryModel();

            List <collection> collections = CollectionRepository.GetCollections().OrderBy(o => o.CollectionName).ToList();

            if (this.Request.SubseriesId > 0)
            {
                subsery subsery = SubseryRepository.FirstOrDefault(s => s.Id == this.Request.SubseriesId);

                subseryModel = Util.ConvertToSubseryModel(subsery, collections.FirstOrDefault(s => s.Id == subsery.CollectionId).CollectionName);
            }
            else
            {
                List <SubseryModel> newSubseriesUnorderedList = new List <SubseryModel>();

                foreach (collection item in collections)
                {
                    newlist.Add(Util.ConvertToCollectionModel(item, string.Empty));
                }

                foreach (subsery item in SubseryRepository.GetSubseries())
                {
                    newSubseriesUnorderedList.Add(Util.ConvertToSubseryModel(item, collections.FirstOrDefault(s => s.Id == item.CollectionId).CollectionName));
                }

                newSubseriesList = newSubseriesUnorderedList.OrderBy(i => i.CollectionName).ThenBy(i => i.SubseryName).ToList();
            }

            Response = new ResponseModel()
            {
                Subseries          = newSubseriesList,
                Collections        = newlist,
                SubseriesModel     = subseryModel,
                IsOperationSuccess = true
            };
        }
Пример #3
0
        /// <summary>
        /// The actual Work to be done.
        /// </summary>
        protected override void Execute()
        {
            MainFormModel mainFormModel = null;

            List <RepositoryModel> repositoryList   = new List <RepositoryModel>();
            List <CollectionModel> newlist          = new List <CollectionModel>();
            List <SubseryModel>    newSubseriesList = new List <SubseryModel>();
            List <SubjectModel>    subjectList      = new List <SubjectModel>();
            List <KeywordModel>    keywordList      = new List <KeywordModel>();
            List <UserTypeModel>   userTypes        = new List <UserTypeModel>();

            //if (Request.IsStartup)
            //{
            mainFormModel = new MainFormModel()
            {
                BrowseRecordCount            = TranscriptionRepository.GetAll().Count(),
                TranscrptionQueueRecordCount = TranscriptionRepository.FindBy(t => t.TranscriptStatus == false).Count(),
            };

            // collect repository details.
            List <repository> repositories = RepositoryRepository.GetRepositoriess();

            foreach (repository item in repositories)
            {
                repositoryList.Add(Util.ConvertToRepositoryModel(item));
            }

            // collect collection details.
            List <collection> collections = CollectionRepository.GetCollections().OrderBy(c => c.CollectionName).ToList();

            foreach (collection item in collections)
            {
                newlist.Add(Util.ConvertToCollectionModel(item, repositories.First(c => c.Id == item.RepositoryId).RepositoryName));
            }

            // collect subseries details.
            foreach (subsery item in SubseryRepository.GetSubseries().OrderBy(s => s.SubseriesName))
            {
                newSubseriesList.Add(Util.ConvertToSubseryModel(item, collections.FirstOrDefault(s => s.Id == item.CollectionId).CollectionName));
            }

            // collect subject details.
            foreach (subject item in SubjectRepository.GetSubjects())
            {
                subjectList.Add(Util.ConvertToSubjectModel(item));
            }

            // collect keywords details.
            foreach (keyword item in KeywordRepository.GetKeywords())
            {
                keywordList.Add(Util.ConvertToKeywordModel(item));
            }

            // collect user types details.
            foreach (usertype item in UserTypeRepository.GetAll())
            {
                userTypes.Add(Util.ConvertToUsertypeModel(item));
            }
            //}

            List <PredefinedUserModel> predefineUserList = Util.ConvertToPredefinedUserModel(PredefineUserRepository.GetPredefinedUsers());

            List <string> audioEquipmentsUsed = AudioEquipmentUsedRepository.List();

            List <string> videoEquipmentsUsed = VideoEquipmentUsedRepository.List();

            Response = new ResponseModel()
            {
                Repositories = repositoryList,
                Subseries    = newSubseriesList,
                Collections  = newlist,
                Subjects     = subjectList,
                Keywords     = keywordList,

                PredefinedUsers     = predefineUserList,
                AudioEquipmentsUsed = audioEquipmentsUsed,
                VideoEquipmentsUsed = videoEquipmentsUsed,
                UserTypes           = userTypes,

                MainFormModel      = mainFormModel,
                IsOperationSuccess = true
            };
        }
        /// <summary>
        /// The actual Work to be done.
        /// </summary>
        protected override void Execute()
        {
            BrowseFormModel browseFormModel = new BrowseFormModel();

            IQueryable <transcription> transcriptions = null;

            if (Request.IsAdminUser)
            {
                transcriptions = TranscriptionRepository.GetAll();
            }
            else
            {
                transcriptions = TranscriptionRepository.FindBy(p => !p.IsRestriction);
            }

            // Interview list

            //List<string> interviewerList = new List<string>();

            //foreach (transcription item in transcriptions)
            //{
            //    List<string> words = item.Interviewer.Split(';').Select(p => p.Trim()).ToList();

            //    foreach (string word in words)
            //    {
            //        if (!string.IsNullOrEmpty(word))
            //        {
            //            interviewerList.Add(word);
            //        }
            //    }
            //}

            //var interviewers = from x in interviewerList
            //               group x by x into g
            //               let count = g.Count()
            //               orderby count descending
            //                select new { Value = g.Key, Count = count };

            //foreach (var interviewer in interviewers)
            //{
            //    browseFormModel.InterviewerList.Add(SetPair(interviewer.Value, interviewer.Count));
            //}

            //Collection list
            var collections = transcriptions
                              .GroupBy(n => n.CollectionId)
                              .Select(n => new
            {
                CollectionId = n.Key,
                Count        = n.Count()
            });

            List <collection> daCollections = CollectionRepository.GetCollections();

            foreach (var item in collections)
            {
                collection collectionOjb = daCollections.First(c => c.Id == item.CollectionId);

                browseFormModel.CollectionList.Add(SetListBoxItem(collectionOjb.CollectionName, item.Count, collectionOjb.Id));
            }

            // Subseries List
            //var subserieList = transcriptions
            //                   .GroupBy(n => n.SubseriesId)
            //                   .Select(n => new
            //                   {
            //                       SubseriesId = n.Key,
            //                       Count = n.Count()
            //                   });

            //List<subsery> subseries = SubseryRepository.GetAll().ToList();

            //foreach (var item in subserieList)
            //{
            //    subsery subseryObj = subseries.First(c => c.Id == item.SubseriesId);

            //    if (subseryObj.SubseriesName.Trim() != "N/A")
            //    {
            //        browseFormModel.SubseriesList.Add(SetListBoxItem(subseryObj.SubseriesName, item.Count, subseryObj.Id));
            //    }
            //}

            ////Content DM list

            //var contentDMs = transcriptions
            //                  .GroupBy(n => n.IsOnline)
            //                  .Select(n => new
            //                  {
            //                      IsOnline = n.Key,
            //                      Count = n.Count()
            //                  });

            //List<KeyValuePair<string, string>> contentDMList = new List<KeyValuePair<string, string>>();

            //foreach (var item in contentDMs)
            //{
            //    browseFormModel.ContentDmList.Add(
            //        new KeyValuePair<string, string>(
            //        item.IsOnline.ToString() + " (" + item.Count + ")", item.IsOnline.ToString()));

            //}

            //// Subject list
            //List<string> subjectList = new List<string>();

            //foreach (transcription item in transcriptions)
            //{
            //    string[] words = item.Subject.Split(';');

            //    foreach (string word in words)
            //    {
            //        if (!string.IsNullOrEmpty(word))
            //        {
            //            subjectList.Add(word);
            //        }
            //    }
            //}

            //var subjects = from x in subjectList
            //               group x by x into g
            //               let count = g.Count()
            //               orderby count descending
            //               select new { Value = g.Key, Count = count };

            //foreach (var subject in subjects)
            //{
            //    browseFormModel.SubjectList.Add(SetPair(subject.Value, subject.Count));
            //}

            Response = new ResponseModel()
            {
                BrowseFormModel    = browseFormModel,
                IsOperationSuccess = true
            };
        }