本文整理汇总了C#中System.Data.OleDb.OleDbDataReader.SafeNullableInt方法的典型用法代码示例。如果您正苦于以下问题:C# OleDbDataReader.SafeNullableInt方法的具体用法?C# OleDbDataReader.SafeNullableInt怎么用?C# OleDbDataReader.SafeNullableInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.OleDb.OleDbDataReader
的用法示例。
在下文中一共展示了OleDbDataReader.SafeNullableInt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PipeComponentDataAdapter
public PipeComponentDataAdapter(OleDbDataReader dr, List<PipeProperty> existingPipeComponentProperties, IList<string> componentPropertyNames, int rowNumber, bool canCreateProperties)
{
string pipeName = dr.SafeString((int)PipeComponentColumn.Tag);
if (!ParseTagNumberToProperties(pipeName, rowNumber))
{
return;
}
RowNumber = rowNumber;
Tag = dr.SafeString((int)PipeComponentColumn.Tag);
PipeDataAdapter adpter = new PipeDataAdapter(Tag);
if (adpter.HasValidParts)
{
this.PipeAdapter = adpter;
}
else
{
ErrorMessages.Add(string.Format("Tag '{0}', row {2}, Component Name '{1}'. Pipe Tag is not in a valid format.", Tag, ComponentName, rowNumber));
}
ComponentType = dr.SafeString((int)PipeComponentColumn.ComponentType);
ComponentAreaNumber = dr.SafeString((int)PipeComponentColumn.ComponentAreaNumber);
ComponentSubArea = dr.SafeNullableInt((int)PipeComponentColumn.ComponentSubArea);
ComponentNumber = dr.SafeNullableInt((int)PipeComponentColumn.ComponentNumber);
Manufacturer = dr.SafeString((int)PipeComponentColumn.Manufacturer);
Model = dr.SafeString((int)PipeComponentColumn.Model);
if (!ComponentSubArea.HasValue)
{
ErrorMessages.Add(string.Format("Tag {0}, row {1}. The ComponentSubArea is blank.", Tag, rowNumber));
}
if (!ComponentNumber.HasValue)
{
ErrorMessages.Add(string.Format("Tag {0}, row {1}. The ComponentNumber is blank.", Tag, rowNumber));
}
if (string.IsNullOrEmpty(ComponentType))
{
ErrorMessages.Add(string.Format("Tag {0}, row {1}. The ComponentType is blank.", Tag, rowNumber));
}
ComponentDescription = dr.SafeString((int)PipeComponentColumn.ComponentDescription);
int k = 0;
const int StartColumnIndex = (int)PipeComponentColumn.Model + 1;
for (int i = StartColumnIndex; i < StartColumnIndex + componentPropertyNames.Count; i++)
{
if (string.IsNullOrEmpty(dr.SafeString(i)))
{
continue;
}
string propertyName = componentPropertyNames[k];
k++;
PipeProperty property = (from x in existingPipeComponentProperties where x.Name.ToLower() == propertyName.ToLower() select x).FirstOrDefault();
if (property != null)
{
//we can grab the value;
PropertyValues.Add(property.Name, dr.SafeString(i));
}
else
{
if (canCreateProperties)
{
if (!PropertyValues.ContainsValue(dr.SafeString(i)))
{
PropertyValues.Add(propertyName, dr.SafeString(i));
}
}
else
{
RaiseMissingPropertyMessage(PipeTag, rowNumber, propertyName);
break;
}
}
}
}
示例2: AlarmDataAdapter
public AlarmDataAdapter(OleDbDataReader dr, string workSheetName, int rowNumber, CommonUtils.ImportType importType)
{
RowNumber = rowNumber;
WorkSheetName = workSheetName;
ControlSystemName = dr.SafeString((int)AlarmColumn.ControlSystemName).Trim();
ComponentName = dr.SafeString((int)AlarmColumn.ComponentName).Trim();
AlarmPropertyName = dr.SafeString((int)AlarmColumn.AlarmPropertyName).Trim();
Enabled = dr.SafeNullableBool((int)AlarmColumn.Enabled);
OnDelay = dr.SafeNullableInt((int)AlarmColumn.OnDelay);
OffDelay = dr.SafeNullableInt((int)AlarmColumn.OffDelay);
ActivationExpr = dr.SafeString((int)AlarmColumn.ActivationExpr).Trim();
MaskingExpr = dr.SafeString((int)AlarmColumn.MaskingExpr).Trim();
AlarmCalcExprEnabled = dr.SafeNullableBool((int)AlarmColumn.AlarmCalcExprEnabled);
AlarmCalcExpr = dr.SafeString((int)AlarmColumn.AlarmCalcExpr).Trim();
Purpose = dr.SafeString((int)AlarmColumn.Purpose).Trim();
Consequence = dr.SafeString((int)AlarmColumn.Consequence).Trim();
Response = dr.SafeString((int)AlarmColumn.Response).Trim();
Notes = dr.SafeString((int)AlarmColumn.Notes).Trim();
Guidance = dr.SafeString((int)AlarmColumn.Guidance).Trim();
Tested = dr.SafeNullableBool((int)AlarmColumn.Tested);
TestedDate = dr.SafeNullableDate((int)AlarmColumn.TestedDate);
TestedUser = dr.SafeString((int)AlarmColumn.TestedUser).Trim();
Reviewed = dr.SafeNullableBool((int)AlarmColumn.Reviewed);
ReviewedDate = dr.SafeNullableDate((int)AlarmColumn.ReviewedDate);
ReviewedUser = dr.SafeString((int)AlarmColumn.ReviewedUser).Trim();
Reportable = dr.SafeNullableBool((int)AlarmColumn.Reportable);
ReportableDate = dr.SafeNullableDate((int)AlarmColumn.ReportableDate);
ReportableUser = dr.SafeString((int)AlarmColumn.ReportableUser).Trim();
PurposeIsIndendedNull = dr.IntendedNull((int)AlarmColumn.Purpose);
ConsequenceIsIntendedNull = dr.IntendedNull((int)AlarmColumn.Consequence);
ResponseTimeIsIndendedNull = dr.IntendedNull((int)AlarmColumn.Response);
AlarmCalcExprIsIntendedNull = dr.IntendedNull((int)AlarmColumn.AlarmCalcExpr);
ActivationExprIsIntendedNull = dr.IntendedNull((int)AlarmColumn.ActivationExpr);
MaskingExprIsIntendedNull = dr.IntendedNull((int)AlarmColumn.MaskingExpr);
GuidanceIsIntendedNull = dr.IntendedNull((int)AlarmColumn.Guidance);
OnDelayIsIntendedNull = dr.IntendedNull((int)AlarmColumn.OnDelay);
OffDelayIsIntendedNull = dr.IntendedNull((int)AlarmColumn.OffDelay);
NotesIsIntendedNull = dr.IntendedNull((int)AlarmColumn.Notes);
TestedDateIsIntendedNull = dr.IntendedNull((int)AlarmColumn.TestedDate);
TestedUserIsIntendedNull = dr.IntendedNull((int)AlarmColumn.TestedUser);
ReviewedIsIntendedNull = dr.IntendedNull((int)AlarmColumn.Reviewed);
ReviewedDateIsIntendedNull = dr.IntendedNull((int)AlarmColumn.ReviewedDate);
ReviewedUserIsIntendedNull = dr.IntendedNull((int)AlarmColumn.ReviewedUser);
ReportabledIsIntendedNull = dr.IntendedNull((int)AlarmColumn.Reportable);
ReportabledDateIsIntendedNull = dr.IntendedNull((int)AlarmColumn.ReportableDate);
ReportableUserIsIntendedNull = dr.IntendedNull((int)AlarmColumn.ReportableUser);
}