Пример #1
0
 // Used by Janitor.Fody
 private void DisposeManaged()
 {
     CellsCollection.Clear();
     ColumnsCollection.Clear();
     RowsCollection.Clear();
     MergedRanges.RemoveAll();
 }
        public void Add(Int32 row, Int32 column, XLCell cell)
        {
            Count++;

            IncrementUsage(RowsUsed, row);
            IncrementUsage(ColumnsUsed, column);

            if (!RowsCollection.TryGetValue(row, out Dictionary <int, XLCell> columnsCollection))
            {
                columnsCollection = new Dictionary <int, XLCell>();
                RowsCollection.Add(row, columnsCollection);
            }
            columnsCollection.Add(column, cell);
            if (row > MaxRowUsed)
            {
                MaxRowUsed = row;
            }
            if (column > MaxColumnUsed)
            {
                MaxColumnUsed = column;
            }

            if (Deleted.TryGetValue(row, out HashSet <int> delHash))
            {
                delHash.Remove(column);
            }
        }
        public int FirstColumnUsed(int rowStart, int columnStart, int rowEnd, int columnEnd, XLCellsUsedOptions options,
                                   Func <IXLCell, Boolean> predicate = null)
        {
            int finalRow        = rowEnd > MaxRowUsed ? MaxRowUsed : rowEnd;
            int finalColumn     = columnEnd > MaxColumnUsed ? MaxColumnUsed : columnEnd;
            int firstColumnUsed = finalColumn;
            var found           = false;

            for (int ro = rowStart; ro <= finalRow; ro++)
            {
                if (RowsCollection.TryGetValue(ro, out Dictionary <Int32, XLCell> columnsCollection))
                {
                    for (int co = columnStart; co <= firstColumnUsed; co++)
                    {
                        if (columnsCollection.TryGetValue(co, out XLCell cell) &&
                            !cell.IsEmpty(options) &&
                            (predicate == null || predicate(cell)) &&
                            co <= firstColumnUsed)
                        {
                            firstColumnUsed = co;
                            found           = true;
                            break;
                        }
                    }
                }
            }

            return(found ? firstColumnUsed : 0);
        }
 public void Dispose()
 {
     CellsCollection.Clear();
     ColumnsCollection.Clear();
     RowsCollection.Clear();
     MergedRanges.RemoveAll();
 }
Пример #5
0
        public DunaGridView()
        {
            this.InitializeComponent();

            BaseGrid b = new BaseGrid();

            baseGridsContainer1.Items.Add(b);
            baseGridsPinnedCols.Items.Add(new BaseGrid());
            PinnedRow nr  = new PinnedRow();
            PinnedRow nr2 = new PinnedRow();

            baseGridsContainer1.Items.Add(nr);
            baseGridsPinnedCols.Items.Add(nr2);

            /*components.FilterRow fr = new components.FilterRow();
             * components.FilterRow fr2 = new components.FilterRow();
             *
             * baseGridsContainer1.Items.Add(fr);
             *
             * baseGridsPinnedCols.Items.Add(fr2);*/

            this.DoubleBuffered = true;
            this.ResizeRedraw   = true;

            //prida datareadery do kolekce
            this.data_readers.Add(new BindingSourceDataReader(this.data_readers));

            this.rows = new RowsCollection(this);

            nr.Rows  = rows;
            nr2.Rows = rows;

            dunaGridHeaderRow1.NeedRefresh          += new EventHandler(dunaGridHeaderRow1_NeedRefresh);
            dunaGridRowSelectorsColumn1.NeedRefresh += new EventHandler(dunaGridHeaderRow1_NeedRefresh);
        }
Пример #6
0
 public Row this[int rowIndex]
 {
     get
     {
         var row = new RowsCollection(_dataTable);
         return(row[rowIndex]);
     }
 }
        public Int32 MaxColumnInRow(Int32 row)
        {
            if (RowsCollection.TryGetValue(row, out Dictionary <Int32, XLCell> columnsCollection) &&
                columnsCollection.Any())
            {
                return(columnsCollection.Keys.Max());
            }

            return(0);
        }
        public void Clear()
        {
            Count = 0;
            RowsUsed.Clear();
            ColumnsUsed.Clear();

            RowsCollection.Clear();
            MaxRowUsed    = 0;
            MaxColumnUsed = 0;
        }
        public XLCell GetCell(Int32 row, Int32 column)
        {
            if (row > MaxRowUsed || column > MaxColumnUsed)
            {
                return(null);
            }

            if (RowsCollection.TryGetValue(row, out Dictionary <Int32, XLCell> columnsCollection))
            {
                return(columnsCollection.TryGetValue(column, out XLCell cell) ? cell : null);
            }
            return(null);
        }
        public Int32 MaxRowInColumn(Int32 column)
        {
            for (int row = MaxRowUsed; row >= 1; row--)
            {
                if (RowsCollection.TryGetValue(row, out Dictionary <Int32, XLCell> columnsCollection) &&
                    columnsCollection.ContainsKey(column))
                {
                    return(row);
                }
            }

            return(0);
        }
Пример #11
0
        private Dictionary <int, int> VratiOznaceneRacune(RowsCollection rowsCollection)
        {
            Dictionary <int, int> oznaceni = new Dictionary <int, int>();

            foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in rowsCollection)
            {
                if (row.Cells["Ozn"].Value.ToString() == "True")
                {
                    oznaceni.Add(Convert.ToInt32(row.Cells["IDRACUN"].Value), Convert.ToInt32(row.Cells["RACUNGODINAIDGODINE"].Value));
                }
            }

            return(oznaceni);
        }
 internal IEnumerable <XLCell> GetCells(Func <IXLCell, Boolean> predicate)
 {
     for (int ro = 1; ro <= MaxRowUsed; ro++)
     {
         if (RowsCollection.TryGetValue(ro, out Dictionary <Int32, XLCell> columnsCollection))
         {
             for (int co = 1; co <= MaxColumnUsed; co++)
             {
                 if (columnsCollection.TryGetValue(co, out XLCell cell) &&
                     (predicate == null || predicate(cell)))
                 {
                     yield return(cell);
                 }
             }
         }
     }
 }
        public void Remove(Int32 row, Int32 column)
        {
            Count--;
            var rowRemoved    = DecrementUsage(RowsUsed, row);
            var columnRemoved = DecrementUsage(ColumnsUsed, column);

            if (rowRemoved && row == MaxRowUsed)
            {
                MaxRowUsed = RowsUsed.Keys.Any()
                    ? RowsUsed.Keys.Max()
                    : 0;
            }

            if (columnRemoved && column == MaxColumnUsed)
            {
                MaxColumnUsed = ColumnsUsed.Keys.Any()
                    ? ColumnsUsed.Keys.Max()
                    : 0;
            }

            if (Deleted.TryGetValue(row, out HashSet <Int32> delHash))
            {
                if (!delHash.Contains(column))
                {
                    delHash.Add(column);
                }
            }
            else
            {
                delHash = new HashSet <int>();
                delHash.Add(column);
                Deleted.Add(row, delHash);
            }

            if (RowsCollection.TryGetValue(row, out Dictionary <Int32, XLCell> columnsCollection))
            {
                columnsCollection.Remove(column);
                if (columnsCollection.Count == 0)
                {
                    RowsCollection.Remove(row);
                }
            }
        }
        public void RemoveAll(Int32 rowStart, Int32 columnStart,
                              Int32 rowEnd, Int32 columnEnd)
        {
            int finalRow    = rowEnd > MaxRowUsed ? MaxRowUsed : rowEnd;
            int finalColumn = columnEnd > MaxColumnUsed ? MaxColumnUsed : columnEnd;

            for (int ro = rowStart; ro <= finalRow; ro++)
            {
                if (RowsCollection.TryGetValue(ro, out Dictionary <int, XLCell> columnsCollection))
                {
                    for (int co = columnStart; co <= finalColumn; co++)
                    {
                        if (columnsCollection.ContainsKey(co))
                        {
                            Remove(ro, co);
                        }
                    }
                }
            }
        }
        public IEnumerable <XLSheetPoint> GetSheetPoints(Int32 rowStart, Int32 columnStart,
                                                         Int32 rowEnd, Int32 columnEnd)
        {
            int finalRow    = rowEnd > MaxRowUsed ? MaxRowUsed : rowEnd;
            int finalColumn = columnEnd > MaxColumnUsed ? MaxColumnUsed : columnEnd;

            for (int ro = rowStart; ro <= finalRow; ro++)
            {
                if (RowsCollection.TryGetValue(ro, out Dictionary <Int32, XLCell> columnsCollection))
                {
                    for (int co = columnStart; co <= finalColumn; co++)
                    {
                        if (columnsCollection.ContainsKey(co))
                        {
                            yield return(new XLSheetPoint(ro, co));
                        }
                    }
                }
            }
        }
Пример #16
0
 private void SetActiveRow(UltraGrid grid, string tagName)
 {
     if (!string.IsNullOrEmpty(tagName))
     {
         RowsCollection sr = grid.Rows;
         if (sr.Count > 0)
         {
             foreach (UltraGridRow row in sr)
             {
                 row.Selected = false;
                 if (row.Cells[colHeaderTagName].Text == tagName)
                 {
                     row.Selected   = true;
                     grid.ActiveRow = row;
                 }
             }
             LoadSelectedTagServers();
         }
     }
 }
Пример #17
0
            private void aCheckBoxUIElement_ElementClick(Object sender, Infragistics.Win.UIElementEventArgs e)
            {
                // Get the CheckBoxUIElement that was clicked
                CheckBoxUIElement aCheckBoxUIElement = (CheckBoxUIElement)e.Element;

                // Get the Header associated with this particular element
                Infragistics.Win.UltraWinGrid.ColumnHeader aColumnHeader = (Infragistics.Win.UltraWinGrid.ColumnHeader)aCheckBoxUIElement.GetAncestor(typeof(HeaderUIElement)).GetContext(typeof(Infragistics.Win.UltraWinGrid.ColumnHeader));

                // Set the Tag on the Header to the new CheckState
                aColumnHeader.Tag = aCheckBoxUIElement.CheckState;

                // So that we can apply various changes only to the relevant Rows collection that the header belongs to
                HeaderUIElement aHeaderUIElement = aCheckBoxUIElement.GetAncestor(typeof(HeaderUIElement)) as HeaderUIElement;
                RowsCollection  hRows            = aHeaderUIElement.GetContext(typeof(RowsCollection)) as RowsCollection;

                // Raise an event so the programmer can do something when the CheckState changes
                if (_CLICKED != null)
                {
                    _CLICKED(this, new HeaderCheckBoxEventArgs(aColumnHeader, aCheckBoxUIElement.CheckState, hRows));
                }
            }
        internal IEnumerable <XLCell> GetCells(Int32 rowStart, Int32 columnStart,
                                               Int32 rowEnd, Int32 columnEnd,
                                               Func <IXLCell, Boolean> predicate = null)
        {
            int finalRow    = rowEnd > MaxRowUsed ? MaxRowUsed : rowEnd;
            int finalColumn = columnEnd > MaxColumnUsed ? MaxColumnUsed : columnEnd;

            for (int ro = rowStart; ro <= finalRow; ro++)
            {
                if (RowsCollection.TryGetValue(ro, out Dictionary <Int32, XLCell> columnsCollection))
                {
                    for (int co = columnStart; co <= finalColumn; co++)
                    {
                        if (columnsCollection.TryGetValue(co, out XLCell cell) &&
                            (predicate == null || predicate(cell)))
                        {
                            yield return(cell);
                        }
                    }
                }
            }
        }
        public int LastRowUsed(int rowStart, int columnStart, int rowEnd, int columnEnd, XLCellsUsedOptions options,
                               Func <IXLCell, Boolean> predicate = null)
        {
            int finalRow    = rowEnd > MaxRowUsed ? MaxRowUsed : rowEnd;
            int finalColumn = columnEnd > MaxColumnUsed ? MaxColumnUsed : columnEnd;

            for (int ro = finalRow; ro >= rowStart; ro--)
            {
                if (RowsCollection.TryGetValue(ro, out Dictionary <Int32, XLCell> columnsCollection))
                {
                    for (int co = finalColumn; co >= columnStart; co--)
                    {
                        if (columnsCollection.TryGetValue(co, out XLCell cell) &&
                            !cell.IsEmpty(options) &&
                            (predicate == null || predicate(cell)))
                        {
                            return(ro);
                        }
                    }
                }
            }
            return(0);
        }
        public void ExtendTest(int rowCount)
        {
            var target = new RowsCollection();

            var      lifeLineStub = new Mock <Lifeline>(MockBehavior.Loose, null, null, null, 0);
            Lifeline lifeline     = lifeLineStub.Object;
            var      rowMocks     = new Stack <Mock>();

            for (int i = 0; i < rowCount; i++)
            {
                var rowMock = new Mock <Row>(MockBehavior.Strict, 0);
                rowMocks.Push(rowMock);
                rowMock.Setup(row => row.Extend(lifeline));
                Row targetRow = rowMock.Object;
                target.Add(targetRow);
            }
            target.Extend(lifeline);

            foreach (var rowMock in rowMocks)
            {
                rowMock.VerifyAll();
            }
        }
 public Boolean Contains(Int32 row, Int32 column)
 {
     return(RowsCollection.TryGetValue(row, out Dictionary <Int32, XLCell> columnsCollection) &&
            columnsCollection.ContainsKey(column));
 }
Пример #22
0
 public void Dispose()
 {
     ColumnsCollection.Dispose();
     RowsCollection.Dispose();
     MergedRanges.Dispose();
 }
Пример #23
0
 object ICustomSummaryCalculator.EndCustomSummary(SummarySettings summarySettings, RowsCollection rows)
 {
     if (decimal.Compare(this.totalsati, decimal.Zero) > 0)
     {
         return(DB.RoundUP(decimal.Divide(decimal.Multiply(DB.RoundUP(decimal.Divide(this.totalbruto, this.totalsati)), 85M), 100M)));
     }
     return(0);
 }
Пример #24
0
 /// <summary>
 /// Costruttore vuoto. Crea l'oggetto inizializzando a vuote le collezioni di righe, colonne e celle.
 /// </summary>
 public Range()
 {
     _rows  = new RowsCollection(this);
     _cols  = new ColumnsCollection(this);
     _cells = new CellsCollection(this);
 }
Пример #25
0
 object ICustomSummaryCalculator.EndCustomSummary(SummarySettings summarySettings, RowsCollection rows)
 {
     return(this.totals);
 }
Пример #26
0
 void ICustomSummaryCalculator.BeginCustomSummary(SummarySettings summarySettings, RowsCollection rows)
 {
     this.totalsati  = new decimal();
     this.totalbruto = new decimal();
 }
 public object EndCustomSummary(SummarySettings summarySettings, RowsCollection rows)
 {
     return(total);
 }
Пример #28
0
        public DunaGridView()
        {
            this.InitializeComponent();

            BaseGrid b = new BaseGrid();
            baseGridsContainer1.Items.Add(b);
            baseGridsPinnedCols.Items.Add(new BaseGrid());
            PinnedRow nr = new PinnedRow();
            PinnedRow nr2 = new PinnedRow();
            baseGridsContainer1.Items.Add(nr);
            baseGridsPinnedCols.Items.Add(nr2);

            /*components.FilterRow fr = new components.FilterRow();
            components.FilterRow fr2 = new components.FilterRow();

            baseGridsContainer1.Items.Add(fr);

            baseGridsPinnedCols.Items.Add(fr2);*/

            this.DoubleBuffered = true;
            this.ResizeRedraw = true;

            //prida datareadery do kolekce
            this.data_readers.Add(new BindingSourceDataReader(this.data_readers));

            this.rows = new RowsCollection(this);

            nr.Rows = rows;
            nr2.Rows = rows;

            dunaGridHeaderRow1.NeedRefresh += new EventHandler(dunaGridHeaderRow1_NeedRefresh);
            dunaGridRowSelectorsColumn1.NeedRefresh += new EventHandler(dunaGridHeaderRow1_NeedRefresh);
        }
Пример #29
0
 public HeaderCheckBoxEventArgs(Infragistics.Win.UltraWinGrid.ColumnHeader hdrColumnHeader, CheckState chkCheckState, RowsCollection Rows)
 {
     mvarColumnHeader   = hdrColumnHeader;
     mvarCheckState     = chkCheckState;
     mvarRowsCollection = Rows;
 }
Пример #30
0
 public HeaderCheckBoxEventArgs(Infragistics.Win.UltraWinGrid.ColumnHeader columnHeader, CheckState checkState, RowsCollection rowsCollection)
 {
     _columnHeader = columnHeader;
     _checkState = checkState;
     _rowsCollection = rowsCollection;
 }
Пример #31
0
        private RiepilogoAssemblea calcolaRiepilogo(RowsCollection rows)
        {
            RiepilogoAssemblea riepilogo = new RiepilogoAssemblea();
            foreach (UltraGridRow row in rows)
            {
                if (checkAbilitatoAllaVotazione(row))
                {
                    riepilogo.Presenti++;

                    var bfavorebole = (bool) row.Cells["favorevole"].Value;
                    var bcontrario = (bool)row.Cells["contrario"].Value;
                    var bastenuto = (bool)row.Cells["astenuto"].Value;

                    if (bfavorebole || bcontrario || bastenuto) riepilogo.Voti++; 
                    riepilogo.MillesimiRealiTotali += (decimal)row.Cells["MillesimiProprietaConvocato"].Value;
                    if (bfavorebole)
                    {
                        riepilogo.Favorevoli++;
                        riepilogo.MillesimiRealiVotazione += (decimal)row.Cells["MillesimiProprietaConvocato"].Value;
                    }
                    if (bcontrario)
                    {
                        riepilogo.Contrari++;
                        riepilogo.MillesimiRealiVotazione += (decimal)row.Cells["MillesimiProprietaConvocato"].Value;
                    }
                    if (bastenuto)
                    {
                        riepilogo.Astenuti++;
                    }
                }
                riepilogo.Convocati++;
            }
            return riepilogo;
        }
 public void BeginCustomSummary(SummarySettings summarySettings, RowsCollection rows)
 {
     total = 0;
 }
Пример #33
0
 private RiepilogoAssemblea calcolaRiepilogo(RowsCollection rows)
 { 
     RiepilogoAssemblea riepilogo = new RiepilogoAssemblea();
     foreach (UltraGridRow row in rows)
     {
         if (bool.Parse(row.Cells["CheckEntrata"].Text))
         {
             riepilogo.Presenti++;
             riepilogo.MillesimiRealiVotazione += (decimal)row.Cells["MillesimiProprietaConvocato"].Value;
         }
         riepilogo.MillesimiRealiTotali += (decimal)row.Cells["MillesimiProprietaConvocato"].Value;
         riepilogo.Convocati++;
     }
     return riepilogo;
 }