/// <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; }
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; }