52 lines
1.3 KiB
C#
52 lines
1.3 KiB
C#
using System;
|
|
using System.Web.Security;
|
|
|
|
namespace Education.MobileSurvey
|
|
{
|
|
public partial class Login : System.Web.UI.Page
|
|
{
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
lbSystemName.Text = PublicVariable.SystemName + " - 行動版";
|
|
|
|
if (!IsPostBack)
|
|
{
|
|
if (Session[PublicVariable.UserId] != null && !string.IsNullOrEmpty(Session[PublicVariable.UserId].ToString()))
|
|
{
|
|
Response.Redirect("SurveyList.aspx");
|
|
}
|
|
}
|
|
}
|
|
|
|
protected void btnLogin_Click(object sender, EventArgs e)
|
|
{
|
|
lbErrMsg.Text = "";
|
|
|
|
if (string.IsNullOrEmpty(txtUserId.Text))
|
|
{
|
|
lbErrMsg.Text = "請輸入使用者代號!";
|
|
return;
|
|
}
|
|
|
|
LoginBPSN login = new LoginBPSN();
|
|
login.UserId = txtUserId.Text;
|
|
login.Password = txtPassword.Text;
|
|
if (login.GetResult())
|
|
{
|
|
Session[PublicVariable.UserId] = txtUserId.Text;
|
|
Session[PublicVariable.UserName] = login.UserName;
|
|
Session[PublicVariable.IsManager] = false;
|
|
Session[PublicVariable.IsWorker] = false;
|
|
Session[PublicVariable.IsBackend] = false;
|
|
|
|
FormsAuthentication.SetAuthCookie(txtUserId.Text, false);
|
|
Response.Redirect("SurveyList.aspx");
|
|
}
|
|
else
|
|
{
|
|
lbErrMsg.Text = login.ErrorMessage;
|
|
}
|
|
}
|
|
}
|
|
}
|