本文整理汇总了C#中Rock.ConvertToInt方法的典型用法代码示例。如果您正苦于以下问题:C# Rock.ConvertToInt方法的具体用法?C# Rock.ConvertToInt怎么用?C# Rock.ConvertToInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rock
的用法示例。
在下文中一共展示了Rock.ConvertToInt方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddSecurityAuthForPage
/// <summary>
/// Adds the page security authentication. Set GroupGuid to null when setting to a special role
/// </summary>
/// <param name="pageGuid">The page unique identifier.</param>
/// <param name="action">The action.</param>
/// <param name="groupGuid">The group unique identifier.</param>
/// <param name="specialRole">The special role.</param>
/// <param name="authGuid">The authentication unique identifier.</param>
public void AddSecurityAuthForPage( string pageGuid, int order, string action, bool allow, string groupGuid, Rock.Model.SpecialRole specialRole, string authGuid )
{
string entityTypeName = "Rock.Model.Page";
EnsureEntityTypeExists( entityTypeName );
string sql = @"
DECLARE @groupId int
SET @groupId = (SELECT [Id] FROM [Group] WHERE [Guid] = '{0}')
DECLARE @entityTypeId int
SET @entityTypeId = (SELECT [Id] FROM [EntityType] WHERE [name] = '{1}')
DECLARE @pageId int
SET @pageId = (SELECT [Id] FROM [Page] WHERE [Guid] = '{2}')
INSERT INTO [dbo].[Auth]
([EntityTypeId]
,[EntityId]
,[Order]
,[Action]
,[AllowOrDeny]
,[SpecialRole]
,[PersonId]
,[GroupId]
,[Guid])
VALUES
(@entityTypeId
,@pageId
,{6}
,'{3}'
,'{7}'
,{4}
,null
,@groupId
,'{5}')
";
Sql( string.Format( sql, groupGuid ?? Guid.Empty.ToString(), entityTypeName, pageGuid, action, specialRole.ConvertToInt(), authGuid, order,
( allow ? "A" : "D" ) ) );
}
示例2: AddReportField
/// <summary>
/// Adds a report field to a report
/// </summary>
/// <param name="reportGuid">The report unique identifier.</param>
/// <param name="reportFieldType">Type of the report field.</param>
/// <param name="showInGrid">if set to <c>true</c> [show in grid].</param>
/// <param name="dataSelectComponentEntityTypeGuid">The data select component entity type unique identifier.</param>
/// <param name="selection">The selection.</param>
/// <param name="order">The order.</param>
/// <param name="columnHeaderText">The column header text.</param>
/// <param name="guid">The unique identifier.</param>
public void AddReportField(string reportGuid, Rock.Model.ReportFieldType reportFieldType, bool showInGrid,
string dataSelectComponentEntityTypeGuid, string selection, int order, string columnHeaderText, string guid )
{
Migration.Sql( string.Format( @"
DECLARE @ReportId INT = (
SELECT TOP 1 [Id]
FROM [Report]
WHERE [Guid] = '{0}'
)
,@DataSelectComponentEntityTypeId INT = (
SELECT TOP 1 [Id]
FROM [EntityType]
WHERE [Guid] = '{3}'
)
INSERT INTO [dbo].[ReportField] (
[ReportId]
,[ReportFieldType]
,[ShowInGrid]
,[DataSelectComponentEntityTypeId]
,[Selection]
,[Order]
,[ColumnHeaderText]
,[Guid]
)
VALUES (
@ReportId
,{1}
,{2}
,@DataSelectComponentEntityTypeId
,'{4}'
,{5}
,'{6}'
,'{7}'
)
",
reportGuid, // {0}
reportFieldType.ConvertToInt(), // {1}
showInGrid.Bit(), // {2}
dataSelectComponentEntityTypeGuid, // {3}
selection.Replace("'", "''"), // {4}
order, // {5}
columnHeaderText, // {6}
guid // {7}
));
}
示例3: AddSecurityAuthForRestAction
/// <summary>
/// Adds the security authentication for rest action.
/// </summary>
/// <param name="restActionMethod">The rest action method.</param>
/// <param name="restActionPath">The rest action path.</param>
/// <param name="order">The order.</param>
/// <param name="action">The action.</param>
/// <param name="allow">if set to <c>true</c> [allow].</param>
/// <param name="groupGuid">The group unique identifier.</param>
/// <param name="specialRole">The special role.</param>
/// <param name="authGuid">The authentication unique identifier.</param>
public void AddSecurityAuthForRestAction( string restActionMethod, string restActionPath, int order, string action, bool allow, string groupGuid, Rock.Model.SpecialRole specialRole, string authGuid )
{
string entityTypeName = "Rock.Model.RestAction";
EnsureEntityTypeExists( entityTypeName );
string sql = @"
DECLARE @EntityTypeId int = ( SELECT TOP 1 [Id] FROM [EntityType] WHERE [name] = '{0}')
DECLARE @ActionId int = ( SELECT TOP 1 [Id] FROM [RestAction] WHERE [ApiId] = '{1}{2}')
IF @EntityTypeId IS NOT NULL AND @ActionId IS NOT NULL
BEGIN
DECLARE @groupId int = ( SELECT TOP 1 [Id] FROM [Group] WHERE [Guid] = '{6}')
IF NOT EXISTS (
SELECT [Id] FROM [dbo].[Auth]
WHERE [EntityTypeId] = @entityTypeId
AND [EntityId] = @ActionId
AND [Action] = '{4}'
AND [SpecialRole] = {7}
AND [GroupId] = @groupId
)
BEGIN
INSERT INTO [dbo].[Auth]
([EntityTypeId]
,[EntityId]
,[Order]
,[Action]
,[AllowOrDeny]
,[SpecialRole]
,[GroupId]
,[Guid])
VALUES
(@EntityTypeId
,@ActionId
,{3}
,'{4}'
,'{5}'
,{7}
,@groupId
,'{8}')
END
END
";
Migration.Sql( string.Format( sql,
entityTypeName, // 0
restActionMethod, // 1
restActionPath, // 2
order, // 3
action, // 4
( allow ? "A" : "D" ), // 5
groupGuid, // 6
specialRole.ConvertToInt(), // 7
authGuid ) ); // 8
}
示例4: AddSecurityAuthForRestController
/// <summary>
/// Adds the security authentication for rest controller.
/// </summary>
/// <param name="restControllerClass">The rest controller class.</param>
/// <param name="order">The order.</param>
/// <param name="action">The action.</param>
/// <param name="allow">if set to <c>true</c> [allow].</param>
/// <param name="groupGuid">The group unique identifier.</param>
/// <param name="specialRole">The special role.</param>
/// <param name="authGuid">The authentication unique identifier.</param>
public void AddSecurityAuthForRestController( string restControllerClass, int order, string action, bool allow, string groupGuid, Rock.Model.SpecialRole specialRole, string authGuid )
{
string entityTypeName = "Rock.Model.RestController";
EnsureEntityTypeExists( entityTypeName );
string sql = @"
DECLARE @EntityTypeId int = ( SELECT TOP 1 [Id] FROM [EntityType] WHERE [name] = '{0}')
DECLARE @ControllerId int = ( SELECT TOP 1 [Id] FROM [RestController] WHERE [ClassName] = '{1}')
IF @EntityTypeId IS NOT NULL AND @ControllerId IS NOT NULL
BEGIN
DECLARE @groupId int = ( SELECT TOP 1 [Id] FROM [Group] WHERE [Guid] = '{5}')
IF NOT EXISTS (
SELECT [Id] FROM [dbo].[Auth]
WHERE [EntityTypeId] = @entityTypeId
AND [EntityId] = @ControllerId
AND [Action] = '{3}'
AND [SpecialRole] = {6}
AND [GroupId] = @groupId
)
BEGIN
INSERT INTO [dbo].[Auth]
([EntityTypeId]
,[EntityId]
,[Order]
,[Action]
,[AllowOrDeny]
,[SpecialRole]
,[GroupId]
,[Guid])
VALUES
(@EntityTypeId
,@ControllerId
,{2}
,'{3}'
,'{4}'
,{6}
,@groupId
,'{7}')
END
END
";
Migration.Sql( string.Format( sql,
entityTypeName, // 0
restControllerClass, // 1
order, // 2
action, // 3
( allow ? "A" : "D" ), // 4
groupGuid, // 5
specialRole.ConvertToInt(), // 6
authGuid ) ); // 7
}
示例5: AddSecurityAuthForGroupType
/// <summary>
/// Adds the page security authentication. Set GroupGuid to null when setting to a special role
/// </summary>
/// <param name="groupTypeGuid">The group type unique identifier.</param>
/// <param name="order">The order.</param>
/// <param name="action">The action.</param>
/// <param name="allow">if set to <c>true</c> [allow].</param>
/// <param name="groupGuid">The group unique identifier.</param>
/// <param name="specialRole">The special role.</param>
/// <param name="authGuid">The authentication unique identifier.</param>
public void AddSecurityAuthForGroupType( string groupTypeGuid, int order, string action, bool allow, string groupGuid, Rock.Model.SpecialRole specialRole, string authGuid )
{
string entityTypeName = "Rock.Model.GroupType";
EnsureEntityTypeExists( entityTypeName );
string sql = @"
DECLARE @groupId int
SET @groupId = (SELECT [Id] FROM [Group] WHERE [Guid] = '{0}')
DECLARE @entityTypeId int
SET @entityTypeId = (SELECT [Id] FROM [EntityType] WHERE [name] = '{1}')
DECLARE @groupTypeId int
SET @groupTypeId = (SELECT [Id] FROM [GroupType] WHERE [Guid] = '{2}')
IF NOT EXISTS (
SELECT [Id] FROM [dbo].[Auth]
WHERE [EntityTypeId] = @entityTypeId
AND [EntityId] = @groupTypeId
AND [Action] = '{3}'
AND [SpecialRole] = {4}
AND [GroupId] = @groupId
)
BEGIN
INSERT INTO [dbo].[Auth]
([EntityTypeId]
,[EntityId]
,[Order]
,[Action]
,[AllowOrDeny]
,[SpecialRole]
,[GroupId]
,[Guid])
VALUES
(@entityTypeId
,@groupTypeId
,{6}
,'{3}'
,'{7}'
,{4}
,@groupId
,'{5}')
END
";
Migration.Sql( string.Format( sql, groupGuid ?? Guid.Empty.ToString(), entityTypeName, groupTypeGuid, action, specialRole.ConvertToInt(), authGuid, order,
( allow ? "A" : "D" ) ) );
}
示例6: AddSecurityAuthForContentChannel
/// <summary>
/// Adds the security authentication for content channel.
/// </summary>
/// <param name="contentChannelGuid">The content channel unique identifier.</param>
/// <param name="order">The order.</param>
/// <param name="action">The action.</param>
/// <param name="allow">if set to <c>true</c> [allow].</param>
/// <param name="groupGuid">The group unique identifier.</param>
/// <param name="specialRole">The special role.</param>
/// <param name="authGuid">The authentication unique identifier.</param>
public void AddSecurityAuthForContentChannel( string contentChannelGuid, int order, string action, bool allow, string groupGuid, Rock.Model.SpecialRole specialRole, string authGuid )
{
if ( string.IsNullOrWhiteSpace( groupGuid ) )
{
groupGuid = Guid.Empty.ToString();
}
string entityTypeName = "Rock.Model.ContentChannel";
EnsureEntityTypeExists( entityTypeName );
string sql = @"
DECLARE @EntityTypeId int = ( SELECT TOP 1 [Id] FROM [EntityType] WHERE [name] = '{0}')
DECLARE @ContentChannelId int = (SELECT TOP 1 [Id] FROM [ContentChannel] WHERE [Guid] = '{1}')
IF @EntityTypeId IS NOT NULL AND @ContentChannelId IS NOT NULL
BEGIN
DECLARE @GroupId int = ( SELECT TOP 1 [Id] FROM [Group] WHERE [Guid] = '{2}')
IF NOT EXISTS (
SELECT [Id] FROM [dbo].[Auth]
WHERE [EntityTypeId] = @EntityTypeId
AND [EntityId] = @ContentChannelId
AND [Action] = '{4}'
AND [AllowOrDeny] = '{5}'
AND [SpecialRole] = {6}
AND [GroupId] = @GroupId
)
BEGIN
INSERT INTO [dbo].[Auth]
([EntityTypeId]
,[EntityId]
,[Order]
,[Action]
,[AllowOrDeny]
,[SpecialRole]
,[GroupId]
,[Guid])
VALUES
(@EntityTypeId
,@ContentChannelId
,{3}
,'{4}'
,'{5}'
,{6}
,@GroupId
,'{7}')
END
END
";
Migration.Sql( string.Format( sql,
entityTypeName, // 0
contentChannelGuid, // 1
groupGuid, // 2
order, // 3
action, // 4
( allow ? "A" : "D" ), // 5
specialRole.ConvertToInt(), // 6
authGuid ) ); // 7
}