Exemplo n.º 1
0
 /// <summary>
 ///		Graba la dimensión
 /// </summary>
 public void SaveDetails(bool newName)
 {
     if (ValidateData())
     {
         // Añade el origen de datos si es nuevo
         if (DataSource.DataWarehouse.DataSources[DataSource.Id] == null)
         {
             DataSource.DataWarehouse.DataSources.Add(DataSource);
         }
         // Asigna las propiedades
         DataSource.Id  = Key;
         DataSource.Sql = Sql;
         // Asigna las columnas
         DataSource.Columns.Clear();
         DataSource.Columns.AddRange(ColumnsViewModel.GetColumns());
         // Asigna los parámetros
         DataSource.Parameters.Clear();
         DataSource.Parameters.AddRange(ParametersViewModel.GetParameters());
         // Graba la solución
         ReportingSolutionViewModel.SaveDataWarehouse(DataSource.DataWarehouse);
         // Cambia la cabecera
         Header = DataSource.Id;
         // Indica que no ha habido modificaciones
         IsUpdated = false;
     }
 }
Exemplo n.º 2
0
        private void DataGrid_CellDrop(object sender, DragEventArgs e)
        {
            DataGridCell dgc = sender as DataGridCell;

            if (_draggedData != null && !_isMultipleCells)
            {
                MappedValue selectedCell = _draggedData as MappedValue;

                RowViewModel     sourceRowModel    = (selectedCell.RowBinding as RowViewModel);
                ColumnsViewModel sourceColumnModel = (selectedCell.ColumnBinding as ColumnsViewModel);


                RowViewModel     targetRowModel    = ((BindableColumn.ViewModel.RowViewModel)(dgc.DataContext));
                ColumnsViewModel targetColumnModel = ((BindableColumn.ViewModel.ColumnsViewModel)((dgc.Column).Header));

                targetCell = targetRowModel.Name + targetColumnModel.Currency;
                sourceCell = sourceRowModel.Name + sourceColumnModel.Currency;


                if (sourceCell == targetCell)
                {
                    RemoveDraggedAdorner();
                    RemoveInsertionAdorner();
                    (this._sourceItemsControl as DataGrid).UnselectAllCells();
                    dgc.IsSelected = false;
                    return;
                }

                MappedValueCollection mappedValueCollection = this._mappedValueCollection;
                var movingCellData = mappedValueCollection.ReturnIfExistAddIfNot(sourceColumnModel, sourceRowModel);

                if (mappedValueCollection.AddCellValue(targetRowModel, targetColumnModel, movingCellData))
                {
                    if (movingCellData.Value != null)
                    {
                        dgc.IsSelected = true;
                    }

                    mappedValueCollection.EmptyCellValue(sourceRowModel, sourceColumnModel);
                }
            }
            else if (_draggedData != null && _isMultipleCells)
            {
                RowViewModel     targetRowModel    = ((BindableColumn.ViewModel.RowViewModel)(dgc.DataContext));
                ColumnsViewModel targetColumnModel = ((BindableColumn.ViewModel.ColumnsViewModel)((dgc.Column).Header));

                targetCell = targetRowModel.Name + targetColumnModel.Currency;

                if (MoveMultipleCells(targetCell, this._multipleDraggedData.Count))
                {
                    this._multipleDraggedData.Clear();
                }
            }

            RemoveDraggedAdorner();
            RemoveInsertionAdorner();
            this._multipleDraggedData.Clear();
            (this._sourceItemsControl as DataGrid).UnselectAllCells();
        }
Exemplo n.º 3
0
 /// <summary>
 ///		Graba la dimensión
 /// </summary>
 public void SaveDetails(bool newName)
 {
     if (ValidateData())
     {
         // Asigna las columnas
         DataSource.Columns.Clear();
         DataSource.Columns.AddRange(ColumnsViewModel.GetColumns());
         // Graba la solución
         ReportingSolutionViewModel.SaveDataWarehouse(DataSource.DataWarehouse);
         // Indica que no ha habido modificaciones
         IsUpdated = false;
     }
 }
Exemplo n.º 4
0
        public ActionResult Columns(ColumnsViewModel model)
        {
            if (SharedInstance.AppUser.Connection == true)
            {
                model.MyColumnas = MyBL.MyGetColumns(model.NombreTabla);
            }
            else
            {
                model.Columnas = BL.GetColumns(model.NombreTabla);
            }
            StatsViewModel temp = new StatsViewModel();

            temp._ColumnsViewModel = model;
            temp.partialName       = "TableColumns";
            return(View("Index", temp));
        }
Exemplo n.º 5
0
        /// <summary>
        ///		Comprueba los datos introducidos
        /// </summary>
        private bool ValidateData()
        {
            bool validated = false;

            // Comprueba los datos
            if (ColumnsViewModel.Items.Count == 0)
            {
                ReportingSolutionViewModel.SolutionViewModel.MainController.SystemController.ShowMessage("No se ha definido ninguna columna");
            }
            else if (ColumnsViewModel.ValidateData())
            {
                validated = true;
            }
            // Devuelve el valor que indica si se ha podido grabar
            return(validated);
        }
Exemplo n.º 6
0
        public LayoutPreferences()
        {
            this.LayoutMode                    = UserSettingsService.LayoutSettingsService.DefaultLayoutMode;
            this.GridViewSize                  = UserSettingsService.LayoutSettingsService.DefaultGridViewSize;
            this.DirectorySortOption           = UserSettingsService.LayoutSettingsService.DefaultDirectorySortOption;
            this.DirectoryGroupOption          = UserSettingsService.LayoutSettingsService.DefaultDirectoryGroupOption;
            this.DirectorySortDirection        = UserSettingsService.LayoutSettingsService.DefaultDirectorySortDirection;
            this.SortDirectoriesAlongsideFiles = UserSettingsService.LayoutSettingsService.DefaultSortDirectoriesAlongsideFiles;
            this.IsAdaptiveLayoutOverridden    = false;

            this.ColumnsViewModel = new ColumnsViewModel();
            this.ColumnsViewModel.DateCreatedColumn.UserCollapsed  = !UserSettingsService.LayoutSettingsService.ShowDateCreatedColumn;
            this.ColumnsViewModel.DateModifiedColumn.UserCollapsed = !UserSettingsService.LayoutSettingsService.ShowDateColumn;
            this.ColumnsViewModel.ItemTypeColumn.UserCollapsed     = !UserSettingsService.LayoutSettingsService.ShowTypeColumn;
            this.ColumnsViewModel.SizeColumn.UserCollapsed         = !UserSettingsService.LayoutSettingsService.ShowSizeColumn;
            this.ColumnsViewModel.TagColumn.UserCollapsed          = !UserSettingsService.LayoutSettingsService.ShowFileTagColumn;
        }
Exemplo n.º 7
0
        protected ColRegExpProcessor CreateRegExpProcessor()
        {
            var highlightColumnsList = new List <int>();

            var viewModel = ColumnsViewModel.FromJSON(BrowserManager.GetViewData(_views, "Columns RegEx"));
            var settings  = viewModel.ColumnsSettingsList.FirstOrDefault(x => x.ColumnID == _selectedColumnID);

            if (settings != null)
            {
                highlightColumnsList.AddRange(settings.HighlightColumnsList.Where(x => x.IsSelected).Select(x => x.ColumnID));
            }
            else
            {
                highlightColumnsList.Add(_selectedColumnID);
            }

            return(new ColRegExpProcessor(_views.MainForm.datasetMain.ColRegExp.Rows.Cast <DataRow>(), highlightColumnsList));
        }
Exemplo n.º 8
0
        private void DragSource_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e)
        {
            IList <DataGridCellInfo> selectedCells = (sender as DataGrid).SelectedCells;

            this._multipleDraggedData.Clear();

            selectedCells.ToList().ForEach(x =>
            {
                RowViewModel rowModel        = x.Item as RowViewModel;
                ColumnsViewModel columnModel = x.Column.Header as ColumnsViewModel;
                MappedValue value            = AttachedColumnBehavior.GetMappedValues(sender as DependencyObject).ReturnIfExistAddIfNot(columnModel, rowModel);

                var selectedCell = rowModel.Name + columnModel.Currency;

                if (value.Value != null && selectedCells.Count > 1 && !_multipleDraggedData.ContainsKey(selectedCell))
                {
                    this._multipleDraggedData.Add(selectedCell, value);
                }
            });

            _isMultipleCells = selectedCells.Count > 1;
        }
Exemplo n.º 9
0
        /// <summary>
        ///		Comprueba los datos introducidos
        /// </summary>
        private bool ValidateData()
        {
            bool validated = false;

            // Comprueba los datos
            if (string.IsNullOrWhiteSpace(Key))
            {
                ReportingSolutionViewModel.SolutionViewModel.MainController.SystemController.ShowMessage("Introduzca la clave del origen de datos");
            }
            else if (string.IsNullOrWhiteSpace(Sql))
            {
                ReportingSolutionViewModel.SolutionViewModel.MainController.SystemController.ShowMessage("Introduzca el comando SQL del origen de datos");
            }
            else if (ColumnsViewModel.Items.Count == 0)
            {
                ReportingSolutionViewModel.SolutionViewModel.MainController.SystemController.ShowMessage("No se ha definido ninguna columna");
            }
            else if (ColumnsViewModel.ValidateData() && ParametersViewModel.ValidateData())
            {
                validated = true;
            }
            // Devuelve el valor que indica si se ha podido grabar
            return(validated);
        }
Exemplo n.º 10
0
        public LogFileViewModel(ILogger Logger, LogFile LogFile, IInlineParserFactoryModule InlineParserBuilderModule, IColorProviderModule ColorProviderModule) : base(Logger)
        {
            AssertParameterNotNull(LogFile, "LogFile");
            AssertParameterNotNull(InlineParserBuilderModule, "InlineParserBuilderModule");
            AssertParameterNotNull(ColorProviderModule, "ColorProviderModule");

            this.logFile = LogFile;


            this.Name          = Path.GetFileName(LogFile.FileName);
            FindOptions        = new FindOptions(Logger);
            FindOptions.Column = LogFile.FormatHandler.DefaultColumn;
            FormatHandlerName  = LogFile.FormatHandler.Name;

            // loaded on opening
            filterItemSourcesViewModel = new FilterItemSourcesViewModel(Logger, LogFile.FormatHandler.Columns);
            Columns = new ColumnsViewModel(Logger, LogFile.FormatHandler, filterItemSourcesViewModel, InlineParserBuilderModule, ColorProviderModule);
            events  = new EventCollectionViewModel(Logger, ColorProviderModule, Columns);

            // loaded on refresh
            this.FilteredEvents = new FilteredEventsViewModel(Logger);
            Severities          = new SeveritiesViewModel(Logger, LogFile.FormatHandler.SeverityColumn);
            Markers             = new MarkersViewModel(Logger, LogFile.FormatHandler.SeverityColumn);
        }
Exemplo n.º 11
0
        private void DropTarget_PreviewDrop(object sender, DragEventArgs e)
        {
            object draggedItem = e.Data.GetData(this._format.Name);

            int indexRemoved = -1;

            if (draggedItem != null)
            {
                if ((e.Effects & DragDropEffects.Move) != 0 && (this._sourceItemsControl == this._targetItemsControl || GetIsDropRejectFromOthers(this._targetItemsControl)))
                {
                    this._targetDataContext = (sender as DataGrid).DataContext;

                    // Remove the selected Cell here from Mapped Values
                    DataGrid dgc = sender as DataGrid;

                    RowViewModel     sourceRowHeader    = ((RowViewModel)(dgc.CurrentItem));
                    ColumnsViewModel sourceColumnHeader = ((ColumnsViewModel)((dgc.CurrentColumn).Header));
                    string           srcCell            = sourceRowHeader.Name + sourceColumnHeader.Currency;


                    MappedValueCollection sourceCell  = AttachedColumnBehavior.GetMappedValues(sender as DependencyObject);
                    MappedValue           mappedValue = sourceCell.ReturnIfExistAddIfNot(sourceColumnHeader, sourceRowHeader);
                    int getIndex = sourceCell.IndexOf(mappedValue);

                    //var hitTestInfo = (sender as DataGrid).InputHitTest(new Point{ X = e.})

                    sourceCell[getIndex].Value = (draggedItem as MappedValue).Value;


                    //indexRemoved = RemoveItemFromItemsControl(this._sourceItemsControl, draggedItem);
                }
                // This happens when we drag an item to a later position within the same ItemsControl.
                if (indexRemoved != -1 && this._sourceItemsControl == this._targetItemsControl && indexRemoved < this._insertionIndex)
                {
                    this._insertionIndex--;
                }
                if (!GetIsDropRejectFromOthers(this._targetItemsControl))
                {
                    IEnumerable itemsSource      = _targetItemsControl.ItemsSource;
                    Type        type             = itemsSource.GetType();
                    Type        genericIListType = type.GetInterface("IList`1");
                    int         elementsCount    = 0;
                    if (genericIListType != null)
                    {
                        elementsCount = (int)type.GetProperty("Count").GetValue(itemsSource, null);
                    }
                    if (elementsCount > this._insertionIndex)
                    {
                        RemoveItemFromItemsControlByIndex(this._targetItemsControl, this._insertionIndex);
                        InsertItemInItemsControl(this._targetItemsControl, draggedItem, this._insertionIndex);

                        if (this._sourceItemsControl == this._targetItemsControl)
                        {
                            Type   draggedType = draggedItem.GetType();
                            object newitem     = Activator.CreateInstance(draggedType);
                            InsertItemInItemsControl(this._sourceItemsControl, newitem, indexRemoved);
                        }
                    }
                }
                else
                {
                    Type   draggedType = draggedItem.GetType();
                    object newitem     = Activator.CreateInstance(draggedType);
                    //InsertItemInItemsControl(this._sourceItemsControl, newitem, indexRemoved);
                }

                RemoveDraggedAdorner();
                RemoveInsertionAdorner();
            }
            e.Handled = true;
        }
Exemplo n.º 12
0
        protected void LoadSettings()
        {
            _viewModel = ColumnsViewModel.FromJSON(BrowserManager.GetViewData(_views, "Columns RegEx"));

            var dynamicColumns = _views.MainForm.datasetMain.DynamicColumns.Rows.Cast <MainDataSet.DynamicColumnsRow>()
                                 .OrderBy(x => x.Order)
                                 .ToList();

            var columns = (from dynamicCol in dynamicColumns
                           join setting in _viewModel.ColumnsSettingsList
                           on dynamicCol.ID equals setting.ColumnID
                           into tmp
                           from t in tmp.DefaultIfEmpty()
                           select new { Column = dynamicCol, Settings = t }).ToList();

            _viewModel.ColumnsSettingsList.Clear();

            foreach (var col in columns)
            {
                var settings = col.Settings ?? new DynamicColumnSettings {
                    ColumnID = col.Column.ID
                };

                settings.Name = col.Column.Title;

                ///////////////////////////////////////////////////////////////////////////////

                var highlightColumns = (from dynamicCol in dynamicColumns
                                        join setting in settings.HighlightColumnsList
                                        on dynamicCol.ID equals setting.ColumnID
                                        into tmp
                                        from t in tmp.DefaultIfEmpty()
                                        select new { Column = dynamicCol, Settings = t }).ToList();

                settings.HighlightColumnsList.Clear();

                foreach (var highlightCol in highlightColumns)
                {
                    var highlightSetting = highlightCol.Settings ?? new DynamicColumnSettings
                    {
                        IsSelected = highlightCol.Column.ID == col.Column.ID,
                        ColumnID   = highlightCol.Column.ID
                    };

                    highlightSetting.Name = highlightCol.Column.Title;

                    settings.HighlightColumnsList.Add(highlightSetting);
                }

                ///////////////////////////////////////////////////////////////////////////////

                _viewModel.ColumnsSettingsList.Add(settings);
            }

            gridDynamicColumns.DataSource = _viewModel.ColumnsSettingsList;

            var selectedColumn = _viewModel.ColumnsSettingsList.FirstOrDefault(x => x.ColumnID == _selectedColumnID) ?? _viewModel.ColumnsSettingsList.First();

            var row = gridDynamicColumns.Rows.Cast <DataGridViewRow>()
                      .FirstOrDefault(x => x.DataBoundItem == selectedColumn);

            if (row != null)
            {
                row.Selected = true;
            }
        }