当前位置: 首页>>代码示例>>C#>>正文


C# OleDbDataReader.SafeNullableInt方法代码示例

本文整理汇总了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;
                    }
                }
            }
        }
开发者ID:barrett2474,项目名称:CMS2,代码行数:84,代码来源:PipeComponentDataAdapter.cs

示例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);
        }
开发者ID:barrett2474,项目名称:CMS2,代码行数:63,代码来源:AlarmDataAdapter.cs


注:本文中的System.Data.OleDb.OleDbDataReader.SafeNullableInt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。