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

📄 ratepost.cs

📁 本系统是在asp版《在线文件管理器》的基础上设计制作
💻 CS
字号:
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
//     Copyright (c) Telligent Systems Corporation.  All rights reserved.
// </copyright> 
//------------------------------------------------------------------------------

using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using CommunityServer.Components;

namespace CommunityServer.Controls {

	// *********************************************************************
	//  RatePost
	//
	/// <summary>
	/// </summary>
	/// 
	// ********************************************************************/
	public abstract class RatePost : SkinnedWebControl {

	    CSContext csContext = CSContext.Current;

		string skinFilename = "Skin-RatePost.ascx";

		// *********************************************************************
		//  RatePost
		//
		/// <summary>
		/// Constructor
		/// </summary>
		// ***********************************************************************/
		public RatePost() : base() {

			// Assign a default template name
			if (SkinFilename == null)
				SkinFilename = skinFilename;

		}

		// *********************************************************************
		//  CreateChildControls
		//
		/// <summary>
		/// This event handler adds the children controls.
		/// </summary>
		// ***********************************************************************/
		protected override void CreateChildControls() {

			if ((CSContext.Current.User.UserID == this.Post.User.UserID) || (CSContext.Current.User.IsAnonymous))
				return;

			base.CreateChildControls();
		}

        protected virtual ApplicationType ApplicationType
        {
            get{ return ApplicationType.Forum;}
        }

		// *********************************************************************
		//  Initializeskin
		//
		/// <summary>
		/// Initialize the control template and populate the control with values
		/// </summary>
		// ***********************************************************************/
		override protected void InitializeSkin(Control skin) {


            //ForumImageButton fib = skin.FindControl("RatingButton") as ForumImageButton;
            //fib.ApplicationType = this.ApplicationType;

		    LinkButton l;

			l = (LinkButton) skin.FindControl("RateZero");
			l.CommandArgument = "0";
			l.Text = ResourceManager.GetString("PostRating_Zero");
			l.Click += new EventHandler(RateTopic_Click);

			l = (LinkButton) skin.FindControl("RateOne");
			l.CommandArgument = "1";
			l.Text = ResourceManager.GetString("PostRating_One");
			l.Click += new EventHandler(RateTopic_Click);

			l = (LinkButton) skin.FindControl("RateTwo");
			l.CommandArgument = "2";
			l.Text = ResourceManager.GetString("PostRating_Two");
			l.Click += new EventHandler(RateTopic_Click);

			l = (LinkButton) skin.FindControl("RateThree");
			l.CommandArgument = "3";
			l.Text = ResourceManager.GetString("PostRating_Three");
			l.Click += new EventHandler(RateTopic_Click);

			l = (LinkButton) skin.FindControl("RateFour");
			l.CommandArgument = "4";
			l.Text = ResourceManager.GetString("PostRating_Four");
			l.Click += new EventHandler(RateTopic_Click);

			l = (LinkButton) skin.FindControl("RateFive");
			l.CommandArgument = "5";
			l.Text = ResourceManager.GetString("PostRating_Five");
			l.Click += new EventHandler(RateTopic_Click);

		}

		void RateTopic_Click (object sender, EventArgs e) {

			LinkButton l = (LinkButton) sender;
			Ratings.Rate( this.Post.ThreadID, CSContext.Current.User.UserID, int.Parse( l.CommandArgument ));

		}


        public abstract Post Post{get;set;}

	}
}

⌨️ 快捷键说明

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