Commit 4d7ea374 authored by solho's avatar solho

fix:revert code

feat:首頁新增版本號 版本日期顯示
parent 40f75f8d
......@@ -24,46 +24,6 @@ namespace WebAPI.Controllers
response = new CommonResponseMsg();
connString = ConfigurationManager.ConnectionStrings["eflow_cur"].ConnectionString;
}
[Route("Get_CustomerListTP")]
[CorsHandle]
[HttpPost]
public HttpResponseMessage Get_CustomerListTP(ParamModel param)
{
if (param != null && param.Input != null && !string.IsNullOrWhiteSpace((param.Input.ToString())))
{
string input = param.Input.ToString();
try
{
JObject obj_input = JObject.Parse(input.ToString());
using (SqlConnection Conn = new SqlConnection(connString))
{
SqlCommand cmd = new SqlCommand("", Conn)
{
CommandText = @"select a.customer_name,a.customer_id,case when isnull(b.customer_id,'')!='' then 1 else 0 end isSelect from c_customer a
left join (select customer_id from essen_request_info a1 where a1.request_id=@request_id) b on a.customer_id=b.customer_id
where a.is_enabled=1 "
};
cmd.Parameters.AddWithValue("@request_id", obj_input["request_id"] ==null ?"" :obj_input["request_id"].ToString());
DataTable dt = SqlToDt(cmd);
response.Msg = JsonConvert.SerializeObject(dt);
response.Code = "1";
}
}
catch (Exception e)
{
response.Code = "0";
response.Msg = "Exception:" + e.StackTrace;
}
}
else
{
response.Code = "0";
response.Msg = "no input or format error";
}
result.Content = new StringContent(JsonConvert.SerializeObject(response), System.Text.Encoding.UTF8, "application/json");
return result;
}
[Route("Get_CustomerList")]
[CorsHandle]
[HttpPost]
......@@ -74,16 +34,15 @@ namespace WebAPI.Controllers
string input = param.Input.ToString();
try
{
JObject obj_input = JObject.Parse(input.ToString());
using (SqlConnection Conn = new SqlConnection(connString))
{
SqlCommand cmd = new SqlCommand("", Conn)
{
CommandText = @"select a.customer_name,a.customer_id,case when isnull(b.customer_id,'')!='' then 1 else 0 end isSelect from c_customer a
left join (select customer_id from essen_customer a1 where a1.request_customer_id=@request_id) b on a.customer_id=b.customer_id
CommandText = @"
select customer_name,customer_id from c_customer a
where a.is_enabled=1 "
};
cmd.Parameters.AddWithValue("@request_id", obj_input["request_id"] == null ? "" : obj_input["request_id"].ToString());
DataTable dt = SqlToDt(cmd);
response.Msg = JsonConvert.SerializeObject(dt);
response.Code = "1";
......@@ -104,53 +63,9 @@ namespace WebAPI.Controllers
result.Content = new StringContent(JsonConvert.SerializeObject(response), System.Text.Encoding.UTF8, "application/json");
return result;
}
[Route("Update_CustomerListTP")]
[CorsHandle]
[HttpPost]
public HttpResponseMessage Update_CustomerListTP(ParamModel param)
{
if (param != null && param.Input != null && !string.IsNullOrWhiteSpace((param.Input.ToString())))
{
string input = param.Input.ToString();
JObject obj_input = JObject.Parse(input.ToString());
try
{
using (SqlConnection Conn = new SqlConnection(connString))
{
SqlCommand cmd = new SqlCommand("", Conn)
{
CommandText = @"MERGE INTO essen_request_info WITH(HOLDLOCK) as target USING(
select @request_id as request_id, @customer_id as customer_id ) as source (request_id,customer_id)
on(target.request_id = source.request_id )
WHEN MATCHED THEN UPDATE SET customer_id = @customer_id
WHEN NOT MATCHED THEN INSERT(request_id,customer_id)
VALUES(@request_id,@customer_id );"
};
cmd.Parameters.AddWithValue("@customer_id", obj_input["customer_id"].ToString());
cmd.Parameters.AddWithValue("@request_id", obj_input["request_id"].ToString());
DataTable dt = SqlToDt(cmd);
response.Msg = JsonConvert.SerializeObject(dt);
response.Code = "1";
}
}
catch (Exception e)
{
response.Code = "0";
response.Msg = "Exception:" + e.StackTrace;
}
}
else
{
response.Code = "0";
response.Msg = "no input or format error";
}
result.Content = new StringContent(JsonConvert.SerializeObject(response), System.Text.Encoding.UTF8, "application/json");
return result;
}
[Route("Update_CustomerList")]
[Route("Update_CustomerListTP")]
[CorsHandle]
[HttpPost]
public HttpResponseMessage Update_CustomerList(ParamModel param)
......@@ -165,12 +80,11 @@ namespace WebAPI.Controllers
{
SqlCommand cmd = new SqlCommand("", Conn)
{
CommandText = @"MERGE INTO essen_customer WITH(HOLDLOCK) as target USING(
select @request_id as request_id, @customer_id as customer_id ) as source (request_id,customer_id)
CommandText = @"MERGE INTO essen_request_info WITH(HOLDLOCK) as target USING(select * from essen_request_info a where a.request_id=@request_id ) as source (request_id,customer_id)
on(target.request_id = source.request_id )
WHEN MATCHED THEN UPDATE SET customer_id = @customer_id
WHEN NOT MATCHED THEN INSERT(request_id,customer_id)
VALUES(@request_id,@customer_id );"
VALUES(@request_id,@customer_id )"
};
......@@ -197,10 +111,10 @@ namespace WebAPI.Controllers
return result;
}
[Route("Delete_CustomerListTP")]
[Route("Update_CustomerList")]
[CorsHandle]
[HttpPost]
public HttpResponseMessage Delete_CustomerListTP(ParamModel param)
public HttpResponseMessage Update_CustomerList2(ParamModel param)
{
if (param != null && param.Input != null && !string.IsNullOrWhiteSpace((param.Input.ToString())))
{
......@@ -212,9 +126,14 @@ namespace WebAPI.Controllers
{
SqlCommand cmd = new SqlCommand("", Conn)
{
CommandText = @"delete from essen_request_info where request_id=@request_id;"
CommandText = @"MERGE INTO essen_customer WITH(HOLDLOCK) as target USING(select * from essen_customer a where a.customer_id=@customer_id) as source (customer_id,request_customer_id)
on(target.customer_id = source.customer_id )
WHEN MATCHED THEN UPDATE SET request_customer_id = @request_customer_id
WHEN NOT MATCHED THEN INSERT(customer_id,request_customer_id)
VALUES(@customer_id,@request_customer_id)"
};
cmd.Parameters.AddWithValue("@request_id", obj_input["request_id"].ToString());
cmd.Parameters.AddWithValue("@customer_id", obj_input["customer_id"].ToString());
cmd.Parameters.AddWithValue("@request_customer_id", obj_input["request_customer_id"].ToString());
DataTable dt = SqlToDt(cmd);
response.Msg = JsonConvert.SerializeObject(dt);
response.Code = "1";
......
......@@ -11,6 +11,12 @@ namespace WebAPI.Controllers
public ActionResult Index()
{
ViewBag.Title = "Home Page";
Version version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
DateTime buildDate = DateTime.Now
.AddDays(version.Build).AddSeconds(version.Revision * 2);
string displayableVersion = $"{version} ({buildDate})";
ViewBag.version = displayableVersion;
return View();
}
}
......
......@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
//
// 您可以指定所有值或預設修訂和組件數目
// 指定為預設值:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.1.*")]
[assembly: AssemblyFileVersion("1.0.0.0")]
......@@ -32,6 +32,7 @@
@RenderBody()
<hr />
<footer>
版本:@ViewBag.version
<p>&copy; @DateTime.Now.Year - 我的 ASP.NET 應用程式</p>
</footer>
</div>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment