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 = 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;
                }
            }
        }
Example #2
0
		public bool SaveSpaceCategory(SpaceCategoryInfo spacecategories)
		{
			//try
			//{
			IDataParameter[] prams = 
				{
					DbHelper.MakeInParam("@categoryid", (DbType)SqlDbType.Int, 4,spacecategories.CategoryID),
					DbHelper.MakeInParam("@title", (DbType)SqlDbType.NVarChar, 50,spacecategories.Title),
					DbHelper.MakeInParam("@uid", (DbType)SqlDbType.Int, 4,spacecategories.Uid),
					DbHelper.MakeInParam("@description", (DbType)SqlDbType.NVarChar, 1000,spacecategories.Description),
					DbHelper.MakeInParam("@typeid", (DbType)SqlDbType.Int, 4,spacecategories.TypeID),
					DbHelper.MakeInParam("@categorycount", (DbType)SqlDbType.Int, 4,spacecategories.CategoryCount),
					DbHelper.MakeInParam("@displayorder", (DbType)SqlDbType.Int, 4,spacecategories.Displayorder)
				};
			string sqlstring = String.Format("UPDATE [" + BaseConfigs.GetTablePrefix + "spacecategories] SET  [title] = @title, [uid] = @uid, [description] = @description, [typeid] = @typeid, [categorycount] = @categorycount, [displayorder] = @displayorder WHERE [categoryid] = @categoryid ");

			DbHelper.ExecuteNonQuery(CommandType.Text, sqlstring, prams);

			return true;
			//}
			//catch (Exception ex)
			//{
			//    errormsg = Globals.TransferSqlErrorInfo(ex.Message);
			//    return false;
			//}

		}
Example #3
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;
		}
Example #4
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;
			}
		}
Example #5
0
        public bool SaveSpaceCategory(SpaceCategoryInfo spacecategories)
        {
            DbParameter[] parms = 
				{
					DbHelper.MakeInParam("@categoryid", (DbType)SqlDbType.Int, 4,spacecategories.CategoryID),
					DbHelper.MakeInParam("@title", (DbType)SqlDbType.NVarChar, 50,spacecategories.Title),
					DbHelper.MakeInParam("@uid", (DbType)SqlDbType.Int, 4,spacecategories.Uid),
					DbHelper.MakeInParam("@description", (DbType)SqlDbType.NVarChar, 1000,spacecategories.Description),
					DbHelper.MakeInParam("@typeid", (DbType)SqlDbType.Int, 4,spacecategories.TypeID),
					DbHelper.MakeInParam("@categorycount", (DbType)SqlDbType.Int, 4,spacecategories.CategoryCount),
					DbHelper.MakeInParam("@displayorder", (DbType)SqlDbType.Int, 4,spacecategories.Displayorder)
				};
            string commandText = string.Format("UPDATE [{0}spacecategories] SET  [title] = @title, [uid] = @uid, [description] = @description, [typeid] = @typeid, [categorycount] = @categorycount, [displayorder] = @displayorder WHERE [categoryid] = @categoryid ", BaseConfigs.GetTablePrefix);

            DbHelper.ExecuteNonQuery(CommandType.Text, commandText, parms);

            return true;    
        }
Example #6
0
        public bool AddSpaceCategory(SpaceCategoryInfo spacecategories)
        {
            DbParameter[] parms = 
				{
					DbHelper.MakeInParam("@categoryid", (DbType)SqlDbType.Int, 4,spacecategories.CategoryID),
					DbHelper.MakeInParam("@title", (DbType)SqlDbType.NVarChar, 50,spacecategories.Title),
					DbHelper.MakeInParam("@uid", (DbType)SqlDbType.Int, 4,spacecategories.Uid),
					DbHelper.MakeInParam("@description", (DbType)SqlDbType.NVarChar, 1000,spacecategories.Description),
					DbHelper.MakeInParam("@typeid", (DbType)SqlDbType.Int, 4,spacecategories.TypeID),
					DbHelper.MakeInParam("@categorycount", (DbType)SqlDbType.Int, 4,spacecategories.CategoryCount),
					DbHelper.MakeInParam("@displayorder", (DbType)SqlDbType.Int, 4,spacecategories.Displayorder)
				};
            string commandText = string.Format("INSERT INTO [{0}spacecategories] ( [title], [uid], [description], [typeid], [categorycount], [displayorder]) VALUES ( @title, @uid, @description, @typeid, @categorycount, @displayorder)", BaseConfigs.GetTablePrefix);

            DbHelper.ExecuteNonQuery(CommandType.Text, commandText, parms);

            return true;         
        }
        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;
                }

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

                SetUrl("usercpspacemanagecategory.aspx");
                SetMetaRefresh();
                SetShowBackLink(true);
                AddMsgLine("添加日志分类完毕");
            }
        }