⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 index.aspx.cs

📁 1、用SQL查询器打开install目录下的dooogo.sql运行之后创建数据库dooogo。 2、然后打开web.config修改 <DbProvider type="Club.Fram
💻 CS
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Club.Framework;
using Club.Framework.Components;
using Club.Framework.Configuration;
using Club.Framework.Data;
namespace Club.Home
{
	/// <summary>
	/// index 的摘要说明。
	/// </summary>
	public class index : System.Web.UI.Page
	{
		protected Club.Common.WebUI.ContentRegion titleContains;
		protected Club.Common.WebUI.ContentRegion headerContains;
		protected Club.Common.WebUI.ContentRegion Content;
		protected Club.Common.WebUI.SitePage PageManage;
		protected System.Web.UI.WebControls.Repeater photoList;
		protected System.Web.UI.WebControls.Repeater articleList;
		protected System.Web.UI.WebControls.Repeater diaryList;
		protected System.Web.UI.WebControls.Repeater guestBookList;
		protected int RegisterId
		{
			get
			{
				if(Request.Params["RegisterId"]==null||Request.Params["RegisterId"]=="")
				{
					return 0;
				}
				return int.Parse(Request.Params["RegisterId"]);
			}
		}
		protected int LoginRegisterId
		{
			get
			{
				try
				{
					return FormSecurity.GetMemberId();
				}
				catch
				{
					return 0;
				}
			}
		}
		private c_UserInfo userInfo;
		private c_UserDataInfo userData;
		protected c_UserInfo UserInfo
		{
			get
			{
				return userInfo;
			}
		}
		protected c_UserDataInfo UserData
		{
			get
			{
				return userData;
			}
		}
		private c_HomeSettingInfo setting;
		protected c_HomeSettingInfo Setting
		{
			get
			{
				return this.setting;
			}
		}

		private c_UserDataCountInfo userDataCount;
		public c_UserDataCountInfo UserDataCount
		{
			get
			{
				return this.userDataCount;
			}
		}
		private void Page_Load(object sender, System.EventArgs e)
		{
			Ajax.Utility.RegisterTypeForAjax(typeof(index));
			if(this.RegisterId==0)
			{
				throw new ShowException("对不起!没有找到该用户网站!",Globals.UrlFormats.Home());
			}
			this.userInfo=Globals.DbProvider.Select_c_UserByID(this.RegisterId);
			this.userData=Globals.DbProvider.Select_c_UserDataByRegisterID(this.RegisterId);
			this.setting=Globals.DbProvider.Select_c_HomeSettingByRegisterID(this.RegisterId);
			this.userDataCount = Globals.DbProvider.GetUserCountInfo(this.RegisterId);
			if(this.userData==null)
			{
				throw new ShowException("您的个人资料未完善,请补充修改!",Globals.UrlFormats.Home());
			}
			if(this.setting==null)
			{
				throw new ShowException("您的网站还未设置,请在个人管理设置!",Globals.UrlFormats.Home());
			}
			//如果不是用户本人并关闭网站提示
			if(!setting.IsOpen&&this.RegisterId!=this.LoginRegisterId)
			{
				throw new ShowException("该网站已经关闭!",Globals.UrlFormats.Home());
			}
			if(setting.SiteTitle==null||setting.SiteTitle=="")
			{
				setting.SiteTitle = UserInfo.NiceName + "的网上家园";
			}
			bindPhoto();
			bindArticle();
			bindDiary();
			bindGuestBook();
			Page.DataBind();
		}
		[Ajax.AjaxMethod()]
		public bool guestBookAdd(int registerId,string content,string niceName)
		{
			c_GuestBookInfo _c_GuestBookInfo=new c_GuestBookInfo();
			_c_GuestBookInfo.Content = content;
			_c_GuestBookInfo.NiceName = niceName;
			_c_GuestBookInfo.PostDate = DateTime.Now;
			_c_GuestBookInfo.RegisterID = registerId;
			return Globals.DbProvider.Create_c_GuestBookInfo(_c_GuestBookInfo);
		}
		private void bindPhoto()
		{
			string sql="select top 4 Id,PhotoName,ImageName from c_Photo where registerid="+this.RegisterId+" and PhotoType=1 and SortId in(select id from c_sort where IsVisible=1 and RegisterId="+this.RegisterId+" and SortType="+((int)Globals.SortType.Photo)+") order by orderid desc";
			DataSet ds=Globals.DbProvider.GetDataSet(sql);
			this.photoList.DataSource = ds;
			this.photoList.DataBind();
		}
		private void bindArticle()
		{
			string sql="select top 8 Id,Title,PostDate,Hits from c_Article where registerid="+this.RegisterId+" and SortId in(select id from c_sort where IsVisible=1 and RegisterId="+this.RegisterId+" and SortType="+((int)Globals.SortType.Article)+") order by PostDate desc";
			DataSet ds=Globals.DbProvider.GetDataSet(sql);
			this.articleList.DataSource = ds;
			this.articleList.DataBind();
		}
		private void bindDiary()
		{
			string sql="select top 8 Id,Title,PostDate,Hits from c_Diary where registerid="+this.RegisterId+" and isVisible=1 order by PostDate desc";
			DataSet ds=Globals.DbProvider.GetDataSet(sql);
			this.diaryList.DataSource = ds;
			this.diaryList.DataBind();
		}
		private void bindGuestBook()
		{
			string sql="select top 4 Content,NiceName,PostDate from c_GuestBook where registerid="+this.RegisterId+" order by PostDate desc";
			DataSet ds=Globals.DbProvider.GetDataSet(sql);
			this.guestBookList.DataSource = ds;
			this.guestBookList.DataBind();
		}
		protected string getSPhotoPath(string imageName)
		{
			string photoPath=Globals.GetWebPath(Config.ClubSPhotoPath);
			if(Config.Settings.UpFileIsMakeDir)
			{
				photoPath=photoPath+this.RegisterId+"/";
			}
			return photoPath+imageName;
		}
		#region Web 窗体设计器生成的代码
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{    
			this.Load += new System.EventHandler(this.Page_Load);
		}
		#endregion
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -