/// <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;
        }
        protected virtual User ParseUserInfo(DataRow dr)
        {
            User user = new User();
            user.Id = dr.Get<int>("UserId");
            user.UserName = dr.GetString("UserName");
            user.Role = dr.Get<UserRole>("UserGroupId");
            user.RoleName = dr.GetString("UserGroupName");
            user.RegistrationDate = dr.GetDate("UserRegistrationDate");

            decimal offSet = dr.Get<decimal>("UserTimeZone");
            user.TimeZone = new TimeSpan((long)(offSet * (decimal)TimeSpan.TicksPerHour));

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

            return user;
        }
Exemplo n.º 3
0
 private static Product GetProduct(DataRow dr)
 {
     return new Product
     {
         Sku = dr.GetString("SKU"),
         GatewayId = dr.GetGuid("GatewayId"),
         TypeId = dr.GetGuid("Type"),
         TrialPeriodDays = dr.GetInt("TrialPeriodDays"),
         InitialPrice = dr.GetDouble("InitialPrice"),
         RecurringPrice = dr.GetDouble("RecurringPrice"),
         SubscriptionDuration = dr.GetNullableInt("SubscriptionDuration"),
         AvailableDuration = dr.GetNullableInt("AvailableDuration"),
         LastUpdatedBy = dr.GetString("LastUpdatedBy"),
         LastUpdatedOn = dr.GetDate("LastUpdatedOn"),
         CreatedOn = dr.GetDate("CreatedOn"),
         CreatedBy = dr.GetString("CreatedBy"),
         RefId = dr.GetInt("RefId"),
         IsCurrent = dr.GetBoolean("Current", false),
         Active = dr.GetBoolean("Active", false),
     };
 }
Exemplo n.º 4
0
        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;
        }
        protected virtual Message ParseBasicMessageRow(DataRow dr)
        {
            var m = new Message();
            m.Id = dr.Get<int>("MessageId");
            m.Body = dr.GetString("MessageBody");
            m.Date = dr.GetDate("MessageCreationDate");
            m.User = (new UsersDataAccess()).Get(dr.Get<int>("UserId"));
            m.User.Signature = dr.GetNullableString("UserSignature");
            m.User.Role = dr.Get<UserRole>("UserGroupId");
            m.User.RoleName = dr.GetString("UserGroupName");
            m.Topic = new Topic(dr.Get<int>("TopicId"));
            m.Active = dr.Get<bool>("Active");

            return m;
        }
Exemplo n.º 6
0
        protected virtual User ParseUserInfo(DataRow dr)
        {
            User user = new User();
            user.Id = dr.Get<int>("UserId");
            user.UserName = dr.GetString("UserName");
            user.Role = dr.Get<UserRole>("UserGroupId");
            user.RoleName = dr.GetString("UserGroupName");
            user.RegistrationDate = dr.GetDate("UserRegistrationDate");

            decimal offSet = dr.Get<decimal>("UserTimeZone");
            user.TimeZone = new TimeSpan((long)(offSet * (decimal)TimeSpan.TicksPerHour));

            return user;
        }