public virtual void Search(int currentPage = 0)
        {
            InputGridEditorItem page = (InputGridEditorItem)getEditor().getActivePage();

            try
            {
                GrilleFilter filter = page.getInputGridForm().GridForm.filterForm.Fill();
                filter.grid      = new Grille();
                filter.grid.code = page.EditedObject.code;
                filter.grid.columnListChangeHandler = page.EditedObject.columnListChangeHandler;
                filter.grid.report = page.EditedObject.report;
                filter.grid.oid    = page.EditedObject.oid;
                filter.grid.name   = page.EditedObject.name;
                //filter.grid = page.EditedObject;
                filter.page     = currentPage;
                filter.pageSize = (int)page.getInputGridForm().GridForm.toolBar.pageSizeComboBox.SelectedItem;
                filter.showAll  = page.getInputGridForm().GridForm.toolBar.showAllCheckBox.IsChecked.Value;
                GrillePage rows = this.GetInputGridService().getGridRows(filter);
                page.getInputGridForm().GridForm.displayPage(rows);
                //OnChange();
            }
            catch (ServiceExecption) {
                GrillePage rows = new GrillePage();
                rows.rows = new List <object[]>(0);
                page.getInputGridForm().GridForm.displayPage(rows);
            }
        }
        protected virtual void UpdateGridForm()
        {
            InputGridEditorItem page = (InputGridEditorItem)getInputGridEditor().getActivePage();

            page.getInputGridForm().EditedObject = page.EditedObject;
            page.getInputGridForm().displayObjectInGridForm();
            Search(page.EditedObject.GrilleFilter != null ? page.EditedObject.GrilleFilter.page : 1);
        }
        private void OnVisibleInShortcutCheck(object sender, RoutedEventArgs e)
        {
            InputGridEditorItem page = (InputGridEditorItem)getInputGridEditor().getActivePage();

            if (!page.getInputGridForm().InputGridSheetForm.InputGridPropertiesPanel.throwEvent)
            {
                return;
            }
            page.EditedObject.visibleInShortcut = page.getInputGridForm().InputGridSheetForm.InputGridPropertiesPanel.visibleInShortcutCheckbox.IsChecked.Value;
            OnChange();
        }
예제 #4
0
        /// <summary>
        /// Retourne une nouvelle page.
        /// </summary>
        /// <returns>Une nouvelle instance de EditorItem</returns>
        protected override EditorItem <Grille> getNewPage()
        {
            InputGridEditorItem item = new InputGridEditorItem(this.SubjectType);

            if (this.Service != null)
            {
                PeriodName name = this.Service.PeriodNameService.getRootPeriodName();
                PeriodName defaultName = name.getDefaultPeriodName();
                item.getInputGridForm().GridForm.filterForm.periodFilter.DefaultPeriodName = defaultName;
                item.getInputGridForm().GridForm.filterForm.periodFilter.DisplayPeriod(null);
            }
            item.getInputGridForm().GridForm.gridBrowser.Service = this.Service;
            return(item);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        protected override void OnPageClosed(object sender, EventArgs args)
        {
            base.OnPageClosed(sender, args);
            InputGridEditorItem page = (InputGridEditorItem)sender;

            page.getInputGridForm().SelectionChanged -= OnSelectedTabChange;
        }
        protected override void Rename(string name)
        {
            InputGridEditorItem page = (InputGridEditorItem)getInputGridEditor().getActivePage();

            page.getInputGridForm().InputGridSheetForm.InputGridPropertiesPanel.NameTextBox.Text = name;
            page.EditedObject.name = name;
            base.Rename(name);
        }
        protected void onGroupFieldChange()
        {
            InputGridEditorItem page = (InputGridEditorItem)getInputGridEditor().getActivePage();
            string name = page.getInputGridForm().InputGridSheetForm.InputGridPropertiesPanel.groupField.textBox.Text;

            ((InputGridSideBar)SideBar).GrilleGroup.GrilleTreeview.updateGrille(name, page.Title, true);
            OnChange();
        }
        /// <summary>
        /// Methode à exécuter lorsqu'il y a un changement sur la vue.
        /// </summary>
        /// <returns>
        /// OperationState.CONTINUE si l'opération a réussi
        /// OperationState.STOP sinon
        /// </returns>
        public override OperationState OnChange()
        {
            base.OnChange();
            InputGridEditorItem page = (InputGridEditorItem)getInputGridEditor().getActivePage();

            page.getInputGridForm().GridForm.gridBrowser.RebuildGrid = true;
            UpdateStatusBar();
            return(OperationState.CONTINUE);
        }
        protected void BuildConfigurationGridColumns()
        {
            InputGridEditorItem page = (InputGridEditorItem)getInputGridEditor().getActivePage();

            if (page == null)
            {
                return;
            }
            page.getInputGridForm().InputGridSheetForm.BuildColunms();
        }
        protected virtual void PerformSelectionChange()
        {
            InputGridEditorItem page = (InputGridEditorItem)getEditor().getActivePage();

            if (page.getInputGridForm().SelectedIndex == 1)
            {
                ((InputGridPropertyBar)this.PropertyBar).DesignLayoutAnchorable.Content = page.getInputGridForm().InputGridSheetForm.InputGridPropertiesPanel;

                //ApplicationManager.MainWindow.displayPropertyBar(this.PropertyBar);
            }
            else
            {
                ((InputGridPropertyBar)this.PropertyBar).DesignLayoutAnchorable.Content = page.getInputGridForm().GridForm.filterForm;

                //ApplicationManager.MainWindow.displayPropertyBar(null);
                if (page.getInputGridForm().GridForm.gridBrowser.RebuildGrid)
                {
                    UpdateGridForm();
                }
            }
        }
        private void OnDeleteRows(object obj)
        {
            String message = "You are about to delete " + ((List <long>)obj).Count + " row(s).\nDo you want to continue?";

            if (MessageDisplayer.DisplayYesNoQuestion("Delete", message) == MessageBoxResult.Yes)
            {
                if (this.GetInputGridService().deleteGridRows((List <long>)obj))
                {
                    InputGridEditorItem page = (InputGridEditorItem)getEditor().getActivePage();
                    Search(page.getInputGridForm().GridForm.toolBar.current);
                }
            }
        }
        /// <summary>
        /// Cette methode est exécuté lorsqu'on édit le nom de la table active.
        /// Si l'utilisateur tappe sur la touche ENTER, le nouveau nom est validé.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        protected void onNameTextChange(object sender, KeyEventArgs args)
        {
            InputGridEditorItem page = (InputGridEditorItem)getInputGridEditor().getActivePage();

            if (args.Key == Key.Escape)
            {
                page.getInputGridForm().InputGridSheetForm.InputGridPropertiesPanel.NameTextBox.Text = page.Title;
            }
            else if (args.Key == Key.Enter)
            {
                ValidateEditedNewName();
                OnChange();
            }
        }
        private void OnDuplicateRows(object obj)
        {
            String message = "You are about to duplicate " + ((List <long>)obj).Count + " row(s).\nDo you want to continue?";

            if (MessageDisplayer.DisplayYesNoQuestion("Duplicate", message) == MessageBoxResult.Yes)
            {
                var list = ((List <long>)obj).ConvertAll(i => (int)i).ToList();
                if (this.GetInputGridService().duplicateGridRows(list))
                {
                    InputGridEditorItem page = (InputGridEditorItem)getEditor().getActivePage();
                    Search(page.getInputGridForm().GridForm.toolBar.total + 1);
                }
            }
        }
 public void Export()
 {
     try
     {
         string filePath = openFileDialog("Export to Excel", null);
         if (filePath == null)
         {
             return;
         }
         InputGridEditorItem page   = (InputGridEditorItem)getEditor().getActivePage();
         GrilleFilter        filter = page.getInputGridForm().GridForm.filterForm.Fill();
         filter.grid = page.EditedObject;
         filter.file = filePath;
         bool response = this.GetInputGridService().exportToExcel(filter);
         if (response)
         {
             MessageDisplayer.DisplayInfo("Export to Excel", "Grid exported!");
         }
     }
     catch (ServiceExecption) { }
 }
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected virtual OperationState ValidateEditedNewName(string newName = "")
        {
            InputGridEditorItem page = (InputGridEditorItem)getInputGridEditor().getActivePage();
            Grille table             = page.EditedObject;

            if (string.IsNullOrEmpty(newName))
            {
                newName = page.getInputGridForm().InputGridSheetForm.InputGridPropertiesPanel.NameTextBox.Text.Trim();
            }
            if (string.IsNullOrEmpty(newName))
            {
                DisplayError("Empty Name", "The Grid name can't be mepty!");
                page.getInputGridForm().InputGridSheetForm.InputGridPropertiesPanel.NameTextBox.SelectAll();
                page.getInputGridForm().InputGridSheetForm.InputGridPropertiesPanel.NameTextBox.Focus();
                return(OperationState.STOP);
            }


            foreach (InputGridEditorItem unInputTable in getInputGridEditor().getPages())
            {
                if (unInputTable != getInputGridEditor().getActivePage() && newName == unInputTable.Title)
                {
                    DisplayError("Duplicate Name", "There is another Grid named: " + newName);
                    page.getInputGridForm().InputGridSheetForm.InputGridPropertiesPanel.NameTextBox.Text = page.Title;
                    page.getInputGridForm().InputGridSheetForm.InputGridPropertiesPanel.NameTextBox.SelectAll();
                    page.getInputGridForm().InputGridSheetForm.InputGridPropertiesPanel.NameTextBox.Focus();
                    return(OperationState.STOP);
                }
            }
            if (!IsRenameOnDoubleClick)
            {
                if (table.name.ToUpper().Equals(newName.ToUpper()))
                {
                    return(OperationState.CONTINUE);
                }
            }

            ((InputGridSideBar)SideBar).GrilleGroup.GrilleTreeview.updateGrille(newName, table.name, false);
            table.name = newName;
            page.Title = newName;
            return(OperationState.CONTINUE);
        }
        /// <summary>
        /// Initialisation des Handlers sur une nouvelle page.
        /// En plus des handlers de base, on initialise les handlers sur :
        /// - DesignerPropertiesPanel
        /// -
        /// - SpreadSheet
        /// -
        /// </summary>
        protected override void initializePageHandlers(EditorItem <Grille> page)
        {
            base.initializePageHandlers(page);
            InputGridEditorItem editorPage = (InputGridEditorItem)page;

            editorPage.getInputGridForm().InputGridSheetForm.InputGridPropertiesPanel.groupField.GroupService = GetInputGridService().GroupService;
            editorPage.getInputGridForm().InputGridSheetForm.InputGridPropertiesPanel.groupField.subjectType = SubjectTypeFound();
            editorPage.getInputGridForm().InputGridSheetForm.InputGridPropertiesPanel.NameTextBox.KeyUp += onNameTextChange;
            editorPage.getInputGridForm().InputGridSheetForm.InputGridPropertiesPanel.NameTextBox.LostFocus += onNameTextLostFocus;
            editorPage.getInputGridForm().InputGridSheetForm.InputGridPropertiesPanel.groupField.Changed += onGroupFieldChange;
            editorPage.getInputGridForm().InputGridSheetForm.InputGridPropertiesPanel.OnSetTableVisible += OnSetTableVisible;

            editorPage.getInputGridForm().InputGridSheetForm.InputGridPropertiesPanel.visibleInShortcutCheckbox.Checked += OnVisibleInShortcutCheck;
            editorPage.getInputGridForm().InputGridSheetForm.InputGridPropertiesPanel.visibleInShortcutCheckbox.Unchecked += OnVisibleInShortcutCheck;

            editorPage.getInputGridForm().InputGridSheetForm.InputGridPropertiesPanel.Changed += OnInputGridPropertiesChange;
            editorPage.getInputGridForm().InputGridSheetForm.InputGridPropertiesPanel.selectionColumnChanged += OnInputGridPropertiesSelectionColumnChange;

            if (editorPage.getInputGridForm().AdministrationBar != null)
            {
                editorPage.getInputGridForm().AdministrationBar.Changed += OnChangeEventHandler;
            }

            initializeGridFormHandlers(editorPage.getInputGridForm());

            editorPage.getInputGridForm().SelectionChanged += OnSelectedTabChange;
        }