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

📄 massemailingadmin.cs

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

using System;
using System.ComponentModel;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using CommunityServer;
using CommunityServer.Components;


namespace CommunityServer.Controls {

	public class MassEmailingAdmin : TemplatedWebControl {

		#region Child Controls

		protected RoleDropDownList RoleList;
		protected TextBox Subject;
		protected Editor Message;
		protected Button SendButton;

		#endregion

		#region Skin

		protected override void AttachChildControls() {

			RoleList = (RoleDropDownList)FindControl( "RoleList" );
			Subject = (TextBox)FindControl( "Subject" );
			Message = (Editor)FindControl( "Message" );
			SendButton = (Button)FindControl( "SendButton" );

			InitializeChildControls();
		}

		private void InitializeChildControls() {

			this.SendButton.Click += new EventHandler(SendButton_Click);

		}

		#endregion

		#region Command Handlers

		private void SendButton_Click(object sender, EventArgs e) {
		    MailPost post = new MailPost();
			post.Subject = Subject.Text;
			post.Body = Message.Text;
			post.PostType = PostType.HTML; //TODO This used to support BBCode... Fix?
			post.FormattedBody = Transforms.FormatPostText( Message.Text, post.PostType );			
			post.PostDate = DateTime.Now;
			post.User = CSContext.Current.User;
			post.Username = CSContext.Current.User.Username;

			Send( post );

			Subject.Text = "";
			Message.Text = "";
			RoleList.ClearSelection();

			Label statusLabel = (Label)FindControl( "StatusLabel" );
			statusLabel.Text = ResourceManager.GetString( "MassEmailing_StatusSuccess" );
			statusLabel.Visible = true;
		}

		#endregion

		#region Command Implementations

		protected virtual void Send( Post post ) {
			Emails.UsersInRole( new Guid(RoleList.SelectedItem.Value), post );
		}

		#endregion

		protected override void OnLoad(EventArgs e) {
			if ( !Page.IsPostBack ) {
				this.DataBind();
			}
			base.OnLoad( e );
		}

		public override void DataBind(){
			base.DataBind();

			this.SendButton.Text = ResourceManager.GetString( "Send" );
		}

	}
}

⌨️ 快捷键说明

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