protected virtual ForumCategory ParseBasicPageContentRow(DataRow dr)
 {
     var category = new ForumCategory()
     {
         Id = dr.Get<int>("CategoryId"),
         Name = dr.GetString("CategoryName"),
         Order = dr.Get<int>("CategoryOrder")
     };
     return category;
 }
示例#2
0
 private static ActionInfo GetActionInfo(DataRow row)
 {
     return new ActionInfo
     {
         Code = row.Get<string>("Code"),
         Name = row.Get<string>("Name"),
         Position = row.Get<string>("Position"),
         Description = row.Get<string>("Description"),
         Sequence = row.Get<int>("Sequence"),
         IsVisible = true
     };
 }
 public UserProfile Build_UserProfile(DataRow dr)
 {
     UserProfile user = new UserProfile();
     user.UserId = Convert.ToInt32(dr.Get<uint>("userId"));
     user.Nombre = dr.GetString("nombre");
     user.Empresa = dr.GetString("empresa");
     user.Website = dr.GetString("website1");
     return user;
 }
        /// <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;
        }
 private Template ParseTemplateDataRow(DataRow dr)
 {
     Template t = new Template();
     t.Id = dr.Get<int>("TemplateId");
     t.Key = dr.GetString("TemplateKey");
     t.Description = dr.GetString("TemplateDescription");
     return t;
 }
示例#7
0
        protected virtual Forum ParseForumDataRow(DataRow dr)
        {
            Forum f = new Forum();
            f.Name = dr.GetString("ForumName");
            f.Description = dr.GetString("ForumDescription");
            f.ShortName = dr.GetString("ForumShortName");
            f.Id = dr.Get<int>("ForumId");
            f.TopicCount = dr.Get<int>("ForumTopicCount");
            f.MessageCount = dr.Get<int>("ForumMessageCount");

            return f;
        }
示例#8
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;
        }
示例#10
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;
        }
示例#11
0
 private static RoleInfo GetRoleInfo(DataRow row, bool initMenus)
 {
     var role = new RoleInfo
     {
         Id = row.Get<string>("Id"),
         Name = row.Get<string>("Name"),
         Description = row.Get<string>("Description"),
         Menus = row.Get<string>("Menus")
     };
     if (initMenus)
     {
         var command = DbHelper.Default.CreateCommand();
         command.Text = "select MenuId from T_RoleMenus where RoleId=?RoleId";
         command.Parameters.Add("RoleId", role.Id);
         var menus = command.ToList(r => { return r.Get<string>("MenuId"); });
         if (string.IsNullOrEmpty(role.Menus))
         {
             role.Menus = string.Join(",", menus.ToArray());
         }
         else
         {
             role.Menus = role.Menus + "," + string.Join(",", menus.ToArray());
         }
     }
     return role;
 }