Exemplo n.º 1
0
        /// <summary>
        /// Cette methode permet d'exporter le fichier excel ouvert dans la page active.
        /// On ouvre le dialogue pour permettre à l'utilisateur d'indiquer le répertoire et le nom
        /// sous lequel il faut exporter le fichier.
        /// </summary>
        /// <returns>
        /// OperationState.CONTINUE si l'opération a réussi
        /// OperationState.STOP sinon
        /// </returns>
        public override OperationState Run()
        {
            OperationState   state = OperationState.CONTINUE;
            ReportEditorItem page  = (ReportEditorItem)getInputTableEditor().getActivePage();

            if (page == null)
            {
                return(state);
            }
            if (page.EditedObject.template)
            {
                SaveAs(page.EditedObject.name + "temp01");
            }
            nextRunActionData = null;
            TableActionData data = new TableActionData();

            if (page.EditedObject.oid.HasValue)
            {
                data = new TableActionData(page.EditedObject.oid.Value, null);
            }
            data.saveBeforePerformAction = page.IsModify;
            data.name = page.EditedObject.name;
            if (((InputTableToolBar)ToolBar).ApplyToAllCheckBox.IsChecked.HasValue && !((InputTableToolBar)ToolBar).ApplyToAllCheckBox.IsChecked.Value)
            {
                Kernel.Ui.Office.Range range = page.getInputTableForm().SpreadSheet.GetSelectedRange();
                if (range == null)
                {
                    return(OperationState.STOP);
                }
                range.Sheet.TableName = page.EditedObject.name;
                data.range            = range;
            }

            if (data.saveBeforePerformAction)
            {
                nextRunActionData = data;
                return(Save(page));
            }

            GetReportService().RunAllocationTableHandler += updateRunProgress;
            Mask(true, "Running...");
            GetReportService().RunAllocationTable(data);
            return(state);
        }
Exemplo n.º 2
0
        private void updateRunProgress(AllocationRunInfo info)
        {
            ReportEditorItem page = (ReportEditorItem)getInputTableEditor().getActivePage();

            if (info != null)
            {
                throwSheetWritting = false;
                page.getInputTableForm().SpreadSheet.ThrowEvent = false;
                foreach (CellAllocationRunInfoBrowserData data in info.infos)
                {
                    page.getReportForm().SpreadSheet.SetValueAt(data.row, data.column,
                                                                data.sheet, data.loadedAmount);
                }
                page.getInputTableForm().SpreadSheet.ThrowEvent = true;
                throwSheetWritting = true;
            }

            if (info == null || info.runEnded == true)
            {
                GetReportService().RunAllocationTableHandler -= updateRunProgress;
                page.IsModify     = true;
                nextRunActionData = null;
                OnChange();
                Mask(false);
            }
            else
            {
                int rate = info.totalCellCount != 0 ? (Int32)(info.runedCellCount * 100 / info.totalCellCount) : 0;
                if (rate > 100)
                {
                    rate = 100;
                }

                ApplicationManager.MainWindow.LoadingProgressBar.Maximum = info.totalCellCount;
                ApplicationManager.MainWindow.LoadingProgressBar.Value   = info.runedCellCount;
                ApplicationManager.MainWindow.LoadingLabel.Content       = "Running Report : " + rate + " %" + " (" + info.runedCellCount + "/" + info.totalCellCount + ")";
            }
        }