2025-03-28 09:49:56 +08:00

63 lines
2.3 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Services;
using Transmission.SDK;
namespace TransferService
{
/// <summary>
/// Service 的摘要说明
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消注释以下行。
[System.Web.Script.Services.ScriptService]
public class Service : System.Web.Services.WebService
{
#region ->
/// <summary>
/// 数据上传
/// </summary>
/// <param name="code"></param>
/// <param name="tableName"></param>
/// <param name="jsonString"></param>
/// <returns></returns>
[WebMethod]
public string UploadTableData(string code, string tableName, string jsonString, string orderString = "")
{
string _OracleConnStr = ConfigurationManager.AppSettings[tableName.Split('.')[0]];
System.Console.WriteLine(tableName + ":" + _OracleConnStr);
OracleHelper _OracleHelper;
try
{
_OracleHelper = new OracleHelper(_OracleConnStr.Split(',')[0], _OracleConnStr.Split(',')[4],
_OracleConnStr.Split(',')[1], _OracleConnStr.Split(',')[2], _OracleConnStr.Split(',')[3]);
}
catch
{
_OracleHelper = new OracleHelper(_OracleConnStr.Split(',')[0], _OracleConnStr.Split(',')[1],
_OracleConnStr.Split(',')[2], _OracleConnStr.Split(',')[3]);
}
System.Console.WriteLine(tableName + ":" + _OracleHelper.ConnString);
if (!string.IsNullOrEmpty(orderString))
{
try
{
return Method.UploadMethod.DataUploading(_OracleHelper, tableName, jsonString);
}
catch { }
}
else
{
return "{\"error\": -1 ,\"msg\": \"获取数据上传失败JSON参数解析异常\",\"rows\":[]}";
}
return "{\"error\": -1 ,\"msg\": \"获取数据上传失败:发生异常!\",\"rows\":[]}";
}
#endregion
}
}