本文整理汇总了C#中Csla.Data.SafeDataReader.GetBool方法的典型用法代码示例。如果您正苦于以下问题:C# SafeDataReader.GetBool方法的具体用法?C# SafeDataReader.GetBool怎么用?C# SafeDataReader.GetBool使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Csla.Data.SafeDataReader
的用法示例。
在下文中一共展示了SafeDataReader.GetBool方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FetchProcess
/// <summary>
/// Retrieves the process.
/// </summary>
/// <param name="id">The process id.</param>
/// <param name="fetchHistory">The fetch history.</param>
/// <param name="locId">The localization/language id.</param>
/// <returns>The processEdit DTO object <see cref="ProcessEditDto" />.</returns>
public ProcessEditDto FetchProcess(int id, IProcessFetchHistory fetchHistory = null, int locId = 0)
{
var process = new ProcessEditDto();
const string commandText = "GetProcessWithLoc";
if (fetchHistory != null)
fetchHistory.BeginLogExecuteSP();
Database.GetDataReader(
commandText,
600,
r =>
{
if (r == null || !r.Read())
{
return;
}
var sr = new SafeDataReader(r);
process.Id = sr.GetInt("Id");
process.Name = sr.GetString("Name").Trim();
process.Description = sr.GetString("Description");
process.Documentation = sr.GetString("Documentation");
process.SystemName = sr.GetString("SystemName");
process.IconId = sr.GetNullableInt("IconId");
process.Guid = sr.GetGuid("Guid");
process.IsPublishedCopy = sr.GetBool("IsPublishedCopy");
process.BaseProcessId = sr.GetNullableInt("BaseProcessId");
process.BaseProcessProcessId = sr.GetNullableInt("BaseProcessProcessId");
process.ProcessOption = sr.GetString("ProcessOption");
process.IsStateEnabled = sr.GetBool("IsStateEnabled", true);
process.DefaultStateId = sr.GetInt32("DefaultStateId");
process.AllowPaperclips = sr.GetBool("AllowPaperclips", true);
process.ColorId = sr.GetNullableInt("ColorId");
process.InheritanceContext = sr.GetString("InheritanceContext");
process.ShowDerivedProcess = sr.GetBool(Constants.ShowDerivedProcess);
process.PublishedProcessId = sr.GetInt("PublishedProcessId");
process.PublishedId = sr.GetInt("PublishedId");
process.IsSystem = sr.GetBool("IsSystem");
process.SimpleProcess = sr.GetBool("SimpleProcess");
process.IsInactive = sr.GetBool("IsInactive");
process.IsTabbedUI = sr.GetBool("IsTabbedUI");
process.IsTrackable = sr.GetBool("IsTrackable");
process.ShowSummaryPage = sr.GetBool("ShowSummaryPage");
process.AllowBatchProcessing = sr.GetBool("AllowBatchProcessing");
process.LastUpdated = sr.GetDateTime("LastUpdated");
process.IdentifierField = sr.GetString("IdentifierField");
var processVersionId = sr.GetInt("ProcessVersionId");
if (fetchHistory != null)
fetchHistory.LogExecuteSP();
if (processVersionId > 0)
{
process.Version = new VersionDto
{
ProcessId = processVersionId,
VersioningStyle = sr.GetEnum("VersioningStyle", VersioningStyles.Char),
StartingVersion = sr.GetString("StartingVersion"),
NextVersionStateGuid = sr.GetGuid("NextVersionStateGuid"),
PreviousVersionStateGuid = sr.GetGuid("PreviousVersionStateGuid"),
IncludeVersionNumberInList = sr.GetBool("IncludeVersionNumberInList"),
IncludeVersionDateInList = sr.GetBool("IncludeVersionDateInList"),
StateFilterGuid = sr.GetGuid("StateFilterGuid")
};
}
if (fetchHistory != null)
fetchHistory.ProcessHistoryDTO.FetchSectionsTime = Profiler.Profile(() => ReadSections(process, sr));
else
ReadSections(process, sr);
ReadRequiredRuleConfigs(process, sr);
if (fetchHistory != null)
fetchHistory.ProcessHistoryDTO.FetchSecurityConfigurationsTime = fetchHistory.Profile(
() =>
{
ReadProcessSecurityConfigurations(process, sr);
ReadProcessSecurityConfigs(process, sr);
});
else
{
ReadProcessSecurityConfigurations(process, sr);
ReadProcessSecurityConfigs(process, sr);
}
ReadStates(process, sr);
ReadEscalationActionOptions(process, sr);
ReadAssignmentActionOptions(process, sr);
ReadApprovalActionOptions(process, sr);
ReadActionRules(process, sr);
//.........这里部分代码省略.........
示例2: FetchCheckboxOptions
/// <summary>
/// Fetches checkbox options.
/// </summary>
/// <param name="processName">The process name.</param>
/// <param name="fieldName">The field name.</param>
/// <param name="isPublishedCopy">The is published copy.</param>
/// <returns>The <see cref="CheckboxOptionsStepDto" />.</returns>
public CheckboxOptionsStepDto FetchCheckboxOptions(string processName, string fieldName, bool isPublishedCopy = false)
{
const string CmdText =
@"
DECLARE @fieldId AS INT
SELECT @fieldId = f.Id
FROM
[dbo].[Processes] p
INNER JOIN [dbo].[Sections] s ON s.ProcessId = p.Id
INNER JOIN [dbo].[Fields] f ON f.SectionId = s.Id
WHERE p.[SystemName] = @processName AND p.IsRemoved = 0 AND p.IsPublishedCopy = @isPublishedCopy AND f.SystemName = @fieldName;
EXEC [dbo].[GetCheckboxOptionsStep] @FieldId = @fieldId;
";
using (var ctx = ConnectionManager<SqlConnection>.GetManager(Database.VeyronMeta, false))
using (var cmd = new SqlCommand(CmdText, ctx.Connection))
{
cmd.Parameters.AddWithValue("@processName", processName);
cmd.Parameters.AddWithValue("@fieldName", fieldName);
cmd.Parameters.AddWithValue("@isPublishedCopy", isPublishedCopy);
using (var reader = new SafeDataReader(cmd.ExecuteReader()))
{
if (reader.Read())
{
var dto = new CheckboxOptionsStepDto
{
Id = reader.GetInt32(0),
IsSwitchToggle = reader.GetBool(1),
DefaultValue = reader.GetBool(2),
MainLabel = reader.GetString(3),
UndefinedLabel = reader.GetString(4),
TrueLabel = reader.GetString(5),
FalseLabel = reader.GetString(6),
};
return dto;
}
}
}
return null;
}
示例3: FetchPublishHistory
/// <summary>
/// Retrieves publish history.
/// </summary>
/// <param name="processId">The process id.</param>
/// <param name="numberOfRecords">The number of records.</param>
/// <returns>The list of DTO objects.</returns>
public IEnumerable<PublishHistoryDto> FetchPublishHistory(int processId, int numberOfRecords = 10)
{
const string Query = @"
SELECT TOP (@count) Date ,
Id ,
IsSuccess ,
ProcessId ,
TimeToBuildClientLib ,
TimeToBuildServerLib ,
TimeToPublish ,
TimeToRegisterPublishedCopy ,
TimeToRetrieve ,
TimeToUpdateRuntime ,
TriggeredBy ,
TriggeredByProcess FROM dbo.PublishHistory
WHERE ProcessId = @processId
ORDER BY Date DESC
";
var result = new List<PublishHistoryDto>();
using (var ctx = ConnectionManager<SqlConnection>.GetManager(Database.VeyronMeta, false))
{
var connection = ctx.Connection;
using (var cmd = new SqlCommand(Query, connection))
{
cmd.Parameters.AddWithValue("@count", numberOfRecords);
cmd.Parameters.AddWithValue("@processId", processId);
using (var reader = new SafeDataReader(cmd.ExecuteReader()))
{
{
while (reader.Read())
{
var item = new PublishHistoryDto
{
Date = reader.ReadDateTime(0),
IsSuccess = reader.GetBool(2),
ProcessId = reader.GetInt32(3),
TimeToPublish = reader.GetInt64(6)
};
result.Add(item);
}
}
}
}
}
return result;
}
示例4: FetchProcessInfo
/// <summary>
/// Retrieves process information.
/// </summary>
/// <param name="id">The process id.</param>
/// <returns>The process info object<see cref="ProcessInfoDTO" />.</returns>
public ProcessInfoDTO FetchProcessInfo(int id)
{
var result = new ProcessInfoDTO();
using (var ctx = ConnectionManager<SqlConnection>.GetManager(Database.VeyronMeta, false))
{
var cn = ctx.Connection;
const string Sql =
@"
SELECT [Id] ,
[Name] ,
[Description] ,
[SystemName] ,
[IsSystem],
[Documentation]
FROM [Processes]
WHERE id = @id";
using (var cmd = new SqlCommand(Sql, cn))
{
cmd.Parameters.AddWithValue("@id", id);
using (var reader = new SafeDataReader(cmd.ExecuteReader()))
{
if (reader.Read())
{
result = new ProcessInfoDTO
{
Id = reader.GetInt32(0),
Name = reader.GetString(1).Trim(),
Description = reader.GetString(2),
SystemName = reader.GetString(3),
IsSystem = reader.GetBool(4),
ProcessDocumentation = reader.GetString(5)
};
}
}
}
}
return result;
}
示例5: FetchLdapProfiles
/// <summary> Fetches the LDAP profiles. </summary>
public IEnumerable<LdapProfileDTO> FetchLdapProfiles()
{
const string sql = @"
SELECT
[Id]
,[Name]
,[ServerType]
,[UseForLogin]
,[ServerPath]
,[Username]
,[Password]
,[RootPath]
,[SearchFilter]
,[UseSSL]
FROM [dbo].[LdapProfiles]";
var resultList = new List<LdapProfileDTO>();
Database.GetDataReader(
sql,
reader =>
{
if (reader == null)
throw new DataAccessException(Resources.FailedToRetrieveSystemOptions);
using (var sr = new SafeDataReader(reader))
{
while (reader.Read())
{
resultList.Add(
new LdapProfileDTO
{
Id = sr.GetInt32("Id"),
Name = sr.GetString("Name"),
ServerType = (LdapServerTypes) sr.GetInt32("ServerType"),
UseForLogin = sr.GetBool("UseForLogin"),
ServerPath = sr.GetString("ServerPath"),
Username = TryDecrypt(sr.GetString("Username")),
Password = TryDecrypt(sr.GetString("Password")),
RootPath = sr.GetString("RootPath"),
SearchFilter = sr.GetString("SearchFilter"),
UseSSL = sr.GetBoolean("UseSSL")
});
}
}
});
return resultList;
}
示例6: FetchReverseCrossRefList
/// <summary>
/// Fetches reverse cross ref list.
/// </summary>
/// <param name="processGuid">The process GUID.</param>
/// <returns>The <see cref="IList" />.</returns>
public IList<PublishedProcessInfoDTO> FetchReverseCrossRefList(Guid processGuid)
{
var result = new List<PublishedProcessInfoDTO>();
const string CmdText =
@"
-- Select processes with cross reference fields
DECLARE @pp_id INT
SELECT @pp_id = pp.[Id] FROM [dbo].[PublishedProcesses] pp WHERE pp.[ProcessGuid] = @processGuid
SELECT pp.[Id]
,p.[Name]
,p.[SystemName]
,p.[Id]
,p.[IsStateEnabled]
,p.[ProcessOption]
FROM [dbo].[PublishedProcesses] pp
INNER JOIN [dbo].[Processes] p ON p.[Id] = pp.[ProcessId]
INNER JOIN (SELECT DISTINCT s.[ProcessId] AS [Id]
FROM [dbo].[Sections] s
INNER JOIN [dbo].[Fields] f on f.[SectionId] = s.[Id]
INNER JOIN [dbo].[CrossRefRequredFieldStep] x on x.[FieldId] = f.[Id]
WHERE x.[CrossRefProcessId] = @pp_id) pu ON p.[Id] = pu.[Id]
WHERE pp.Id <> @pp_id
-- Select processes with checklist fields
DECLARE @pp_systemName AS NVARCHAR(200)
SELECT @pp_systemName = p.[SystemName] FROM [dbo].[Processes] p WHERE p.[Guid] = @processGuid AND p.[IsPublishedCopy] = 1 AND p.[IsRemoved] = 0
SELECT pp.[Id]
,p.[Name]
,p.[SystemName]
,p.[Id]
,p.[IsStateEnabled]
,p.[ProcessOption]
FROM [dbo].[PublishedProcesses] pp
INNER JOIN [dbo].[Processes] p ON p.[Id] = pp.[ProcessId]
INNER JOIN (SELECT DISTINCT s.[ProcessId] AS [Id]
FROM [dbo].[Sections] s
INNER JOIN [dbo].[Fields] f on f.[SectionId] = s.[Id]
INNER JOIN [dbo].[stepChecklist] x on x.[FieldId] = f.[Id]
WHERE x.[AnswerProcessSystemName] = @pp_systemName) pu ON p.[Id] = pu.[Id]
WHERE pp.Id <> @pp_id";
using (var ctx = ConnectionManager<SqlConnection>.GetManager(Database.VeyronMeta, false))
{
var cn = ctx.Connection;
using (var cmd = new SqlCommand(CmdText, cn))
{
cmd.Parameters.AddWithValue("@processGuid", processGuid);
using (var reader = new SafeDataReader(cmd.ExecuteReader()))
{
do
{
while (reader.Read())
{
var dto = new PublishedProcessInfoDTO
{
Id = reader.GetInt(0),
Name = reader.GetString(1),
SystemName = reader.GetString(2),
ProcessId = reader.GetInt(3),
IsStateEnabled = reader.GetBool(4),
ProcessOption = reader.GetEnum(5, ProcessOption.None)
};
if (result.All(x => x.Id != dto.Id))
{
result.Add(dto);
}
}
}
while (reader.NextResult());
}
}
}
return result;
}
示例7: GetCode
/// <summary>
/// Retrieves code.
/// </summary>
/// <param name="libraryType">The library type.</param>
/// <returns>The <see cref="Dictionary{TKey,TValue}"/>.</returns>
public Dictionary<string, SourceCodeDto> GetCode(LibraryTypes libraryType)
{
var result = new Dictionary<string, SourceCodeDto>();
using (var ctx = ConnectionManager<SqlConnection>.GetManager(Database.VeyronMeta, false))
{
var connection = ctx.Connection;
using (var command = new SqlCommand("GetAllCode", connection))
{
command.CommandType = CommandType.StoredProcedure;
if (((libraryType & LibraryTypes.System) == LibraryTypes.System)
&& ((libraryType & LibraryTypes.Custom) == LibraryTypes.Custom))
{
command.Parameters.AddWithValue("@includeCustom", 1);
command.Parameters.AddWithValue("@includeSystem", 1);
}
else
{
command.Parameters.AddWithValue(
(libraryType & LibraryTypes.System) == LibraryTypes.System
? "@includeSystem"
: "@includeCustom",
1);
}
using (var sr = new SafeDataReader(command.ExecuteReader()))
{
while (sr.Read())
{
var clientCode = sr.GetString(0);
var serverCode = sr.GetString(1);
var systemName = sr.GetString(2);
var isSystem = sr.GetBool(3);
var version = ParseVersion(sr.GetString(4));
result.Add(
systemName,
new SourceCodeDto
{
ClientCode = clientCode,
ServerCode = serverCode,
IsSystem = isSystem,
Version = version
});
}
}
}
}
return result;
}
示例8: GetBaseBusinessUnitUsings
/// <summary>
/// Gets all usings for a specified business unit.
/// </summary>
/// <param name="businessUnitId">Id of the business unit.</param>
/// <returns>IEnumerable{RecordUsingsDto}.</returns>
public IEnumerable<RecordUsingsDto> GetBaseBusinessUnitUsings(int businessUnitId)
{
const string CmdText = @"
SELECT 'UsingInFieldsSecurityConfigs' as Using, p.Name as ProcessName, p.IsPublishedCopy, NULL as CommandName, NULL as ReportName
FROM [dbo].[ProcessSecurityConfigs] sc
JOIN [dbo].[Processes] p ON p.Id = sc.ProcessId
WHERE @BusinessUnitId = BusinessUnitId
UNION
SELECT 'UsingInStateConfigs' as Using, p.Name as ProcessName, p.IsPublishedCopy, NULL as CommandName, NULL as ReportName
FROM [dbo].[States] s
LEFT OUTER JOIN [dbo].[StateLinks] sl ON sl.StateOutGuid = s.Guid
LEFT OUTER JOIN [dbo].[StateConnectorSecurityConfigurations] scsc ON scsc.StateInGuid = sl.StateInGuid AND scsc.StateOutGuid = sl.StateOutGuid
JOIN [dbo].[Processes] p ON p.Id = s.ProcessId
WHERE @BusinessUnitId = scsc.BusinessUnitId
UNION
SELECT 'UsingInCommandsSecurityConfigs' as Using, p.Name as ProcessName, p.IsPublishedCopy, c.CommandName, NULL as ReportName
FROM [dbo].[Commands] c
LEFT OUTER JOIN [dbo].[ProcessCommandSecurityConfigurations] pcsc ON pcsc.ProcessCommandId = c.Id
JOIN [dbo].[Processes] p ON p.Id = c.ProcessId
WHERE @BusinessUnitId = pcsc.BusinessUnitId
UNION
SELECT 'UsingInReportSecurityConfigurations' as Using, p.Name as ProcessName, p.IsPublishedCopy, NULL as CommandName, r.Title as ReportName
FROM [dbo].[Reports] r
LEFT OUTER JOIN [dbo].[ProcessReportSecurityConfigurations] prsc ON prsc.ReportId = r.Id
JOIN [dbo].[Processes] p ON p.Id = r.ProcessId
WHERE @BusinessUnitId = prsc.BusinessUnitId
UNION
SELECT 'UsingInProcessSecurityConfigs' as Using, p.Name as ProcessName, p.IsPublishedCopy, NULL as CommandName, NULL as ReportName
FROM [dbo].[ProcessSecurityConfigurations] sc
JOIN [dbo].[Processes] p ON p.Id = sc.ProcessId
WHERE @BusinessUnitId = BusinessUnitId
";
using (var ctx = ConnectionManager<SqlConnection>.GetManager(Database.VeyronMeta, false))
using (var cmd = new SqlCommand(CmdText, ctx.Connection))
{
cmd.Parameters.AddWithValue("@BusinessUnitId", businessUnitId);
using (var reader = new SafeDataReader(cmd.ExecuteReader()))
{
var usings = new List<RecordUsingsDto>();
while (reader.Read())
{
var use = new RecordUsingsDto
{
UsingName = reader.GetString(0),
ProcessName = reader.GetString(1),
IsPublished = reader.GetBool(2),
CommandName = reader.GetString(3),
ReportName = reader.GetString(4),
};
usings.Add(use);
}
if (!usings.IsNullOrEmpty())
{
return usings;
}
}
}
return null;
}
示例9: ReadMetrics
/// <summary>
/// Reads metrics.
/// </summary>
/// <param name="process">The process.</param>
/// <param name="sr">The reader.</param>
private static void ReadMetrics(ProcessEditDto process, SafeDataReader sr)
{
sr.NextResult();
while (sr.Read())
{
process.Metrics.Add(new ProcessMetricEditDto
{
Id = sr.GetInt32(0),
ProcessId = sr.GetInt32(1),
LastModifiedOn = sr.GetDateTime(2),
GuidId = sr.GetString(3),
Name = sr.GetString(4),
Documentation = sr.GetString(5),
SummaryType = sr.GetString(6),
LockFilter = sr.GetBool(7),
SnapshotFrequency = sr.GetString(8),
MetricFieldSystemName = sr.GetString(9),
GroupFieldOneSystemName = sr.GetString(10),
GroupFieldTwoSystemName = sr.GetString(11),
GroupFieldThreeSystemName = sr.GetString(12),
GroupFieldFourSystemName = sr.GetString(13),
FilterGuid = sr.GetGuid(14),
OrderByMetricField = sr.GetString(15),
OrderByAscending = (bool?)sr.GetValue(16),
FilterDefinition = sr.GetString(17)
});
}
}
示例10: FetchList
public IPagedList<ProcessInfoDTO> FetchList(string filter, int pageNumber, int pageSize, string filterExpression)
{
var result = new PagedList<ProcessInfoDTO>();
using (var ctx = ConnectionManager<SqlConnection>.GetManager(Database.VeyronMeta, false))
{
var cn = ctx.Connection;
var sql = @"
DECLARE @p0 AS INT
SET @p0 = {1}
DECLARE @p1 AS INT
SET @p1 = {2};
SELECT [t1].[Id],
[t1].[Name],
[t1].[Description],
[t1].[Icon],
CASE
WHEN [t1].PublishedCopyId IS NULL THEN 0
ELSE 1
END AS IsPublished,
[t1].[SystemName],
[t1].[Guid],
[t1].[Color],
[t1].IsInactive,
[t1].IsSystem,
[t1].[Documentation]
FROM (
SELECT ROW_NUMBER() OVER(ORDER BY [t0].[Name], [t0].[Id]) AS
[ROW_NUMBER],
[t0].[Name],
[t0].SystemName,
[t0].[Guid],
[t0].Id,
[t0].[Description],
[t0].[Documentation],
[t0].IsInactive,
[t0].IsSystem,
[i].Icon,
[c].Color,
(
SELECT id
FROM Processes p
WHERE p.Guid = [t0].Guid
AND p.IsPublishedCopy = 1
AND p.IsRemoved = 0
) AS PublishedCopyId
FROM [dbo].[Processes] AS [t0]
LEFT OUTER JOIN Icons i
ON [t0].IconId = [i].Id
LEFT OUTER JOIN Colors c
ON [t0].ColorId = [c].Id
{0}
) AS [t1]
WHERE [t1].[ROW_NUMBER] BETWEEN @p0 + 1 AND @p0 + @p1
ORDER BY
[t1].[ROW_NUMBER]
";
var fieldFilterWhere = AdoHelper.BuildFilterStatement(FilterDescriptor.GetFilterList(filterExpression), "Processes", tableAlias: "[t0]");
var globalFilterWhere = AdoHelper.BuildFilterStatement(filter, new[] { "[t0].Name", "[t0].Description" });
var where = string.Format(CultureInfo.InvariantCulture, "WHERE IsRemoved = 0 AND IsPublishedCopy = 0 {0} {1}", globalFilterWhere, fieldFilterWhere);
if (pageSize == 0)
{
pageSize = int.MaxValue;
}
var commandText = string.Format(CultureInfo.InvariantCulture, sql, where, pageNumber * pageSize, pageSize);
using (var cmd = new SqlCommand(commandText, cn))
using (var reader = new SafeDataReader(cmd.ExecuteReader()))
{
while (reader.Read())
{
result.Add(
new ProcessInfoDTO
{
Id = reader.GetInt32(0),
Name = reader.GetString(1),
Description = reader.GetString(2),
Icon = AdoHelper.ReadImage(reader, 3),
IsPublished = reader.GetInt32(4) != 0,
SystemName = reader.GetString(5),
Guid = reader.GetGuid(6),
ProcessColor = reader.GetInt64(7),
IsInactive = reader.GetBool(8),
IsSystem = reader.GetBool(9),
ProcessDocumentation = reader.GetString(10),
});
}
}
sql = string.Format(CultureInfo.InvariantCulture, "SELECT TotalRowCount = (SELECT COUNT(t0.Id) FROM Processes [t0] {0}), TotalActiveRowCount = (SELECT COUNT(t0.Id) FROM dbo.Processes t0 {0} AND t0.IsInactive = 0 AND t0.SimpleProcess = 0)", where);
using (var cmd = new SqlCommand(sql, cn))
using (var reader = new SafeDataReader(cmd.ExecuteReader()))
{
if (reader.Read())
{
//.........这里部分代码省略.........
示例11: ReadSecurityConfigFields
/// <summary>
/// The read security config fields.
/// </summary>
/// <param name="sr">The reader.</param>
/// <param name="process">The process.</param>
private static void ReadSecurityConfigFields(SafeDataReader sr, ProcessEditDto process)
{
sr.NextResult();
while (sr.Read())
{
var securityConfigFieldDto = new ProcessSecurityConfigFieldDto
{
Id = sr.GetInt32(0),
SecurityConfigId = sr.GetInt32(1),
CanView = sr.GetBool(2),
CanEdit = sr.GetBool(3),
Guid = sr.GetGuid(4),
FieldGuid = sr.GetGuid(5)
};
var config = process.SecurityConfigs.FirstOrDefault(sc => sc.Id == securityConfigFieldDto.SecurityConfigId);
if (config != null)
{
config.SecurityConfigFields.Add(securityConfigFieldDto);
}
}
}
示例12: ReadProcessDataIndexes
/// <summary>
/// Reads process data indexes.
/// </summary>
/// <param name="process">The process.</param>
/// <param name="sr">The reader.</param>
private static void ReadProcessDataIndexes(ProcessEditDto process, SafeDataReader sr)
{
sr.NextResult();
var temp = new List<ProcessDataIndexDto>();
while (sr.Read())
{
temp.Add(new ProcessDataIndexDto
{
Id = sr.GetInt32(0),
ProcessId = sr.GetInt32(1),
Name = sr.GetString(2),
Notes = sr.GetString(3),
IsUniqueIndex = sr.GetBool(4),
ViolationMessage = sr.GetString(5),
GuidId = sr.GetGuid(6),
ExcludeRemovedItems = sr.GetBoolean(7)
});
}
var fieldsData = ReadProcessDataIndexesFields(sr);
foreach (var processDataIndexDto in temp)
{
var dto = processDataIndexDto;
var dataIndexFields = fieldsData.Where(x => x.DataIndexId == dto.Id);
var processDataIndexFieldDtos = dataIndexFields as ProcessDataIndexFieldDto[] ??
dataIndexFields.ToArray();
process.DataIndexes.Add(new ProcessDataIndexDto(processDataIndexFieldDtos.ToList())
{
Id = dto.Id,
ProcessId = dto.ProcessId,
Name = dto.Name,
Notes = dto.Notes,
ExcludeRemovedItems = dto.ExcludeRemovedItems,
IsUniqueIndex = dto.IsUniqueIndex,
ViolationMessage = dto.ViolationMessage,
GuidId = dto.GuidId
});
}
}
示例13: ReadFields
/// <summary>
/// Reads fields.
/// </summary>
/// <param name="process">The process.</param>
/// <param name="sr">The reader.</param>
private void ReadFields(ProcessEditDto process, SafeDataReader sr)
{
sr.NextResult();
int? sectionId = null;
SectionDto section = null;
var times = new List<double>();
while (sr.Read())
{
var start = DateTime.Now;
var fieldDto = new FieldDto
{
Id = sr.GetInt32(0),
Name = sr.GetSafeString(1, string.Empty).Replace(@"""", "''"),
FieldTypeId = sr.GetInt32(2),
SectionId = sr.GetInt32(3),
Width = sr.GetDouble(4),
RowSpan = sr.GetInt(5),
ShowInList = sr.GetBoolean(6),
IncludeInFilter = sr.GetBoolean(7),
HideFromDetails = sr.GetBoolean(8),
SystemName = sr.GetString(9),
Position = sr.GetInt32(10),
CopyFieldValueOnCopyItem = sr.GetBool(11),
DeepCopy = sr.GetBool(12),
Guid = sr.GetGuid(13),
SearchPosition = sr.GetInt(14),
SearchWidth = sr.GetInt(15),
IsBase = sr.GetBoolean(16),
UseInGlobalSearch = sr.GetBoolean(19),
PublishedCopyId = sr.GetNullableInt(21),
AllowLocalizedData = sr.GetBoolean("AllowLocalizedData")
};
if (fieldDto.SectionId != sectionId || section == null)
{
section = process.Sections.First(s => s.Id == fieldDto.SectionId);
sectionId = fieldDto.SectionId;
}
fieldDto.FieldTypeInfo = new FieldTypeDto
{
Id = fieldDto.FieldTypeId,
Name = sr.GetString(17),
DataType = sr.GetString(18),
CanBeRequired = sr.GetBoolean(20)
};
section.FieldList.Add(fieldDto);
times.Add((DateTime.Now - start).TotalMilliseconds);
}
Profiler.Profile(() => this.ReadFieldEditors(process, sr));
}
示例14: GetBaseRoleUsings
//.........这里部分代码省略.........
UNION
SELECT 'UsingInActions' as Using, p.Name as ProcessName, p.IsPublishedCopy, ad.Name as ActionName, NULL as CommandName, NULL as FilterName, NULL as ReportName, NULL as NavigationGroupName, NULL as NavigationItemName
FROM [dbo].[ActionDefinitions] ad
LEFT OUTER JOIN [dbo].[AssignmentActionOptions] aa ON aa.ActionId = ad.[Id]
JOIN [dbo].[Processes] p ON p.Id = ad.ProcessId
WHERE @RoleId = aa.RoleId
UNION
SELECT 'UsingInCommandsSecurityConfigs' as Using, p.Name as ProcessName, p.IsPublishedCopy, NULL as ActionName, c.CommandName, NULL as FilterName, NULL as ReportName, NULL as NavigationGroupName, NULL as NavigationItemName
FROM [dbo].[Commands] c
LEFT OUTER JOIN [dbo].[ProcessCommandSecurityConfigurations] pcsc ON pcsc.ProcessCommandId = c.Id
JOIN [dbo].[Processes] p ON p.Id = c.ProcessId
WHERE @RoleId = pcsc.RoleId
UNION
SELECT 'UsingInFiltersSecurityConfigs' as Using, p.Name as ProcessName, p.IsPublishedCopy, NULL as ActionName, NULL as CommandName, f.Name as FilterName, NULL as ReportName, NULL as NavigationGroupName, NULL as NavigationItemName
FROM [dbo].[Filters] f
JOIN [dbo].[Processes] p ON p.Id = f.ProcessId
WHERE @RoleID = ANY(SELECT Int_Value FROM fn_ParseText2Table(RoleIds, ','))
UNION
SELECT 'UsingInReportSecurityConfigurations' as Using, p.Name as ProcessName, p.IsPublishedCopy, NULL as ActionName, NULL as CommandName, NULL as FilterName, r.Title as ReportName, NULL as NavigationGroupName, NULL as NavigationItemName
FROM [dbo].[Reports] r
LEFT OUTER JOIN [dbo].[ProcessReportSecurityConfigurations] prsc ON prsc.ReportId = r.Id
JOIN [dbo].[Processes] p ON p.Id = r.ProcessId
WHERE @RoleId = prsc.RoleId
UNION
SELECT 'UsingInProcessSecurityConfigs' as Using, p.Name as ProcessName, p.IsPublishedCopy, NULL as ActionName, NULL as CommandName, NULL as FilterName, NULL as ReportName, NULL as NavigationGroupName, NULL as NavigationItemName
FROM [dbo].[ProcessSecurityConfigurations] sc
JOIN [dbo].[Processes] p ON p.Id = sc.ProcessId
WHERE @RoleID = RoleId
UNION
SELECT 'UsingInNavigationGroup' as Using, NULL as ProcessId, NULL as IsPublishedCopy, NULL as ActionName, NULL as CommandName, NULL as FilterName, NULL as ReportName, ng.Name as NavigationGroupName, NULL as NavigationItemName
FROM [dbo].[NavigationGroupSecurityConfigurations] ngs
JOIN [dbo].[NavigationGroups] ng ON ng.Id = ngs.NavigationGroupId
WHERE @RoleID = RoleId AND ngs.CanView = 1
UNION
SELECT 'UsingInNavigationItem' as Using, p.Name as ProcessName, NULL as IsPublishedCopy, NULL as ActionName, NULL as CommandName, NULL as FilterName, NULL as ReportName, ng.Name as NavigationGroupName, ni.Name as NavigationItemName
FROM [dbo].[NavigationItemSecurityConfigurations] nis
JOIN [dbo].[NavigationItems] ni ON ni.Id = nis.NavigationItemId
JOIN [dbo].[PublishedProcesses] pp ON pp.Id = ni.PublishedProcessId
JOIN [dbo].[Processes] p ON p.Id = pp.ProcessId
JOIN [dbo].[NavigationGroups] ng ON ng.Id = ni.NavigationGroupId
WHERE @RoleID = RoleId AND nis.CanView = 1
UNION
SELECT 'UsingInNavigationItem' as Using, NULL as ProcessName, NULL as IsPublishedCopy, NULL as ActionName, NULL as CommandName, NULL as FilterName, NULL as ReportName, ng.Name as NavigationGroupName, ni.Name as NavigationItemName
FROM [dbo].[NavigationItemSecurityConfigurations] nis
JOIN [dbo].[NavigationItems] ni ON ni.Id = nis.NavigationItemId
JOIN [dbo].[NavigationGroups] ng ON ng.Id = ni.NavigationGroupId
WHERE @RoleID = RoleId AND nis.CanView = 1 AND ni.PublishedProcessId IS NULL
";
using (var ctx = ConnectionManager<SqlConnection>.GetManager(Database.VeyronMeta, false))
using (var cmd = new SqlCommand(CmdText, ctx.Connection))
{
cmd.Parameters.AddWithValue("@RoleID", roleId);
using (var reader = new SafeDataReader(cmd.ExecuteReader()))
{
var usings = new List<RecordUsingsDto>();
while (reader.Read())
{
var use = new RecordUsingsDto
{
UsingName = reader.GetString(0),
ProcessName = reader.GetString(1),
IsPublished = reader.GetBool(2),
ActionName = reader.GetString(3),
CommandName = reader.GetString(4),
FilterName = reader.GetString(5),
ReportName = reader.GetString(6),
NavigationGroupName = reader.GetString(7),
NavigationItemName = reader.GetString(8),
};
usings.Add(use);
}
if (!usings.IsNullOrEmpty())
{
return usings;
}
}
}
return null;
}
示例15: FetchPublishedProcess
public PublishedProcessInfoDTO FetchPublishedProcess(int id)
{
var result = new PublishedProcessInfoDTO();
var sql = string.Format(CultureInfo.InvariantCulture, @"
SELECT pp.Id
,ISNULL(pl.ProcessName, p.[Name])
,p.Id AS ProcessId
,p.SystemName
,p.BaseProcessId
,p.ProcessOption
,p.SimpleProcess
,p.IsStateEnabled
FROM [dbo].[PublishedProcesses] pp
INNER JOIN Processes p ON pp.ProcessId = p.Id
INNER JOIN Processes p2 ON pp.ProcessGuid = p2.[Guid] and p2.[IsPublishedCopy] = 0
LEFT OUTER JOIN dbo.Localizations l ON l.CultureName = '{0}'
LEFT OUTER JOIN dbo.ProcessLocalizations pl ON pl.LocalizationId = l.Id AND p2.Id = pl.ProcessId
WHERE pp.id = @id", System.Threading.Thread.CurrentThread.CurrentUICulture.Name);
using (var ctx = ConnectionManager<SqlConnection>.GetManager(Database.VeyronMeta, false))
{
var cn = ctx.Connection;
using (var cmd = new SqlCommand(sql, cn))
{
cmd.Parameters.AddWithValue("@id", id);
using (var reader = new SafeDataReader(cmd.ExecuteReader()))
{
if (reader.Read())
{
result = new PublishedProcessInfoDTO
{
Id = reader.GetInt32(0),
Name = reader.GetString(1),
ProcessId = reader.GetInt32(2),
SystemName = reader.GetString(3),
ProcessOption =
!string.IsNullOrEmpty(reader.GetString(5))
? (ProcessOption)
Enum.Parse(
typeof(ProcessOption), reader.GetString(5))
: ProcessOption.None,
SimpleProcess = reader.GetBool(6),
IsStateEnabled = reader.GetBoolean(7)
};
if (!reader.IsDBNull(4))
{
result.BaseProcess = this.FetchPublishedProcess(reader.GetInt32(4));
}
}
}
}
}
return result;
}