示例#1
0
 /// <summary>
 /// Удаление набора строк
 /// </summary>
 public void ClearRows()
 {
     if (Rows.Count > 0)
     {
         Rows.Clear();
     }
 }
        public void UpdateWorkHours(List <EmployeeWorkWeek> currentWorkWeek, string StoreId)
        {
            Rows.Clear();
            Refresh();

            if (currentWorkWeek != null)
            {
                string[] row;
                int      index = 0;

                foreach (EmployeeWorkWeek eW in currentWorkWeek)
                {
                    string storeId    = eW.StoreId;
                    string day        = eW.Day;
                    string date       = eW.Date.ToShortDateString();
                    string start      = eW.StartTime;
                    string finish     = eW.FinishTime;
                    string rotaStart  = eW.RotaStartTime;
                    string rotaFinish = eW.RotaFinishTime;
                    string lunchTime  = eW.LunchTime;

                    row = new string[] { storeId, day, date, start, finish, rotaStart, rotaFinish, lunchTime };
                    Rows.Add(row);
                    if (!storeId.Equals(StoreId))
                    {
                        Rows[index].ReadOnly = true;
                    }
                    index++;
                }
            }
            else
            {
                MessageBox.Show("Something went wrong", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#3
0
        private void RefreshList(IJobList jobs)
        {
            Rows.Clear();
            var rows     = new List <DataGridViewRow>();
            var rowIndex = 0;

            foreach (var job in jobs.All)
            {
                var row = new DataGridViewRow
                {
                    Tag = job
                };
                row.Cells.Add(new DataGridViewTextBoxCell());
                row.Cells.Add(new DataGridViewTextBoxCell());
                row.Cells.Add(new DataGridViewTextBoxCell());
                row.Cells.Add(new DataGridViewTextBoxCell());
                row.Cells.Add(new DataGridViewTextBoxCell());
                row.Cells.Add(new DataGridViewTextBoxCell());
                row.Cells.Add(new DataGridViewTextBoxCell());
                row.Cells.Add(new DataGridViewTextBoxCell());
                job.RowIndex = rowIndex;
                rows.Add(row);
                rowIndex++;
            }
            Rows.AddRange(rows.ToArray());
        }
        public void ShowElement(IAccountingElement iElmt, TreeViewMappingElement tvme = null, Dictionary <string, double?> lastTotal = null)
        {
            if (tvme == null)
            {
                tvme = _Memory;
            }
            else
            {
                _Memory = tvme;
            }

            SetLastTotalMemoryAmount(lastTotal);

            Rows.Clear();
            foreach (IAccountingElement item in iElmt.GetItemList(tvme))
            {
                AddRow(item, iElmt.CcyRef, lastTotal: GetLastTotalMemoryAmount(item.GetName()));
            }
            AddRow(iElmt.GetTotalAccount(FXMarketUsed, AssetMarketUsed, iElmt.CcyRef,
                                         overrideName: "Total",
                                         lastTotal: GetLastTotalMemoryAmount()),
                   isTotalRow: iElmt.GetNodeType() != NodeType.Account);
            ElementShowed             = iElmt;
            TotalShowed               = null;
            Rows[0].Cells[0].Selected = false;
        }
示例#5
0
 public void ResetTable()
 {
     Rows.Clear();
     CurrentRows = 0;
     GenerateHeaderRow();
     InsertRow(InitialRows);
 }
示例#6
0
        public void TrimOrExpand(int columnsLimit, int rowsLimit, bool fillWhenExpand = true)
        {
            if (!fillWhenExpand)
            {
                if (columnsLimit > Columns.Count)
                {
                    columnsLimit = Columns.Count;
                }
                if (rowsLimit > Rows.Count)
                {
                    rowsLimit = Rows.Count;
                }
            }
            if (columnsLimit == Columns.Count && rowsLimit == Rows.Count)
            {
                return;
            }

            var temp = this.Clone();

            Columns.Clear();
            Rows.Clear();
            for (int i = 0; i < rowsLimit; i++)
            {
                Row newRow = new Row();
                for (int k = 0; k < columnsLimit; k++)
                {
                    newRow.Data.Add(null);
                    newRow.Legends.Add(null);
                }
                Rows.Add(newRow);
            }
            for (int k = 0; k < columnsLimit; k++)
            {
                Columns.Add(new Column());
            }

            int columnRange = Math.Min(columnsLimit, temp.Columns.Count);
            int rowRange    = Math.Min(rowsLimit, temp.Rows.Count);

            for (int i = 0; i < rowRange; i++)
            {
                Rows[i].Header       = temp.Rows[i].Header;
                Rows[i].IsHidden     = temp.Rows[i].IsHidden;
                Rows[i].MappedHeader = temp.Rows[i].MappedHeader;
                for (int k = 0; k < columnRange; k++)
                {
                    Rows[i].Data[k]    = temp.Rows[i].Data[k];
                    Rows[i].Legends[k] = temp.Rows[i].Legends[k];
                }
            }
            for (int k = 0; k < columnRange; k++)
            {
                Columns[k].Header       = temp.Columns[k].Header;
                Columns[k].IsHidden     = temp.Columns[k].IsHidden;
                Columns[k].MappedHeader = temp.Columns[k].MappedHeader;
                Columns[k].IsCalculated = temp.Columns[k].IsCalculated;
            }
            Normalize();
        }
示例#7
0
        /// <summary>
        /// Insert chars from string into the table.
        /// </summary>
        /// <param name="chars">The string to be entered</param>
        public void update(string chars)
        {
            ClearTable();
            foreach (char c in chars)
            {
                if (!freqs.ContainsKey(c))
                {
                    freqs.Add(c, 0);
                }
                freqs[c]++;
            }

            Dictionary <char, string> enc = encoding();

            Rows.Clear();
            foreach (char c in freqs.Keys)
            {
                string cstr = string.Format("0x{0,2:X}", (byte)c);
                cstr += " '" + c + "'";
                object[] row = { cstr, freqs[c], enc[c] };
                if (freqs[c] > maxweight)
                {
                    maxweight = freqs[c];
                }
                Rows.Add(row);
            }
        }
        private void UpdateScriptControllerList()
        {
            if (update_forbid_)
            {
                return;
            }
            if (update_busy_)
            {
                return;
            }

            update_busy_ = true;

            Rows.Clear();

            foreach (var script_obj in ScriptManager.ScriptList)
            {
                var row_obj = Rows[Rows.Add()];

                row_obj.Tag = script_obj;

                UpdateScriptControllerStatus(row_obj, script_obj);
            }

            if (update_timer_.Enabled)
            {
                update_timer_.Stop();
            }

            update_busy_ = false;
        }
示例#9
0
        /// <summary>
        /// Gets the current data from the associated Google spreadsheet.
        /// </summary>
        /// <param name="force">Set to True to override any local changes.</param>
        public async Task Get(bool force = false)
        {
            if (Dirty && !force)
            {
                Console.WriteLine("The Spreadsheet data has been modified since the last Get. Push your changes first or pass in 'True' to overwrite your changes.");
                return;
            }

            var request = await RequestValues();

            Rows.Clear();
            Dirty = false;

            if (request == null)
            {
                // TODO.
            }
            else
            {
                foreach (var row in request.Values)
                {
                    AddRowInternal(row as List <object>);
                }
            }
        }
示例#10
0
        public ConsoleTable Attach(int columnIndex, object column, params object[] rowColumn)
        {
            if (rowColumn.Length != Rows.Count)
            {
                throw new ArgumentOutOfRangeException(CreateOutOfRangeMessage(rowColumn.Length, Rows.Count));
                //AddRow(rowColumn);
            }

            Columns.Insert(columnIndex, column);


            var cpy = new List <object[]>(Rows.Count);
            int lim = rowColumn.Length;

            for (int i = 0; i < lim; i++)
            {
                var row   = Rows[i];
                var rgCpy = Arrays.Insert(row, columnIndex, rowColumn[i]);

                cpy.Add(rgCpy);
            }

            Rows.Clear();
            Rows.AddRange(cpy);

            return(this);
        }
示例#11
0
        public void UpdatePayroll(List <PayrollData> payrollWeek)
        {
            string[] row;
            string   errorMessage = "";

            Rows.Clear();
            Refresh();

            foreach (PayrollData payrollData in payrollWeek)
            {
                string name          = payrollData.EmployeeName;
                string hoursRota     = payrollData.HoursRota.ToString();
                string hoursWorked   = payrollData.HoursWorked.ToString();
                string holidayUsed   = payrollData.HolidayHours.ToString();
                string contractHours = payrollData.ContractHours.ToString();
                errorMessage += payrollData.ErrorMessage;

                row = new string[] { name, hoursRota, hoursWorked, holidayUsed, contractHours };
                Rows.Add(row);
            }

            mErrorTextBox.Text = errorMessage;

            if (!errorMessage.Equals(""))
            {
                mPayrollButton.Enabled = false;
            }
            else
            {
                mPayrollButton.Enabled = true;
            }
        }
示例#12
0
        // Utility
        public void Update()
        {
            Rows.Clear();
            var nodes = _root.AllVisibleChildren.ToArray();

            Rows.InsertRange(0, nodes);
        }
 public void Update(CurrencyAssetStaticsDataBase CcyDB)
 {
     Rows.Clear();
     ColumnCount           = 5;
     Columns[0].HeaderText = "Name";
     Columns[1].HeaderText = "Symbol";
     Columns[2].HeaderText = "Decimal Number";
     Columns[3].HeaderText = "Thousand Marker";
     Columns[4].HeaderText = "Pricing CcyPair";
     for (int i = 0; i < ColumnCount; i++)
     {
         Columns[i].Width    = i == 0 ? 50 : 75;
         Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
     }
     AllowUserToAddRows = false;
     foreach (var item in CcyDB.DataBase)
     {
         CurrencyPair cp     = item.PricingCcyPair;
         string       cpStr  = cp == null ? "Ref. Ccy" : cp.ToString();
         object[]     values = { item.Name, item.Symbol, item.DecimalNumber, item.ThousandMark, cpStr };
         Rows.Add(values);
     }
     _Memo = CcyDB;
     Rows[0].DefaultCellStyle.BackColor = Color.FromArgb(200, 200, 200);
     ClearSelection();
 }
示例#14
0
        /// <summary>
        /// Fills the data grid view with information about label categories
        /// </summary>
        public void RefreshList()
        {
            SuspendLayout();
            Rows.Clear();

            int numCategories = _shapefile.Categories.Count;

            if (numCategories == 0)
            {
                ColumnHeadersVisible = false;
                ResumeLayout();
                return;
            }

            ColumnHeadersVisible = true;
            Rows.Add(numCategories);

            bool noEventsState = LockUpdate;

            LockUpdate = true;

            FillCategories();

            ResumeLayout();

            AutoSizeColumns();

            LockUpdate = noEventsState;
        }
示例#15
0
        private void InitGrid()
        {
            fMaskedTextBox                = new MaskedTextBox();
            fMaskedTextBox.Visible        = false;
            fMaskedTextBox.Name           = "fMaskedTextBox";
            fMaskedTextBox.Mask           = @"00/00/0000";
            fMaskedTextBox.TextMaskFormat = MaskFormat.IncludePromptAndLiterals;
            Controls.Add(fMaskedTextBox);

            Rows.Clear();
            ((System.ComponentModel.ISupportInitialize)(this)).BeginInit();
            Columns.AddRange(new DataGridViewColumn[] {
                AddComboColumn("FField", LangMan.LS(LSID.LSID_Field), fFields, 200),
                AddComboColumn("FCondition", LangMan.LS(LSID.LSID_Condition), GKData.CondSigns, 150),
                AddTextColumn("FValue", LangMan.LS(LSID.LSID_Value), 300)
            });

            CellBeginEdit += dataGridView1_CellBeginEdit;
            CellEndEdit   += dataGridView1_CellEndEdit;
            Scroll        += dataGridView1_Scroll;

            ((System.ComponentModel.ISupportInitialize)(this)).EndInit();

            //this.dataGridView1.AutoResizeColumns();
            Columns[0].Width = 150;
            Columns[1].Width = 150;
            Columns[2].Width = 150;
        }
示例#16
0
文件: StaticGrid.cs 项目: minskowl/MY
        /// <summary>
        /// Deserializes item collection
        /// </summary>
        private void DeserializeItemCollection()
        {
            Rows.Clear();

            if (_gridDataXmlHF == null)
            {
                return;
            }
            if (string.IsNullOrEmpty(_gridDataXmlHF.Value))
            {
                return;
            }

            XmlDocument document = new XmlDocument();

            document.LoadXml(_gridDataXmlHF.Value);

            foreach (XmlNode rowNode in document.DocumentElement.SelectNodes("row"))
            {
                RowItem rowItem = new RowItem();
                rowItem.ID = rowNode.Attributes["rowId"].Value;

                foreach (XmlNode cellNode in rowNode.SelectNodes("cell"))
                {
                    rowItem.Values.Add(cellNode.InnerText);
                }

                Rows.Add(rowItem);
            }
        }
示例#17
0
        public void CreateMazeControls(IMaze maze)
        {
            this.SuspendLayout();
            Rows.Clear();
            var rowControls = CreateRowControls(maze);
            List <ObservationSpaceRow> rows = new List <ObservationSpaceRow>();

            foreach (var row in rowControls)
            {
                rows.Add(row);
                Rows.Add(row);
                row.Dock = DockStyle.Top;
            }

            this.Controls.Clear();

            this.Controls.AddRange(rows.ToArray());

            for (int i = rows.Count - 1; i >= 0; i--)
            {
                rows[i].SendToBack();
            }

            this.ResumeLayout();
        }
示例#18
0
        public void Update(CurrencyAssetStaticsDataBase ccyDb)
        {
            if (ccyDb != null)
            {
                if (ccyDb.AssetDataBase.Count > 0)
                {
                    Rows.Clear();
                    ColumnCount           = 2;
                    Columns[0].HeaderText = "Name";
                    Columns[1].HeaderText = "Ccy";
                    for (int i = 0; i < Columns.Count; i++)
                    {
                        Columns[i].Width    = 50;
                        Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
                    }

                    AllowUserToAddRows = false;
                    foreach (var item in ccyDb.AssetDataBase)
                    {
                        object[] values = { item.Name, item.Ccy.CcyString };
                        Rows.Add(values);
                    }
                    _Memo = ccyDb;
                }
            }
            ClearSelection();
        }
示例#19
0
文件: BAData.cs 项目: iliaeg/ADBench
 void Clear()
 {
     Rows.Clear();
     Cols.Clear();
     Vals.Clear();
     Rows.Add(0);
 }
示例#20
0
 public void ThreadSafeClear()
 {
     lock (m_SyncLock)
     {
         Rows.Clear();
     }
 }
示例#21
0
        public void SetData(byte[] buffer)
        {
            Rows.Clear();
            DataTable dataTable = DataTableFromBuffer(buffer);

            SetData(dataTable);
        }
示例#22
0
 private void SetColumns(ResultsOptions.ViewMode viewMode)
 {
     Rows.Clear();
     RowCount = 1;
     if (viewMode == ResultsOptions.ViewMode.VerticalPairTable)
     {
         ColumnCount = (int)ColumnsTypeVertical.Size;
         for (int i = 0; i < (int)ColumnsTypeVertical.Size; i++)
         {
             Columns[i].Name         = ((ColumnsTypeVertical)i).ToString();
             Columns[i].SortMode     = DataGridViewColumnSortMode.Programmatic;
             Columns[i].Width        = m_options.resultsOptions.columnOptionsVertical[i].width;
             Columns[i].DisplayIndex = m_options.resultsOptions.columnOptionsVertical[i].order;
         }
         Rows[0].Cells[0] = new DataGridViewDoubleTextBoxCell("0", "0");
     }
     if (viewMode == ResultsOptions.ViewMode.HorizontalPairTable)
     {
         ColumnCount = (int)ColumnsTypeHorizontal.Size;
         for (int i = 0; i < (int)ColumnsTypeHorizontal.Size; i++)
         {
             Columns[i].Name         = ((ColumnsTypeHorizontal)i).ToString();
             Columns[i].SortMode     = DataGridViewColumnSortMode.Programmatic;
             Columns[i].Width        = m_options.resultsOptions.columnOptionsHorizontal[i].width;
             Columns[i].DisplayIndex = m_options.resultsOptions.columnOptionsHorizontal[i].order;
         }
         Rows[0].Cells[0]       = new DataGridViewTextBoxCell();
         Rows[0].Cells[0].Value = "0";
     }
     RowTemplate        = new DataGridViewCustomRow();
     RowTemplate.Height = Rows[0].Cells[0].PreferredSize.Height;
     Rows.Clear();
     UpdateRows();
 }
示例#23
0
 public void Update(GridSplitter gs, Grid grid)
 {
     Rows.Clear();
     Cols.Clear();
     Rows.AddRange(grid.RowDefinitions.Select(d => (DtoGridLength)d.Height));
     Cols.AddRange(grid.ColumnDefinitions.Select(d => (DtoGridLength)d.Width));
 }
示例#24
0
 public void ClearResults()
 {
     m_results = new CoreResult[0];
     Rows.Clear();
     RowCount          = 1;
     m_currentRowIndex = 0;
 }
示例#25
0
 public void SetRowCountFast(int nRows)
 {
     if (RowCount > nRows)
     {
         Rows.Clear(); // work around : removing rows is slow.
     }
     RowCount = nRows;
 }
示例#26
0
 /// <summary>
 /// Clear the DmTable rows
 /// </summary>
 public void Clear()
 {
     foreach (var c in this.columns)
     {
         c.Clear();
     }
     Rows.Clear();
 }
 private void LoadRows()
 {
     Rows.Clear();
     foreach (var row in Group.Rows)
     {
         Rows.Add(new FormRowViewModel(row));
     }
 }
示例#28
0
        private void DoUpdateData()
        {
            if (UpdateColumns)
            {
                Clear();
                Columns.Clear();
            }
            Rows.Clear();
            BeginLoadData();
            FEof         = false;
            FInternalEof = false;
            if (FCurrentReader == null)
            {
                FEof         = true;
                FInternalEof = true;
                return;
            }
            int i;

            if (Columns.Count == 0)
            {
                DataTable  adatatable = FCurrentReader.GetSchemaTable();
                DataColumn col;

                for (i = 0; i < adatatable.Rows.Count; i++)
                {
                    string  acolname;
                    DataRow nrow = adatatable.Rows[i];
                    //					col=Columns.Add();
                    acolname = nrow["ColumnName"].ToString().ToUpper();
                    if (acolname.Length < 1)
                    {
                        acolname = "Column" + i.ToString();
                    }
                    //					col.ColumnName=acolname;
                    //					col.DataType=(Type)nrow["DataType"];
                    //					col.Caption=acolname;
                    //					col.Caption=acolname;
                    col = Columns.Add(acolname, (Type)nrow["DataType"]);
                    if (col.DataType.ToString() == "System.String")
                    {
                        int maxlength = (int)nrow["ColumnSize"];
                        col.MaxLength = maxlength;
                    }
                    col.Caption = acolname;
                }
            }
            int x = 0;

            while (x < PageSize)
            {
                x++;
                if (!Next())
                {
                    break;
                }
            }
        }
示例#29
0
        public override void Fill(params object [] pars)
        {
            int count = (int)pars[1]
            , hour = -1
            , offset = -1
            , i = -1, c = -1;
            DateTime dtCurrent   = (DateTime)pars[0];
            bool     bSeasonDate = (bool)pars[2];

            Rows.Clear();

            //Rows.Add(count + 1);
            RowsAdd();

            for (i = 0; i < count; i++)
            {
                hour = i + 1;
                if (bSeasonDate == true)
                {
                    offset = HAdmin.GetSeasonHourOffset(dtCurrent, hour);

                    Rows[i].Cells[(int)INDEX_COLUMNS.PART_TIME].Value = (hour - offset).ToString();
                    if ((hour - 1) == HAdmin.SeasonDateTime.Hour)
                    {
                        Rows[i].Cells[0].Value += @"*";
                    }
                    else
                    {
                        ;
                    }
                }
                else
                {
                    Rows[i].Cells[(int)INDEX_COLUMNS.PART_TIME].Value = (hour).ToString();
                }

                for (c = 1; c < m_arColumns.Length; c++)
                {
                    Rows[i].Cells[c].Value = 0.ToString("F2");
                }
            }

            Rows[count].Cells[0].Value = "Сумма";
            for (c = 1; c < m_arColumns.Length; c++)
            {
                switch ((INDEX_COLUMNS)c)
                {
                case INDEX_COLUMNS.PBR:
                case INDEX_COLUMNS.PBRe:
                    Rows[i].Cells[c].Value = @"-".ToString();
                    break;

                default:
                    Rows[i].Cells[c].Value = 0.ToString("F2");
                    break;
                }
            }
        }
示例#30
0
 public void Clear()
 {
     foreach (BoardRowViewModel row in Rows)
     {
         row.Squares.Clear();
     }
     Rows.Clear();
     OnNumberOfRowsOrColsChanged();
 }