chore: 首次簽入 Thinkyu ASP.NET 專案
- 加入 Visual Studio / ASP.NET .gitignore - 排除建置輸出、IDE 設定、NuGet packages、大型 MSI 安裝檔
This commit is contained in:
@@ -0,0 +1,160 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Services;
|
||||
using System.Web.Script.Services;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Wellan.Common;
|
||||
using Wellan.Data;
|
||||
using System.Data;
|
||||
|
||||
/// <summary>
|
||||
/// GetData 的摘要描述
|
||||
/// </summary>
|
||||
[WebService(Namespace = "http://tempuri.org/")]
|
||||
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
|
||||
[ScriptService]
|
||||
public class GetDataService : System.Web.Services.WebService
|
||||
{
|
||||
|
||||
public GetDataService()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
[WebMethod(EnableSession = true)]
|
||||
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
|
||||
public GetDataResponse GetOverTimeBegin(string date, string userid)
|
||||
{
|
||||
DateTime aDate;
|
||||
int result = -1;
|
||||
string beginHour = string.Empty;
|
||||
string beginMinute = string.Empty;
|
||||
TimeCalc timeCalc = new TimeCalc();
|
||||
|
||||
if (WGuard1.CheckDate(date, out aDate))
|
||||
{
|
||||
aDate = aDate.AddYears(WGuard1.CY11);
|
||||
RcrdDAC rcrdDAC = new RcrdDAC(WGuard1.Query);
|
||||
DataTable dt = rcrdDAC.ReadByDate(userid, aDate);
|
||||
if (dt.Rows.Count > 0)
|
||||
{
|
||||
string begintime = WDAC.GetStringValue(dt.Rows[0]["RCC01"]);
|
||||
|
||||
if (!string.IsNullOrEmpty(begintime))
|
||||
{
|
||||
begintime = TimeCalc.加分鐘數(begintime, 540);
|
||||
beginHour = begintime.Substring(0, 2);
|
||||
beginMinute = begintime.Substring(3, 2);
|
||||
result = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//JObject data = new JObject();
|
||||
//data.Add("beginhour", new JValue(beginHour));
|
||||
//data.Add("beginminute", new JValue(beginMinute));
|
||||
|
||||
return new GetDataResponse()
|
||||
{
|
||||
Result = result,
|
||||
Data = new { beginhour = beginHour , beginminute = beginMinute }
|
||||
};
|
||||
}
|
||||
|
||||
[WebMethod(EnableSession = true)]
|
||||
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
|
||||
public GetDataResponse CheckAvailHours(string USERID, string RPPYN, string RPREN, string RPTYP, string RPRDT, string RPRTM, string RPEDT, string RPETM)
|
||||
{
|
||||
// 從設定檔中取得連線字串
|
||||
var ConnectionConfigName = WConfig.GetConnectionConfigName();
|
||||
WConnectionString.ConnectionConfigFile = WConfig.GetConnectionConfig();
|
||||
var ConnectionString = WConnectionString.GetConnectionString(ConnectionConfigName);
|
||||
var ConnectionType = WConnectionString.GetConnectionType(ConnectionConfigName);
|
||||
var Query = new WQuery(ConnectionType, ConnectionString);
|
||||
WGuard1.SetQuery(ConnectionType, ConnectionString);
|
||||
|
||||
DateTime rprdt, rpedt;
|
||||
//if (WGuard1.CheckDate(RPRDT, out rprdt))
|
||||
//{
|
||||
// rprdt = rprdt.AddYears(WGuard1.CY11);
|
||||
//}
|
||||
//if (WGuard1.CheckDate(RPEDT, out rpedt))
|
||||
//{
|
||||
// rpedt = rpedt.AddYears(WGuard1.CY11);
|
||||
//}
|
||||
WGuard1.CheckDate(RPRDT, out rprdt);
|
||||
WGuard1.CheckDate(RPEDT, out rpedt);
|
||||
|
||||
#region 取剩餘時數
|
||||
var rparDao = new RparDAC(Query);
|
||||
int 年度事假;
|
||||
int 年度病假;
|
||||
int availHours = 0;
|
||||
if (int.TryParse(WGuard1.WSetR("UNRPARTIME", 5), out 年度事假))
|
||||
年度事假 = 年度事假 * 60;
|
||||
else
|
||||
年度事假 = 112 * 60;
|
||||
if (int.TryParse(WGuard1.WSetR("UNRPARTIME", 6), out 年度病假))
|
||||
年度病假 = 年度病假 * 60;
|
||||
else
|
||||
年度病假 = 240 * 60;
|
||||
|
||||
if (rprdt.Ticks == 0 || rpedt.Ticks == 0 || string.IsNullOrEmpty(RPRTM) || string.IsNullOrEmpty(RPETM))
|
||||
{
|
||||
availHours = - 1;
|
||||
}
|
||||
if (RPTYP == RPAR_TYPE.T02_事假 || RPTYP == RPAR_TYPE.T0B_家庭照顧假)
|
||||
{
|
||||
availHours = 年度事假 - rparDao.Get已請事假(USERID, rprdt, RPREN) - new TimeCalc().計算請假總時數(USERID, rprdt, rpedt, RPRTM, RPETM, RPTYP, true);
|
||||
}
|
||||
if (RPTYP == RPAR_TYPE.T03_病假)
|
||||
{
|
||||
availHours = 年度病假 - rparDao.Get已請病假(USERID, rprdt, RPREN) - new TimeCalc().計算請假總時數(USERID, rprdt, rpedt, RPRTM, RPETM, RPTYP, true);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region
|
||||
var bpsnDao = new BpsnDAC(Query);
|
||||
var rdt_rppyn = string.Empty;
|
||||
var edt_rppyn = string.Empty;
|
||||
var dateMessage = new List<string>();
|
||||
if (rprdt.Ticks > 0)
|
||||
{
|
||||
rdt_rppyn = bpsnDao.GetProjectByDate(USERID, rprdt);
|
||||
if (RPPYN.CompareTo(rdt_rppyn) != 0)
|
||||
{
|
||||
dateMessage.Add(string.Format("{0}日期不在目前專案的範圍", rprdt.Ticks > 0 && rpedt.Ticks > 0 ? "開始" : ""));
|
||||
}
|
||||
}
|
||||
if (rpedt.Ticks > 0)
|
||||
{
|
||||
edt_rppyn = bpsnDao.GetProjectByDate(USERID, rpedt);
|
||||
if (RPPYN.CompareTo(edt_rppyn) != 0)
|
||||
{
|
||||
dateMessage.Add("結束日期不在目前專案的範圍");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
return new GetDataResponse()
|
||||
{
|
||||
Result = 0,
|
||||
Data = new {
|
||||
availHours = availHours,
|
||||
dateMessage = dateMessage
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public class GetDataResponse
|
||||
{
|
||||
public int Result;
|
||||
public object Data;
|
||||
public string Message;
|
||||
}
|
||||
Reference in New Issue
Block a user