Files
thinkyu/報到系統/Services/BPSNService.asmx.cs
T
sryang 577060bc78 chore: 首次簽入 Thinkyu ASP.NET 專案
- 加入 Visual Studio / ASP.NET .gitignore
- 排除建置輸出、IDE 設定、NuGet packages、大型 MSI 安裝檔
2026-09-10 09:42:37 +08:00

69 lines
2.2 KiB
C#

using System;
using System.Security.Cryptography;
using System.Text;
using System.Web.Services;
using System.Web.Script.Services;
using WebLib;
namespace 報到系統
{
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
[ScriptService]
public class BPSNService : System.Web.Services.WebService
{
/// <summary>
/// 下載員工資料
/// </summary>
[WebMethod(EnableSession = true)]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public BaseResponse Download()
{
try
{
DAC_BPSN dac = new DAC_BPSN();
BPSNList result = dac.SelectForClient();
// 因為決定客戶端離線模式不驗證密碼,所以不把密碼雜湊值傳給客戶端了
//foreach (var item in result)
//{
// string decryptedPassword = EncDec.KeyDec(item.BPAWD);
// string combined = item.BPENO + decryptedPassword;
// using (SHA1 sha1 = SHA1.Create())
// {
// byte[] hash = sha1.ComputeHash(Encoding.UTF8.GetBytes(combined));
// item.BPAWD = Convert.ToBase64String(hash);
// }
//}
if (result == null || result.Count == 0)
{
return new BaseResponse
{
Success = true,
Message = "沒有員工資料",
Data = new BPSNList()
};
}
return new BaseResponse
{
Success = true,
Message = "下載成功",
Data = result
};
}
catch (Exception ex)
{
return new BaseResponse
{
Success = false,
Message = "下載員工資料發生錯誤:" + ex.Message
};
}
}
}
}