Ejemplo n.º 1
0
        protected override JsonApplication JsonApplicationCreate()
        {
            JsonApplication result = new JsonApplication();

            result.Session = Guid.NewGuid();
            //
            new GridKeyboard(result, "GridKeyboard");
            var container   = new LayoutContainer(result, "Container");
            var rowHeader   = new LayoutRow(container, "Header");
            var cellHeader1 = new LayoutCell(rowHeader, "HeaderCell1");

            new GridField(cellHeader1, "Field", null, null, null);
            var rowContent   = new LayoutRow(container, "Content");
            var cellContent1 = new LayoutCell(rowContent, "ContentCell1");

            new Grid(cellContent1, "Master", "Master");
            var cellContent2 = new LayoutCell(rowContent, "ContentCell2");

            new Grid(cellContent2, "Detail", "Detail");
            var rowFooter  = new LayoutRow(container, "Footer");
            var cellFooter = new LayoutCell(rowFooter, "FooterCell1");
            var button     = new Button(cellFooter, "Hello");
            //
            var gridData = new GridData();

            gridData.LoadToJsonGrid("Master", typeof(Database.dbo.TableName));
            gridData.ColumnList["Master"].Where(item => item.FieldName == "TableName2").First().IsUpdate = true;
            gridData.LoadToJsonGrid("Detail", typeof(Database.dbo.AirportDisplay));
            result.GridData = gridData;
            //
            return(result);
        }
Ejemplo n.º 2
0
        public void InitAvrPivotSettings(AvrPivotSettings pivotSettings)
        {
            if (LayoutRow != null)
            {
                pivotSettings.DefaultGroupInterval = LayoutRow.idfsDefaultGroupDate;

                pivotSettings.ShowColumnGrandTotals     = LayoutRow.blnShowColGrandTotals;
                pivotSettings.ShowColumnTotals          = LayoutRow.blnShowColsTotals;
                pivotSettings.ShowRowGrandTotals        = LayoutRow.blnShowRowGrandTotals;
                pivotSettings.ShowRowTotals             = LayoutRow.blnShowRowsTotals;
                pivotSettings.ShowTotalsForSingleValues = LayoutRow.blnShowForSingleTotals;

                pivotSettings.ShowMissedValues      = LayoutRow.blnShowMissedValuesInPivotGrid;
                pivotSettings.ShowMissedValuesSaved = LayoutRow.blnShowMissedValuesInPivotGrid;
                pivotSettings.ApplyFilter           = LayoutRow.blnApplyPivotGridFilter;
                pivotSettings.CompactLayout         = LayoutRow.blnCompactPivotGrid;
                pivotSettings.FreezeRowHeaders      = LayoutRow.blnFreezeRowHeaders;
                pivotSettings.FilterCriteriaString  = LayoutRow.strPivotGridSettings;
                pivotSettings.UseArchiveData        = LayoutRow.blnUseArchivedData;
                pivotSettings.IsPublished           = LayoutRow.blnReadOnly;
                pivotSettings.ShowDataInPivot       = LayoutRow.blnShowDataInPivotGrid;

                pivotSettings.IsSingleSearchObject = !LayoutRow.IsblnSingleSearchObjectNull() && LayoutRow.blnSingleSearchObject;
            }
            else
            {
                pivotSettings.DefaultGroupInterval = (long)DBGroupInterval.gitDateYear;
                pivotSettings.ShowDataInPivot      = true;
            }
            pivotSettings.LayoutDataset = LayoutDataSet;
        }
Ejemplo n.º 3
0
        public UpdateTemplateResponse UpdateTemplate(UpdateTemplateRequest request)
        {
            var template = DataContext.DashboardTemplates
                           .Include(x => x.LayoutRows)
                           .Include(x => x.LayoutRows.Select(y => y.LayoutColumns))
                           .Single(x => x.Id == request.Id);

            template.Name        = request.Name;
            template.RefershTime = request.RefershTime;
            template.Remark      = request.Remark;
            template.IsActive    = request.IsActive;
            foreach (var row in template.LayoutRows.ToList())
            {
                foreach (var column in row.LayoutColumns.ToList())
                {
                    DataContext.LayoutColumns.Remove(column);
                }
                DataContext.LayoutRows.Remove(row);
            }

            var index = 0;

            foreach (var row in request.LayoutRows)
            {
                var layoutRow = new LayoutRow();
                var colIndex  = 0;
                layoutRow.Index = index;
                foreach (var col in row.LayoutColumns)
                {
                    var layoutColumn = new LayoutColumn();
                    layoutColumn.Index = colIndex;
                    layoutColumn.Width = col.Width;
                    if (col.ArtifactId != 0)
                    {
                        if (DataContext.Artifacts.Local.FirstOrDefault(x => x.Id == col.ArtifactId) == null)
                        {
                            var artifact = new Artifact {
                                Id = col.ArtifactId, GraphicType = "Unchanged", GraphicName = "Unchanged", HeaderTitle = "Unchanged"
                            };
                            //DataContext.Entry(artifact).State = EntityState.Unchanged;
                            DataContext.Artifacts.Attach(artifact);
                            layoutColumn.Artifact = artifact;
                        }
                        else
                        {
                            layoutColumn.Artifact = DataContext.Artifacts.Local.FirstOrDefault(x => x.Id == col.ArtifactId);
                        }
                    }
                    layoutRow.LayoutColumns.Add(layoutColumn);
                    colIndex++;
                }
                template.LayoutRows.Add(layoutRow);
                index++;
            }
            DataContext.DashboardTemplates.Attach(template);
            DataContext.Entry(template).State = EntityState.Modified;
            DataContext.SaveChanges();

            return(new UpdateTemplateResponse());
        }
 public static LayoutRowEntity ToEntity(this LayoutRow contract)
 {
     return(new LayoutRowEntity
     {
         Cells = contract.Cells.ToEntities(),
     });
 }
Ejemplo n.º 5
0
        public CreateTemplateResponse CreateTemplate(CreateTemplateRequest request)
        {
            var template = request.MapTo <DashboardTemplate>();
            var index    = 0;

            foreach (var row in request.LayoutRows)
            {
                var layoutRow = new LayoutRow();
                var colIndex  = 0;
                layoutRow.Index = index;
                foreach (var col in row.LayoutColumns)
                {
                    var LayoutColumn = new LayoutColumn();
                    LayoutColumn.Index = colIndex;
                    LayoutColumn.Width = col.Width;
                    LayoutColumn.HighlightPeriodeType = col.HighlightPeriodeType;
                    LayoutColumn.ColumnType           = col.ColumnType;
                    if (col.ArtifactId != 0)
                    {
                        if (DataContext.Artifacts.Local.Where(x => x.Id == col.ArtifactId).FirstOrDefault() == null)
                        {
                            var artifact = new Artifact {
                                Id = col.ArtifactId, GraphicType = "Unchanged", GraphicName = "Unchanged", HeaderTitle = "Unchanged"
                            };
                            //DataContext.Entry(artifact).State = EntityState.Unchanged;
                            DataContext.Artifacts.Attach(artifact);
                            LayoutColumn.Artifact = artifact;
                        }
                        else
                        {
                            LayoutColumn.Artifact = DataContext.Artifacts.Local.Where(x => x.Id == col.ArtifactId).FirstOrDefault();
                        }
                    }
                    if (col.HighlightTypeId != 0)
                    {
                        if (DataContext.SelectOptions.Local.Where(x => x.Id == col.HighlightTypeId).FirstOrDefault() == null)
                        {
                            var highlightType = new SelectOption {
                                Id = col.HighlightTypeId
                            };
                            DataContext.SelectOptions.Attach(highlightType);
                            LayoutColumn.HighlightType = highlightType;
                        }
                        else
                        {
                            LayoutColumn.HighlightType = DataContext.SelectOptions.Local.Where(x => x.Id == col.HighlightTypeId).FirstOrDefault();
                        }
                    }
                    layoutRow.LayoutColumns.Add(LayoutColumn);
                    colIndex++;
                }
                template.LayoutRows.Add(layoutRow);
                index++;
            }
            DataContext.DashboardTemplates.Add(template);
            DataContext.SaveChanges();
            return(new CreateTemplateResponse());
        }
Ejemplo n.º 6
0
        public bool RemoveLayoutRow(LayoutRow row)
        {
            var item = Queryable.FirstOrDefault(_context.LayoutRow, t => t.LayoutRowId == row.LayoutRowId);

            if (item != null)
            {
                _context.LayoutRow.Remove(item);
            }
            return(_context.SaveChanges() > 0);
        }
Ejemplo n.º 7
0
        public async Task <bool> RemoveLayoutRowAsync(LayoutRow row)
        {
            var token = new CancellationToken();
            var item  = await _context.LayoutRow.FirstOrDefaultAsync(t => t.LayoutRowId == row.LayoutRowId);

            if (item != null)
            {
                _context.LayoutRow.Remove(item);
            }
            return(await _context.SaveChangesAsync(token) > 0);
        }
Ejemplo n.º 8
0
        public bool AddLayoutRow(Layout layout, string layoutTypeId)
        {
            var layoutRow = new LayoutRow
            {
                LayoutTypeId = layoutTypeId,
                LayoutId     = layout.LayoutId,
                RowIndex     = layout.LayoutRows.Count
            };

            _context.LayoutRow.Add(layoutRow);
            return(_context.SaveChanges() > 0);
        }
Ejemplo n.º 9
0
        public async Task <bool> AddLayoutRowAsync(Layout layout, string layoutTypeId)
        {
            var layoutRow = new LayoutRow
            {
                LayoutTypeId = layoutTypeId,
                LayoutId     = layout.LayoutId,
                RowIndex     = layout.LayoutRows.Count + 1
            };

            _context.LayoutRow.Add(layoutRow);
            return(await _context.SaveChangesAsync(new CancellationToken()) > 0);
        }
Ejemplo n.º 10
0
        public async Task <IActionResult> OnPostAddLayoutRow([FromBody] PostData data)
        {
            var types = await _service.GetLayoutTypesAsync();

            var layoutRow = new LayoutRow
            {
                LayoutRowId  = "0",
                LayoutTypeId = data.LayoutTypeId,
                LayoutType   = types.FirstOrDefault(e => e.LayoutTypeId == data.LayoutTypeId)
            };

            return(ViewComponent("LayoutRow", layoutRow));
        }
 protected override void VisitRow(LayoutRow row)
 {
     if (!IsFound)
     {
         RowIndex++;
         if (row.Range.Contains(document.CaretPosition.ToInt()))
         {
             IsFound  = true;
             ColIndex = document.CaretPosition.ToInt() - row.Range.Start;
         }
     }
     base.VisitRow(row);
 }
Ejemplo n.º 12
0
        public async Task <IActionResult> AddLayoutRow(string layoutTypeId)
        {
            var types = await _service.GetLayoutTypesAsync();

            var layoutRow = new LayoutRow
            {
                LayoutRowId  = "0",
                LayoutTypeId = layoutTypeId,
                LayoutType   = types.FirstOrDefault(e => e.LayoutTypeId == layoutTypeId)
            };

            return(PartialView("LayoutRow", layoutRow));
        }
        // get information about a current text box layout
        public static string GetInformationAboutCurrentTextBox(SubDocument subDocument, DocumentLayout currentLayout, DocumentPosition docPosition)
        {
            string returnedInformation = "!A TEXTBOX CONTENT IS SELECTED!\r\n";

            LayoutIterator layoutIterator     = new LayoutIterator(currentLayout, subDocument.Range);
            LayoutPage     currentTextBoxPage = null;
            LayoutTextBox  currentTextBox     = null;

            while (layoutIterator.MoveNext())
            {
                LayoutElement element = layoutIterator.Current;
                if (element is LayoutTextBox)
                {
                    currentTextBox = (element as LayoutTextBox);
                    if (currentTextBox.Parent is LayoutPage)
                    {
                        currentTextBoxPage = currentTextBox.Parent as LayoutPage;
                    }
                }
                if (element is PlainTextBox)
                {
                    PlainTextBox currentPlaintTextBox = element as PlainTextBox;
                    if (currentPlaintTextBox.Range.Contains(docPosition.ToInt()))
                    {
                        returnedInformation += String.Format("Selected content: {0}\r\n", currentPlaintTextBox.Text);

                        LayoutRow currentRow       = currentPlaintTextBox.Parent as LayoutRow;
                        int       currentLineIndex = currentTextBox.Rows.ToList().IndexOf(currentRow);
                        returnedInformation += String.Format("Line index: {0}\r\n", currentLineIndex + 1);
                        returnedInformation += String.Format("Selected block bounds: {0}\r\n", currentPlaintTextBox.Bounds);
                        break;
                    }
                }
            }

            returnedInformation += String.Format("TEXTBOX bounds: {0}\r\n", currentTextBox.Bounds);
            returnedInformation += String.Format("\r\n!!Content information:\r\n");
            returnedInformation += GetInformationAboutCurrentTextBoxContent(currentTextBox, currentLayout);

            if (currentTextBoxPage != null)
            {
                returnedInformation += PageLayoutHelper.GetInformationAboutCurrentPage(currentLayout, currentTextBoxPage, docPosition);
            }
            return(returnedInformation);
        }
        // get information about a current regular text block
        public static string GetInformationAboutRegularTextBlock(PlainTextBox currentTextBlock, Document currentDocument)
        {
            string returnedInformation = "!A REGULAR TEXT BLOCK IS SELECTED!\r\n";

            returnedInformation += String.Format("Content: {0}\r\n", currentTextBlock.Text);

            LayoutRow    currentRow       = currentTextBlock.Parent as LayoutRow;
            LayoutColumn currentColumn    = currentRow.Parent as LayoutColumn;
            int          currentLineIndex = currentColumn.Rows.ToList().IndexOf(currentRow);

            returnedInformation += String.Format("Line index: {0}\r\n", currentLineIndex + 1);
            returnedInformation += String.Format("Start position: {0}\r\n", currentTextBlock.Range.Start);
            returnedInformation += String.Format("End position: {0}\r\n", currentTextBlock.Range.Start + currentTextBlock.Range.Length);

            int currentParagraphIndex = currentDocument.Paragraphs.ToList().IndexOf(currentDocument.Paragraphs.Get(currentDocument.CreatePosition(currentTextBlock.Range.Start)));

            returnedInformation += String.Format("Paragrpah index: {0}\r\n", currentParagraphIndex + 1);
            returnedInformation += String.Format("Text block bounds: {0}\r\n", currentTextBlock.Bounds);

            return(returnedInformation);
        }
Ejemplo n.º 15
0
 protected override void OnLayoutSet(LayoutRow value)
 {
     base.OnLayoutSet(value);
     _columns = value.cols;
 }
Ejemplo n.º 16
0
 public void Visit(LayoutRow row)
 {
     Array.ForEach(row.cols, c => c.col.Accept(this));
 }
Ejemplo n.º 17
0
 protected override void VisitRow(LayoutRow row)
 {
     TryAddElementToCollection(row, ContentDisplayAction.Select, true);
     base.VisitRow(row);
 }
Ejemplo n.º 18
0
 public override void DrawRow(LayoutRow row)
 {
     base.DrawRow(row);
     HighlightElement(row);
 }
 protected override void VisitRow(LayoutRow row)
 {
     AddTreeNode(row, ContentDisplayAction.Select);
     base.VisitRow(row);
 }
Ejemplo n.º 20
0
 protected override void VisitRow(LayoutRow row)
 {
     TextLinesCount++;
     base.VisitRow(row);
 }
 protected override void VisitRow(LayoutRow row)
 {
     RowIndex++;
     base.VisitRow(row);
 }
Ejemplo n.º 22
0
            public void LayoutItem(VisualElement visual)
            {
                int colSpan = Math.Min(Columns, GetColumnSpan(visual));
                int rowSpan = GetRowSpan(visual);

                if (availableRow == null)
                {
                    availableRow = GetRow(rows.Count);
                }

                LayoutRow startRow    = availableRow;
                int       startColumn = startRow.NextAvailableColumn;

                int?foundCol = null;

                int rowUpper = 0;

                while (foundCol == null)
                {
                    foundCol = startRow.FindAvailableColumn(startColumn, colSpan);
                    rowUpper = startRow.RowNo + rowSpan;
                    if (foundCol == null)
                    {
                        startRow    = GetRow(startRow.RowNo + 1);
                        startColumn = startRow.NextAvailableColumn;
                        continue;
                    }
                    for (int r = startRow.RowNo + 1; r < rowUpper; r++)
                    {
                        LayoutRow nextRow = GetRow(r);
                        if (nextRow.IsFull)
                        {
                            foundCol    = null;
                            startRow    = GetRow(nextRow.RowNo + 1);
                            startColumn = startRow.NextAvailableColumn;
                            break;
                        }
                        if (GetRow(r).FindAvailableColumn(startColumn, colSpan) == null)
                        {
                            foundCol = null;
                            startColumn++;
                            break;
                        }
                    }
                }

                var item = new LayoutItemData(visual, startRow.RowNo, startColumn, colSpan);

                for (int r = startRow.RowNo; r < rowUpper; r++)
                {
                    rows[r].Occupy(startColumn, colSpan, item);
                }

                while (availableRow != null && availableRow.IsFull)
                {
                    int nextAvailableRowNo = availableRow.RowNo + 1;
                    availableRow = nextAvailableRowNo < rows.Count
                        ? rows[nextAvailableRowNo]
                        : null;
                }
            }