本文整理汇总了C#中Row.SetValue方法的典型用法代码示例。如果您正苦于以下问题:C# Row.SetValue方法的具体用法?C# Row.SetValue怎么用?C# Row.SetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Row
的用法示例。
在下文中一共展示了Row.SetValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetUserStatus
public void SetUserStatus(string userName, UserStatus status)
{
using (var query = Session.CreateQuery()) {
// Internally we implement this by adding the user to the #locked group.
var table = query.Access().GetMutableTable(UserRoleTableName);
var c1 = table.GetResolvedColumnName(0);
var c2 = table.GetResolvedColumnName(1);
// All 'user_role' where user = %username%
var t = table.SimpleSelect(query, c1, SqlExpressionType.Equal, SqlExpression.Constant(userName));
// All from this set where PrivGroupName = %role%
t = t.SimpleSelect(query, c2, SqlExpressionType.Equal, SqlExpression.Constant(SystemRoles.LockedRole));
bool userBelongsToLockGroup = t.RowCount > 0;
if (status == UserStatus.Locked &&
!userBelongsToLockGroup) {
// Lock the user by adding the user to the Lock group
// Add this user to the locked group.
var rdat = new Row(table);
rdat.SetValue(0, userName);
rdat.SetValue(1, SystemRoles.LockedRole);
table.AddRow(rdat);
} else if (status == UserStatus.Unlocked &&
userBelongsToLockGroup) {
// Unlock the user by removing the user from the Lock group
// Remove this user from the locked group.
table.Delete(t);
}
}
}
示例2: GetTable
public ITable GetTable(int offset)
{
var tableInfo = GetTableInfo(offset);
var table = new TriggeredOldNew(transaction.DatabaseContext, tableInfo);
if (HasOldTable) {
if (offset == 0) {
// Copy data from the table to the new table
var dtable = transaction.GetTable(transaction.TableState.TableSource);
var oldRow = new Row(table);
int rowIndex = transaction.TableState.OldRowIndex;
for (int i = 0; i < tableInfo.ColumnCount; ++i) {
oldRow.SetValue(i, dtable.GetValue(rowIndex, i));
}
// All OLD tables are immutable
table.SetReadOnly(true);
table.SetData(oldRow);
return table;
}
}
table.SetReadOnly(!transaction.TableState.IsNewMutable);
table.SetData(transaction.TableState.NewDataRow);
return table;
}