diff --git a/App_Code/globalClass.cs b/App_Code/globalClass.cs index bade81e..b59a859 100644 --- a/App_Code/globalClass.cs +++ b/App_Code/globalClass.cs @@ -47,7 +47,15 @@ public static class globalClass years = months / 12; months = months % 12; - return years.ToString() + "歲" + months.ToString() + "月"; + if (months > 0) + { + return years.ToString() + "歲" + months.ToString() + "月"; + } + else + { + return years.ToString() + "歲"; + + } } public static int MonthDiff(DateTime self, DateTime target) diff --git a/bin/abbott_2024_event.dll b/bin/abbott_2024_event.dll index cd3585a..1716761 100644 Binary files a/bin/abbott_2024_event.dll and b/bin/abbott_2024_event.dll differ diff --git a/webapi/babyData.ashx b/webapi/babyData.ashx index 671bfc2..2eb3c90 100644 --- a/webapi/babyData.ashx +++ b/webapi/babyData.ashx @@ -1 +1 @@ -<%@ WebHandler Language="C#" CodeBehind="babyData.ashx.cs" Class="abbott_2024_event.webapi.babyData" %> +<%@ WebHandler Language="C#" CodeBehind="babyData.ashx.cs" Class="abbott_2024_event.webapi.babyDataAshx" %> diff --git a/webapi/babyData.ashx.cs b/webapi/babyData.ashx.cs index 5d666f1..13202c0 100644 --- a/webapi/babyData.ashx.cs +++ b/webapi/babyData.ashx.cs @@ -94,7 +94,7 @@ namespace abbott_2024_event.webapi return; } - if (line_uid != null) { + if (line_uid != "") { lineUser lineUser = conn.QueryFirstOrDefault("select * from lineUser where line_uid = @line_uid", new { line_uid = line_uid }); if (lineUser != null) @@ -194,8 +194,8 @@ namespace abbott_2024_event.webapi - lenHeiTable objLenHei = conn.QueryFirstOrDefault("select * from lenHeiTable where lenHeiTable_sexual = @gender and lenHeiTable_month = @month and lenHeiTable_minVal < @height1 and lenHeiTable_maxVal >= @height2 ", new { gender = gender, month = newRec.babyRec_months, height1 = height, height2 = height}); - lenHeiTable objMidHei = conn.QueryFirstOrDefault("select * from lenHeiTable where lenHeiTable_sexual = @gender and lenHeiTable_month = @month and lenHeiTable_percent = 50", new { gender = gender, month=newRec.babyRec_months }); + lenHeiTable objLenHei = conn.QueryFirstOrDefault("select * from lenHeiTable where lenHeiTable_sexual = @gender and lenHeiTable_month = @month and lenHeiTable_minVal < @height1 and lenHeiTable_maxVal >= @height2 ", new { gender = newBaby.babyData_sexual, month = newRec.babyRec_months, height1 = height, height2 = height}); + lenHeiTable objMidHei = conn.QueryFirstOrDefault("select * from lenHeiTable where lenHeiTable_sexual = @gender and lenHeiTable_month = @month and lenHeiTable_percent = 50", new { gender = newBaby.babyData_sexual, month=newRec.babyRec_months }); if (objLenHei == null) { objRet.ret = "no"; @@ -220,6 +220,7 @@ namespace abbott_2024_event.webapi objRet.baby_data.baby_height = newRec.babyRec_height; objRet.baby_data.baby_age = newRec.babyRec_yearMonthStr; objRet.baby_data.average_height = newRec.babyRec_middleHeight; + objRet.baby_data.babyData_uid = newBaby.babyData_uid; objRet.ret = "yes"; json.WriteObject(context.Response.OutputStream, objRet); @@ -242,6 +243,7 @@ namespace abbott_2024_event.webapi public string baby_age { get; set; } = ""; public double baby_height { get; set; } = 0.0; public double average_height { get; set; } = 0.0; + public string babyData_uid { get; set; } = ""; } public bool IsReusable diff --git a/webapi/babyList.ashx.cs b/webapi/babyList.ashx.cs index 64496d6..a0bf820 100644 --- a/webapi/babyList.ashx.cs +++ b/webapi/babyList.ashx.cs @@ -47,6 +47,7 @@ namespace abbott_2024_event.webapi foreach (babyData data in babyDatas) { baby baby = new baby(); + baby.babyData_uid = data.babyData_uid; baby.babyData_name = data.babyData_name; baby.babyData_gender = data.babyData_sexual; baby.babyData_birthday = data.babyData_birthday.ToString("yyyy/MM/dd"); @@ -68,6 +69,7 @@ namespace abbott_2024_event.webapi public class baby { + public string babyData_uid { get; set; } = ""; public string babyData_birthday { get; set; } = ""; public string babyData_name { get; set; } = ""; public string babyData_gender { get; set; } = "M"; diff --git a/webapi/bindBabyData.ashx.cs b/webapi/bindBabyData.ashx.cs index 46192d8..cfc74aa 100644 --- a/webapi/bindBabyData.ashx.cs +++ b/webapi/bindBabyData.ashx.cs @@ -43,7 +43,7 @@ namespace abbott_2024_event.webapi return; } - babyRec babyRec = conn.QueryFirstOrDefault("select * from babyRec where babyRec_key = @babyRec_key", new { babyRec_key = temp_key }); + babyRec babyRec = conn.QueryFirstOrDefault("select * from babyRec where babyRec_key = @babyRec_key", new { babyRec_key = temp_key }); if (babyRec == null) { objRet.ret = "no"; @@ -106,9 +106,9 @@ namespace abbott_2024_event.webapi babyRec.babyData_uid = babyData_uid; babyRec.babyRec_monthLastRec = "Y"; - conn.Execute("update babyRec set babyRec_monthLastRec = 'N' where babyData_uid = @babyData_uid and babyRec_recYear = @babyRec_recYear and babyRec_recMonth = @babyRec_recMonth", new { babyData_uid = babyData_uid, babyRec_recYear = babyRec.babyRec_recYear, babyRec_recMonth = babyRec.babyRec_recMonth }); + conn.Execute("update babyRec set babyRec_monthLastRec = 'N' where babyData_uid = @babyData_uid and babyRec_recYear = @babyRec_recYear and babyRec_recMonth = @babyRec_recMonth and babyRec_months = @babyRec_months", new { babyData_uid = babyData_uid, babyRec_recYear = babyRec.babyRec_recYear, babyRec_recMonth = babyRec.babyRec_recMonth, babyRec_months = babyRec.babyRec_months }); - babyRec.line_uid = babyData_uid; + babyRec.line_uid = line_uid; conn.Update(babyRec); objRet.ret = "yes"; diff --git a/webapi/lineLogin.ashx.cs b/webapi/lineLogin.ashx.cs index 1f6e4e3..e2e85da 100644 --- a/webapi/lineLogin.ashx.cs +++ b/webapi/lineLogin.ashx.cs @@ -73,6 +73,7 @@ namespace abbott_2024_event.webapi foreach (babyData data in babyDatas) { baby baby = new baby(); + baby.babyData_uid = data.babyData_uid; baby.babyData_name = data.babyData_name; baby.babyData_gender = data.babyData_sexual; baby.babyData_birthday = data.babyData_birthday.ToString("yyyy/MM/dd"); @@ -98,6 +99,7 @@ namespace abbott_2024_event.webapi public class baby { + public string babyData_uid { get; set; } = ""; public string babyData_birthday { get; set; } = ""; public string babyData_name { get; set; } = ""; public string babyData_gender { get; set; } = "M";