本文整理汇总了C#中Csla.Data.SafeDataReader.GetEnum方法的典型用法代码示例。如果您正苦于以下问题:C# SafeDataReader.GetEnum方法的具体用法?C# SafeDataReader.GetEnum怎么用?C# SafeDataReader.GetEnum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Csla.Data.SafeDataReader
的用法示例。
在下文中一共展示了SafeDataReader.GetEnum方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FetchChecklistStep
/// <summary>
/// Retrieves checklist step.
/// </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="ChecklistStepDto" />.</returns>
public ChecklistStepDto FetchChecklistStep(string processName, string fieldName, bool isPublishedCopy = false)
{
const string CommandText = @"
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].[GetChecklistStep] @FieldId = @fieldId;";
using (var ctx = ConnectionManager<SqlConnection>.GetManager(Database.VeyronMeta, false))
using (var cmd = new SqlCommand(CommandText, 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 ChecklistStepDto
{
QuestionProcessSystemName = reader.GetString(0),
AnswerProcessSystemName = reader.GetString(1),
AnswerProcessDefaultStateGuid = reader.GetGuid(2),
CommentsFieldSystemName = reader.GetString(3),
IsSingleQuestionView = reader.GetBool(4),
ListDisplayFieldSystemName = reader.GetString(5),
AllowAdhocQuestions = reader.GetBool(6),
FilterDefinition = reader.GetString(7),
FilterGuid = reader.IsDBNull(8) ? null : (Guid?)reader.GetGuid(8),
CanChangeItemState = reader.GetBool(9),
ShowLinkedItems = reader.GetBool(10),
SortFieldSystemName = reader.GetString(11),
SortDirection = reader.GetEnum(12, SortDirection.Ascending),
HideValidationIcon = reader.GetBool(13)
};
return dto;
}
}
}
return null;
}
示例2: 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;
}
示例3: 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);
//.........这里部分代码省略.........
示例4: GetPersons
public Collection<PersonInfo> GetPersons(IEditableRoot item)
{
if (item == null)
throw new ArgumentNullException("item");
using (var ctx = ConnectionManager<SqlConnection>.GetManager(ServerSettings.ConnectionString, false))
{
using (var cmd = new SqlCommand(QueryDefinition.CommandText, ctx.Connection))
{
foreach (var parameterBuilder in QueryDefinition.ParameterBuilders)
{
cmd.Parameters.Add(parameterBuilder.CreateParameter(item));
}
using (var reader = new SafeDataReader(cmd.ExecuteReader()))
{
var result = new Collection<PersonInfo>();
while (reader.Read())
{
result.Add(
new PersonInfo
{
Id = reader.GetInt32(0),
FirstName = reader.GetString(1),
LastName = reader.GetString(2),
Email = reader.GetString(3),
OutOfOffice = reader.GetNullableBool(4),
DelegateApproverId = reader.GetNullableInt(5),
AccountId = reader.GetNullableInt(6),
UserName = reader.GetString(7),
Locale = reader.GetString(8),
AuthenticationType = reader.GetEnum(9, AuthenticationTypes.MQ1)
});
}
return result;
}
}
}
}
示例5: FetchPublishedProcesses
public IList<PublishedProcessInfoDTO> FetchPublishedProcesses(string culture)
{
var result = new List<PublishedProcessInfoDTO>();
using (var ctx = ConnectionManager<SqlConnection>.GetManager(Database.VeyronMeta, false))
{
var connection = ctx.Connection;
var commandText = string.Format(CultureInfo.InvariantCulture, @"
SELECT pp.Id
,ISNULL(pl.ProcessName, p.[Name])
,p.[SystemName]
,p.Id AS ProcessId
,p.[BaseProcessId]
,p2.[IconId]
,p.[Guid]
,p.[ProcessOption]
,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.ProcessLocalizations pl
INNER JOIN dbo.Localizations l ON pl.LocalizationId = l.Id AND l.CultureName = '{0}'
ON p2.Id = pl.ProcessId
WHERE p.IsRemoved = 0 AND p2.IsRemoved = 0
ORDER BY p.Name", culture);
using (var cmd = new SqlCommand(commandText, connection))
using (var reader = new SafeDataReader(cmd.ExecuteReader()))
{
while (reader.Read())
{
var dto = new PublishedProcessInfoDTO
{
Id = reader.GetInt32(0),
Name = reader.GetString(1),
SystemName = reader.GetString(2),
ProcessId = reader.GetInt32(3),
IconId = reader.GetNullableInt(5),
ProcessGuid = reader.GetGuid(6),
ProcessOption = reader.GetEnum(7, ProcessOption.None),
IsStateEnabled = reader.GetBoolean(8)
};
if (!reader.IsDBNull(4))
{
dto.BaseProcess = this.FetchPublishedProcess(reader.GetInt(4));
}
result.Add(dto);
}
}
}
return result;
}
示例6: ReadPerson
/// <summary>
/// Initializes a new <see cref="PersonInfo"/> with values from a data reader.
/// </summary>
/// <param name="reader">
/// The data reader.
/// </param>
/// <returns>
/// The <see cref="PersonInfo"/>.
/// </returns>
protected virtual PersonInfo ReadPerson(SafeDataReader reader)
{
if (reader == null)
throw new ArgumentNullException("reader");
return new PersonInfo
{
Id = reader.GetInt32(0),
FirstName = reader.GetString(1),
LastName = reader.GetString(2),
Email = reader.GetString(3),
OutOfOffice = reader.GetNullableBool(4),
DelegateApproverId = reader.GetNullableInt(5),
AccountId = reader.GetNullableInt(6),
UserName = reader.GetString(7),
Locale = reader.GetString(8),
AuthenticationType = reader.GetEnum(9, AuthenticationTypes.MQ1)
};
}
示例7: ReadDataTriggerStoredProcedureParameters
/// <summary>
/// Reads the data trigger stored procedure parameters.
/// </summary>
/// <param name="process">The process.</param>
/// <param name="sr">The data reader.</param>
private static void ReadDataTriggerStoredProcedureParameters(ProcessEditDto process, SafeDataReader sr)
{
sr.NextResult();
int? triggerId = null;
ProcessDataTriggerEditDto trigger = null;
while (sr.Read())
{
var parameterDto = new DataTriggerStoredProcedureParameterDto
{
Id = sr.GetInt32(0),
Guid = sr.GetGuid(1),
TriggerId = sr.GetInt32(2),
Name = sr.GetString(3),
DataType =
sr.GetEnum(4, DbDataType.String),
Expression = sr.GetString(5)
};
if (parameterDto.TriggerId != triggerId)
{
trigger = process.TriggerList.First(t => t.Id == parameterDto.TriggerId);
triggerId = parameterDto.TriggerId;
}
trigger.StoredProcedureParameters.Add(parameterDto);
}
}
示例8: ReadDataTriggers
/// <summary>
/// Reads data triggers.
/// </summary>
/// <param name="process">The process.</param>
/// <param name="sr">The reader.</param>
private static void ReadDataTriggers(ProcessEditDto process, SafeDataReader sr)
{
sr.NextResult();
while (sr.Read())
{
var dto = new ProcessDataTriggerEditDto
{
Id = sr.GetInt32(0),
Guid = sr.GetGuid(1),
Name = sr.GetString(2),
Notes = sr.GetString(3),
ProcessToModifySystemName = sr.GetString(4),
FilterGuid = sr.GetNullableGuid(5),
FilterDefinition = sr.GetString(6),
ModificationType = (DataTriggerModificationType)Enum.Parse(typeof(DataTriggerModificationType), sr.GetString(7), true),
ModificationMapping = sr.GetString(8),
TriggerType = sr.GetEnum(9, DataTriggerTypes.Process),
StoredProcedureName = sr.GetString(10)
};
process.TriggerList.Add(dto);
}
ReadDataTriggerMappings(process, sr);
ReadDataTriggerRules(process, sr);
ReadDataTriggerStoredProcedureParameters(process, sr);
}
示例9: ReadIntegrationServiceMethods
/// <summary>
/// Reads the integration service methods.
/// </summary>
/// <param name="settingsDto">The settings dto.</param>
/// <param name="reader">The reader.</param>
private static void ReadIntegrationServiceMethods(IntegrationServiceCreationSettingsDto settingsDto, SafeDataReader reader)
{
reader.NextResult();
while (reader.Read())
{
var dto = new IntegrationServiceMethodDto
{
Id = reader.GetInt32(0),
Guid = reader.GetGuid(1),
Name = reader.GetString(2),
Username = reader.GetString(3),
Password = reader.GetString(4),
CanInsert = reader.GetBoolean(5),
CanUpdate = reader.GetBoolean(6),
CanInsertOrUpdate = reader.GetBoolean(7),
CanRemove = reader.GetBoolean(8),
EndpointMapping = reader.GetString(9),
Namespace = reader.GetString(10),
CanSelect = reader.GetBoolean("CanSelect"),
ResultTypeGuid = reader.GetNullableGuid("ResultTypeGuid"),
ResultMapping = reader.GetString("ResultMapping"),
ReturnMode = reader.GetEnum("ReturnMode", IntegrationServiceMethodReturnMode.All),
GenerateIndexes = reader.GetBoolean("GenerateIndexes")
};
settingsDto.Methods.Add(dto);
}
ReadIntegrationServiceMethodParameters(settingsDto, reader);
}
示例10: FetchSystemOptions
//.........这里部分代码省略.........
SystemOptionsDTO dto = null;
Database.GetDataReader(
Sql,
reader =>
{
if (reader == null)
throw new DataAccessException(Resources.FailedToRetrieveSystemOptions);
if (!reader.Read())
{
dto = new SystemOptionsDTO { InactivityMinutes = 1, MinimumPasswordLength = 1};
InsertSystemOptions(dto);
}
else
{
using (var sr = new SafeDataReader(reader))
{
dto = new SystemOptionsDTO
{
SystemOptionsId = sr.GetInt("SystemOptionsID"),
LoginHtml = sr.GetString("LoginHTML"),
AuditLogin = sr.GetBool("AuditLogin"),
AuditLogout = sr.GetBool("AuditLogout"),
AnimateWindows = sr.GetBool("AnimateWindows", true),
TempDocumentUNC = sr.GetString("TempDocumentUNC"),
TempDocumentURI = sr.GetString("TempDocumentURI"),
PaperclipUNC = sr.GetString("PaperclipUNC"),
PaperclipURI = sr.GetString("PaperclipURI"),
FileUploadURI = sr.GetString("FileUploadURI"),
FileProcessorURI = sr.GetString("FileProcessorURI"),
InactivitySetting = sr.GetEnum("InactivitySetting", InactivityTypesEnum.None),
InactivityMinutes = sr.GetInt("InactivityMinutes"),
DaysBeforeAccountDisabled = sr.GetInt("DaysBeforeAccountDisabled"),
DelayAfterInvalidLogin = sr.GetBool("DelayAfterInvalidLogin"),
DelayAfterInvalidLoginTimeout = sr.GetInt("DelayAfterInvalidLoginTimeout"),
InvalidLoginAttemptCount = sr.GetInt("InvalidLoginAttemptCount"),
InvalidLoginAttemptTime = sr.GetInt("InvalidLoginAttemptTime"),
DisableAccountSetting = sr.GetEnum("DisableAccountSetting", DisableAccountActionsType.DisableAdmin),
InvalidLoginTimeout = sr.GetInt("InvalidLoginTimeout"),
SessionInactivityTimeoutAction = sr.GetEnum("SessionInactivityTimeoutAction", InactivityTimoutActionEnum.None),
IsMandatoryPasswordChange = sr.GetBool("IsMandatoryPasswordChange"),
PasswordExpirationAction = sr.GetEnum("PasswordExpirationAction", PasswordExpirationActions.NoAction),
PasswordExpirationDays = sr.GetInt("PasswordExpirationDays"),
MinimumPasswordLength = sr.GetInt("MinimumPasswordLength"),
EnableSpecialChar = sr.GetBool("EnableSpecialChar"),
EnableUpperLowerCase = sr.GetBool("EnableUpperLowerCase"),
PasswordHistoryCount = sr.GetInt("PasswordHistoryCount"),
PasswordStrengthExpression = sr.GetString("PasswordStrengthExpression"),
NotifyUserLastSucccessfulLogin = sr.GetBool("NotifyLastSucccessfulLogin"),
NotifyUserLastUnsucccessfulLogin = sr.GetBool("NotifyLastUnsucccessfulLogin"),
NotifyUserLastLoginAttempts = sr.GetBool("NotifyUserLastLoginAttempts"),
NotifyUserLastLoginAttemptsDays = sr.GetInt("NotifyLastLoginAttemptsDays"),
NotifyUserSecurityChanges = sr.GetBool("NotifyUserSecurityChanges"),
SMTPServer = sr.GetString("SMTPServer"),
SMTPPort = sr.GetInt("SMTPPort", 25),
SMTPUseSsl = sr.GetBool("SMTPUseSsl"),
SMTPUseAuth = sr.GetBool("SMTPUseAuth"),
SMTPAuthName = sr.GetString("SMTPAuthName"),
SMTPAuthPass = sr.GetString("SMTPAuthPass"),
EmailFromAddress = sr.GetString("EmailFromAddress"),
EmailFromCurrentUser = sr.GetBoolean("EmailFromCurrentUser"),
ReportsPath = sr.GetString("ReportsPath"),
IsUnderMaintenance = sr.GetBool("IsUnderMaintenance"),