/// <summary> /// 将行的数据行的状态全部重置 /// </summary> /// <param name="state">状态[0:未更改;1:已赋值,值相同[可插入];2:已赋值,值不同[可更新]]</param> /// <param name="op">状态设置选项</param> public MDataRow SetState(int state, BreakOp op) { for (int i = 0; i < this.Count; i++) { switch (op) { case BreakOp.Null: if (this[i].IsNull) { continue; } break; case BreakOp.Empty: if (this[i].strValue == "") { continue; } break; case BreakOp.NullOrEmpty: if (this[i].IsNullOrEmpty) { continue; } break; } this[i].cellValue.State = state; } return(this); }
private void SetState(int state, BreakOp op, MDataCell cell) { switch (op) { case BreakOp.Null: if (cell.IsNull) { return; } break; case BreakOp.Empty: if (cell.StringValue == "") { return; } break; case BreakOp.NullOrEmpty: if (cell.IsNullOrEmpty) { return; } break; } cell.State = state; }
/// <param name="columns"><para>批量指定某些列</para></param> /// <returns></returns> public MDataRow SetState(int state, BreakOp op, string columns) { if (!string.IsNullOrEmpty(columns)) { string[] items = columns.Trim(',', ' ').Split(','); for (int i = 0; i < items.Length; i++) { MDataCell cell = this[items[i]]; if (cell != null) { SetState(state, op, cell); } } } else { for (int i = 0; i < this.Count; i++) { SetState(state, op, this[i]); } } return(this); }
/// <summary> /// 将行的数据行的状态全部重置 /// </summary> /// <param name="state">状态[0:未更改;1:已赋值,值相同[可插入];2:已赋值,值不同[可更新]]</param> /// <param name="op">状态设置选项</param> public MDataRow SetState(int state, BreakOp op) { return(SetState(state, op, string.Empty)); }