📄 diaryshow.aspx.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>
/// diaryShow 的摘要说明。
/// </summary>
public class diaryShow : System.Web.UI.Page
{
protected Club.Common.Controls.Calendar DiaryCalendar;
protected System.Web.UI.WebControls.Repeater dataList;
protected string Title;
protected DateTime Today;
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;
protected c_UserInfo UserInfo
{
get
{
return userInfo;
}
}
private c_HomeSettingInfo setting;
protected c_HomeSettingInfo Setting
{
get
{
return this.setting;
}
}
protected int Year
{
get
{
if(Request.Params["Year"]==null||Request.Params["Year"]=="")
{
return 1900;
}
return int.Parse(Request.Params["Year"]);
}
}
protected int Month
{
get
{
if(Request.Params["Month"]==null||Request.Params["Month"]=="")
{
return 1;
}
return int.Parse(Request.Params["Month"]);
}
}
protected int Day
{
get
{
if(Request.Params["Day"]==null||Request.Params["Day"]=="")
{
return 1;
}
return int.Parse(Request.Params["Day"]);
}
}
protected int DiaryID
{
get
{
if(Request.Params["DiaryID"]==null||Request.Params["DiaryID"]=="")
{
return 0;
}
return int.Parse(Request.Params["DiaryID"]);
}
}
protected c_DiaryInfo DiaryInfo;
private void Page_Load(object sender, System.EventArgs e)
{
Ajax.Utility.RegisterTypeForAjax(typeof(diaryShow));
if(this.RegisterId==0)
{
throw new ShowException("对不起!没有找到该用户网站!",Globals.UrlFormats.Home());
}
this.userInfo=Globals.DbProvider.Select_c_UserByID(this.RegisterId);
this.setting=Globals.DbProvider.Select_c_HomeSettingByRegisterID(this.RegisterId);
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 + "的网上家园";
}
this.Title=setting.SiteTitle+"-Blog";
try
{
this.Today=DateTime.Parse(this.Year+"-"+this.Month+"-"+this.Day);
}
catch
{
throw new ShowException("对不起,没有找到该天Blog!",Globals.UrlFormats.Home());
}
this.DiaryInfo = Globals.DbProvider.Select_c_DiaryByID(this.DiaryID);
if(this.DiaryInfo==null)
{
throw new ShowException("对不起,没有找到该Blog!",Globals.UrlFormats.Home());
}
this.Title+="-"+Today.ToLongDateString();
this.Title+="-"+DiaryInfo.Title;
this.DiaryCalendar.TodaysDate=Today;
Page.DataBind();
}
[Ajax.AjaxMethod()]
public bool commentPost(int registerId,int itemID,int commentRegisterID,int sortType,string content)
{
c_CommentInfo _c_CommentInfo=new c_CommentInfo();
_c_CommentInfo.RegisterID=registerId;
_c_CommentInfo.CommentRegisterID = commentRegisterID;
_c_CommentInfo.Content = content;
_c_CommentInfo.ItemID = itemID;
_c_CommentInfo.SortType =sortType;
return Globals.DbProvider.Create_c_CommentInfo(_c_CommentInfo);
}
[Ajax.AjaxMethod()]
public bool deleteComment(int id)
{
return Globals.DbProvider.Delete_c_CommentByID(id);
}
#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);
this.DiaryCalendar.DayRender+=new DayRenderEventHandler(DiaryCalendar_DayRender);
}
private void DiaryCalendar_DayRender(object sender, DayRenderEventArgs e)
{
this.DiaryCalendar.BindUrl(e,Globals.UrlFormats.SiteDiaryDay(this.RegisterId,"{0}","{1}","{2}"),this.RegisterId);
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -