Пример #1
0
 public PresentationMessage(PresentationModel presentation) : base(presentation.Id)
 {
     this.AddLocalRef(presentation);
     using (Synchronizer.Lock(presentation.SyncRoot)) {
         this.HumanName = presentation.HumanName;
     }
 }
Пример #2
0
        public ActionResult AddFacetsToSearch()
        {
            ViewBag.Title = PresentationModel.GetViewTitleForTenant("Search", this.Session.GetTenant());

            ISearchProvider provider = IoCFactory.Container.ResolveForSession <ISearchProvider>();

            List <string> selectedValues = new List <string>();
            string        parent         = GetParentOfSelectAbleCategories();

            //data.ToList().ForEach(p => selectedValues.Add(p.ToString()));

            for (int i = 0; i < this.Request.Form.AllKeys.Count() - 1; i++)
            {
                int      index = Convert.ToInt32(this.Request.Form.AllKeys[i]);
                string[] temp  = this.Request.Form.GetValues(i);
                string   value = temp[0];

                if (value == "true" || value == "True")
                {
                    selectedValues.Add(GetSelectAbleCategoryList().ElementAt(index).Name);
                }
            }

            provider.WorkingSearchModel.UpdateSearchCriteria(parent, selectedValues, SearchComponentBaseType.Facet, true);
            provider.SearchAndUpdate(provider.WorkingSearchModel.CriteriaComponent);

            return(View("Index", provider));
        }
Пример #3
0
            public DeckTraversalsCollectionHelper(NetworkAssociationService service, PresentationModel source) : base(service.m_EventQueue, source, "DeckTraversals")
            {
                this.m_Service = service;
                this.m_Bucket  = this.m_Service.m_Model.Workspace;

                base.Initialize();
            }
Пример #4
0
        public ActionResult Index(string autoComplete, string FilterList, string searchType)
        {
            ViewBag.Title = PresentationModel.GetViewTitleForTenant("Search", this.Session.GetTenant());

            ISearchProvider provider = IoCFactory.Container.ResolveForSession <ISearchProvider>();

            if (searchType == "new")
            {
                Session["FilterAC"] = null;
                Session["SelectedIndexFilterAC"] = 0;
                Session["PropertiesDictionary"]  = null;

                provider.WorkingSearchModel.CriteriaComponent.Clear();
            }

            SetSearchType(searchType);

            if (!provider.WorkingSearchModel.CriteriaComponent.ContainsSearchCriterion(FilterList, autoComplete, SearchComponentBaseType.Category))
            {
                provider.WorkingSearchModel.UpdateSearchCriteria(FilterList, autoComplete, SearchComponentBaseType.Category);
            }

            provider.SearchAndUpdate(provider.WorkingSearchModel.CriteriaComponent);

            //reset searchType
            // after every search - searchType must be based on
            SetSearchType("basedon");

            return(View(provider));
        }
Пример #5
0
        private void OpenConfiguration()
        {
            openFileDialog1.Filter = "Configuration files|*.config|Xml files|*.xml|All files|*.*";
            if (openFileDialog1.ShowDialog() != DialogResult.Cancel)
            {
                if (openFileDialog1.FileName != "")
                {
                    try
                    {
                        ClearControls();

                        IEngine engine = EngineFactory.FromFile(openFileDialog1.FileName, true);
                        model = PresentationModelManager.CreatePresentationModel(engine);

                        configFileName = openFileDialog1.FileName;

                        RefreshAll();
                    }
                    catch (Exception ex)
                    {
                        HandleException(ex);
                    }
                }
            }
        }
Пример #6
0
        /// <summary>
        /// is called when the Search View is selected
        ///
        /// </summary>
        /// <param name="model">from type SearchDataModel</param>
        /// <returns></returns>
        //[Authorize(Roles="Guest")]
        public ActionResult Index()
        {
            ViewBag.Title = PresentationModel.GetViewTitleForTenant("Search", this.Session.GetTenant());
            Session["SubmissionAction"]     = "Index";
            Session["Controller"]           = "Home";
            Session["PropertiesDictionary"] = null;

            try
            {
                ISearchProvider provider = IoCFactory.Container.ResolveForSession <ISearchProvider>();

                provider.WorkingSearchModel.CriteriaComponent.Clear();
                provider.SearchAndUpdate(provider.WorkingSearchModel.CriteriaComponent);

                SetSessionsToDefault();

                return(View(provider));
            }
            catch (Exception e)
            {
                ModelState.AddModelError(String.Empty, e.Message);

                return(View("Error"));
            }
        }
Пример #7
0
        public ActionResult Version()
        {
            // Site
            var site = ConfigurationManager.AppSettings["ApplicationVersion"];

            // Database
            using (var versionManager = new VersionManager())
            {
                var database = versionManager.GetLatestVersion().Value;

                // Workspace
                string    filePath  = Path.Combine(AppConfiguration.WorkspaceGeneralRoot, "General.Settings.xml");
                XDocument settings  = XDocument.Load(filePath);
                XElement  entry     = XmlUtility.GetXElementByAttribute("entry", "key", "version", settings);
                var       workspace = entry.Attribute("value")?.Value;


                var model = new VersionModel()
                {
                    Site      = site,
                    Database  = database,
                    Workspace = workspace
                };

                ViewBag.Title = PresentationModel.GetViewTitleForTenant("Session Timeout", this.Session.GetTenant());

                return(View(model));
            }
        }
Пример #8
0
 public static SheetNetworkService ForSheet(SendingQueue sender, PresentationModel presentation, DeckModel deck, SlideModel slide, SheetModel sheet, SheetMessage.SheetCollection selector)
 {
     if (sheet is RealTimeInkSheetModel)
     {
         return(new RealTimeInkSheetNetworkService(sender, presentation, deck, slide, ((RealTimeInkSheetModel)sheet), selector));
     }
     else if (sheet is InkSheetModel)
     {
         return(new InkSheetNetworkService(sender, presentation, deck, slide, ((InkSheetModel)sheet), selector));
     }
     else if (sheet is ImageSheetModel)
     {
         return(new ImageSheetNetworkService(sender, presentation, deck, slide, ((ImageSheetModel)sheet), selector));
     }
     else if (sheet is TextSheetModel)
     {
         return(new TextSheetNetworkService(sender, presentation, deck, slide, ((TextSheetModel)sheet), selector));
     }
     else if (sheet is QuickPollSheetModel)
     {
         return(new QuickPollSheetNetworkService(sender, presentation, deck, slide, ((QuickPollSheetModel)sheet), selector));
     }
     else
     {
         return(null);
     }
 }
        public async Task <IActionResult> PutPresentation(long id, [FromForm] PresentationModel presentationModel)
        {
            try
            {
                Presentation presentation = new Presentation()
                {
                    PresentationId    = presentationModel.PresentationId,
                    PresentationName  = presentationModel.PresentationName,
                    PresentationTopic = presentationModel.PresentationTopic
                };

                byte[] fileData = null;
                using (var binaryReader = new BinaryReader(presentationModel.File.OpenReadStream()))
                {
                    fileData = binaryReader.ReadBytes((int)presentationModel.File.Length);
                }
                presentation.File = fileData;

                await _presentationService.PutPresentation(id, presentation);
            }
            catch (BadRequestException bex)
            {
                return(BadRequest(bex.Message));
            }
            catch (ItemNotFoundEsception iex)
            {
                return(NotFound(iex.Message));
            }

            return(NoContent());
        }
Пример #10
0
        /// <summary>
        /// Constructs a listener for changes to the deck traversal
        /// </summary>
        /// <param name="sender">The event queue for handling updates</param>
        /// <param name="presentation">The presentation</param>
        /// <param name="traversal">The deck traversal we care about </param>
        public DeckTraversalWebService(SendingQueue sender, PresentationModel presentation, DeckTraversalModel traversal)
        {
            this.m_Sender        = sender;
            this.m_Presentation  = presentation;
            this.m_DeckTraversal = traversal;

            // Create the deck object
            string deckName = "Untitled Deck";

            using (Synchronizer.Lock(this.m_DeckTraversal.SyncRoot))
            {
                using (Synchronizer.Lock(this.m_DeckTraversal.Deck))
                {
                    deckName = this.m_DeckTraversal.Deck.HumanName;
                }
            }
            SimpleWebDeck deck = new SimpleWebDeck();

            deck.Name = deckName;
            lock (WebService.Instance.GlobalModel) {
                WebService.Instance.GlobalModel.Decks.Add(deck);
            }
            WebService.Instance.UpdateModel();

            this.m_DeckWebService = new DeckWebService(this.m_Sender, this.m_Presentation, this.m_DeckTraversal.Deck);

            this.m_CurrentChangedDispatcher = new EventQueue.PropertyEventDispatcher(this.m_Sender, new PropertyEventHandler(this.HandleCurrentChanged));
            this.m_DeckTraversal.Changed["Current"].Add(this.m_CurrentChangedDispatcher.Dispatcher);
        }
Пример #11
0
        public ActionResult UploadWizard()
        {
            ViewBag.Title = PresentationModel.GetViewTitleForTenant("Upload Data", this.Session.GetTenant());

            Session["TaskManager"] = null;
            TaskManager            = null;

            try
            {
                string path = "";

                path = Path.Combine(AppConfiguration.GetModuleWorkspacePath("DCM"), "EasyUploadTaskInfo.xml");

                XmlDocument xmlTaskInfo = new XmlDocument();
                xmlTaskInfo.Load(path);

                Session["TaskManager"] = EasyUploadTaskManager.Bind(xmlTaskInfo);

                TaskManager = (EasyUploadTaskManager)Session["TaskManager"];
            }
            catch (Exception e)
            {
                ModelState.AddModelError(String.Empty, e.Message);
            }

            TaskManager = (EasyUploadTaskManager)Session["TaskManager"];

            return(View((EasyUploadTaskManager)Session["TaskManager"]));
        }
Пример #12
0
 public StartPage()
 {
     _delegates            = new PresentationModel(GetUserView, ShowPlayer, GetUserAction, GetGameSettings, ShowRoundResult, ReadKey);
     Console.BufferWidth   = Console.WindowWidth = 70;
     Console.BufferHeight  = Console.WindowHeight = 26;
     Console.CursorVisible = false;
 }
Пример #13
0
        public ActionResult ViewPartyDetail(int id)
        {
            PartyManager     partyManager     = null;
            PartyTypeManager partyTypeManager = null;

            try
            {
                partyManager     = new PartyManager();
                partyTypeManager = new PartyTypeManager();
                ViewBag.Title    = PresentationModel.GetGenericViewTitle("View Party");
                var model = new PartyModel();
                model.PartyTypeList = partyTypeManager.PartyTypeRepository.Get().ToList();
                Party party = partyManager.PartyRepository.Get(id);
                model.Description = party.Description;
                model.EndDate     = party.EndDate;
                model.Id          = party.Id;
                model.PartyType   = party.PartyType;
                model.StartDate   = party.StartDate;
                model.ViewMode    = true;
                model.Name        = party.Name;
                return(PartialView("View", model));
            }
            finally
            {
                partyManager     = null;
                partyTypeManager = null;
            }
        }
Пример #14
0
        protected override bool UpdateTarget(ReceiveContext context)
        {
            PresentationModel presentation = this.Target as PresentationModel;
            bool isUntitledPresentation    = false;

            if (this.HumanName.Equals("Untitled Presentation"))
            {
                isUntitledPresentation = true;
            }
            if (presentation == null)
            {
                this.Target = presentation = new PresentationModel(((Guid)this.TargetId), context.Participant, this.HumanName, isUntitledPresentation);
            }
            else
            {
                using (Synchronizer.Lock(presentation.SyncRoot)) {
                    presentation.HumanName = this.HumanName;
                    presentation.IsUntitledPresentation = isUntitledPresentation;
                }
            }

            using (Synchronizer.Lock(context.Classroom.SyncRoot)) {
                if (!context.Classroom.Presentations.Contains(presentation))
                {
                    context.Classroom.Presentations.Add(presentation);
                }
            }

            return(true);
        }
Пример #15
0
        /// <summary>
        /// Construct a new deck web service
        /// </summary>
        /// <param name="sender">The event handler </param>
        /// <param name="presentation">The presentation model</param>
        /// <param name="deck">The deck model</param>
        public DeckWebService(SendingQueue sender, PresentationModel presentation, DeckModel deck)
        {
            this.m_Sender       = sender;
            this.m_Presentation = presentation;
            this.m_Deck         = deck;

            this.m_SlideRemovedDispatcher = new EventQueue.PropertyEventDispatcher(this.m_Sender, new PropertyEventHandler(this.HandleSlideRemoved));
            this.m_SlideAddedDispatcher   = new EventQueue.PropertyEventDispatcher(this.m_Sender, new PropertyEventHandler(this.HandleSlideAdded));
//            this.m_SlideContentAddedDispatcher = new EventQueue.PropertyEventDispatcher(this.m_Sender, new PropertyEventHandler(this.HandleSlideContentAdded));
//            this.m_DeckBackgroundChangedDispatcher = new EventQueue.PropertyEventDispatcher(this.m_Sender, new PropertyEventHandler(this.HandleDeckBackgroundChanged));

            this.m_SlideWebServices = new Hashtable();

//            this.m_TableOfContentsWebService = new TableOfContentsWebService(this.m_Sender, this.m_Presentation, this.m_Deck);

            // Lock the deck so no content can be added between registering the event listeners and calling SendAllSlidesAndContent().
            using (Synchronizer.Lock(this.m_Presentation.SyncRoot))
            {
                using (Synchronizer.Lock(deck.SyncRoot))
                {
                    this.m_Deck.SlideRemoved += this.m_SlideRemovedDispatcher.Dispatcher;
                    this.m_Deck.SlideAdded   += this.m_SlideAddedDispatcher.Dispatcher;
//                    this.m_Deck.SlideContentAdded += this.m_SlideContentAddedDispatcher.Dispatcher;
//                    this.m_Deck.Changed["DeckBackgroundColor"].Add(this.m_DeckBackgroundChangedDispatcher.Dispatcher);
//                    this.m_Deck.Changed["DeckBackgroundTemplate"].Add(this.m_DeckBackgroundChangedDispatcher.Dispatcher);
                }
            }

            this.UpdateAllSlidesAndContent();
        }
Пример #16
0
        public ActionResult ImportMetadataStructureWizard()
        {
            ViewBag.Title = PresentationModel.GetViewTitleForTenant("Import Metadata Structure", this.Session.GetTenant());

            Session["TaskManager"] = null;
            TaskManager            = null;
            if (TaskManager == null)
            {
                TaskManager = (ImportMetadataStructureTaskManager)Session["TaskManager"];
            }

            if (TaskManager == null)
            {
                try
                {
                    string path = "";
                    path = Path.Combine(AppConfiguration.GetModuleWorkspacePath("DCM"), "ImportMetadataStructureTaskInfo.xml");
                    XmlDocument xmlTaskInfo = new XmlDocument();
                    xmlTaskInfo.Load(path);
                    TaskManager            = ImportMetadataStructureTaskManager.Bind(xmlTaskInfo);
                    Session["TaskManager"] = TaskManager;
                }
                catch (Exception e)
                {
                    ModelState.AddModelError(String.Empty, e.Message);
                }
            }

            return(View((ImportMetadataStructureTaskManager)Session["TaskManager"]));
        }
        public ActionResult Activity()
        {
            ViewBag.Title = PresentationModel.GetViewTitleForTenant("Manage Activities", Session.GetTenant());
            List <ActivityModel> model = new List <ActivityModel>();

            using (var rManager = new ActivityManager())
                using (var permissionManager = new EntityPermissionManager())
                    using (var entityTypeManager = new EntityManager())
                    {
                        List <Activity> data = rManager.GetAllActivities().ToList();

                        // get id from loged in user
                        long userId = UserHelper.GetUserId(HttpContext.User.Identity.Name);

                        // get entity type id
                        long entityTypeId = entityTypeManager.FindByName("Activity").Id;

                        foreach (Activity a in data)
                        {
                            ActivityModel temp = new ActivityModel(a);
                            // temp.InUse = rManager.IsInEvent(a.Id);

                            // get permission from logged in user
                            temp.EditAccess = permissionManager.HasEffectiveRight(userId, new List <long> {
                                entityTypeId
                            }, a.Id, RightType.Read);
                            temp.DeleteAccess = permissionManager.HasEffectiveRight(userId, new List <long> {
                                entityTypeId
                            }, a.Id, RightType.Delete);

                            model.Add(temp);
                        }
                    }
            return(View("ActivityManager", model));
        }
Пример #18
0
        /// <summary>
        /// Purges a dataset, which means the dataset and all its versions will be physically removed from the database.
        /// </summary>
        /// <param name="id">the identifier of the dataset to be purged.</param>
        /// <remarks>This operation is not revocerable.</remarks>
        /// <returns></returns>
        public ActionResult Purge(long id)
        {
            ViewBag.Title = PresentationModel.GetViewTitleForTenant("Purge", Session.GetTenant());

            DatasetManager dm = new DatasetManager();
            var            entityPermissionManager = new EntityPermissionManager();

            try
            {
                if (dm.PurgeDataset(id))
                {
                    entityPermissionManager.Delete(typeof(Dataset), id);

                    if (this.IsAccessibale("DDM", "SearchIndex", "ReIndexUpdateSingle"))
                    {
                        var x = this.Run("DDM", "SearchIndex", "ReIndexUpdateSingle", new RouteValueDictionary()
                        {
                            { "id", id }, { "actionType", "DELETE" }
                        });
                    }
                }
            }
            catch (Exception e)
            {
                ViewData.ModelState.AddModelError("", string.Format("Dataset {0} could not be purged.", id));
            }
            return(View());
        }
        public ActionResult Create()
        {
            ViewBag.Title = PresentationModel.GetViewTitleForTenant("Create Resource Structures", this.Session.GetTenant());
            CreateResourceStructureModel resourceStructure = new CreateResourceStructureModel();

            return(View("_createResourceStructure", resourceStructure));
        }
Пример #20
0
        public void PresentationModelTest()
        {
            PresentationModel presentationModel = new PresentationModel(new Model());
            Model             model             = new Model();

            Assert.AreEqual(model.GetCount(), 0);
        }
Пример #21
0
        /// <summary>
        /// is called when the Search View is selected
        ///
        /// </summary>
        /// <param name="model">from type SearchDataModel</param>
        /// <returns></returns>
        //[Authorize(Roles="Guest")]
        public ActionResult Index()
        {
            ViewBag.Title = PresentationModel.GetViewTitleForTenant("Search", this.Session.GetTenant());

            try
            {
                ISearchProvider provider = IoCFactory.Container.ResolveForSession <ISearchProvider>();

                //if (provider.WorkingSearchModel.CriteriaComponent.SearchCriteriaList.Count > 0)
                //{
                provider.WorkingSearchModel.CriteriaComponent.Clear();
                provider.SearchAndUpdate(provider.WorkingSearchModel.CriteriaComponent);
                //}
                //var pp = IoCFactory.Container.ResolveAll<ISearchProvider>();

                SetSessionsToDefault();

                return(View(provider));
            }
            catch (Exception e)
            {
                ModelState.AddModelError(String.Empty, e.Message);

                return(View());
            }
        }
Пример #22
0
        public void GetDictionaryLengthTest()
        {
            const int         NUMBER            = 1081;
            PresentationModel presentationModel = new PresentationModel(new Model());

            Assert.AreEqual(NUMBER, presentationModel.GetDictionaryLength());
        }
Пример #23
0
        /// <summary>
        /// Updated the current deck traversal in the model
        /// </summary>
        private void UpdateCurrentDeckTraversal()
        {
            int slideIndex = -1;
            int deckIndex  = -1;

            // Get the slide and deck index
            using (Synchronizer.Lock(this.m_Instructor.SyncRoot))
            {
                DeckTraversalModel traversal = this.m_Instructor.CurrentDeckTraversal;
                if (traversal != null)
                {
                    using (Synchronizer.Lock(traversal.SyncRoot)) {
                        slideIndex = traversal.AbsoluteCurrentSlideIndex;
                    }
                }

                PresentationModel presentation = this.m_Instructor.CurrentPresentation;
                if (presentation != null)
                {
                    using (Synchronizer.Lock(presentation.SyncRoot)) {
                        deckIndex = this.m_Instructor.CurrentPresentation.DeckTraversals.IndexOf(traversal);
                    }
                }
            }

            // Change the SimpleWebModel
            lock (WebService.Instance.GlobalModel) {
                WebService.Instance.GlobalModel.CurrentDeck  = deckIndex;
                WebService.Instance.GlobalModel.CurrentSlide = slideIndex;
            }
            WebService.Instance.UpdateModel();
        }
Пример #24
0
        public void IsTimeTest()
        {
            PresentationModel presentationModel = new PresentationModel(new Model());

            presentationModel.Set(false);
            Assert.IsFalse(presentationModel.IsTime());
        }
Пример #25
0
        public ActionResult Index()
        {
            ViewBag.Title = PresentationModel.GetViewTitleForTenant("Search in Public Datasets", this.Session.GetTenant());
            Session["SubmissionAction"]     = "Index";
            Session["Controller"]           = "PublicSearch";
            Session["PropertiesDictionary"] = null;

            try
            {
                ISearchProvider provider = IoCFactory.Container.ResolveForSession <ISearchProvider>();

                provider.WorkingSearchModel.CriteriaComponent.Clear();
                ///
                /// Make sure that a criterion to filter public datasets is in the working search model.
                ///
                provider.WorkingSearchModel.UpdateSearchCriteria("gen_isPublic", "TRUE", SearchComponentBaseType.General, false, false, "AND");

                provider.SearchAndUpdate(provider.WorkingSearchModel.CriteriaComponent);
                SetSessionsToDefault();

                return(View("Index", provider));
            }
            catch (Exception e)
            {
                ModelState.AddModelError(String.Empty, e.Message);

                return(View("Error"));
            }
        }
Пример #26
0
        public void GetScoreTest()
        {
            const int         TEN = 10;
            PresentationModel presentationModel = new PresentationModel(new Model());

            presentationModel.GetScore(TEN);
        }
Пример #27
0
        public ActionResult Index(string autoComplete, string FilterList, string searchType)
        {
            ViewBag.Title = PresentationModel.GetViewTitleForTenant("Search in Public Datasets", this.Session.GetTenant());
            Session["SubmissionAction"] = "Index";
            Session["Controller"]       = "PublicSearch";

            ISearchProvider provider = IoCFactory.Container.ResolveForSession <ISearchProvider>();

            if (searchType == "new")
            {
                Session["FilterAC"] = null;
                Session["SelectedIndexFilterAC"] = 0;
                Session["PropertiesDictionary"]  = null;

                provider.WorkingSearchModel.CriteriaComponent.Clear();
                ///
                /// Make sure that a criterion to filter public datasets is in the working search model.
                ///
                provider.WorkingSearchModel.UpdateSearchCriteria("gen_isPublic", "TRUE", SearchComponentBaseType.General, false, false, "AND");
            }

            SetSearchType(searchType);

            if (!provider.WorkingSearchModel.CriteriaComponent.ContainsSearchCriterion(FilterList, autoComplete, SearchComponentBaseType.Category))
            {
                provider.WorkingSearchModel.UpdateSearchCriteria(FilterList, autoComplete, SearchComponentBaseType.Category);
            }

            provider.SearchAndUpdate(provider.WorkingSearchModel.CriteriaComponent);

            SetSearchType("basedon");

            return(View(provider));
        }
Пример #28
0
        public void ClickNextMultipleTest()
        {
            PresentationModel presentationModel = new PresentationModel(new Model());
            const string      STR = "10";

            presentationModel.Start(STR, 0);
        }
Пример #29
0
        public ActionResult Index(long DataStructureId = 0)
        {
            ViewBag.Title = PresentationModel.GetViewTitleForTenant("Data Structure Edit", this.Session.GetTenant());
            DataStructureManager dsm = null;

            try
            {
                dsm = new DataStructureManager();
                if (DataStructureId != 0 && dsm.StructuredDataStructureRepo.Get(DataStructureId) != null)
                {
                    return(View(DataStructureId));
                }
                else if (DataStructureId == 0)
                {
                    return(View(DataStructureId));
                }
                else
                {
                    return(RedirectToAction("Index", "DataStructureSearch"));
                }
            }
            finally
            {
                dsm.Dispose();
            }
        }
Пример #30
0
        public ActionResult Delete(string path)
        {
            ViewBag.Title = PresentationModel.GetViewTitleForTenant("Push Big File", this.Session.GetTenant());
            FileHelper.Delete(path);

            return(View("Index", LoadDefaultModel()));
        }