Ejemplo n.º 1
0
        /// <summary>
        /// Open the Search view for a functionality in creation mode
        /// </summary>
        /// <param name="token">NavigationToken</param>
        protected OperationState openSearchPage(NavigationToken token)
        {
            String       functionality = token.Functionality;
            Controllable page          = searchInOpenedPages(functionality);

            if (page == null)
            {
                page = ApplicationManager.ControllerFactory.GetController(functionality, token.ViewType, token.EditionMode);
                if (page == null)
                {
                    return(openHomePage());
                }
                OpenedPages.Add(page);
                page.NavigationToken = token;
                page.Initialize();
            }
            openPage(page);
            page.Search();

            if (token.ItemId != null)
            {
                int idmodel = int.Parse(token.ItemId.ToString());
                page.Search(idmodel);
            }
            return(OperationState.CONTINUE);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Display the page and call
        /// </summary>
        /// <param name="page"></param>
        protected OperationState openPage(Controllable page)
        {
            FunctionalityType functionalityType = page.NavigationToken != null ? page.NavigationToken.FunctionalityType : FunctionalityType.MAIN_FONCTIONALITY;
            bool isSubFonctionality             = functionalityType == FunctionalityType.SUB_FONCTIONALITY;

            if (page == null)
            {
                return(OperationState.CONTINUE);
            }

            if (ActivePage != null && ActivePage is FileController)
            {
                page.ParentController = ActivePage;
            }

            if (ActivePage == null || (!page.Equals(ActivePage) || !page.FunctionalityCode.Equals(ActivePage.FunctionalityCode)))
            {
                if (isSubFonctionality)
                {
                    page.ParentController = ActivePage;
                }

                ActivePage = page;
                ApplicationManager.MainWindow.displayPage(page);
                if (!OpenedPages.Contains(page))
                {
                    OpenedPages.Add(page);
                }
            }
            return(OperationState.CONTINUE);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Open a Edition view for a fonctionality
        /// This method shall be called by the PageManager
        /// </summary>
        /// <param name="token">NavigationToken</param>
        protected OperationState openEditionPage(NavigationToken token)
        {
            Controllable page = null;

            try
            {
                String functionality = token.Functionality;

                if (functionality == FunctionalitiesCode.FILE_SAVE)
                {
                    return(saveFile(token));
                }

                page = searchInOpenedPages(functionality);

                if (page == null)
                {
                    page = ApplicationManager.ControllerFactory.GetController(functionality, token.ViewType, token.EditionMode);
                    if (page == null)
                    {
                        return(openHomePage());
                    }
                    OpenedPages.Add(page);
                    page.NavigationToken = token;
                    page.Initialize();
                }
                openPage(page);
                EditionMode editionMode = token.EditionMode;
                object      oid         = token.ItemId;
                if (editionMode == EditionMode.CREATE)
                {
                    page.Create();
                }
                else if (editionMode == EditionMode.READ_ONLY)
                {
                    if (token.ItemIds.Count == 0)
                    {
                        page.Open(oid);
                    }

                    foreach (object id in token.ItemIds)
                    {
                        if (id != null)
                        {
                            page.Open(id);
                        }
                    }
                }
                else if (editionMode == EditionMode.MODIFY)
                {
                    if (token.ItemIds.Count == 0)
                    {
                        page.Edit(oid);
                    }
                    foreach (object id in token.ItemIds)
                    {
                        if (id != null)
                        {
                            page.Edit(id);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                InternalErrorMessage = ex.Message;
                OnClosePage(page);
            }
            return(OperationState.CONTINUE);
        }