chore: 首次簽入 Thinkyu ASP.NET 專案
- 加入 Visual Studio / ASP.NET .gitignore - 排除建置輸出、IDE 設定、NuGet packages、大型 MSI 安裝檔
This commit is contained in:
@@ -0,0 +1,174 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Data.Common;
|
||||
using WebLib;
|
||||
|
||||
/// <summary>
|
||||
/// Summary description for Login
|
||||
/// </summary>
|
||||
namespace 報到系統
|
||||
{
|
||||
public class LoginBPSN : DAC
|
||||
{
|
||||
private string _userId = "";
|
||||
private string _password = "";
|
||||
private string _userName = "";
|
||||
private string _errMessage = "";
|
||||
private string _userLang = "";
|
||||
private bool _noPassword = false;
|
||||
private bool _isSystemManager;
|
||||
private bool _isCustomManager;
|
||||
private bool _isFieldStaffWorker;
|
||||
private bool _isQueryWorker;
|
||||
|
||||
public LoginBPSN()
|
||||
{
|
||||
}
|
||||
|
||||
public string UserId
|
||||
{
|
||||
get
|
||||
{
|
||||
return _userId;
|
||||
}
|
||||
set
|
||||
{
|
||||
_userId = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string Password
|
||||
{
|
||||
get
|
||||
{
|
||||
return _password;
|
||||
}
|
||||
set
|
||||
{
|
||||
_password = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string UserName
|
||||
{
|
||||
get
|
||||
{
|
||||
return _userName;
|
||||
}
|
||||
}
|
||||
|
||||
public string ErrorMessage
|
||||
{
|
||||
get
|
||||
{
|
||||
return _errMessage;
|
||||
}
|
||||
}
|
||||
|
||||
public bool NoPassword
|
||||
{
|
||||
get
|
||||
{
|
||||
return _noPassword;
|
||||
}
|
||||
}
|
||||
|
||||
public string UserLang
|
||||
{
|
||||
get
|
||||
{
|
||||
return _userLang;
|
||||
}
|
||||
set
|
||||
{
|
||||
_userLang = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否是管理員
|
||||
/// </summary>
|
||||
public bool IsSystemManager
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isSystemManager;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsCustomManager
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isCustomManager;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsFieldStaffWorker
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isFieldStaffWorker;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsQueryWorker
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isQueryWorker;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 取得是否登入成功
|
||||
/// </summary>
|
||||
/// <returns>登入成功與否。若回傳 false,錯誤訊息將儲存在 ErrorMessage 屬性中</returns>
|
||||
public bool GetResult()
|
||||
{
|
||||
DbCommand cmd = NewCommand("SELECT BPENO, BPNME, BPEDY, BPAWD FROM BPSNView WHERE BPENO=@BPENO");
|
||||
AddParam(cmd, "BPENO", _userId);
|
||||
DataTable rs = Select(cmd);
|
||||
_noPassword = false;
|
||||
|
||||
if (rs.Rows.Count == 0)
|
||||
{
|
||||
_errMessage = "無此使用者代號或是密碼錯誤";
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
string pwd1 = GetString(rs.Rows[0]["BPAWD"]);
|
||||
string pwd2 = EncDec.KeyDec(pwd1);
|
||||
|
||||
if (pwd1.CompareTo("\u007f\u007f\u007f\u007f") == 0)
|
||||
{
|
||||
_noPassword = true;
|
||||
pwd2 = "";
|
||||
}
|
||||
|
||||
if (_password.CompareTo(pwd2) != 0)
|
||||
{
|
||||
_errMessage = "無此使用者代號或是密碼錯誤";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (rs.Rows[0]["BPEDY"] != DBNull.Value)
|
||||
{
|
||||
_errMessage = "您沒有使用這個系統的權限";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
_errMessage = "";
|
||||
_userName = GetString(rs.Rows[0]["BPNME"]);
|
||||
DAC_BPSN dacBPSN = new DAC_BPSN(conn);
|
||||
_isSystemManager = dacBPSN.Is系統管理群組(_userId);
|
||||
_isCustomManager = dacBPSN.Is客戶管理群組(_userId);
|
||||
_isFieldStaffWorker = dacBPSN.Is現場工作群組(_userId);
|
||||
_isQueryWorker = dacBPSN.Is查詢群組(_userId);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user