public void SetVariable(string VariableName, string value, string GroupName) { if (tmpv.Equals(GroupName + VariableName)) { Rows[tmpin].Cells[2].Value = value; string buffer = ""; Array.ForEach(Encoding.Unicode.GetBytes(value), x => buffer += x.ToString("X2") + " "); Rows[tmpin].Cells[3].Value = String.Format("{0}", buffer); return; } tmpv = GroupName + VariableName; if (CheckInRowVG(VariableName, GroupName)) { int i = GetIndexByVGName(VariableName, GroupName); tmpin = i; if (i >= 0) { Rows[i].Cells[2].Value = value; string buffer = ""; Array.ForEach(Encoding.Unicode.GetBytes(value), x => buffer += x.ToString("X2") + " "); Rows[i].Cells[3].Value = String.Format("{0}", buffer); } } else { DataGridViewRow row = (DataGridViewRow)Rows[0].Clone(); row.Tag = VariableName; row.Cells[0].Value = GroupName; row.Cells[1].Value = VariableName; row.Cells[2].Value = value; string buffer = ""; Array.ForEach(Encoding.Unicode.GetBytes(value), x => buffer += x.ToString("X2") + " "); row.Cells[3].Value = String.Format("{0}", buffer); row.Cells[4].Value = "string"; row.Height = 30; tmpin = Rows.Add(row); } //ListViewItem item = new ListViewItem(VariableName); //item.SubItems.Add(VariableName); //item.SubItems.Add(String.Format("0x{0}", value.ToString("X8"))); //item.SubItems.Add("int"); }
protected DataGridViewRow AddRow(int nHgt, bool bFroz, Color PlnCellCol, bool bPlanCellReadOnly) { DataGridViewRow Row = null; DataGridViewCell Cell = null; int nRowIdx; //--- Add the row nRowIdx = Rows.Add(null, null); Row = Rows[nRowIdx]; //--- Set the row properties Row.Height = nHgt; Row.Resizable = DataGridViewTriState.False; Row.Frozen = bFroz; Row.DefaultCellStyle.WrapMode = DataGridViewTriState.True; for (int nIdx = 0; nIdx < Row.Cells.Count; nIdx++) { Cell = Row.Cells[nIdx]; if (nIdx == ColIdx_Ctrl) { Cell.Style.Font = ValueFont; Cell.ReadOnly = true; Cell.Style.BackColor = CellCol_Ctrl; } else if (nIdx == ColIdx_Hdr) { Cell.Style.Font = ValueFont; Cell.ReadOnly = true; Cell.Style.BackColor = CellCol_Hdr; } else { Cell.Style.Font = ValueFont; Cell.ReadOnly = bPlanCellReadOnly; Cell.Style.BackColor = PlnCellCol; } } return(Row); }
/// <summary> /// Initialises TableListDataTable /// Pulls Data from the database and generates columns and rows to match the said data /// and inputs that dta afterwards /// </summary> /// <param name="context">Allows it to know which activity it is calling it from</param> /// <param name="Name">Used to Determine which spreadsheet is to be openned</param> public TableListDataTable(Context context, String Name) : base(Name) { TableListDB tableListdb = new TableListDB(context); string tableID = "TableID"; string tableName = "TableName"; string userName = "******"; string dateCreated = "DateCreated"; var dataColumns = new Dictionary <string, float>(); dataColumns.Add(" " + tableID, 100); dataColumns.Add(tableName, 100); dataColumns.Add(userName, 150); dataColumns.Add(dateCreated, 300); foreach (var key in dataColumns.Keys) { var dc = new DSDataColumn(key); dc.Caption = key; dc.ReadOnly = true; dc.DataType = typeof(string); dc.AllowSort = true; dc.Width = dataColumns[key]; Columns.Add(dc); } List <string> PrimaryKeyList = tableListdb.readString(tableID); List <string> TableNameList = tableListdb.readString(tableName); List <string> UserNameList = tableListdb.readString(userName); int row = tableListdb.Count(); for (int i = 0; i < row; i += 1) { var dataRows = new DSDataRow(); dataRows[" " + tableID] = " " + PrimaryKeyList[i]; dataRows[tableName] = TableNameList[i]; dataRows[userName] = UserNameList[i]; dataRows[dateCreated] = tableListdb.readDateTime(dateCreated, 0); Rows.Add(dataRows); } }
public MyDataTable() { Columns.Add("Title", typeof(string)); Columns.Add("Status", typeof(string)); Columns.Add("Min", typeof(double)); Columns.Add("Max", typeof(double)); Columns.Add("Avg", typeof(double)); Columns.Add("Percentile25", typeof(double)); Columns.Add("Percentile50", typeof(double)); Columns.Add("Percentile75", typeof(double)); DataRow row = NewRow(); row["Status"] = "Status 1"; row["Min"] = 10; row["Max"] = 60; row["Avg"] = 20; row["Percentile25"] = 50; row["Percentile50"] = 30; row["Percentile75"] = 40; Rows.Add(row); row = NewRow(); row["Status"] = "Status 2"; row["Min"] = 40; row["Max"] = 90; row["Avg"] = 50; row["Percentile25"] = 80; row["Percentile50"] = 60; row["Percentile75"] = 70; Rows.Add(row); row = NewRow(); row["Status"] = "Status 3"; row["Min"] = 20; row["Max"] = 70; row["Avg"] = 30; row["Percentile25"] = 60; row["Percentile50"] = 40; row["Percentile75"] = 50; Rows.Add(row); }
public void GetEmployeesHoliday(List <EmployeeHoliday> employeeHoliday, string errorMessage) { Rows.Clear(); Refresh(); foreach (EmployeeHoliday empHoliday in employeeHoliday) { string id = empHoliday.Id.ToString(); string employeeId = empHoliday.EmployeeName; DateTime date = empHoliday.Date; string status = empHoliday.State; Rows.Add(id, date, employeeId, status); } if (errorMessage != null) { MessageBox.Show(errorMessage, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
/*========================================================================================================================== | ADD ROW \-------------------------------------------------------------------------------------------------------------------------*/ /// <summary> /// Provides a convenience method for adding a new <see cref="DataRow"/> based on the expected column values. /// </summary> /// <param name="attributeKey">The <see cref="AttributeValue.Key"/>.</param> /// <param name="attributeValue">The <see cref="AttributeValue.Value"/>.</param> internal DataRow AddRow(string attributeKey, string? attributeValue = null) { /*------------------------------------------------------------------------------------------------------------------------ | Define record \-----------------------------------------------------------------------------------------------------------------------*/ var record = NewRow(); record["AttributeKey"] = attributeKey; record["AttributeValue"] = attributeValue; /*------------------------------------------------------------------------------------------------------------------------ | Add record \-----------------------------------------------------------------------------------------------------------------------*/ Rows.Add(record); /*------------------------------------------------------------------------------------------------------------------------ | Return record \-----------------------------------------------------------------------------------------------------------------------*/ return record; }
public override bool AddNote(Note note) { if (note is DescribedNote) { DescribedNote describedNote = note as DescribedNote; Rows.Add(new string[] { describedNote.Id.ToString(), describedNote.Name, describedNote.Description, States[(int)describedNote.CurrentState], describedNote.Comment }); return(true); } return(false); }
public bool Insert(Model model) { try { MCHEI mCHEI = (MCHEI)model; DataRow newRow = NewRow(); newRow["FullName"] = mCHEI.FullName; newRow["AbbreviatedName"] = mCHEI.AbbreviatedName; newRow["Rector"] = mCHEI.Rector; newRow["Phone"] = mCHEI.Phone; newRow["Email"] = mCHEI.Email; Rows.Add(newRow); return(true); } catch (Exception ex) { Debug.WriteLine(ex.Source); return(false); } }
/// <summary> /// Create matrix for html serizlization /// </summary> private void CreateMatrix() { for (int i = 0; i < this.RowsCount; i++) { var row = new Row(); for (int j = 0; j < this.ColumnsCount; j++) { var column = new Cell { RowIndex = i, ColumnIndex = j, Character = string.Empty }; row.Add(column); } Rows.Add(row); } }
/// <inheritdoc/> protected override uint AddMethodSpec(MethodSpec ms) { if (ms == null) { Error("MethodSpec is null"); return(0); } if (methodSpecInfos.TryGetRid(ms, out uint rid)) { return(rid); } var row = new RawMethodSpecRow(AddMethodDefOrRef(ms.Method), GetSignature(ms.Instantiation)); rid = tablesHeap.MethodSpecTable.Add(row); methodSpecInfos.Add(ms, rid); AddCustomAttributes(Table.MethodSpec, rid, ms); AddCustomDebugInformationList(Table.MethodSpec, rid, ms); return(rid); }
/// <summary> /// Adds a new service record if one identified by <paramref name="guid"/> doesn't already exist /// </summary> /// <param name="guid">The unique identifier. Obtained from service contract.</param> /// <param name="initializer">Initializer</param> public void AddOrUpdatePlugin(string guid, Action <PluginRow> initializer) { PluginRow plugin = GetPlugin(guid); if (plugin == null) { var obj = new PluginRow(NewRow()) { Name = "New Service", Guid = guid, }; initializer(obj); Rows.Add(obj.Row); } else { initializer(plugin); } Save(); }
public ConsoleTable SortNatural(string columnName) { int colIndex = Columns.IndexOf(columnName); if (colIndex == -1) { throw new IndexOutOfRangeException($"Column \"{columnName}\" not found"); } var result = Rows.OrderBy(row => row[colIndex]).ToArray(); Rows.Clear(); foreach (object[] o in result) { Rows.Add(o); } return(this); }
/// <inheritdoc/> protected override uint AddStandAloneSig(StandAloneSig sas) { if (sas == null) { Error("StandAloneSig is null"); return(0); } uint rid; if (standAloneSigInfos.TryGetRid(sas, out rid)) { return(rid); } var row = new RawStandAloneSigRow(GetSignature(sas.Signature)); rid = tablesHeap.StandAloneSigTable.Add(row); standAloneSigInfos.Add(sas, rid); AddCustomAttributes(Table.StandAloneSig, rid, sas); return(rid); }
public override bool AddNote(Note note) { if (note is DatedNote) { DatedNote datedNote = note as DatedNote; Rows.Add(new string[] { datedNote.Id.ToString(), datedNote.Name, (datedNote.Year == 0) ? "" : datedNote.Year.ToString(), States[(int)datedNote.CurrentState], datedNote.Comment }); return(true); } return(false); }
public ConsoleTable AddRow(params object[] values) { if (values == null) { throw new ArgumentNullException(); } if (!Columns.Any()) { throw new Exception("Please set the columns first"); } if (Columns.Count != values.Length) { throw new Exception(string.Format("The number columns in the row ({0:d}) does not match the values ({1:d}", Columns.Count, values.Length)); } Rows.Add(values); return(this); }
/// <summary> /// Добавляет строку в таблицу. /// </summary> /// <param name="values"></param> /// <returns></returns> public void AddRow(params Object[] values) { if (values == null) { throw new ArgumentNullException(nameof(values)); } if (!Columns.Any()) { throw new Exception("Добавьте пожалуйста столбцы."); } if (Columns.Count != values.Length) { throw new Exception( $"Число столбцов в строке ({Columns.Count}) не соответствует значениям ({values.Length}"); } Rows.Add(values); }
public DataRow AddRecord(byte Клас, string Імя, string Прізвище, string Пароль, DateTime еєстрація) { DataRow row = Select(Клас, Імя, Прізвище); if (row == null) { ushort code = 0; if (Rows.Count != 0) { code = (ushort)(Convert.ToUInt16(Rows[Rows.Count - 1][0]) + 1); } Rows.Add(code, Імя, Прізвище, Пароль, еєстрація, Клас); adapter.Update(this); return(Rows[Rows.Count - 1]); } else { return(row); } }
private async Task UpdateRowsCommand() { if (string.IsNullOrEmpty(Url)) { return; } if (IsBusy) { return; } pageId = 1; IsBusy = true; RefreshCommand.ChangeCanExecute(); var rows = await WebManager.LoadItemsAsync(Url); Rows = RemoveDuplicateRows(rows); Rows.Add(GetMoreRowData()); IsBusy = false; RefreshCommand.ChangeCanExecute(); }
public ConsoleTable AddRow(params object[] values) { if (values == null) { throw new ArgumentNullException(nameof(values)); } if (!Columns.Any()) { throw new Exception("Please set the columns first"); } if (Columns.Count != values.Length) { throw new Exception(CreateOutOfRangeMessage(Columns.Count, values.Length)); } Rows.Add(values); return(this); }
public void AddRows(DataTable dt) { foreach (DataRow dr in dt.Rows) { DataGridRow r = NewRow(); if ((dt.PrimaryKey != null) && (dt.PrimaryKey.Length > 0)) { r.Attributes.Add("data-primarykey", dr[dt.PrimaryKey[0]].ToString()); } for (int ci = 0; ci < Columns.Count; ci++) { String dbName = Columns[ci].ColumnName; if (!String.IsNullOrWhiteSpace(dbName) && dt.Columns.Contains(dbName)) { r[ci] = dr[dbName]; } } Rows.Add(r); } }
public void AddRow(T instance, BindingFlags bindingFlags) { var properties = typeof(T).GetProperties(bindingFlags); var row = NewRow(); for (var i = 0; i < Columns.Count; ++i) { var columnName = Columns[i].ColumnName; var propertyInfo = properties.FirstOrDefault(pi => pi.Name.Equals(columnName)); var value = propertyInfo == null ? null : propertyInfo.GetValue(instance, null); row[i] = value; } Rows.Add(row); }
public DebuggerGridControl(DynamicTreeRow row) { this.row = row; BeginUpdate(); AddColumns(Columns); Rows.Add(row); row.Expanded += delegate { isExpanded = true; }; row.Collapsed += delegate { isExpanded = false; }; CreateControl(); using (Graphics g = CreateGraphics()) { this.Width = GetRequiredWidth(g); } this.Height = row.Height; EndUpdate(); }
public void ExecuteCatchPrint(string query) { SqlConnection connection = null; try { using (connection = new SqlConnection(GetConnectionString(ServerName, DatabaseName))) { using (SqlCommand command = new SqlCommand(query, connection)) { if (Timeout != null) { command.CommandTimeout = (int)Timeout; } connection.InfoMessage += OnInfoMessageGenerated; connection.Open(); command.StatementCompleted += OnStatementCompleted; catchPrint = true; command.ExecuteNonQuery(); SqlRow row = new SqlRow(); row.GetPrintValue(caughtPrint); Rows.Add(row); } } } catch (SqlException se) { ProcessSqlError(se); throw; } catch (Exception e) { MessageLogging.WriteLine(string.Format("Exception {0}", e.Message)); throw; } finally { catchPrint = false; caughtPrint = ""; } }
//Данные заявителя private bool createManagerRow() { ReportRow row = new ReportRow(); row.Cells.Add(new ReportCell("Заявитель") { Height = 24.00, TextStyle = new List <TextStyle>() { TextStyle.Bold }, VerticalAlignment = VerticalAlignment.Bottom }); AddEmptyCell(row, 2); row.Cells.Add(new ReportCell(Auth.getInstance().Full_name) { ColumnSpan = 7, BorderColor = System.Drawing.Color.Black, TextStyle = new List <TextStyle>() { TextStyle.Bold } }); AddEmptyCell(row, 6); row.Cells.Add(new ReportCell() { VerticalAlignment = VerticalAlignment.Bottom, HorizontalAlignment = HorizontalAlignment.Center }); row.Cells.Add(new ReportCell() { BorderColor = System.Drawing.Color.Black, ColumnSpan = 4 }); AddEmptyCell(row, 4); Rows.Add(row); return(true); }
/// <summary> /// Imports a data table /// </summary> /// <param name="table">The Data table</param> /// <param name="startFromReference">Start From Reference</param> /// <param name="includeColumnNames">Whether to include column names or not</param> public void ImportDataTable(DataTable table, string startFromReference, bool includeColumnNames) { if (table != null) { int startColumnIndex = Utilities.ColumnNames.IndexOf(Utilities.GetColumnName(startFromReference)) + 1; int startRowIndex = Utilities.GetRowIndex(startFromReference); int columnIndex = startColumnIndex, rowIndex = startRowIndex; // Write columns to Excel if includeColumnNames = true if (includeColumnNames) { foreach (DataColumn column in table.Columns) { Columns.ColumnsList.Add(new Column { Index = columnIndex }); AddCell(rowIndex, columnIndex++, column.Caption); } Rows.Add(new Row(rowIndex)); } // Add all the data row values rowIndex++; columnIndex = startColumnIndex; foreach (DataRow row in table.Rows) { Rows.Add(new Row(rowIndex)); for (var i = 0; i < table.Columns.Count; i++) { AddCell(rowIndex, columnIndex++, row[i].ToString()); } rowIndex++; columnIndex = startColumnIndex; } } else { throw new ArgumentNullException("table"); } }
public EmulationControl(IEmulationControl emulationControl) { _emulationControl = emulationControl; _runHaltButton = new Button { Text = emulationControl.Running ? "Halt" : "Run", Command = new Command((s, a) => { if (_emulationControl.Running) { _emulationControl.Running = false; _stepButton.Enabled = true; _runHaltButton.Text = "Run"; } else { _emulationControl.Running = true; _stepButton.Enabled = false; _runHaltButton.Text = "Halt"; } }) }; _stepButton = new Button { Text = "Step", Enabled = !emulationControl.Running, Command = new Command((s, a) => { _emulationControl.Step(); }) }; Rows.Add(_runHaltButton); Rows.Add(_stepButton); Rows.Add(null); Spacing = new Size(6, 4); Padding = new Padding(6, 4); }
public BoardViewModel(ReversiBoard board, OptionsViewModel options) { this.spel = new ReversiGame(board.Width, board.Height); this.Rows = new List <BoardRowViewModel>(); this.bord = board; this.black = bord.CountStones(Player.BLACK); this.white = bord.CountStones(Player.WHITE); this.currentPlayer = spel.CurrentPlayer; this.options = options; //timer var timeService = ServiceLocator.Current.GetInstance <ITimeService>(); _start = timeService.Now; _timer = ServiceLocator.Current.GetInstance <ITimerService>(); _timer.Tick += Timer_Tick; _timer.Start(new TimeSpan(0, 0, 0, 0, 100)); //this.Milliseconds = modelTimer.Milliseconds; for (var i = 0; i < board.Height; i++) { var rij = new BoardRowViewModel(spel); for (var j = 0; j < board.Width; j++) { rij.Squares[j].speler = spel.Board[new Vector2D(j, i)]; //breedte hoogte, j breedte i hoogte rij.Squares[j].Positie = new Vector2D(j, i); // nu is er aan elke square een juiste positie toegekend } Rows.Add(rij); } this.Command = new PutStoneCommand(this); // heeft een board nodig dus daarom de this we gaan deze direct meegeven this.commandend = new ToEndCommand(options, this); }
public void Fill(IDataReader reader) { while (reader.Read()) { var row = new CrossDataRow(); foreach (var column in Columns.OfType <CrossDataKeyColumn>()) { var value = reader.IsDBNull(column.Key) ? null : reader.GetValue(column.Key); row.AddValue(column, value); } var existsRow = Find(row); if (existsRow != null) { row = existsRow; } else { Rows.Add(row); } var i = 0; CrossDataGroupColumnValue columnValue = null; foreach (var column in Columns.OfType <CrossDataGroupColumn>()) { var value = reader.IsDBNull(column.Key) ? null : reader.GetValue(column.Key); var currColumnValue = i == 0 ? column.GetValue(value) : column.GetValue(columnValue, value); // row.AddValue(column, columnValue, value); columnValue = currColumnValue; i++; } foreach (var column in Columns.OfType <CrossDataFuncColumn>()) { var value = reader.IsDBNull(column.Key) ? null : reader.GetValue(column.Key); row.AddValue(column, columnValue, value); } } }
internal void AddRow(DataGridViewCell[] Cells, bool ReadOnly, int Height) { if (InvokeRequired) { this.Invoke(new Action(() => AddRow(Cells, ReadOnly, Height))); return; } DataGridViewRow Row = new DataGridViewRow() { DefaultHeaderCellType = typeof(DataGridViewRowHeaderCell), MinimumHeight = Height }; Row.Cells.AddRange(Cells); Rows.Add(Row); Row.HeaderCell.Style = RowHeaderStyle; Row.HeaderCell.ToolTipText = Row.Index.ToString(); Row.DefaultCellStyle = CellStyle; Row.Frozen = Row.HeaderCell.Frozen; Row.ReadOnly = ReadOnly; Row.Height = Height; Row.MinimumHeight = Height; Row.DividerHeight = 0; Row.HeaderCell.Value = Row.Index; Row.Resizable = DataGridViewTriState.False; Row.Selected = false; Row.Tag = string.Empty; foreach (DataGridViewCell item in Row.Cells) { item.Selected = false; if (item.ColumnIndex.Equals(4)) { item.ReadOnly = false; } else { item.ReadOnly = true; } } }
protected override int CreateChildControls( IEnumerable dataSource, bool dataBinding) { Controls.Clear(); int count = 0; if (dataBinding && dataSource != null) { IEnumerator e = dataSource.GetEnumerator(); while (e.MoveNext()) { object datarow = e.Current; PersonRow row = new PersonRow(count, datarow); Rows.Add(row); Controls.Add(row); count++; } _itemCount = count; } else { if (_itemCount > 0) { for (count = 0; count < _itemCount; count++) { PersonRow row = new PersonRow(count, null); Rows.Add(row); Controls.Add(row); } } } CreatePagerControls(); AttachStyle(); ClearChildViewState(); ChildControlsCreated = true; return(count); }