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


C# DataRow.GetNullableStruct方法代码示例

本文整理汇总了C#中System.Data.DataRow.GetNullableStruct方法的典型用法代码示例。如果您正苦于以下问题:C# DataRow.GetNullableStruct方法的具体用法?C# DataRow.GetNullableStruct怎么用?C# DataRow.GetNullableStruct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Data.DataRow的用法示例。


在下文中一共展示了DataRow.GetNullableStruct方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ParseUserLoginInfo

        /// <summary>
        /// Converts a user data row into a app user entity
        /// </summary>
        /// <param name="dr"></param>
        /// <returns></returns>
        protected virtual User ParseUserLoginInfo(DataRow dr)
        {
            var user = new User();
            user.Id = dr.Get<int>("UserId");
            user.UserName = dr.GetString("UserName");
            user.Role = dr.Get<UserRole>("UserGroupId");
            user.Guid = dr.Get<Guid>("UserGuid");
            user.ExternalProfileUrl = dr.GetString("UserExternalProfileUrl");
            user.ProviderLastCall = dr.GetDate("UserProviderLastCall");
            user.Email = dr.GetString("UserEmail");
            decimal offSet = dr.Get<decimal>("UserTimeZone");
            user.TimeZone = new TimeSpan((long)(offSet * (decimal)TimeSpan.TicksPerHour));
            if (dr.Table.Columns.Contains("WarningStart"))
            {
                user.Warned = (!dr.IsNull("WarningStart")) && dr.GetNullableStruct<bool>("WarningRead") != true;
                user.Suspended = (!dr.IsNull("SuspendedStart")) && (dr.IsNull("SuspendedEnd") || dr.GetNullableStruct<DateTime>("SuspendedEnd") >= DateTime.UtcNow);
                user.Banned = !dr.IsNull("BannedStart");
                user.SuspendedEnd = dr.GetNullableStruct<DateTime>("SuspendedEnd");
            }

            //se obtiene el perfil desde construnario
            UserProfileAcces profileaccess = new UserProfileAcces(MysqlconnectionString);
            user.Construnario_Profile = profileaccess.Get_UserProfilebyUserName(user.UserName );

            return user;
        }
开发者ID:ramiglez30,项目名称:Forum-Construnario,代码行数:31,代码来源:UsersDataAccess.cs

示例2: ParseBasicTopicDataRow

        public virtual Topic ParseBasicTopicDataRow(DataRow dr, bool parseAccessRights)
        {
            Topic t = new Topic();
            t.Id = dr.Get<int>("TopicId");
            t.Date = dr.GetDate("TopicCreationDate");
            t.Title = dr.GetString("TopicTitle");
            t.ShortName = dr.GetString("TopicShortName");
            t.Description = dr.GetString("TopicDescription");
            t.Replies = dr.Get<int>("TopicReplies");
            t.Views = dr.Get<int>("TopicViews");
            t.IsClosed = dr.Get<bool>("TopicIsClose");
            t.IsSticky = dr.GetNullable<int?>("TopicOrder") >= 0;
            if (parseAccessRights)
            {
                t.ReadAccessRole = dr.GetNullableStruct<UserRole>("ReadAccessGroupId");
                t.PostAccessRole = dr.Get<UserRole>("PostAccessGroupId");
            }

            return t;
        }
开发者ID:jorgebay,项目名称:nearforums,代码行数:20,代码来源:TopicsDataAccess.cs


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