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

📄 lyrisexample1.ascx

📁 一种Portal的实现源码
💻 ASCX
字号:
<%@ Control language="c#" Inherits="Rainbow.DesktopModules.OneFileModule" %>
<%@ Register TagPrefix="cc1" Namespace="Rainbow.UI.WebControls" Assembly="Rainbow" %>
<%@ Import Namespace="System.Web.Mail" %>
<%@ Import Namespace="Rainbow.UI" %>
<%@ Import Namespace="Rainbow.UI.WebControls" %>
<%@ Import Namespace="Rainbow.Configuration" %>
<script language="C#" runat="server">


	string lyrisListName;
	string lyrisServerName;


	void Page_Load(Object sender, EventArgs e)
	{
		InitSettings(SettingsType.Xml);
		// Note you have these variables available everywhere in your code:
		// string SettingsStr  -- The content of setting "Settings string"
		// bool DebugMode      -- true if setting "Debug Mode" is clicked
		// bool SettingsExists -- false if settings are missing
		// string GetStrSetting(settingName) -- Returns the setting from SettingsStr
		// string GetXmlSetting(settingName) -- Returns the setting from XML file
		// string GetSetting(settingName)    -- Returns the setting in search order: 
		//                                      1)SettingsStr, 2)XML file

		if (SettingsExists)
		{
			lyrisListName = GetSetting("LyrisListName");
			lyrisServerName = GetSetting("LyrisServerName");
			if (DebugMode)
				Message.Text = "Debug info: " + lyrisListName + " - " + lyrisServerName;
		}
		
		if (IsPostBack == false)
		{
			// prepopulate box
			email.Text = PortalSettings.CurrentUser.Identity.Email;
		}
	}

    void SubscribeBtn_Click(Object sender, EventArgs e) {
		JoinList(email.Text, lyrisListName);
		Message.Text = email.Text + " subscribed!";
    }

    void LeaveBtn_Click(Object sender, EventArgs e) {
		LeaveList(email.Text, lyrisListName);
		Message.Text = email.Text + " unsubscribed!";
    }
    
    void JoinList(string email, string listname) {
		MailMessage Mailer = new MailMessage();   
		Mailer.From = email; 
		Mailer.To = "join-" + listname + lyrisServerName;
		Mailer.Subject = "Join";
		Mailer.Body = "Join";
		SmtpMail.SmtpServer = PortalSettings.SmtpServer;
		SmtpMail.Send(Mailer);    
    }
    
    void LeaveList(string email, string listname) {
		MailMessage Mailer = new MailMessage();   
		Mailer.From = email; 
		Mailer.To = "leave-" + listname + lyrisServerName;
		Mailer.Subject = "Leave";
		Mailer.Body = "Leave";
		SmtpMail.SmtpServer = PortalSettings.SmtpServer;
		SmtpMail.Send(Mailer);    
    }
</script>
<cc1:DesktopModuleTitle EditText="Edit" EditUrl="~/DesktopModules/PropertyPage.aspx" PropertiesText="PROPERTIES" PropertiesUrl="~/DesktopModules/PropertyPage.aspx" runat="server" ID="ModuleTitle" />
<hr noshade="noshade" size="1pt" width="98%" />
<table cellpadding="0" cellspacing="0" border="0">
	<tr>
		<td><span class="SubSubHead" style="height:20">Newsletter Signup:</span></td>
	</tr>
	<tr>
		<td>
			<span class="Normal">Email:</span></td>
		</td>
	</tr>
	<tr>
		<td>
			<asp:TextBox id="email" columns="9" width="130" cssclass="NormalTextBox" runat="server" />
			<div class="SubHead">
				<asp:RegularExpressionValidator runat="server" id="validEMailRegExp" ControlToValidate="email" Display="Dynamic" ErrorMessage="Please enter a valid email address." ValidationExpression="[\w\.-]+(\+[\w-]*)?@([\w-]+\.)+[\w-]+" />
				<asp:RequiredFieldValidator runat="server" id="rfvEMail" ControlToValidate="email" Display="Dynamic" ErrorMessage="'Email' must not be left blank." />
			</div>
		</td>
	</tr>
	<tr>
		<td>
			<asp:Button id="SubscribeBtn" runat="server" OnClick="SubscribeBtn_Click" Text="Join" />
			<asp:Button id="LeaveBtn" runat="server" OnClick="LeaveBtn_Click" Text="Leave" />
		</td>
	</tr>
	<tr>
		<td>
			<asp:label id="Message" class="NormalRed" runat="server" />
		</td>
	</tr>
</table>

⌨️ 快捷键说明

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