/// <summary> /// 设置行头 /// </summary> private void _setRowHeader() { this.Rows.Clear(); if (this._rows == null || this._rows.Count == 0) { return; } int max = 0; if (this._tableType.ID == (int)EnumTableType.Narrow || this._tableType.ID == (int)EnumTableType.GCLevel) { max = 7; } else if (this._tableType.ID == (int)EnumTableType.Wide) { max = 9; } else if (this._tableType.ID == (int)EnumTableType.Residue) { max = 8; } else if (this._tableType.ID == (int)EnumTableType.Whole) { max = 2; } int k = 0; foreach (var r in this._rows) { bool tag = k < max; k++; var row = new GridOilRow() { RowEntity = r, Visible = r.isDisplay, Frozen = tag }; row.CreateCells(this, r.itemName, r.itemEnName, r.itemUnit, r.itemCode); this.Rows.Add(row); r.RowIndex = row.Index; } }
/// <summary> /// 设置渣油表的行 /// </summary> public static void _setResidueRow(DataGridView dataGridView, string XItemCode, string YItemCode) { dataGridView.Rows.Clear(); List <OilTableRowEntity> tempRowList = OilTableRowBll._OilTableRow.Where(o => o.oilTableTypeID == (int)EnumTableType.Residue).ToList(); OilTableRowEntity ICPRow = tempRowList.Where(o => o.itemCode == "ICP").FirstOrDefault(); OilTableRowEntity tempRowX = tempRowList.Where(o => o.itemCode == XItemCode).FirstOrDefault(); OilTableRowEntity tempRowY = tempRowList.Where(o => o.itemCode == YItemCode).FirstOrDefault(); #region "添加行" GridOilRow rowAX = new GridOilRow(); rowAX.RowEntity = tempRowX; rowAX.CreateCells(dataGridView, tempRowX.itemName, tempRowX.itemUnit, "原始库"); rowAX.ReadOnly = true; dataGridView.Rows.Add(rowAX); tempRowX.RowIndex = rowAX.Index; GridOilRow rowAY = new GridOilRow(); rowAY.RowEntity = tempRowY; rowAY.CreateCells(dataGridView, tempRowY.itemName, tempRowY.itemUnit, "原始库"); rowAY.ReadOnly = true; dataGridView.Rows.Add(rowAY); tempRowY.RowIndex = rowAY.Index; #endregion #region "添加行" GridOilRow ICP = new GridOilRow(); ICP.RowEntity = ICPRow; ICP.CreateCells(dataGridView, ICPRow.itemName, ICPRow.itemUnit, " "); ICP.ReadOnly = true; dataGridView.Rows.Add(ICP);//添加第三行 #endregion #region "添加行" GridOilRow row = new GridOilRow(); row.RowEntity = tempRowX; row.CreateCells(dataGridView, tempRowX.itemName, tempRowX.itemUnit, "应用库"); row.ReadOnly = true; dataGridView.Rows.Add(row);//添加第四行 GridOilRow LastRow = new GridOilRow(); LastRow.RowEntity = tempRowY; LastRow.CreateCells(dataGridView, tempRowY.itemName, tempRowY.itemUnit, "应用库"); LastRow.ReadOnly = false; dataGridView.Rows.Add(LastRow);//添加第五行 #endregion }