protected virtual void UpdateGridForm(ReconciliationFilterTemplateBottomGrid grid)
        {
            ReconciliationFilterTemplateEditorItem page = (ReconciliationFilterTemplateEditorItem)getEditor().getActivePage();

            page.getForm().EditedObject = page.EditedObject;
            grid.displayObject();
        }
        /// <summary>
        /// Cette méthode est exécutée lorsqu'on sélectionne une Input Table sur la sidebar.
        /// Cette opération a pour but d'ouvrir une page pour la table selectionnée dans l'éditeur.
        /// </summary>
        /// <param name="sender">La table sélectionnée</param>
        protected void onSelectTemplateFromSidebar(object sender)
        {
            if (sender != null && sender is ReconciliationFilterTemplate)
            {
                ReconciliationFilterTemplate grid = (ReconciliationFilterTemplate)sender;
                EditorItem <ReconciliationFilterTemplate> page = getEditor().getPage(grid.name);
                if (page != null)
                {
                    page.fillObject();
                    getEditor().selectePage(page);
                }
                else if (grid.oid != null && grid.oid.HasValue)
                {
                    this.Open(grid.oid.Value);
                }
                else
                {
                    page = getEditor().addOrSelectPage(grid);
                    initializePageHandlers(page);
                    page.Title = grid.name;

                    getEditor().ListChangeHandler.AddNew(grid);
                }
                ReconciliationFilterTemplateEditorItem pageOpen = (ReconciliationFilterTemplateEditorItem)getEditor().getActivePage();
            }
        }
        /// <summary>
        /// Cette methode permet de créer une nouvelle table.
        /// </summary>
        /// <returns>CONTINUE si la création du nouveau Model se termine avec succès. STOP sinon</returns>
        public override OperationState Create()
        {
            ApplicationManager.MainWindow.IsBussy = true;
            Kernel.Application.Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Background,
                                                                          new Action(() =>
            {
                try
                {
                    ReconciliationFilterTemplate template = GetNewTemplate();
                    ((ReconciliationFilterTemplateSideBar)SideBar).TemplateGroup.TemplateTreeview.AddTemplate(template);
                    ReconciliationFilterTemplateEditorItem page = (ReconciliationFilterTemplateEditorItem)getEditor().addOrSelectPage(template);
                    initializePageHandlers(page);
                    page.Title = template.name;
                    getEditor().ListChangeHandler.AddNew(template);
                    page.SearchAll();
                }
                catch (Exception e)
                {
                    MessageDisplayer.DisplayError("Error", e.Message);
                }
                finally
                {
                    ApplicationManager.MainWindow.IsBussy = false;
                }
            }));

            return(OperationState.CONTINUE);
        }
        protected override void Rename(string name)
        {
            ReconciliationFilterTemplateEditorItem page = (ReconciliationFilterTemplateEditorItem)getEditor().getActivePage();

            page.getForm().ConfigurationPanel.ConfigurationPropertiesPanel.NameTextBox.Text = name;
            //page.EditedObject.name = name;
            base.Rename(name);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="oid"></param>
        /// <returns></returns>
        public override OperationState Open(ReconciliationFilterTemplate template)
        {
            ReconciliationFilterTemplateEditorItem page = (ReconciliationFilterTemplateEditorItem)getEditor().addOrSelectPage(template);

            initializePageHandlers(page);
            getEditor().ListChangeHandler.AddNew(template);
            page.SearchAll();
            return(OperationState.CONTINUE);
        }
        protected void onGroupFieldChange()
        {
            ReconciliationFilterTemplateEditorItem page = (ReconciliationFilterTemplateEditorItem)getEditor().getActivePage();
            string name  = page.getForm().ConfigurationPanel.ConfigurationPropertiesPanel.groupField.textBox.Text;
            BGroup group = page.getForm().ConfigurationPanel.ConfigurationPropertiesPanel.groupField.Group;

            ((ReconciliationFilterTemplateSideBar)SideBar).TemplateGroup.TemplateTreeview.updateTemplate(name, page.Title, true);
            page.EditedObject.group = group;
            OnChange();
        }
        protected virtual void UpdateGridForm(ReconciliationFilterTemplateGrid grid)
        {
            ReconciliationFilterTemplateEditorItem page = (ReconciliationFilterTemplateEditorItem)getEditor().getActivePage();

            page.getForm().EditedObject = page.EditedObject;
            grid.GrilleBrowserForm.displayObject();
            grid.Search(grid.EditedObject.GrilleFilter != null ? grid.EditedObject.GrilleFilter.page : 1);

            /*page.getForm().displayObjectInGridForm();
             * Search(page.EditedObject.GrilleFilter != null ? page.EditedObject.GrilleFilter.page : 1);*/
        }
 /// <summary>
 /// Cette méthode est exécutée lorsqu'on sélectionne une mesure sur la sidebar.
 /// Cette opération a pour but d'assigner la mesure sélectionnée
 /// aux cellProperties correspondants à la sélection Excel.
 /// </summary>
 /// <param name="sender">La mesure sélectionnée</param>
 protected void onSelectMeasureFromSidebar(object sender)
 {
     if (sender != null && (sender is Measure || sender is CalculatedMeasure))
     {
         ReconciliationFilterTemplateEditorItem page = (ReconciliationFilterTemplateEditorItem)getEditor().getActivePage();
         if (page == null)
         {
             return;
         }
         page.SetMeasure((Measure)sender);
     }
 }
        public override OperationState Rename()
        {
            if (base.Rename() != OperationState.CONTINUE)
            {
                return(OperationState.STOP);
            }

            IsRenameOnDoubleClick = true;
            ReconciliationFilterTemplateEditorItem page = (ReconciliationFilterTemplateEditorItem)getEditor().getActivePage();

            return(ValidateEditedNewName(page.Title));
        }
        /// <summary>
        /// Cette méthode est exécutée lorsqu'on sélectionne une target sur la sidebar.
        /// Cette opération a pour but de rajouté la target sélectionnée au filtre de la table en édition,
        /// ou au scope des cellProperties correspondants à la sélection Excel.
        /// </summary>
        /// <param name="sender">La target sélectionné</param>
        protected void onSelectTargetFromSidebar(object target)
        {
            ReconciliationFilterTemplateEditorItem page = (ReconciliationFilterTemplateEditorItem)getEditor().getActivePage();

            if (page == null)
            {
                return;
            }
            ReconciliationFilterTemplatePropertyBar bar = (ReconciliationFilterTemplatePropertyBar)this.PropertyBar;

            page.SetTarget((Target)target, bar.FilterLayoutAnchorable.IsSelected);
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 protected void onSelectPeriodFromSidebar(object sender)
 {
     if (sender != null)
     {
         ReconciliationFilterTemplateEditorItem page = (ReconciliationFilterTemplateEditorItem)getEditor().getActivePage();
         if (page == null)
         {
             return;
         }
         ReconciliationFilterTemplatePropertyBar bar = (ReconciliationFilterTemplatePropertyBar)this.PropertyBar;
         page.SetPeriod(sender, bar.FilterLayoutAnchorable.IsSelected);
     }
 }
Ejemplo n.º 12
0
        /// <summary>
        /// Retourne une nouvelle page.
        /// </summary>
        /// <returns>Une nouvelle instance de EditorItem</returns>
        protected override EditorItem <ReconciliationFilterTemplate> getNewPage()
        {
            ReconciliationFilterTemplateEditorItem item = new ReconciliationFilterTemplateEditorItem(this.SubjectType);

            if (this.Service != null)
            {
                //PeriodName name = this.Service.PeriodNameService.getRootPeriodName();
                //PeriodName defaultName = name.getDefaultPeriodName();
                //item.getForm().GridForm.filterForm.periodFilter.DefaultPeriodName = defaultName;
                //item.getForm().GridForm.filterForm.periodFilter.DisplayPeriod(null);
            }
            //item.getForm().GridForm.gridBrowser.Service = this.Service;
            return(item);
        }
        private void onNameTextChange(object sender, KeyEventArgs args)
        {
            ReconciliationFilterTemplateEditorItem page = (ReconciliationFilterTemplateEditorItem)getEditor().getActivePage();

            if (args.Key == Key.Escape)
            {
                page.getForm().ConfigurationPanel.ConfigurationPropertiesPanel.NameTextBox.Text = page.Title;
            }
            else if (args.Key == Key.Enter)
            {
                ValidateEditedNewName();
                OnChange();
            }
        }
        public override Misp.Kernel.Domain.SubjectType SubjectTypeFound()
        {
            ReconciliationFilterTemplateEditorItem editorPage = (ReconciliationFilterTemplateEditorItem)getEditor().getActivePage();

            if (editorPage == null)
            {
                return(Misp.Kernel.Domain.SubjectType.INPUT_GRID);
            }
            if (editorPage.getForm().SelectedIndex == 0)
            {
            }
            else if (editorPage.getForm().SelectedIndex == 1)
            {
                return(Misp.Kernel.Domain.SubjectType.RECONCILIATION_FILTER);
            }
            return(Misp.Kernel.Domain.SubjectType.INPUT_GRID);
        }
        protected virtual OperationState ValidateEditedNewName(string newName = "")
        {
            ReconciliationFilterTemplateEditorItem page  = (ReconciliationFilterTemplateEditorItem)getEditor().getActivePage();
            ReconciliationFilterTemplate           table = page.EditedObject;

            if (string.IsNullOrEmpty(newName))
            {
                newName = page.getForm().ConfigurationPanel.ConfigurationPropertiesPanel.NameTextBox.Text.Trim();
            }
            if (string.IsNullOrEmpty(newName))
            {
                DisplayError("Empty Name", "The Filter Template name can't be mepty!");
                page.getForm().ConfigurationPanel.ConfigurationPropertiesPanel.NameTextBox.SelectAll();
                page.getForm().ConfigurationPanel.ConfigurationPropertiesPanel.NameTextBox.Focus();
                return(OperationState.STOP);
            }


            foreach (ReconciliationFilterTemplateEditorItem unInputTable in getEditor().getPages())
            {
                if (unInputTable != getEditor().getActivePage() && newName == unInputTable.Title)
                {
                    DisplayError("Duplicate Name", "There is another Filter Template  named: " + newName);
                    page.getForm().ConfigurationPanel.ConfigurationPropertiesPanel.NameTextBox.Text = page.Title;
                    page.getForm().ConfigurationPanel.ConfigurationPropertiesPanel.NameTextBox.SelectAll();
                    page.getForm().ConfigurationPanel.ConfigurationPropertiesPanel.NameTextBox.Focus();
                    return(OperationState.STOP);
                }
            }
            if (!IsRenameOnDoubleClick)
            {
                if (table.name.ToUpper().Equals(newName.ToUpper()))
                {
                    return(OperationState.CONTINUE);
                }
            }

            ((ReconciliationFilterTemplateSideBar)SideBar).TemplateGroup.TemplateTreeview.updateTemplate(newName, table.name, false);
            table.name = newName;
            page.Title = newName;
            return(OperationState.CONTINUE);
        }
        protected virtual void removePageHandlers(EditorItem <ReconciliationFilterTemplate> page)
        {
            //base.removePageHandlers(page);
            ReconciliationFilterTemplateEditorItem editorPage = (ReconciliationFilterTemplateEditorItem)page;

            editorPage.getForm().SelectionChanged -= OnSelectedTabChange;
            if (ApplicationManager.User != null && ApplicationManager.User.IsAdmin())
            {
                editorPage.getForm().ConfigurationPanel.ConfigurationPropertiesPanel.groupField.Changed -= onGroupFieldChange;
                editorPage.getForm().ConfigurationPanel.ConfigurationPropertiesPanel.ItemChanged -= OnConfigurationChanged;
                editorPage.getForm().ConfigurationPanel.WriteOffConfigPanel.ItemChanged -= OnConfigurationChanged;
                editorPage.getForm().ConfigurationPanel.ItemChanged -= OnConfigurationChanged;
                editorPage.getForm().ConfigurationPanel.ConfigurationPropertiesPanel.NameTextBox.KeyUp -= onNameTextChange;
                editorPage.getForm().FormChanged -= OnFormChanged;
            }
            if (editorPage.getForm().AdministrationBar != null)
            {
                editorPage.getForm().AdministrationBar.Changed -= OnChangeEventHandler;
            }
        }
        protected override void initializePageHandlers(EditorItem <ReconciliationFilterTemplate> page)
        {
            base.initializePageHandlers(page);
            ReconciliationFilterTemplateEditorItem editorPage = (ReconciliationFilterTemplateEditorItem)page;

            editorPage.getForm().SelectionChanged += OnSelectedTabChange;
            if (ApplicationManager.User != null && ApplicationManager.User.IsAdmin())
            {
                editorPage.getForm().ConfigurationPanel.ConfigurationPropertiesPanel.groupField.GroupService = GetService().GroupService;
                editorPage.getForm().ConfigurationPanel.ConfigurationPropertiesPanel.groupField.subjectType = SubjectTypeFound();
                editorPage.getForm().ConfigurationPanel.ConfigurationPropertiesPanel.groupField.Changed += onGroupFieldChange;
                editorPage.getForm().ConfigurationPanel.ConfigurationPropertiesPanel.ItemChanged += OnConfigurationChanged;
                editorPage.getForm().ConfigurationPanel.WriteOffConfigPanel.ItemChanged += OnConfigurationChanged;
                editorPage.getForm().ConfigurationPanel.ItemChanged += OnConfigurationChanged;
                editorPage.getForm().ConfigurationPanel.ConfigurationPropertiesPanel.NameTextBox.KeyUp += onNameTextChange;
                editorPage.getForm().FormChanged += OnFormChanged;
            }
            if (editorPage.getForm().AdministrationBar != null)
            {
                editorPage.getForm().AdministrationBar.Changed += OnChangeEventHandler;
            }
        }
        private void OnConfigurationChanged(object item)
        {
            ReconciliationFilterTemplateEditorItem page = (ReconciliationFilterTemplateEditorItem)getEditor().getActivePage();

            if (page == null)
            {
                return;
            }
            if (item is ReconciliationFilterTemplate)
            {
                ReconciliationFilterTemplate recoFilterTemplate = (ReconciliationFilterTemplate)item;
                page.EditedObject.group              = recoFilterTemplate.group;
                page.EditedObject.visibleInShortcut  = recoFilterTemplate.visibleInShortcut;
                page.EditedObject.balanceFormulaEnum = recoFilterTemplate.balanceFormulaEnum;
                page.EditedObject.useDebitCredit     = recoFilterTemplate.useDebitCredit;
            }
            else if (item is WriteOffConfiguration)
            {
                page.EditedObject.writeOffConfig = (WriteOffConfiguration)item;
            }
            OnChange();
        }
        protected virtual void PerformSelectionChange()
        {
            ReconciliationFilterTemplatePropertyBar bar  = (ReconciliationFilterTemplatePropertyBar)this.PropertyBar;
            ReconciliationFilterTemplateEditorItem  page = (ReconciliationFilterTemplateEditorItem)getEditor().getActivePage();

            if (page.getForm().SelectedIndex == 0)
            {
                ApplicationManager.MainWindow.displayPropertyBar(null);
                if (page.getForm().LeftGrid.GrilleBrowserForm.gridBrowser.RebuildGrid)
                {
                    UpdateGridForm(page.getForm().LeftGrid);
                }
                if (page.getForm().RightGrid.GrilleBrowserForm.gridBrowser.RebuildGrid)
                {
                    UpdateGridForm(page.getForm().RightGrid);
                }
                if (page.getForm().BottomGrid.GridBrowser.RebuildGrid)
                {
                    UpdateGridForm(page.getForm().BottomGrid);
                }

                page.getForm().LeftGrid.CustomizeDC();
                page.getForm().RightGrid.CustomizeDC();
            }
            else if (ApplicationManager.Instance.User.IsAdmin())
            {
                ApplicationManager.MainWindow.displayPropertyBar(this.PropertyBar);
                //if (!bar.Pane.Children.Contains(bar.DesignLayoutAnchorable)) bar.Pane.Children.Add(bar.DesignLayoutAnchorable);
                //if (bar.AdministratorLayoutAnchorable != null && !bar.Pane.Children.Contains(bar.AdministratorLayoutAnchorable)) bar.Pane.Children.Add(bar.AdministratorLayoutAnchorable);

                bar.Pane.Children.Remove(bar.FilterLayoutAnchorable);
                if (page.getForm().SelectedIndex == 1)
                {
                    ConfigurationPropertiesPanel configPane = page.getForm().ConfigurationPanel.ConfigurationPropertiesPanel;
                    configPane.displayObject();
                    bar.DesignLayoutAnchorable.Content = page.getForm().ConfigurationPanel.ConfigurationPropertiesPanel;
                    bar.DesignLayoutAnchorable.Title   = "Filter Properties";
                }
                else if (page.getForm().SelectedIndex == 2)
                {
                    bar.DesignLayoutAnchorable.Content = page.getForm().LeftGridProperties.InputGridPropertiesPanel;
                    bar.DesignLayoutAnchorable.Title   = "Left Grid Properties";
                    bar.FilterLayoutAnchorable.Content = page.getForm().LeftGrid.GrilleBrowserForm.filterForm;
                    bar.FilterLayoutAnchorable.Title   = "Left Filter Properties";

                    bar.Pane.Children.Insert(1, bar.FilterLayoutAnchorable);
                }
                else if (page.getForm().SelectedIndex == 3)
                {
                    bar.DesignLayoutAnchorable.Content = page.getForm().RightGridProperties.InputGridPropertiesPanel;
                    bar.DesignLayoutAnchorable.Title   = "Right Grid Properties";
                    bar.FilterLayoutAnchorable.Content = page.getForm().RightGrid.GrilleBrowserForm.filterForm;
                    bar.FilterLayoutAnchorable.Title   = "Right Filter Properties";

                    bar.Pane.Children.Insert(1, bar.FilterLayoutAnchorable);
                }
                else if (page.getForm().SelectedIndex == 4)
                {
                    bar.DesignLayoutAnchorable.Content = page.getForm().BottomGridProperties.InputGridPropertiesPanel;
                    bar.DesignLayoutAnchorable.Title   = "Bottom Grid Properties";
                }
            }
        }