当前位置: 首页>>代码示例>>C#>>正文


C# Row.SetValue方法代码示例

本文整理汇总了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);
                }
            }
        }
开发者ID:deveel,项目名称:deveeldb,代码行数:31,代码来源:UserManager.cs

示例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;
            }
开发者ID:ArsenShnurkov,项目名称:deveeldb,代码行数:29,代码来源:Transaction.cs


注:本文中的Row.SetValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。