Пример #1
0
        /// <summary>
        /// 获取日志分类
        /// </summary>
        /// <param name="__idatareader"></param>
        /// <returns></returns>
        public static SpaceCategoryInfo GetSpaceCategoryInfo(IDataReader idatareader)
        {
            if (idatareader == null)
            {
                return(null);
            }

            if (idatareader.Read())
            {
                SpaceCategoryInfo spacecategoriesinfo = new SpaceCategoryInfo();
                spacecategoriesinfo.CategoryID    = TypeConverter.ObjectToInt(idatareader["categoryid"]);
                spacecategoriesinfo.Title         = idatareader["title"].ToString();
                spacecategoriesinfo.Uid           = TypeConverter.ObjectToInt(idatareader["uid"]);
                spacecategoriesinfo.Description   = idatareader["description"].ToString();
                spacecategoriesinfo.TypeID        = TypeConverter.ObjectToInt(idatareader["typeid"]);
                spacecategoriesinfo.CategoryCount = TypeConverter.ObjectToInt(idatareader["categorycount"]);
                spacecategoriesinfo.Displayorder  = TypeConverter.ObjectToInt(idatareader["displayorder"]);

                idatareader.Close();
                return(spacecategoriesinfo);
            }
            else
            {
                idatareader.Close();
                return(null);
            }
        }
Пример #2
0
        /// <summary>
        /// 获取日志分类
        /// </summary>
        /// <param name="dt"></param>
        /// <returns></returns>
        public static SpaceCategoryInfo[] GetSpaceCategories(DataTable dt)
        {
            if (dt == null || dt.Rows.Count == 0)
            {
                return(null);
            }

            SpaceCategoryInfo[] spacecategoriesinfoarray = new SpaceCategoryInfo[dt.Rows.Count];
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                spacecategoriesinfoarray[i]               = new SpaceCategoryInfo();
                spacecategoriesinfoarray[i].CategoryID    = TypeConverter.ObjectToInt(dt.Rows[i]["categoryid"]);
                spacecategoriesinfoarray[i].Title         = dt.Rows[i]["title"].ToString();
                spacecategoriesinfoarray[i].Uid           = TypeConverter.ObjectToInt(dt.Rows[i]["uid"]);
                spacecategoriesinfoarray[i].Description   = dt.Rows[i]["description"].ToString();
                spacecategoriesinfoarray[i].TypeID        = TypeConverter.ObjectToInt(dt.Rows[i]["typeid"]);
                spacecategoriesinfoarray[i].CategoryCount = TypeConverter.ObjectToInt(dt.Rows[i]["categorycount"]);
                spacecategoriesinfoarray[i].Displayorder  = TypeConverter.ObjectToInt(dt.Rows[i]["displayorder"]);
            }

            dt.Dispose();
            return(spacecategoriesinfoarray);
        }
        protected override void ShowPage()
        {
            pagetitle = "用户控制面板";

            if (userid == -1)
            {
                AddErrLine("你尚未登录");

                return;
            }
            user = Users.GetUserInfo(userid);
            if (config.Enablespace != 1)
            {
                AddErrLine("个人空间功能已被关闭");
                return;
            }

            if (user.Spaceid <= 0)
            {
                AddErrLine("您尚未开通个人空间");
                return;
            }

            if (DNTRequest.IsPost())
            {
                if (ForumUtils.IsCrossSitePost())
                {
                    AddErrLine("您的请求来路不正确,无法提交。如果您安装了某种默认屏蔽来路信息的个人防火墙软件(如 Norton Internet Security),请设置其不要禁止来路信息后再试。");
                    return;
                }

                string title = DNTRequest.GetHtmlEncodeString("title");
                if ((title.Length > 50) || (title == ""))
                {
                    AddErrLine("分类名称不得超过50个字符且不能为空");
                    return;
                }
                if (DNTRequest.GetString("description").Length > 1000)
                {
                    AddErrLine("分类描述不得超过1000个字符");
                    return;
                }
                if (!Utils.IsNumeric(DNTRequest.GetString("displayorder")))
                {
                    AddErrLine("分类描述序号必须为数字");
                    return;
                }

                SpaceCategoryInfo __spacecategoryinfo = new SpaceCategoryInfo();
                __spacecategoryinfo.Title        = title;
                __spacecategoryinfo.Description  = DNTRequest.GetHtmlEncodeString("description");
                __spacecategoryinfo.Displayorder = Convert.ToInt32(DNTRequest.GetString("displayorder"));
                __spacecategoryinfo.Uid          = userid;
                Space.Data.DbProvider.GetInstance().AddSpaceCategory(__spacecategoryinfo);

                SetUrl("usercpspacemanagecategory.aspx");
                SetMetaRefresh();
                SetShowBackLink(true);
                AddMsgLine("添加日志分类完毕");
            }
        }
Пример #4
0
        protected override void ShowPage()
        {
            pagetitle = "用户控制面板";

            if (userid == -1)
            {
                AddErrLine("你尚未登录");
                return;
            }
            user = Users.GetUserInfo(userid);
            if (config.Enablespace != 1)
            {
                AddErrLine("个人空间功能已被关闭");
                return;
            }
            if (user.Spaceid <= 0)
            {
                AddErrLine("您尚未开通个人空间");
                return;
            }

            if (DNTRequest.IsPost())
            {
                if (ForumUtils.IsCrossSitePost())
                {
                    AddErrLine("您的请求来路不正确,无法提交。如果您安装了某种默认屏蔽来路信息的个人防火墙软件(如 Norton Internet Security),请设置其不要禁止来路信息后再试。");
                    return;
                }

                string title = Utils.HtmlEncode(DNTRequest.GetString("title"));
                if ((title.Length > 50) || (title == ""))
                {
                    AddErrLine("分类名称不得超过50个字符且不能为空");
                    return;
                }
                if (DNTRequest.GetString("description").Length > 1000)
                {
                    AddErrLine("分类描述不得超过1000个字符");
                    return;
                }
                if (!Utils.IsNumeric(DNTRequest.GetString("displayorder")))
                {
                    AddErrLine("分类描述序号必须为数字");
                    return;
                }

                string errorinfo  = "";
                int    categoryid = DNTRequest.GetInt("categoryid", 0);
                if (categoryid == 0)
                {
                    AddErrLine("请正确选择分类信息");
                    return;
                }

                spacecategoryinfo = BlogProvider.GetSpaceCategoryInfo(Space.Data.DbProvider.GetInstance().GetSpaceCategoryByCategoryID(categoryid));
                if (spacecategoryinfo == null || spacecategoryinfo.Uid != userid)
                {
                    AddErrLine("您选择分类不存在");
                    return;
                }
                spacecategoryinfo.Title        = title;
                spacecategoryinfo.Description  = Utils.HtmlEncode(DNTRequest.GetString("description"));
                spacecategoryinfo.Displayorder = Convert.ToInt32(DNTRequest.GetString("displayorder"));
                Space.Data.DbProvider.GetInstance().SaveSpaceCategory(spacecategoryinfo);

                if (errorinfo == "")
                {
                    SetUrl("usercpspacemanagecategory.aspx");
                    SetMetaRefresh();
                    SetShowBackLink(true);
                    AddMsgLine("修改文章分类完毕");
                }
                else
                {
                    AddErrLine(errorinfo);
                    return;
                }
            }
            else
            {
                int categoryid = DNTRequest.GetInt("categoryid", 0);
                if (categoryid == 0)
                {
                    AddErrLine("请正确选择分类信息");
                    return;
                }

                spacecategoryinfo = BlogProvider.GetSpaceCategoryInfo(Space.Data.DbProvider.GetInstance().GetSpaceCategoryByCategoryID(categoryid));
                if (spacecategoryinfo.Uid != userid)
                {
                    AddErrLine("请选择的分类不存在");
                    return;
                }
                if (spacecategoryinfo == null || spacecategoryinfo.Uid != userid)
                {
                    AddErrLine("您选择分类不存在");
                    return;
                }
            }
        }