本文整理汇总了C#中Csla.Data.SafeDataReader.GetBoolean方法的典型用法代码示例。如果您正苦于以下问题:C# SafeDataReader.GetBoolean方法的具体用法?C# SafeDataReader.GetBoolean怎么用?C# SafeDataReader.GetBoolean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Csla.Data.SafeDataReader
的用法示例。
在下文中一共展示了SafeDataReader.GetBoolean方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadRequiredRuleConfigFields
/// <summary>
/// Reads required rule config fields.
/// </summary>
/// <param name="process">The process.</param>
/// <param name="sr">The reader.</param>
/// ProcessCommandSecurityConfigurations
private static void ReadRequiredRuleConfigFields(ProcessEditDto process, SafeDataReader sr)
{
sr.NextResult();
int? requiredConfigId = null;
RequiredRuleConfigEditDto config = null;
while (sr.Read())
{
var configFieldDto = new RequiredRuleConfigFieldEditDto
{
Id = sr.GetInt32(0),
RequiredConfigId = sr.GetInt32(1),
Guid = sr.GetGuid(2),
FieldGuid = sr.GetGuid(3),
IsRequired = sr.GetBoolean(4)
};
if (configFieldDto.RequiredConfigId != requiredConfigId)
{
config = process.RequiredRuleConfigs.First(rrc => rrc.Id == configFieldDto.RequiredConfigId);
requiredConfigId = configFieldDto.RequiredConfigId;
}
config.FieldList.Add(configFieldDto);
}
}
示例2: FetchLocalizationList
public IList<LocalizationDto> FetchLocalizationList()
{
var result = new List<LocalizationDto>();
using (var ctx = ConnectionManager<SqlConnection>.GetManager(Database.VeyronMeta, false))
{
var connection = ctx.Connection;
var commandText = string.Format(CultureInfo.InvariantCulture,
@"
SELECT loc.[Id],
loc.[LocalName],
loc.[EnglishName],
loc.[CultureName],
loc.[IconId],
loc.[IsRightToLeft],
loc.[IsDefault]
FROM [dbo].[Localizations] loc
ORDER BY loc.EnglishName");
using (var cmd = new SqlCommand(commandText, connection))
using (var reader = new SafeDataReader(cmd.ExecuteReader()))
while (reader.Read())
{
var dto = new LocalizationDto
{
Id = reader.GetInt32(0),
LocalName = reader.GetString(1),
EnglishName = reader.GetString(2),
CultureName = reader.GetString(3),
IconId = reader.GetInt32(4),
IsRightToLeft = reader.GetBoolean(5),
IsDefault = reader.GetBoolean(6)
};
result.Add(dto);
}
}
return result;
}
示例3: ReadSearchDisplayFields
/// <summary>
/// Reads search display fields.
/// </summary>
/// <param name="process">The process.</param>
/// <param name="sr">The reader.</param>
private static void ReadSearchDisplayFields(ProcessEditDto process, SafeDataReader sr)
{
sr.NextResult();
while (sr.Read())
{
process.Search.Add(
new ProcessSearchEditDto
{
Id = sr.GetInt32(0),
ProcessId = sr.GetInt32(1),
GuidId = sr.GetGuid(2),
FieldSystemName = sr.GetString(3),
Position = sr.GetInt32(4),
Width = sr.GetInt32(5),
ShowInList = sr.GetBoolean(6)
});
}
}
示例4: CopyNavigationMenu
//.........这里部分代码省略.........
[IconURL],
[LastModifiedOn],
[Sequence],
[NavigationGroupId],
[Description],
[ProcessColor],
0,
[IconId])
-- delete rows that are in the target but not the source
WHEN NOT MATCHED BY SOURCE THEN
DELETE ;
SET IDENTITY_INSERT __NavigationItem OFF ", string.Join(",", values));
ExecuteSql(script);
//------------------------------------------------------
values.Clear();
const string navigationGroupSecurityConfigurationsScript = @"
SELECT ngscs.[id],
ngscs.[NavigationGroupId],
ngscs.[RoleId],
ngscs.[CanView]
FROM [dbo].[NavigationGroupSecurityConfigurations] ngscs";
using (var ctx = GetMetaDatabaseConnectionManager())
{
using (var cmd = new SqlCommand(navigationGroupSecurityConfigurationsScript, ctx.Connection))
{
using (var reader = new SafeDataReader(cmd.ExecuteReader()))
{
while (reader.Read())
{
values.Add(string.Format(CultureInfo.InvariantCulture, "({0}, '{1}', '{2}', '{3}')", reader.GetInt32(0),reader.GetInt32(1), reader.GetInt32(2), reader.GetBoolean(3)));
}
}
}
}
if (values.Count == 0)
return;
script = string.Format(@"SET IDENTITY_INSERT __NavigationGroupSecurity ON
MERGE INTO [dbo].[__NavigationGroupSecurity] AS TARGET USING (
VALUES {0} )
AS Source([Id], [NavigationGroup], [RoleId], [CanView]) ON TARGET.id = Source.Id -- update matched rows
WHEN MATCHED THEN
UPDATE
SET [NavigationGroup] = Source.[NavigationGroup],
[RoleId] = Source.[RoleId],
[CanView] = Source.[CanView]
WHEN NOT MATCHED BY TARGET THEN
INSERT ([Id],
[NavigationGroup],
[RoleId],
[CanView],
[IsRemoved])
VALUES ([Id],
[NavigationGroup],
[RoleId],
[CanView],
0)
-- delete rows that are in the target but not the source
示例5: FetchDisplayField
/// <summary>
/// Retrieves display field.
/// </summary>
/// <param name="processId">The process id.</param>
/// <param name="displayField">The display field.</param>
/// <returns>The <see cref="FieldInfoDto" />.</returns>
public FieldInfoDto FetchDisplayField(int processId, string displayField)
{
const string CommandText = @"
WITH ProcessList ( SystemName, Id, PublishedProcessId, IdOfPublishedProcess, LEVEL, IsBase )
AS ( SELECT p.SystemName ,
p.Id AS Id ,
pp.Id AS PublishedProcessId ,
pp.ProcessId IdOfPublishedProcess ,
0 AS LEVEL ,
0 AS IsBase
FROM Processes p
LEFT OUTER JOIN PublishedProcesses pp ON pp.Id = p.BaseProcessId
WHERE p.Id = @processId
UNION ALL
SELECT p1.SystemName ,
pp.ProcessId ,
pp.Id AS PublishedProcessId ,
pp.ProcessId IdOfPublishedProcess ,
LEVEL + 1 ,
1 AS IsBase
FROM Processes p
INNER JOIN PublishedProcesses pp ON p.BaseProcessId = pp.Id
INNER JOIN processes p1 ON pp.ProcessId = p1.Id
INNER JOIN ProcessList pl ON p.id = pl.Id
)
SELECT f.Id ,
f.Name ,
f.SystemName ,
f.FieldTypeId ,
pl.IsBase ,
pl.SystemName ,
CASE WHEN f.[FieldTypeId] = 6
AND ISNULL(crrs.AllowMultiple, 0) = 1
THEN 'MultiReference'
ELSE ft.[DataType]
END ,
f.Guid ,
CASE WHEN LEN(ISNULL(CAST(es.[CalculatedExpression] AS NVARCHAR(MAX)),
'')) > 0 THEN CAST(1 AS BIT)
ELSE CAST(0 AS BIT)
END AS 'IsCalculated' ,
( SELECT CAST(CASE WHEN EXISTS ( SELECT *
FROM [dbo].[RequiredRuleConfigFields] rrcf
INNER JOIN [dbo].[RequiredRuleConfigs] rrc ON rrc.[Id] = rrcf.[RequiredConfigId]
WHERE rrc.[ProcessId] = pl.[Id]
AND rrcf.[FieldGuid] = f.[Guid] )
THEN 1
ELSE 0
END AS BIT)
) AS [IsRequired]
FROM Fields f
INNER JOIN Sections s ON s.Id = f.SectionId
INNER JOIN ProcessList pl ON s.ProcessId = pl.Id
INNER JOIN [dbo].[FieldTypes] ft ON ft.[Id] = f.[FieldTypeId]
LEFT JOIN [dbo].[CrossRefRequredFieldStep] crrs ON crrs.[FieldId] = f.[Id]
AND f.[FieldTypeId] = 6
LEFT JOIN [dbo].[stepExpressions] es ON es.[FieldId] = f.[Id]
WHERE f.SystemName = @displayField
";
using (var ctx = ConnectionManager<SqlConnection>.GetManager(Database.VeyronMeta, false))
{
var cn = ctx.Connection;
using (var cmd = new SqlCommand(CommandText, cn))
{
cmd.Parameters.AddWithValue("@processId", processId);
cmd.Parameters.AddWithValue("@displayField", displayField);
using (var reader = new SafeDataReader(cmd.ExecuteReader()))
{
if (reader.Read())
{
return new FieldInfoDto
{
Id = reader.GetInt32(0),
Name = reader.GetString(1),
SystemName = reader.GetString(2),
FieldTypeId = reader.GetInt32(3),
DefinedIn = reader.GetString(5),
DataType = reader.GetString(6),
Guid = reader.GetGuid(7),
IsCalculated = reader.GetBoolean(8),
IsRequired = reader.GetBoolean(9)
};
}
}
}
}
return null;
}
示例6: FetchReverseCrossRefOptionsStep
/// <summary>
/// Retrieves reverse cross ref options 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="ReverseCrossRefOptionsStepDto" />.</returns>
public ReverseCrossRefOptionsStepDto FetchReverseCrossRefOptionsStep(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].[GetReverseCrossRefOptionsStep] @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 ReverseCrossRefOptionsStepDto
{
Id = reader.GetInt(0),
FieldId = reader.GetInt(1),
AllowAddNew = reader.GetBoolean(2),
AllowLink = reader.GetBoolean(3),
ShowLatestVersion = reader.GetBoolean(4)
};
return dto;
}
}
}
return null;
}
示例7: FetchReverseCrossRefField
/// <summary>
/// Retrieves reverse cross ref field.
/// </summary>
/// <param name="fieldId">The field id.</param>
/// <returns>The <see cref="ReverseCrossRefFieldDto" />.</returns>
public ReverseCrossRefFieldDto FetchReverseCrossRefField(int fieldId)
{
const string CmdText =
@"
SELECT
f.[Id]
,f.[Name]
,f.[SystemName]
,x.[DisplayMultiple]
,x.[ReverseCrossRefProcessId]
,p.[SystemName]
,x.[CrossRefFieldName]
,x.[DisplayFieldName]
,o.[ShowLatestVersion]
FROM [dbo].[Fields] f
INNER JOIN [dbo].[ReverseCrossRefRequiredFieldStep] x ON f.[Id] = x.[FieldId]
INNER JOIN [dbo].[PublishedProcesses] pp ON pp.[Id] = x.[ReverseCrossRefProcessId]
INNER JOIN [dbo].[Processes] p ON p.[Id] = pp.[ProcessId] AND p.[IsRemoved] = 0
LEFT OUTER JOIN [dbo].[ReverseCrossRefOptionsFieldStep] o ON o.[FieldId] = f.[Id]
WHERE f.[Id] = @fieldId";
using (var ctx = ConnectionManager<SqlConnection>.GetManager(Database.VeyronMeta, false))
{
var cn = ctx.Connection;
using (var cmd = new SqlCommand(CmdText, cn))
{
cmd.Parameters.AddWithValue("@fieldId", fieldId);
using (var reader = new SafeDataReader(cmd.ExecuteReader()))
{
while (reader.Read())
{
return new ReverseCrossRefFieldDto
{
FieldId = reader.GetInt32(0),
Name = reader.GetString(1),
SystemName = reader.GetString(2),
DisplayMultiple = reader.GetBoolean(3),
ReferenceProcessId = reader.GetInt32(4),
ReferenceProcessSystemName = reader.GetString(5),
ReferenceField = reader.GetString(6),
DisplayField = reader.GetString(7),
ShowLatestVersion = reader.GetNullableBool(8) ?? false
};
}
}
}
}
return new ReverseCrossRefFieldDto();
}
示例8: FetchCrossRefField
/// <summary>
/// Retrieves cross ref field.
/// </summary>
/// <param name="fieldId">The field id.</param>
/// <returns>The <see cref="CrossRefFieldDto" />.</returns>
public CrossRefFieldDto FetchCrossRefField(int fieldId)
{
const string CmdText =
@"
SELECT f.[Name]
, f.[SystemName]
, x.[AllowMultiple]
, x.[CrossRefProcessId]
, x.[LinkFieldSystemName]
, x.[DisplayFieldName]
, p.[SystemName]
FROM [dbo].[Fields] f
INNER JOIN [dbo].[CrossRefRequredFieldStep] x ON f.[Id] = x.[FieldId]
LEFT OUTER JOIN [dbo].[PublishedProcesses] pp ON pp.[Id] = x.[CrossRefProcessId]
LEFT OUTER JOIN [dbo].[Processes] p ON p.[Id] = pp.[ProcessId]
WHERE f.[Id] = @fieldId";
using (var ctx = ConnectionManager<SqlConnection>.GetManager(Database.VeyronMeta, false))
{
var cn = ctx.Connection;
using (var cmd = new SqlCommand(CmdText, cn))
{
cmd.Parameters.AddWithValue("@fieldId", fieldId);
using (var reader = new SafeDataReader(cmd.ExecuteReader()))
{
while (reader.Read())
{
return new CrossRefFieldDto
{
Name = reader.GetString(0),
SystemName = reader.GetString(1),
AllowMany = reader.GetBoolean(2),
CrossRefProcessId = reader.GetInt32(3),
LinkFieldSystemName = reader.GetString(4),
DisplayField = reader.GetString(5),
ProcessSystemName = reader.GetString(6)
};
}
}
}
}
return new CrossRefFieldDto();
}
示例9: FetchCrossRefFields
//.........这里部分代码省略.........
, f.[SystemName]
, f.[Id]
, x.[AllowMultiple]
, x.[DisplayFieldName]
, p.[SystemName]
, p.[Id]
FROM [dbo].[Sections] s
INNER JOIN [dbo].[Fields] f ON s.[Id] = f.[SectionId]
INNER JOIN [dbo].[CrossRefRequredFieldStep] x ON f.[Id] = x.[FieldId]
INNER JOIN [dbo].[PublishedProcesses] [pp] ON [pp].[Id] = x.CrossRefProcessId
INNER JOIN [dbo].[Processes] [p] ON [p].[Id] = pp.ProcessId
WHERE s.[ProcessId] = @processId";
}
}
else
{
cmdText = @"
DECLARE @pp_id INT
SELECT @pp_id = pp.[Id] FROM [dbo].[PublishedProcesses] pp WHERE pp.[ProcessGuid] = @crossRefProcessGuid
SELECT f.[Name]
, f.[SystemName]
, f.[Id]
, x.[AllowMultiple]
, x.[DisplayFieldName]
, p.[SystemName]
, p.[Id]
FROM [dbo].[Sections] s
INNER JOIN [dbo].[Fields] f ON s.[Id] = f.[SectionId]
INNER JOIN [dbo].[CrossRefRequredFieldStep] x ON f.[Id] = x.[FieldId]
INNER JOIN [dbo].[PublishedProcesses] [pp] ON [pp].[Id] = x.CrossRefProcessId
INNER JOIN [dbo].[Processes] [p] ON [p].[Id] = pp.ProcessId
WHERE s.[ProcessId] = @processId AND x.[CrossRefProcessId] = @pp_id
DECLARE @pp_systemName NVARCHAR(200)
SELECT @pp_systemName = p.[SystemName] FROM [dbo].[Processes] p WHERE p.[Guid] = @crossRefProcessGuid
SELECT f.[Name]
, f.[SystemName]
, f.[Id]
, p.[SystemName]
, p.[Id]
FROM [dbo].[Sections] s
INNER JOIN [dbo].[Fields] f ON s.[Id] = f.[SectionId]
INNER JOIN [dbo].[stepChecklist] x ON f.[Id] = x.[FieldId]
INNER JOIN [dbo].[Processes] p ON p.[IsRemoved] = 0 AND p.[IsPublishedCopy] = 1 AND p.[SystemName] = x.[AnswerProcessSystemName]
WHERE s.[ProcessId] = @processId AND x.[AnswerProcessSystemName] = @pp_SystemName";
}
cmdText += @"
";
using (var ctx = ConnectionManager<SqlConnection>.GetManager(Database.VeyronMeta, false))
{
var cn = ctx.Connection;
using (var cmd = new SqlCommand(cmdText, cn))
{
cmd.Parameters.AddWithValue("@processId", processId);
cmd.Parameters.AddWithValue("@crossRefProcessGuid", crossRefProcessGuid);
using (var reader = new SafeDataReader(cmd.ExecuteReader()))
{
while (reader.Read())
{
result.Add(new CrossRefFieldDto
{
Name = reader.GetString(0),
SystemName = reader.GetString(1),
FieldId = reader.GetInt(2),
AllowMany = reader.GetBoolean(3),
DisplayField = reader.GetString(4),
ProcessSystemName = reader.GetString(5),
ProcessId = reader.GetInt(6),
ColumnType = reader.GetBoolean(3) ? ColumnTypes.MultiReference : ColumnTypes.Reference
});
}
if (reader.NextResult())
{
while (reader.Read())
{
result.Add(new CrossRefFieldDto
{
Name = reader.GetString(0),
SystemName = reader.GetString(1),
FieldId = reader.GetInt32(2),
ProcessSystemName = reader.GetString(3),
ProcessId = reader.GetInt32(4),
ColumnType = ColumnTypes.Checklist
});
}
}
}
}
}
return result;
}
示例10: Fetch
private PaymentInfoDto Fetch(SafeDataReader dr)
{
var paymentInfo = new PaymentInfoDto();
paymentInfo.Id = dr.GetInt32("tran_id");
paymentInfo.BatchNum = dr.GetInt32("batch_num");
paymentInfo.PayDate = dr.GetSmartDate("pay_date");
paymentInfo.JobNum = dr.GetInt32("job_num");
paymentInfo.ThankYou1 = dr.GetString("thank_you_1");
paymentInfo.StudyTopic = dr.GetString("study_topic");
paymentInfo.ThankYou2 = dr.GetString("thank_you_2");
paymentInfo.MarketingResearchMessage = dr.GetString("marketing_research_message");
paymentInfo.CheckDate = dr.GetSmartDate("check_date");
paymentInfo.CheckNum = dr.GetString("check_num");
paymentInfo.Amount = dr.GetDecimal("tran_amount");
paymentInfo.PersonId = dr.GetString("person_id");
paymentInfo.Prefix = dr.GetString("name_prefix");
paymentInfo.FirstName = dr.GetString("first_name");
paymentInfo.MiddleName = dr.GetString("middle_name");
paymentInfo.LastName = dr.GetString("last_name");
paymentInfo.NameSuffix = dr.GetString("name_suffix");
paymentInfo.Title = dr.GetString("title");
paymentInfo.Company = dr.GetString("company");
paymentInfo.Address1 = dr.GetString("address_1");
paymentInfo.Address2 = dr.GetString("address_2");
paymentInfo.Municipality = dr.GetString("municipality");
paymentInfo.Region = dr.GetString("region");
paymentInfo.PostalCode = dr.GetString("postal_code");
paymentInfo.Country = dr.GetString("country");
paymentInfo.Email = dr.GetString("email");
paymentInfo.PhoneNumber = dr.GetString("phone_number");
paymentInfo.Completed = dr.GetBoolean("print_flag");
return paymentInfo;
}
示例11: PopulateResultForSqlOracle
/// <summary>
/// Populates the result for SQL oracle.
/// </summary>
/// <param name="reader">The reader.</param>
/// <returns>List{FieldInfoDto}.</returns>
private List<FieldInfoDto> PopulateResultForSqlOracle(SafeDataReader reader)
{
var result = new List<FieldInfoDto>();
while (reader.Read())
{
result.Add(new FieldInfoDto
{
Name = reader.GetString(1),
SystemName = "\"" + reader.GetString(2) + "\"",
FieldTypeId = reader.GetInt32(3),
ProcessID = reader.GetInt32(4),
ProcessName = reader.GetString(5),
ProcessSystemName = "\"" + reader.GetString(6) + "\"",
DefinedIn = reader.GetString(8),
DataType = reader.GetString(9),
Guid = reader.GetGuid(10),
IsRichTextField = reader.GetBoolean(11),
});
}
if (reader.NextResult() && reader.Read())
{
//var baseProcessId = reader.GetInt32(0);
result.AddRange(FetchFieldList());
}
return result;
}
示例12: FetchConnectionSetupList
public IEnumerable<ConnectionSettingsDto> FetchConnectionSetupList()
{
const string sql = @"
SELECT [ConnectionSetupId]
,[Name]
,[SystemName]
,[Documentation]
,[ConnectionType]
,[PortName]
,[BaudRate]
,[Parity]
,[Dtr]
,[FlowControlHighSignal]
,[ParityErrorChecking]
,[FlowControl]
,[Rts]
,[DataBits]
,[StopBits]
,[GuidId]
,[Vid]
,[Pid]
,[ParentIdPrefix]
FROM [dbo].[MultiplexorConnections] cs
WHERE cs.IsRemoved = 0
";
var result = new List<ConnectionSettingsDto>();
using (var ctx = ConnectionManager<SqlConnection>.GetManager(Database.VeyronMeta, false))
{
var cn = ctx.Connection;
if (cn.State != ConnectionState.Open)
{
cn.Open();
}
using (var cmd = new SqlCommand(sql, cn))
{
using (var sr = new SafeDataReader(cmd.ExecuteReader()))
{
while (sr.Read())
{
var parameter = new ConnectionSettingsDto
{
ConnectionSetupId = sr.GetInt32(0),
Name = sr.GetString(1),
SystemName = sr.GetString(2),
Documentation = sr.GetString(3),
ConnectionType = !string.IsNullOrEmpty(sr.GetString(4))
? (ConnectionType)Enum.Parse(typeof(ConnectionType), sr.GetString(4))
: ConnectionType.SerialPort,
PortName = sr.GetString(5),
BaudRate = sr.GetString(6),
Parity = !string.IsNullOrEmpty(sr.GetString(7))
? (SerialPortParity)Enum.Parse(typeof(SerialPortParity), sr.GetString(7))
: SerialPortParity.None,
Dtr = sr.GetBoolean(8),
FlowControlHighSignal = sr.GetInt32(9),
ParityErrorChecking = sr.GetBoolean(10),
FlowControl = !string.IsNullOrEmpty(sr.GetString(11))
? (FlowControl)Enum.Parse(typeof(FlowControl), sr.GetString(11))
: FlowControl.None,
Rts = sr.GetBoolean(12),
DataBits = sr.GetInt32(13),
StopBits = !string.IsNullOrEmpty(sr.GetString(14))
? (StopBits)Enum.Parse(typeof(StopBits), sr.GetString(14))
: StopBits.One,
Guid = sr.GetGuid(15),
Vid = sr.GetString(16),
Pid = sr.GetString(17),
ParentIdPrefix = sr.GetString(18)
};
result.Add(parameter);
}
}
foreach (var dto in result)
{
dto.ComputerConectionList = new List<ComputerConnectionEditDto>();
FetchComputerConnectionList(cn, dto);
}
}
}
return result;
}
示例13: FetchConnectionSetup
public static ConnectionSettingsDto FetchConnectionSetup(SqlConnection connection, int Id)
{
const string sql = @"
SELECT [ConnectionSetupId]
,[Name]
,[SystemName]
,[Documentation]
,[ConnectionType]
,[PortName]
,[BaudRate]
,[Parity]
,[Dtr]
,[FlowControlHighSignal]
,[ParityErrorChecking]
,[FlowControl]
,[Rts]
,[DataBits]
,[StopBits]
,[GuidId]
,[Vid]
,[Pid]
,[ParentIdPrefix]
FROM [dbo].[MultiplexorConnections] mpxc
WHERE mpxc.IsRemoved = 0
AND mpxc.[ConnectionSetupId] = @id
";
var result = new ConnectionSettingsDto();
using (var cmd = new SqlCommand(sql, connection))
{
cmd.Parameters.AddWithValue("@id", Id);
using (var sr = new SafeDataReader(cmd.ExecuteReader()))
{
while (sr.Read())
{
var parameter = new ConnectionSettingsDto
{
ConnectionSetupId = sr.GetInt32(0),
Name = sr.GetString(1),
SystemName = sr.GetString(2),
Documentation = sr.GetString(3),
ConnectionType = !string.IsNullOrEmpty(sr.GetString(4))
? (ConnectionType)Enum.Parse(typeof(ConnectionType), sr.GetString(4))
: ConnectionType.SerialPort,
PortName = sr.GetString(5),
BaudRate = sr.GetString(6),
Parity = !string.IsNullOrEmpty(sr.GetString(7))
? (SerialPortParity)Enum.Parse(typeof(SerialPortParity), sr.GetString(7))
: SerialPortParity.None,
Dtr = sr.GetBoolean(8),
FlowControlHighSignal = sr.GetInt32(9),
ParityErrorChecking = sr.GetBoolean(10),
FlowControl = !string.IsNullOrEmpty(sr.GetString(11))
? (FlowControl)Enum.Parse(typeof(FlowControl), sr.GetString(11))
: FlowControl.None,
Rts = sr.GetBoolean(12),
DataBits = sr.GetInt32(13),
StopBits = !string.IsNullOrEmpty(sr.GetString(14))
? (StopBits)Enum.Parse(typeof(StopBits), sr.GetString(14))
: StopBits.One,
Guid = sr.GetGuid(15),
Vid = sr.GetString(16),
Pid = sr.GetString(17),
ParentIdPrefix = sr.GetString(18)
};
result = parameter;
}
}
result.ComputerConectionList = new List<ComputerConnectionEditDto>();
FetchComputerConnectionList(connection, result);
}
return result;
}
示例14: Map
public Profile Map(SafeDataReader reader)
{
var item = (Profile)Activator.CreateInstance(typeof(Profile), true);
using (BypassPropertyChecks(item))
{
item.UniqueID = reader.GetInt32("UniqueID");
item.Username = reader.GetString("Username");
item.ApplicationName = reader.GetString("ApplicationName");
item.IsAnonymous = reader.IsDBNull("IsAnonymous") ? (System.Boolean?)null : reader.GetBoolean("IsAnonymous");
item.LastActivityDate = reader.IsDBNull("LastActivityDate") ? (System.DateTime?)null : reader.GetDateTime("LastActivityDate");
item.LastUpdatedDate = reader.IsDBNull("LastUpdatedDate") ? (System.DateTime?)null : reader.GetDateTime("LastUpdatedDate");
}
MarkOld(item);
return item;
}
示例15: ReadReports
/// <summary>
/// Read reports.
/// </summary>
/// <param name="process">The process.</param>
/// <param name="sr">The reader.</param>
private static void ReadReports(ProcessEditDto process, SafeDataReader sr)
{
sr.NextResult();
while (sr.Read())
{
var reportDto = new ProcessReportEditDto
{
Id = sr.GetInt32(0),
Guid = sr.GetGuid(1),
Title = sr.GetString(2),
Description = sr.GetString(3),
FileName = sr.GetString(4),
DisplayToUsers = sr.GetBoolean(5),
Visibility = (ReportVisibility)Enum.Parse(typeof(ReportVisibility), sr.GetString(6), true),
IsSecured = sr.GetBoolean(7)
};
process.ReportList.Add(reportDto);
}
ReadReportSecurityConfigurations(process, sr);
}