📄 addsubscription.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 ASPNET.StarterKit.Communities.Services;
namespace ASPNET.StarterKit.Communities.Admin.EditServiceSubscriptions
{
/// <summary>
/// Summary description for AddSubscription.
/// </summary>
public class AddSubscription : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label lblError;
protected System.Web.UI.WebControls.TextBox txtServiceName;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;
protected System.Web.UI.WebControls.TextBox txtServiceUrl;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator2;
protected System.Web.UI.WebControls.TextBox txtPassword;
protected System.Web.UI.WebControls.RegularExpressionValidator RegularExpressionValidator1;
protected System.Web.UI.WebControls.Button btnAdd;
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
}
#endregion
//*******************************************************
//
// Add a new service subscription to the database.
//
//*******************************************************
void btnAdd_Click(Object s, EventArgs e) {
if (Page.IsValid) {
ServiceSubscriptionInfo serviceInfo = new ServiceSubscriptionInfo();
serviceInfo.Name = txtServiceName.Text;
serviceInfo.Url = txtServiceUrl.Text;
serviceInfo.Password = txtPassword.Text;
int result = AdminUtility.AddServiceSubscription(serviceInfo);
if (result == 0)
Response.Redirect("Default.aspx");
lblError.Visible = true;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -