update
parent
8029f50dd9
commit
0873e20a38
|
|
@ -13213,6 +13213,12 @@
|
|||
<Compile Include="webapi\babyData.ashx.cs">
|
||||
<DependentUpon>babyData.ashx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="webapi\babyList.ashx.cs">
|
||||
<DependentUpon>babyList.ashx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="webapi\lineLogin.ashx.cs">
|
||||
<DependentUpon>lineLogin.ashx</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="App_Data\" />
|
||||
|
|
@ -17688,6 +17694,8 @@
|
|||
<DependentUpon>Web.config</DependentUpon>
|
||||
</None>
|
||||
<Content Include="webapi\babyData.ashx" />
|
||||
<Content Include="webapi\babyList.ashx" />
|
||||
<Content Include="webapi\lineLogin.ashx" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
<%@ WebHandler Language="C#" CodeBehind="babyList.ashx.cs" Class="abbott_2024_event.webapi.babyList" %>
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Runtime.Serialization.Json;
|
||||
using System.Web.SessionState;
|
||||
using Dapper;
|
||||
using Dapper.Contrib.Extensions;
|
||||
using System.Data.SqlClient;
|
||||
|
||||
namespace abbott_2024_event.webapi
|
||||
{
|
||||
/// <summary>
|
||||
/// babyList 的摘要描述
|
||||
/// </summary>
|
||||
public class babyList : IHttpHandler
|
||||
{
|
||||
|
||||
SqlConnection conn = new SqlConnection(globalClass.appsettings("DBConnectionString"));
|
||||
public void ProcessRequest(HttpContext context)
|
||||
{
|
||||
result objRet = new result();
|
||||
DataContractJsonSerializer json = new DataContractJsonSerializer(objRet.GetType());
|
||||
context.Response.ContentType = "application/json;charset=utf-8";
|
||||
|
||||
string line_uid = (context.Request["line_uid"] == null) ? "" : context.Request["line_uid"].ToString();
|
||||
|
||||
if (line_uid == "") {
|
||||
objRet.ret = "no";
|
||||
objRet.err_code = "2001";
|
||||
objRet.message = "line_uid為空字串!";
|
||||
json.WriteObject(context.Response.OutputStream, objRet);
|
||||
}
|
||||
|
||||
lineUser lineUser = conn.QueryFirstOrDefault<lineUser>("select * from lineUser where line_uid = @line_uid", new { line_uid = line_uid });
|
||||
|
||||
if (lineUser == null) {
|
||||
objRet.ret = "no";
|
||||
objRet.err_code = "2002";
|
||||
objRet.message = "無此line_uid的資料!";
|
||||
json.WriteObject(context.Response.OutputStream, objRet);
|
||||
}
|
||||
|
||||
List<babyData> babyDatas = conn.Query<babyData>("select * from babyData where line_uid = @line_uid", new { line_uid = line_uid }).ToList();
|
||||
|
||||
foreach (babyData data in babyDatas) {
|
||||
baby baby = new baby();
|
||||
baby.babyData_name = data.babyData_name;
|
||||
baby.babyData_gender = data.babyData_sexual;
|
||||
baby.babyData_birthday = data.babyData_birthday.ToString("yyyy/MM/dd");
|
||||
objRet.babyList.Add(baby);
|
||||
}
|
||||
|
||||
objRet.ret = "yes";
|
||||
|
||||
json.WriteObject(context.Response.OutputStream, objRet);
|
||||
}
|
||||
|
||||
public class result
|
||||
{
|
||||
public string ret = "no";
|
||||
public string err_code = "0000";
|
||||
public string message = "";
|
||||
public List<baby> babyList = new List<baby>();
|
||||
}
|
||||
|
||||
public class baby
|
||||
{
|
||||
public string babyData_birthday { get; set; } = "";
|
||||
public string babyData_name { get; set; } = "";
|
||||
public string babyData_gender { get; set; } = "M";
|
||||
|
||||
}
|
||||
|
||||
public bool IsReusable
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
<%@ WebHandler Language="C#" CodeBehind="lineLogin.ashx.cs" Class="abbott_2024_event.webapi.lineLogin" %>
|
||||
|
|
@ -0,0 +1,111 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Runtime.Serialization.Json;
|
||||
using System.Web.SessionState;
|
||||
using Dapper;
|
||||
using Dapper.Contrib.Extensions;
|
||||
using System.Data.SqlClient;
|
||||
|
||||
namespace abbott_2024_event.webapi
|
||||
{
|
||||
/// <summary>
|
||||
/// lineLogin 的摘要描述
|
||||
/// </summary>
|
||||
public class lineLogin : IHttpHandler
|
||||
{
|
||||
SqlConnection conn = new SqlConnection(globalClass.appsettings("DBConnectionString"));
|
||||
|
||||
public void ProcessRequest(HttpContext context)
|
||||
{
|
||||
result objRet = new result();
|
||||
DataContractJsonSerializer json = new DataContractJsonSerializer(objRet.GetType());
|
||||
context.Response.ContentType = "application/json;charset=utf-8";
|
||||
|
||||
string line_uid = (context.Request["line_uid"] == null) ? "" : context.Request["line_uid"].ToString();
|
||||
string line_displayName = (context.Request["line_displayname"] == null) ? "" : context.Request["line_displayname"].ToString();
|
||||
|
||||
if (line_uid == "")
|
||||
{
|
||||
objRet.ret = "no";
|
||||
objRet.err_code = "2001";
|
||||
objRet.message = "line_uid或line_displayname為空字串!";
|
||||
json.WriteObject(context.Response.OutputStream, objRet);
|
||||
}
|
||||
|
||||
if (line_displayName == "")
|
||||
{
|
||||
objRet.ret = "no";
|
||||
objRet.err_code = "2001";
|
||||
objRet.message = "line_uid或line_displayname為空字串!";
|
||||
json.WriteObject(context.Response.OutputStream, objRet);
|
||||
}
|
||||
|
||||
lineUser lineUser = conn.QueryFirstOrDefault<lineUser>("select * from lineUser where line_uid = @line_uid", new { line_uid = line_uid });
|
||||
|
||||
if (lineUser == null)
|
||||
{
|
||||
lineUser.lineUser_uid = globalClass.CreateRandomCode(32);
|
||||
lineUser.line_uid = line_uid;
|
||||
lineUser.line_displayName = line_displayName;
|
||||
|
||||
conn.Insert<lineUser>(lineUser);
|
||||
|
||||
objRet.ret = "yes";
|
||||
objRet.isFirst = "Y";
|
||||
|
||||
json.WriteObject(context.Response.OutputStream, objRet);
|
||||
}
|
||||
|
||||
if (lineUser != null) {
|
||||
if (lineUser.line_displayName != line_displayName) {
|
||||
lineUser.line_displayName= line_displayName;
|
||||
lineUser.lineUser_modifydate = DateTime.Now;
|
||||
conn.Update<lineUser>(lineUser);
|
||||
}
|
||||
|
||||
List<babyData> babyDatas = conn.Query<babyData>("select * from babyData where line_uid = @line_uid", new { line_uid = line_uid }).ToList();
|
||||
|
||||
foreach (babyData data in babyDatas)
|
||||
{
|
||||
baby baby = new baby();
|
||||
baby.babyData_name = data.babyData_name;
|
||||
baby.babyData_gender = data.babyData_sexual;
|
||||
baby.babyData_birthday = data.babyData_birthday.ToString("yyyy/MM/dd");
|
||||
objRet.babyList.Add(baby);
|
||||
}
|
||||
objRet.isFirst = "N";
|
||||
objRet.ret = "yes";
|
||||
json.WriteObject(context.Response.OutputStream, objRet);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class result
|
||||
{
|
||||
public string ret = "no";
|
||||
public string err_code = "0000";
|
||||
public string message = "";
|
||||
public string isFirst = "N";
|
||||
public List<baby> babyList = new List<baby>();
|
||||
}
|
||||
|
||||
public class baby
|
||||
{
|
||||
public string babyData_birthday { get; set; } = "";
|
||||
public string babyData_name { get; set; } = "";
|
||||
public string babyData_gender { get; set; } = "M";
|
||||
|
||||
}
|
||||
|
||||
public bool IsReusable
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue