default.aspx.cs

来自「会员管理系统」· CS 代码 · 共 108 行

CS
108
字号
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 com.sungoal.MemberManage.BusinessFacade;
using com.sungoal.MemberManage.Common;
using System.Web.Security;

namespace com.sungoal.MemberManage.Web
{
	/// <summary>
	/// Summary description for _Default.
	/// </summary>
	public class Default : PageBase
	{
		protected System.Web.UI.WebControls.Label lblUserID;
		protected System.Web.UI.WebControls.TextBox txtUserID;
		protected System.Web.UI.WebControls.Label lblPassword;
		protected System.Web.UI.WebControls.Button btnLogin;
		protected System.Web.UI.WebControls.Button btnRegister;
		protected System.Web.UI.WebControls.RequiredFieldValidator ValUserID;
		protected System.Web.UI.WebControls.RequiredFieldValidator ValPassword;
		protected System.Web.UI.WebControls.ValidationSummary ValSummary;
		protected System.Web.UI.WebControls.TextBox txtPassword;
		
		private void Page_Load(object sender, System.EventArgs e)
		{
//			if(!IsAuthenticated)
//			this.ParseControl().
//		LoadControl("Login.ascx");// Put user code to initialize the page here
		}

		#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.btnLogin.Click += new System.EventHandler(this.btnLogin_Click);
			this.btnRegister.Click += new System.EventHandler(this.btnRegister_Click);
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion

		/// <summary>
		/// 登录
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void btnLogin_Click(object sender, System.EventArgs e)
		{
			if(Page.IsValid)
			{
				string userId=txtUserID.Text;
				string password=txtPassword.Text;

				int	ret=0;//new UserFacade().Login(userId,password);

				if (ret < 0)	//登录失败
				{
					ValPassword.IsValid = false;					
					txtPassword.Text=String.Empty;
				}
				else 
				{
					string	url=PageBase.UrlBase;

					//余额不足
					if(ret==0)	
					{
						url += @"/PrePay.aspx";
						JScriptSet.ShowDialog(Response,url,"dialogHeight: 320px; dialogWidth: 350px;center:yes;help:no;status:no;");
					}
					else 
					{
						base.UserKey=userId;
						url += @"/PersonalPage.aspx";	
						Response.Redirect(url);
					}			
				}
			}
		}

		private void btnRegister_Click(object sender, System.EventArgs e)
		{
			string url=PageBase.UrlBase + @"/RegisterUser.aspx";
			JScriptSet.ShowDialog(Response,url,"dialogHeight: 320px; dialogWidth: 350px;center:yes;help:no;status:no;");
		}
	}
}

⌨️ 快捷键说明

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