chore: 首次簽入 Thinkyu ASP.NET 專案
- 加入 Visual Studio / ASP.NET .gitignore - 排除建置輸出、IDE 設定、NuGet packages、大型 MSI 安裝檔
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Services;
|
||||
using System.Web.Script.Services;
|
||||
using WebLib;
|
||||
|
||||
namespace Education.Services
|
||||
{
|
||||
[WebService(Namespace = "http://tempuri.org/")]
|
||||
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
|
||||
[System.ComponentModel.ToolboxItem(false)]
|
||||
[ScriptService]
|
||||
public class 火車票價 : ServiceBase
|
||||
{
|
||||
[WebMethod(EnableSession = true)]
|
||||
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
|
||||
public ServiceResponse SelectOriginStation(string key)
|
||||
{
|
||||
try
|
||||
{
|
||||
DAC_火車票價 dac = new DAC_火車票價();
|
||||
var result = dac.查詢起站(key);
|
||||
|
||||
if (result.Count > 0)
|
||||
return ServiceResponse.CreateSuccess("查詢成功", result);
|
||||
return ServiceResponse.CreateError($"無符合資料");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ServiceResponse.CreateError($"查詢車站失敗:{ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
[WebMethod(EnableSession = true)]
|
||||
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
|
||||
public ServiceResponse SelectDestStation(string key)
|
||||
{
|
||||
try
|
||||
{
|
||||
DAC_火車票價 dac = new DAC_火車票價();
|
||||
var result = dac.查詢迄站(key);
|
||||
|
||||
if (result.Count > 0)
|
||||
return ServiceResponse.CreateSuccess("查詢成功", result);
|
||||
return ServiceResponse.CreateError($"無符合資料");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ServiceResponse.CreateError($"查詢車站失敗:{ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
[WebMethod(EnableSession = true)]
|
||||
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
|
||||
public ServiceResponse SelectFare(string 起站, string 迄站)
|
||||
{
|
||||
try
|
||||
{
|
||||
DAC_火車票價 dac = new DAC_火車票價();
|
||||
var fare = dac.查詢票價(起站 != null ? 起站.Trim() : null, 迄站 != null ? 迄站.Trim() : null);
|
||||
|
||||
if (fare > 0)
|
||||
return ServiceResponse.CreateSuccess("查詢成功", fare);
|
||||
return ServiceResponse.CreateError($"無符合資料");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ServiceResponse.CreateError($"查詢票價失敗:{ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user