master
dk96 2024-12-09 17:09:47 +08:00
parent 102d095c06
commit 69f0a5185c
7 changed files with 22 additions and 8 deletions

View File

@ -47,8 +47,16 @@ public static class globalClass
years = months / 12;
months = months % 12;
if (months > 0)
{
return years.ToString() + "歲" + months.ToString() + "月";
}
else
{
return years.ToString() + "歲";
}
}
public static int MonthDiff(DateTime self, DateTime target)
{

Binary file not shown.

View File

@ -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" %>

View File

@ -94,7 +94,7 @@ namespace abbott_2024_event.webapi
return;
}
if (line_uid != null) {
if (line_uid != "") {
lineUser lineUser = conn.QueryFirstOrDefault<lineUser>("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<lenHeiTable>("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<lenHeiTable>("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

View File

@ -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";

View File

@ -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<babyRec>("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>(babyRec);
objRet.ret = "yes";

View File

@ -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";