Пример #1
0
        private void PasteRowValues(PasteParam pasteParam)
        {
            // create Paste Processor
            var clipboard                 = new Clipboard();
            var clipboardParser           = new CopyParser(clipboard);
            var newRowPasteProcessor      = new NewRowPasteProcessor(clipboardParser, this.View);
            var existingRowPasteProcessor = new ExistingRowPasteProcessor(clipboardParser, this.View);


            string[][] copiedValues = clipboardParser.ToArray();
            if (copiedValues == null)
            {
                return;
            }

            GridListEditor listEditor = ((ListView)View).Editor as GridListEditor;

            if (listEditor != null)
            {
                var gridView = listEditor.GridView;

                if ((gridView.IsNewItemRow(gridView.FocusedRowHandle)))
                {
                    // paste to new rows
                    newRowPasteProcessor.Process(pasteParam);
                }
                else
                {
                    // paste to selected rows
                    int[] selectedRowHandles = gridView.GetSelectedRows();
                    existingRowPasteProcessor.Process(selectedRowHandles, pasteParam);
                }
            }
        }
Пример #2
0
        private void PasteColumnValues()
        {
            var clipboard          = new Clipboard();
            var clipboardParser    = new CopyParser(clipboard);
            var cellPasteProcessor = new CellPasteProcessor(clipboardParser, this.View);

            string[] copiedValues = clipboardParser.ToArray(0);
            if (copiedValues == null)
            {
                return;
            }
            cellPasteProcessor.Process(copiedValues);
        }
Пример #3
0
        private void PasteRowValues(PasteParam pasteParam)
        {
            // create clipboard parser
            var clipboard       = new Clipboard();
            var clipboardParser = new CopyParser(clipboard);

            // validate

            string[][] copiedValues = clipboardParser.ToArray();
            if (copiedValues == null)
            {
                return;
            }

            if (copiedValues.GetLength(0) > PasteSettings.MaximumOnlineRows)
            {
                logger.Log("Rows exceeded the maximum of {0}. OFFLINE mode used.",
                           PasteSettings.MaximumOnlineRows);

                var sw = new Stopwatch();
                sw.Start();
                PasteOfflineRowValues(pasteParam, false);
                sw.Stop();
                logger.Log("Import completed in {0:0.00} seconds.", sw.Elapsed.TotalSeconds);

                new Xafology.ExpressApp.SystemModule.GenericMessageBox(
                    logger.LogMessage, "Import SUCCESSFUL");
                return;
            }
            // create Paste Processor
            var newRowPasteProcessor      = new NewRowPasteProcessor(clipboardParser, this.View);
            var existingRowPasteProcessor = new ExistingRowPasteProcessor(clipboardParser, this.View);

            GridListEditor listEditor = ((ListView)View).Editor as GridListEditor;

            if (listEditor != null)
            {
                var gridView = listEditor.GridView;

                if ((gridView.IsNewItemRow(gridView.FocusedRowHandle)))
                {
                    // paste to new rows
                    newRowPasteProcessor.Process(pasteParam);
                }
                else
                {
                    // paste to selected rows
                    existingRowPasteProcessor.Process(pasteParam);
                }
            }
        }
Пример #4
0
        private void PasteCommitRowValues(PasteParam pasteParam, bool isRoot = false)
        {
            int commitInterval = 100;
            // create Paste Processor
            var clipboard                 = new Clipboard();
            var clipboardParser           = new CopyParser(clipboard);
            var newRowPasteProcessor      = new NewRowPasteProcessor(clipboardParser, this.View, logger);
            var existingRowPasteProcessor = new ExistingRowPasteProcessor(clipboardParser, this.View, logger);

            string[][] copiedValues = clipboardParser.ToArray();
            if (copiedValues == null)
            {
                return;
            }

            GridListEditor listEditor = ((ListView)View).Editor as GridListEditor;

            if (listEditor != null)
            {
                var sw = new Stopwatch();
                sw.Start();

                var gridView = listEditor.GridView;

                if ((gridView.IsNewItemRow(gridView.FocusedRowHandle)))
                {
                    // paste to new rows
                    newRowPasteProcessor.ProcessOffline(pasteParam, commitInterval);
                }
                else
                {
                    existingRowPasteProcessor.ProcessOffline(pasteParam, commitInterval);
                }

                sw.Stop();
                logger.Log("Import completed in {0:0.00} seconds.", sw.Elapsed.TotalSeconds);
                logger.Log("Changes saved to database.");
                if (isRoot)
                {
                    new Xafology.ExpressApp.SystemModule.GenericMessageBox(
                        logger.LogMessage, "Import SUCCESSFUL");
                }
            }
        }