/// <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
            };
        }
Пример #2
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
            };
        }