Commit ee6f9d0d authored by charleslee's avatar charleslee

add tool

parent f1114459
...@@ -11,6 +11,7 @@ using System.Net.Http; ...@@ -11,6 +11,7 @@ using System.Net.Http;
using System.Text; using System.Text;
using System.Web; using System.Web;
using System.Web.Http; using System.Web.Http;
using System.Web.Http.Cors;
using WebAPI.Models; using WebAPI.Models;
using static WebAPI.Models.CommonModel; using static WebAPI.Models.CommonModel;
...@@ -35,6 +36,8 @@ namespace WebAPI.Controllers ...@@ -35,6 +36,8 @@ namespace WebAPI.Controllers
/// <param name="Get_cur_his_id"></param> /// <param name="Get_cur_his_id"></param>
/// <returns></returns> /// <returns></returns>
[Route("Get_cur_his")] [Route("Get_cur_his")]
[EnableCors(origins: "http://120.78.73.107:8888,https://ipeasy.purplevineip.com,https://ipeasy.essenptl.com",
headers: "*", methods: "*", SupportsCredentials = true)]
[HttpPost] [HttpPost]
[HttpGet] [HttpGet]
public MessageList Get_cur_his(String Get_cur_his_id) public MessageList Get_cur_his(String Get_cur_his_id)
...@@ -124,6 +127,8 @@ namespace WebAPI.Controllers ...@@ -124,6 +127,8 @@ namespace WebAPI.Controllers
/// <param name="trids"></param> /// <param name="trids"></param>
/// <returns></returns> /// <returns></returns>
[Route("Download_cur_hiss_Excel")] [Route("Download_cur_hiss_Excel")]
[EnableCors(origins: "http://120.78.73.107:8888,https://ipeasy.purplevineip.com,https://ipeasy.essenptl.com",
headers: "*", methods: "*", SupportsCredentials = true)]
[HttpPost] [HttpPost]
[HttpGet] [HttpGet]
public HttpResponse Download_cur_hiss_Excel(String trids) public HttpResponse Download_cur_hiss_Excel(String trids)
...@@ -331,6 +336,8 @@ namespace WebAPI.Controllers ...@@ -331,6 +336,8 @@ namespace WebAPI.Controllers
/// <param name="trids"></param> /// <param name="trids"></param>
/// <returns></returns> /// <returns></returns>
[Route("Get_cur_hiss")] [Route("Get_cur_hiss")]
[EnableCors(origins: "http://120.78.73.107:8888,https://ipeasy.purplevineip.com,https://ipeasy.essenptl.com",
headers: "*", methods: "*", SupportsCredentials = true)]
[HttpPost] [HttpPost]
[HttpGet] [HttpGet]
//[EnableCors(origins: "*", headers: "*", methods: "*")] //[EnableCors(origins: "*", headers: "*", methods: "*")]
...@@ -430,6 +437,8 @@ namespace WebAPI.Controllers ...@@ -430,6 +437,8 @@ namespace WebAPI.Controllers
} }
[Route("Get_cur_hiss_test")] [Route("Get_cur_hiss_test")]
[EnableCors(origins: "http://120.78.73.107:8888,https://ipeasy.purplevineip.com,https://ipeasy.essenptl.com",
headers: "*", methods: "*", SupportsCredentials = true)]
[HttpPost] [HttpPost]
[HttpGet] [HttpGet]
[HttpOptions] [HttpOptions]
......
using ExcelDataReader;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Web;
using System.Web.Http;
using System.Web.Http.Cors;
using WebAPI.Models;
using WebAPI.Tool;
using static WebAPI.Models.CommonModel;
namespace WebAPI.Controllers
{
public class DictionaryController : ApiController
{
public DictionaryController()
{
}
#region 獲取字典訊息
[Route("Dictionary")]
[CorsHandle]
[HttpGet]
public HttpResponseMessage GetDictionary(string name, string fields = null)
{
HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK);
CommonResponseMsg response = new CommonResponseMsg();
try
{
if (string.IsNullOrWhiteSpace(name))
{
response.Code = "0";
response.Msg = "no name";
}
else
{
SqlServerHelper sql_server_helper = new SqlServerHelper();
string sql_fields = "";
if(string.IsNullOrWhiteSpace(fields))
{
sql_fields += "*";
}
else
{
sql_fields += fields.Trim();
}
DataTable dt = sql_server_helper.GetTable("select " + sql_fields + " FROM s_dictionary where dictionary_name = '" + name + "' order by seq");
response.Code = "1";
response.Msg = dt;
}
}
catch (Exception e)
{
response.Code = "0";
response.Msg = e.Message;
}
result.Content = new StringContent(JsonConvert.SerializeObject(response), System.Text.Encoding.UTF8, "application/json");
return result;
}
#endregion
}
}
\ No newline at end of file
...@@ -254,7 +254,7 @@ namespace WebAPI.Controllers ...@@ -254,7 +254,7 @@ namespace WebAPI.Controllers
if (drTemp != null) ids.Add("config_type", drTemp["config_type"].ToString()); if (drTemp != null) ids.Add("config_type", drTemp["config_type"].ToString());
else else
{ {
ids.Add("config_type", "AD"); ids.Add("config_type", "");
if (!String.IsNullOrWhiteSpace(FieldValue)) Noticemsg += "(無" + FieldName + ":" + FieldValue + "),"; if (!String.IsNullOrWhiteSpace(FieldValue)) Noticemsg += "(無" + FieldName + ":" + FieldValue + "),";
} }
#endregion #endregion
......
using ExcelDataReader;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Web;
using System.Web.Http;
using System.Web.Http.Cors;
using WebAPI.Models;
using WebAPI.Tool;
using static WebAPI.Models.CommonModel;
namespace WebAPI.Controllers
{
public class FileController : ApiController
{
public FileController()
{
}
#region 獲取文件信息
[Route("File/confidential")]
[CorsHandle]
[HttpPost]
public HttpResponseMessage GetInventor(ParamModel param)
{
HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK);
CommonResponseMsg response = new CommonResponseMsg();
if (param != null && param.Input != null && !string.IsNullOrWhiteSpace((param.Input.ToString())))
{
JObject obj_input = JObject.Parse(param.Input.ToString());
try
{
SqlServerHelper sql_server_helper = new SqlServerHelper();
List<string> list_condition = new List<string>();
foreach (var jt in (JObject)obj_input["condition"])
{
if (jt.Value.Type == JTokenType.Integer || jt.Value.Type == JTokenType.Float)
{
list_condition.Add(jt.Key + " = " + jt.Value);
}
else
{
list_condition.Add(jt.Key + " = '" + jt.Value + "'");
}
}
if (list_condition.Count > 0)
{
//string sql = "UPDATE dbo.p_proc_info SET " + string.Join(",", list_fields.ToArray()) + " where proc_id = '" + id + "'";
string sql = string.Format(@"SELECT {0} FROM dbo.p_case_info pci
LEFT JOIN dbo.p_proc_info ppi ON ppi.case_id = pci.case_id
LEFT JOIN dbo.p_file_list pfl ON pfl.obj_id = ppi.proc_id
LEFT JOIN dbo.i_file_desc ifd ON pfl.file_desc_id = ifd.file_desc_id
WHERE {1} and ifd.file_desc_zh_tw LIKE '%保密%'", obj_input["field"].ToString(), string.Join(" and ", list_condition.ToArray()));
DataTable dt_inventor = sql_server_helper.GetTable(sql);
response.Code = "1";
response.Msg = dt_inventor;
}
else
{
response.Code = "0";
response.Msg = "no input";
}
}
catch (Exception e)
{
response.Code = "0";
response.Msg = e.Message;
}
}
else
{
response.Code = "0";
response.Msg = "no input";
}
result.Content = new StringContent(JsonConvert.SerializeObject(response), System.Text.Encoding.UTF8, "application/json");
return result;
}
#endregion
}
}
\ No newline at end of file
using ExcelDataReader;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Web;
using System.Web.Http;
using System.Web.Http.Cors;
using WebAPI.Models;
using WebAPI.Tool;
using static WebAPI.Models.CommonModel;
namespace WebAPI.Controllers
{
public class InventorController : ApiController
{
public InventorController()
{
}
#region 獲取發明人信息
[Route("Inventor")]
[CorsHandle]
[HttpPost]
public HttpResponseMessage GetInventor(ParamModel param)
{
HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK);
CommonResponseMsg response = new CommonResponseMsg();
if (param != null && param.Input != null && !string.IsNullOrWhiteSpace((param.Input.ToString())))
{
JObject obj_input = JObject.Parse(param.Input.ToString());
try
{
SqlServerHelper sql_server_helper = new SqlServerHelper();
List<string> list_condition = new List<string>();
foreach (var jt in (JObject)obj_input["condition"])
{
if (jt.Value.Type == JTokenType.Integer || jt.Value.Type == JTokenType.Float)
{
list_condition.Add(jt.Key + " = " + jt.Value);
}
else
{
list_condition.Add(jt.Key + " = '" + jt.Value + "'");
}
}
if (list_condition.Count > 0)
{
//string sql = "UPDATE dbo.p_proc_info SET " + string.Join(",", list_fields.ToArray()) + " where proc_id = '" + id + "'";
string sql = string.Format(@"SELECT {0} FROM dbo.p_case_info pci
LEFT JOIN dbo.p_inventor_list pil ON pci.case_id = pil.obj_id
LEFT JOIN dbo.i_inventor ii ON pil.inventor_id = ii.inventor_id
WHERE {1}" , obj_input["field"].ToString(), string.Join(" and ", list_condition.ToArray()));
DataTable dt_inventor = sql_server_helper.GetTable(sql);
response.Code = "1";
response.Msg = dt_inventor;
}
else
{
response.Code = "0";
response.Msg = "no input";
}
}
catch (Exception e)
{
response.Code = "0";
response.Msg = e.Message;
}
}
else
{
response.Code = "0";
response.Msg = "no input";
}
result.Content = new StringContent(JsonConvert.SerializeObject(response), System.Text.Encoding.UTF8, "application/json");
return result;
}
#endregion
}
}
\ No newline at end of file
using ExcelDataReader;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Web;
using System.Web.Http;
using System.Web.Http.Cors;
using WebAPI.Models;
using WebAPI.Tool;
using static WebAPI.Models.CommonModel;
namespace WebAPI.Controllers
{
public class ProcInfoController : ApiController
{
public ProcInfoController()
{
}
#region 獲取處理事項訊息
[Route("ProcInfo")]
[CorsHandle]
[HttpGet]
public HttpResponseMessage GetProcInfo(string id, string fields)
{
HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK);
CommonResponseMsg response = new CommonResponseMsg();
try
{
if (string.IsNullOrWhiteSpace(id))
{
response.Code = "0";
response.Msg = "no id";
}
else
{
SqlServerHelper sql_server_helper = new SqlServerHelper();
string sql_fields = "";
if(string.IsNullOrWhiteSpace(fields))
{
sql_fields += "*";
}
else
{
sql_fields += fields.Trim();
}
DataTable dt = sql_server_helper.GetTable("select " + sql_fields + " FROM dbo.p_proc_info where proc_id = '" + id + "'");
response.Code = "1";
response.Msg = dt;
}
}
catch (Exception e)
{
response.Code = "0";
response.Msg = e.Message;
}
result.Content = new StringContent(JsonConvert.SerializeObject(response), System.Text.Encoding.UTF8, "application/json");
return result;
}
#endregion
#region 更新處理事項訊息
[Route("ProcInfo")]
[CorsHandle]
[HttpPut]
public HttpResponseMessage UpdateProcInfo(string id, [FromBody]dynamic input)
{
HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK);
string a = input.ToString();
CommonResponseMsg response = new CommonResponseMsg();
try
{
if (string.IsNullOrWhiteSpace((id)))
{
response.Code = "0";
response.Msg = "no id";
}
else
{
SqlServerHelper sql_server_helper = new SqlServerHelper();
JObject obj_input = JObject.Parse(input.ToString());
List<string> list_fields = new List<string>();
foreach (var jt in obj_input)
{
if (jt.Value.Type == JTokenType.Integer || jt.Value.Type == JTokenType.Float)
{
list_fields.Add(jt.Key + " = " + jt.Value);
}
else
{
list_fields.Add(jt.Key + " = '" + jt.Value + "'");
}
}
if (list_fields.Count > 0)
{
string sql = "UPDATE dbo.p_proc_info SET " + string.Join(",", list_fields.ToArray()) + " where proc_id = '" + id + "'";
int updated_count = sql_server_helper.ExecuteSqlCommand(sql);
response.Code = "1";
response.Msg = updated_count;
}
else
{
response.Code = "0";
response.Msg = "no input";
}
}
}
catch (Exception e)
{
response.Code = "0";
response.Msg = e.Message;
}
result.Content = new StringContent(JsonConvert.SerializeObject(response), System.Text.Encoding.UTF8, "application/json");
return result;
}
#endregion
#region 更新處理事項訊息
[Route("ProcInfo")]
[CorsHandle]
[HttpPost]
public HttpResponseMessage UpdateProcInfo_post(ParamModel param)
{
HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK);
CommonResponseMsg response = new CommonResponseMsg();
string input = param.Input.ToString();
if (string.IsNullOrWhiteSpace((input)))
{
response.Code = "0";
response.Msg = "no input";
}
else
{
JObject obj_input = JObject.Parse(input.ToString());
try
{
string id = Common.isJTokenNull(obj_input["id"], "").ToString();
if (string.IsNullOrWhiteSpace(id))
{
response.Code = "0";
response.Msg = "no id";
}
else
{
SqlServerHelper sql_server_helper = new SqlServerHelper();
List<string> list_fields = new List<string>();
foreach (var jt in obj_input)
{
if (jt.Key != "id")
{
if (jt.Value.Type == JTokenType.Integer || jt.Value.Type == JTokenType.Float)
{
list_fields.Add(jt.Key + " = " + jt.Value);
}
else
{
list_fields.Add(jt.Key + " = '" + jt.Value + "'");
}
}
}
if (list_fields.Count > 0)
{
string sql = "UPDATE dbo.p_proc_info SET " + string.Join(",", list_fields.ToArray()) + " where proc_id = '" + id + "'";
int updated_count = sql_server_helper.ExecuteSqlCommand(sql);
response.Code = "1";
response.Msg = updated_count;
}
else
{
response.Code = "0";
response.Msg = "no input";
}
}
}
catch (Exception e)
{
response.Code = "0";
response.Msg = e.Message;
}
}
result.Content = new StringContent(JsonConvert.SerializeObject(response), System.Text.Encoding.UTF8, "application/json");
return result;
}
#endregion
}
}
\ No newline at end of file
using ExcelDataReader;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Web;
using System.Web.Http;
using System.Web.Http.Cors;
using WebAPI.Models;
using WebAPI.Tool;
using static WebAPI.Models.CommonModel;
namespace WebAPI.Controllers
{
public class SubProcInfoController : ApiController
{
public SubProcInfoController()
{
}
#region 獲取主管派點申請
[Route("SubProcInfo/SuggestPoints")]
[CorsHandle]
[HttpGet]
public HttpResponseMessage GetSuggestPoints(string id)
{
HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK);
CommonResponseMsg response = new CommonResponseMsg();
try
{
if (string.IsNullOrWhiteSpace(id))
{
response.Code = "0";
response.Msg = "no id";
}
else
{
SqlServerHelper sql_server_helper = new SqlServerHelper();
DataTable dt = sql_server_helper.GetTable("select * FROM dbo.esn_OthData where oth_ID = '" + id + "'");
response.Code = "1";
response.Msg = dt;
}
}
catch (Exception e)
{
response.Code = "0";
response.Msg = e.Message;
}
result.Content = new StringContent(JsonConvert.SerializeObject(response), System.Text.Encoding.UTF8, "application/json");
return result;
}
#endregion
#region 更新主管派點申請
[Route("SubProcInfo/SuggestPoints")]
[CorsHandle]
[HttpPost]
public HttpResponseMessage UpdateProcInfo_post(ParamModel param)
{
HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK);
CommonResponseMsg response = new CommonResponseMsg();
string input = param.Input.ToString();
if (string.IsNullOrWhiteSpace((input)))
{
response.Code = "0";
response.Msg = "no input";
}
else
{
JObject obj_input = JObject.Parse(input.ToString());
try
{
string id = Common.isJTokenNull(obj_input["oth_ID"], "").ToString();
if (string.IsNullOrWhiteSpace(id))
{
response.Code = "0";
response.Msg = "no id";
}
else
{
SqlServerHelper sql_server_helper = new SqlServerHelper();
if (obj_input.Count>0)
{
string sql = string.Format(@"UPDATE dbo.esn_OthData
SET FldValue = '{1}', FldMemo = '{2}', oth_Status = 'U', updateUser = '{3}', update_time = GETDATE()
WHERE oth_ID = '{0}';
IF(@@ROWCOUNT = 0)
BEGIN
INSERT INTO dbo.esn_OthData (oth_ID, FldName, FldValue, FldMemo, oth_Status, updateUser, update_time)
VALUES('{0}', 'SuggestPoints', '{1}', '{2}', 'I', '{3}', GETDATE())
END;", id, obj_input["FldValue"].ToString(), obj_input["FldMemo"].ToString(), obj_input["updateUser"].ToString());
//string sql = @"UPDATE dbo.p_proc_info SET " + string.Join(",", list_fields.ToArray()) + " where proc_id = '" + id + "'";
int updated_count = sql_server_helper.ExecuteSqlCommand(sql);
response.Code = "1";
response.Msg = updated_count;
}
else
{
response.Code = "0";
response.Msg = "no input";
}
}
}
catch (Exception e)
{
response.Code = "0";
response.Msg = e.Message;
}
}
result.Content = new StringContent(JsonConvert.SerializeObject(response), System.Text.Encoding.UTF8, "application/json");
return result;
}
#endregion
}
}
\ No newline at end of file
...@@ -19,5 +19,13 @@ namespace WebAPI ...@@ -19,5 +19,13 @@ namespace WebAPI
RouteConfig.RegisterRoutes(RouteTable.Routes); RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles); BundleConfig.RegisterBundles(BundleTable.Bundles);
} }
protected void Application_BeginRequest()
{
if (Request.Headers.AllKeys.Contains("Origin") && Request.HttpMethod == "OPTIONS")
{
Response.Flush();
}
}
} }
} }
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace WebAPI.Models
{
[Serializable]
public class CommonResponseMsg
{
private string code = "0";
public string Code
{
get { return code; }
set { code = value; }
}
private object msg ="Failed";
public object Msg
{
get { return this.msg; }
set { this.msg = value; }
}
private string extraInfo="";
public string ExtraInfo
{
get { return this.extraInfo; }
set { this.extraInfo = value; }
}
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace WebAPI.Models
{
[Serializable]
public class ParamModel
{
private object input = "";
public object Input
{
get { return this.input; }
set { this.input = value; }
}
}
}
\ No newline at end of file
using MySql.Data.MySqlClient;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Data;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Text;
using System.Web;
using WebAPI.Models;
namespace WebAPI.Tool
{
public class Common
{
static public DataTable LinqQueryToDataTable<T>(IEnumerable<T> query)
{
DataTable tbl = new DataTable();
PropertyInfo[] props = null;
foreach (T item in query)
{
if (props == null) //尚未初始化
{
Type t = item.GetType();
props = t.GetProperties();
foreach (PropertyInfo pi in props)
{
Type colType = pi.PropertyType;
//針對Nullable<>特別處理
if (colType.IsGenericType
&& colType.GetGenericTypeDefinition() == typeof(Nullable<>))
colType = colType.GetGenericArguments()[0];
//建立欄位
tbl.Columns.Add(pi.Name, colType);
}
}
DataRow row = tbl.NewRow();
foreach (PropertyInfo pi in props)
row[pi.Name] = pi.GetValue(item, null) ?? DBNull.Value;
tbl.Rows.Add(row);
}
return tbl;
}
public static Dictionary<string, object> objToDBInput(string type, object obj)
{
List<MySqlParameter> list = new List<MySqlParameter>();
Dictionary<string, object> output = new Dictionary<string, object>();
string colName = "";
string colNameAt = "";
string colInsert = "";
foreach (var prop in obj.GetType().GetProperties())
{
var propName = prop.Name;
var propValue = prop.GetValue(obj);
bool isInput = true;
if (propValue == null)
{
isInput = false;
}
else
{
if (propValue.GetType() == typeof(DateTime) && (DateTime)propValue == DateTime.MinValue)
{
isInput = false;
}
}
if (isInput)
{
list.Add(new MySqlParameter("@" + propName, propValue));
colName += propName + ",";
colNameAt += "@" + propName + ",";
colInsert += propName + "=" + "@" + propName + ",";
}
}
if (colName.Length > 0)
{
colName = colName.Substring(0, colName.Length - 1);
}
if (colNameAt.Length > 0)
{
colNameAt = colNameAt.Substring(0, colNameAt.Length - 1);
}
if (colInsert.Length > 0)
{
colInsert = colInsert.Substring(0, colInsert.Length - 1);
}
MySqlParameter[] parms = list.ToArray();
if (type == "insert")
{
output["sql"] = "(" + colName + ") values(" + colNameAt + ")";
}
else if (type == "update")
{
output["sql"] = colInsert;
}
output["parms"] = parms;
return output;
}
public static CommonResponseMsg post(string url, Dictionary<string, string> parameters)
{
CommonResponseMsg result = new CommonResponseMsg();
try
{
using (var client = new WebClient())
{
var values = new NameValueCollection();
foreach (string key in parameters.Keys)
{
values[key] = parameters[key];
}
var response = client.UploadValues(url, values);
var responseString = Encoding.UTF8.GetString(response);
responseString = System.Text.RegularExpressions.Regex.Unescape(responseString);
result.Code = "1";
result.Msg = responseString;
return result;
}
}
catch (Exception err)
{
result.Code = "0";
result.Msg = err.Message;
return result;
}
}
public static CommonResponseMsg post_json(string url, object parameters)
{
CommonResponseMsg result = new CommonResponseMsg();
try
{
using (WebClient webClient = new WebClient())
{
// 指定 WebClient 編碼
webClient.Encoding = Encoding.UTF8;
// 指定 WebClient 的 Content-Type header
webClient.Headers.Add(HttpRequestHeader.ContentType, "application/json");
// 指定 WebClient 的 authorization header
//webClient.Headers.Add("authorization", "token {apitoken}");
// 將 data 轉為 json
string json = JsonConvert.SerializeObject(parameters);
// 執行 post 動作
var result_post = webClient.UploadString(url, json);
result.Code = "1";
result.Msg = result_post;
return result;
}
}
catch (Exception err)
{
result.Code = "0";
result.Msg = err.Message;
return result;
}
}
public static List<object> objToList(Object obj)
{
return ((IEnumerable)obj).Cast<object>().ToList();
}
public static object isJTokenNull(JToken jToken, object output)
{
object result = jToken;
if (jToken == null)
{
result = output;
}
else
{
if (jToken.Type == JTokenType.Null)
{
result = output;
}
}
return result;
}
}
}
\ No newline at end of file
using System;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using System.Web.Cors;
using System.Web.Http.Cors;
public class CorsHandle : Attribute, ICorsPolicyProvider
{
private CorsPolicy objProlicy;
public CorsHandle()
{
// 建立一個跨網域存取的原則物件
objProlicy = new CorsPolicy
{
SupportsCredentials = true,
};
// 在這裡透過資料庫或是設定的方式,可動態加入允許存取的來源網域清單
objProlicy.Origins.Add("http://120.78.73.107:8888");
objProlicy.Origins.Add("http://120.78.73.107:8088");
objProlicy.Origins.Add("https://ipeasy.purplevineip.com");
objProlicy.Origins.Add("https://ipeasy.essenptl.com");
objProlicy.Origins.Add("http://127.0.0.1");
objProlicy.Origins.Add("http://localhost");
objProlicy.Origins.Add("https://dev.essenptl.com");
objProlicy.Origins.Add("https://ite.essenptl.com");
objProlicy.Methods.Add("GET");
objProlicy.Methods.Add("POST");
objProlicy.Methods.Add("DELETE");
objProlicy.Methods.Add("PUT");
objProlicy.Methods.Add("OPTIONS");
objProlicy.Methods.Add("HEAD");
objProlicy.Headers.Add("Origin");
objProlicy.Headers.Add("Content-Type");
objProlicy.Headers.Add("X-Auth-Token");
}
public Task<CorsPolicy> GetCorsPolicyAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
return Task.FromResult(objProlicy);
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using MySql.Data.MySqlClient;
using System.Collections;
namespace WebAPI.Tool
{
/// <summary>
/// MySqlHelper 的摘要说明
/// </summary>
public class MySqlHelper
{
//数据库连接字符串
public static string Conn_Dashboard = "Database='dashboard';Data Source='192.168.1.124';User Id='charles';Password='CharlesEssen99'; convert zero datetime=True; Max Pool Size=526;charset='utf8';pooling=true;Allow User Variables=True;command timeout='300'";
public static string Conn_IP = "Database='essen_dev_charles';Data Source='192.168.1.174';User Id='charles';Password='doi2_33Kn4u'; convert zero datetime=True; Max Pool Size=526;charset='utf8';pooling=true;Allow User Variables=True;command timeout='300'";
// 用于缓存参数的HASH表
private static Hashtable parmCache = Hashtable.Synchronized(new Hashtable());
/// <summary>
/// 给定连接的数据库用假设参数执行一个sql命令(不返回数据集)
/// </summary>
/// <param name="connectionString">一个有效的连接字符串</param>
/// <param name="cmdType">命令类型(存储过程, 文本, 等等)</param>
/// <param name="cmdText">存储过程名称或者sql命令语句</param>
/// <param name="commandParameters">执行命令所用参数的集合</param>
/// <returns>执行命令所影响的行数</returns>
public static int ExecuteNonQuery(string connectionString, CommandType cmdType, string cmdText, params MySqlParameter[] commandParameters)
{
MySqlCommand cmd = new MySqlCommand();
using (MySqlConnection conn = new MySqlConnection(connectionString))
{
PrepareCommand(cmd, conn, null, cmdType, cmdText, commandParameters);
int val = cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
conn.Close();
return val;
}
}
/// <summary>
/// 用现有的数据库连接执行一个sql命令(不返回数据集)
/// </summary>
/// <param name="connection">一个现有的数据库连接</param>
/// <param name="cmdType">命令类型(存储过程, 文本, 等等)</param>
/// <param name="cmdText">存储过程名称或者sql命令语句</param>
/// <param name="commandParameters">执行命令所用参数的集合</param>
/// <returns>执行命令所影响的行数</returns>
public static int ExecuteNonQuery(MySqlConnection connection, CommandType cmdType, string cmdText, params MySqlParameter[] commandParameters)
{
MySqlCommand cmd = new MySqlCommand();
PrepareCommand(cmd, connection, null, cmdType, cmdText, commandParameters);
int val = cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
return val;
}
/// <summary>
///使用现有的SQL事务执行一个sql命令(不返回数据集)
/// </summary>
/// <remarks>
///举例:
/// int result = ExecuteNonQuery(connString, CommandType.StoredProcedure, "PublishOrders", new MySqlParameter("@prodid", 24));
/// </remarks>
/// <param name="trans">一个现有的事务</param>
/// <param name="cmdType">命令类型(存储过程, 文本, 等等)</param>
/// <param name="cmdText">存储过程名称或者sql命令语句</param>
/// <param name="commandParameters">执行命令所用参数的集合</param>
/// <returns>执行命令所影响的行数</returns>
public static int ExecuteNonQuery(MySqlTransaction trans, CommandType cmdType, string cmdText, params MySqlParameter[] commandParameters)
{
MySqlCommand cmd = new MySqlCommand();
PrepareCommand(cmd, trans.Connection, trans, cmdType, cmdText, commandParameters);
int val = cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
return val;
}
/// <summary>
/// 用执行的数据库连接执行一个返回数据集的sql命令
/// </summary>
/// <remarks>
/// 举例:
/// MySqlDataReader r = ExecuteReader(connString, CommandType.StoredProcedure, "PublishOrders", new MySqlParameter("@prodid", 24));
/// </remarks>
/// <param name="connectionString">一个有效的连接字符串</param>
/// <param name="cmdType">命令类型(存储过程, 文本, 等等)</param>
/// <param name="cmdText">存储过程名称或者sql命令语句</param>
/// <param name="commandParameters">执行命令所用参数的集合</param>
/// <returns>包含结果的读取器</returns>
public static MySqlDataReader ExecuteReader(string connectionString, CommandType cmdType, string cmdText, params MySqlParameter[] commandParameters)
{
//创建一个MySqlCommand对象
MySqlCommand cmd = new MySqlCommand();
//创建一个MySqlConnection对象
MySqlConnection conn = new MySqlConnection(connectionString);
//在这里我们用一个try/catch结构执行sql文本命令/存储过程,因为如果这个方法产生一个异常我们要关闭连接,因为没有读取器存在,
//因此commandBehaviour.CloseConnection 就不会执行
try
{
//调用 PrepareCommand 方法,对 MySqlCommand 对象设置参数
PrepareCommand(cmd, conn, null, cmdType, cmdText, commandParameters);
//调用 MySqlCommand 的 ExecuteReader 方法
MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
//清除参数
cmd.Parameters.Clear();
conn.Close();
return reader;
}
catch
{
//关闭连接,抛出异常
conn.Close();
throw;
}
}
/// <summary>
/// 返回DataSet
/// </summary>
/// <param name="connectionString">一个有效的连接字符串</param>
/// <param name="cmdType">命令类型(存储过程, 文本, 等等)</param>
/// <param name="cmdText">存储过程名称或者sql命令语句</param>
/// <param name="commandParameters">执行命令所用参数的集合</param>
/// <returns></returns>
public static DataSet GetDataSet(string connectionString, CommandType cmdType, string cmdText, params MySqlParameter[] commandParameters)
{
//创建一个MySqlCommand对象
MySqlCommand cmd = new MySqlCommand();
//创建一个MySqlConnection对象
MySqlConnection conn = new MySqlConnection(connectionString);
//在这里我们用一个try/catch结构执行sql文本命令/存储过程,因为如果这个方法产生一个异常我们要关闭连接,因为没有读取器存在,
try
{
//调用 PrepareCommand 方法,对 MySqlCommand 对象设置参数
PrepareCommand(cmd, conn, null, cmdType, cmdText, commandParameters);
//调用 MySqlCommand 的 ExecuteReader 方法
MySqlDataAdapter adapter = new MySqlDataAdapter();
adapter.SelectCommand = cmd;
DataSet ds = new DataSet();
adapter.Fill(ds);
//清除参数
cmd.Parameters.Clear();
return ds;
}
catch (Exception e)
{
throw e;
}
finally
{
conn.Close();
}
}
/// <summary>
/// 用指定的数据库连接字符串执行一个命令并返回一个数据集的第一列
/// </summary>
/// <remarks>
///例如:
/// Object obj = ExecuteScalar(connString, CommandType.StoredProcedure, "PublishOrders", new MySqlParameter("@prodid", 24));
/// </remarks>
///<param name="connectionString">一个有效的连接字符串</param>
/// <param name="cmdType">命令类型(存储过程, 文本, 等等)</param>
/// <param name="cmdText">存储过程名称或者sql命令语句</param>
/// <param name="commandParameters">执行命令所用参数的集合</param>
/// <returns>用 Convert.To{Type}把类型转换为想要的 </returns>
public static object ExecuteScalar(string connectionString, CommandType cmdType, string cmdText, params MySqlParameter[] commandParameters)
{
MySqlCommand cmd = new MySqlCommand();
using (MySqlConnection connection = new MySqlConnection(connectionString))
{
PrepareCommand(cmd, connection, null, cmdType, cmdText, commandParameters);
object val = cmd.ExecuteScalar();
cmd.Parameters.Clear();
return val;
}
}
/// <summary>
/// 用指定的数据库连接执行一个命令并返回一个数据集的第一列
/// </summary>
/// <remarks>
/// 例如:
/// Object obj = ExecuteScalar(connString, CommandType.StoredProcedure, "PublishOrders", new MySqlParameter("@prodid", 24));
/// </remarks>
/// <param name="connection">一个存在的数据库连接</param>
/// <param name="cmdType">命令类型(存储过程, 文本, 等等)</param>
/// <param name="cmdText">存储过程名称或者sql命令语句</param>
/// <param name="commandParameters">执行命令所用参数的集合</param>
/// <returns>用 Convert.To{Type}把类型转换为想要的 </returns>
public static object ExecuteScalar(MySqlConnection connection, CommandType cmdType, string cmdText, params MySqlParameter[] commandParameters)
{
MySqlCommand cmd = new MySqlCommand();
PrepareCommand(cmd, connection, null, cmdType, cmdText, commandParameters);
object val = cmd.ExecuteScalar();
cmd.Parameters.Clear();
return val;
}
/// <summary>
/// 将参数集合添加到缓存
/// </summary>
/// <param name="cacheKey">添加到缓存的变量</param>
/// <param name="commandParameters">一个将要添加到缓存的sql参数集合</param>
public static void CacheParameters(string cacheKey, params MySqlParameter[] commandParameters)
{
parmCache[cacheKey] = commandParameters;
}
/// <summary>
/// 找回缓存参数集合
/// </summary>
/// <param name="cacheKey">用于找回参数的关键字</param>
/// <returns>缓存的参数集合</returns>
public static MySqlParameter[] GetCachedParameters(string cacheKey)
{
MySqlParameter[] cachedParms = (MySqlParameter[])parmCache[cacheKey];
if (cachedParms == null)
return null;
MySqlParameter[] clonedParms = new MySqlParameter[cachedParms.Length];
for (int i = 0, j = cachedParms.Length; i < j; i++)
clonedParms[i] = (MySqlParameter)((ICloneable)cachedParms[i]).Clone();
return clonedParms;
}
/// <summary>
/// 准备执行一个命令
/// </summary>
/// <param name="cmd">sql命令</param>
/// <param name="conn">OleDb连接</param>
/// <param name="trans">OleDb事务</param>
/// <param name="cmdType">命令类型例如 存储过程或者文本</param>
/// <param name="cmdText">命令文本,例如:Select * from Products</param>
/// <param name="cmdParms">执行命令的参数</param>
private static void PrepareCommand(MySqlCommand cmd, MySqlConnection conn, MySqlTransaction trans, CommandType cmdType, string cmdText, MySqlParameter[] cmdParms)
{
if (conn.State != ConnectionState.Open)
conn.Open();
cmd.Connection = conn;
cmd.CommandText = cmdText;
if (trans != null)
cmd.Transaction = trans;
cmd.CommandType = cmdType;
if (cmdParms != null)
{
foreach (MySqlParameter parm in cmdParms)
cmd.Parameters.Add(parm);
}
}
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Web;
using WebAPI.Models;
namespace WebAPI.Tool
{
/// <summary>
/// SQL 连接助手类
/// </summary>
public class SqlServerHelper
{
/// <summary>
/// Sql连接对象
/// </summary>
/// <value>Sql连接对象</value>
private SqlConnection SqlCnt { get; set; } //Sql连接对象
/// <summary>
/// 构造函数
/// (預設)
/// </summary>
public SqlServerHelper()
{
String connectionString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;
SqlCnt = new SqlConnection(connectionString);
}
/// <summary>
/// 构造函数
/// (使用Windows身份验证)
/// </summary>
/// <param name="dataSource">数据源</param>
/// <param name="dataBase">数据库</param>
/// <param name="timeout">连接超时(秒),默认5秒</param>
public SqlServerHelper(string dataSource, string dataBase, int timeout = 5)
{
string connectionString = "Data Source=" + dataSource + ";Initial Catalog=" + dataBase + ";Integrated Security=True;Connection Timeout=" + timeout + ";";
SqlCnt = new SqlConnection(connectionString);
}
/// <summary>
/// 构造函数
/// (传入连接字符串)
/// </summary>
/// <param name="connectionString"></param>
public SqlServerHelper(string connectionString)
{
SqlCnt = new SqlConnection(connectionString);
}
/// <summary>
/// 打开连接
/// </summary>
private void OpenConnection()
{
if (SqlCnt.State == ConnectionState.Closed) //连接关闭
{
try
{
SqlCnt.Open();
}
catch (Exception e)
{
throw new Exception("服务器连接失败:" + e);
}
}
else if (SqlCnt.State == ConnectionState.Broken) //连接中断
{
try
{
CloseConnection();
SqlCnt.Open();
}
catch (Exception e)
{
throw new Exception("服务器连接失败:" + e);
}
}
}
/// <summary>
/// 关闭连接
/// </summary>
public void CloseConnection()
{
try
{
SqlCnt.Close();
}
catch (Exception e)
{
throw new Exception("关闭数据库连接失败:" + e);
}
}
/// <summary>
/// 执行一条SQL语句
/// </summary>
/// <param name="sqlCommand">要执行的SQL语句</param>
/// <param name="closeConnection">是否关闭连接,默认关闭</param>
/// <returns>执行SQL语句受影响的行数</returns>
public int ExecuteSqlCommand(string sqlCommand, bool closeConnection = true)
{
if (string.IsNullOrEmpty(sqlCommand))
throw new Exception("要执行的SQL语句不能为空");
OpenConnection();
SqlCommand sqlCmd = new SqlCommand(sqlCommand, SqlCnt);
try
{
int changeRows = sqlCmd.ExecuteNonQuery(); //执行SQL语句
if (closeConnection) //关闭连接
CloseConnection();
return changeRows;
}
catch (Exception e)
{
throw new Exception("SQL语句存在错误:" + e);
}
}
/// <summary>
/// 通过sql语句获取数据表
/// </summary>
/// <param name="selectSqlCommand">获取表的select语句</param>
/// <returns>获取到的数据表</returns>
public DataTable GetTable(string selectSqlCommand)
{
if (string.IsNullOrEmpty(selectSqlCommand))
throw new Exception("要执行的select语句不能为空");
OpenConnection();
SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(selectSqlCommand, SqlCnt);
DataTable dataTable = new DataTable();
try
{
sqlDataAdapter.Fill(dataTable); //通过SqlDataAdapter填充DataTable对象
}
catch (Exception e)
{
throw new Exception("select语句有错或者数据表不存在:" + e);
}
finally
{
CloseConnection();
}
return dataTable;
}
/// <summary>
/// 通过表名获取数据表
/// </summary>
/// <param name="tableName">获取数据表的名称</param>
/// <param name="rows">查询的数据行数</param>
/// <returns>获取到的数据表</returns>
public DataTable GetTable(string tableName, int rows)
{
if (string.IsNullOrEmpty(tableName))
throw new Exception("要获取的数据表名称不能为空");
OpenConnection();
SqlDataAdapter sqlDataAdapter = new SqlDataAdapter("select top " + rows + " * from " + tableName, SqlCnt);
DataTable dataTable = new DataTable();
try
{
sqlDataAdapter.Fill(dataTable); //通过SqlDataAdapter填充DataTable对象
CloseConnection();
return dataTable;
}
catch (Exception e)
{
throw new Exception("数据表不存在:" + e);
}
}
/// <summary>
/// 按流的方式单向读取数据
/// (使用SqlDataReader)
/// </summary>
/// <param name="selectSqlCommand">获取数据的select语句</param>
/// <returns>SqlDataReader对象</returns>
public SqlDataReader GetDataStream(string selectSqlCommand)
{
if (string.IsNullOrEmpty(selectSqlCommand))
throw new Exception("要执行的select语句不能为空");
OpenConnection();
SqlCommand sqlCmd = new SqlCommand(selectSqlCommand, SqlCnt);
try
{
SqlDataReader reader = sqlCmd.ExecuteReader(); //建立SqlDataReader对象
return reader;
}
catch (Exception e)
{
throw new Exception("select语句存在错误或者数据表不存在:" + e);
}
}
/// <summary>
/// 添加数据到指定DataSet中
/// (添加到一张表)
/// </summary>
/// <param name="dataSet">被填充的DataSet</param>
/// <param name="selectSqlCommands">获取数据的select语句</param>
/// <param name="insertTableName">插入数据表的表名</param>
public void AddDataToDataSet(DataSet dataSet, string selectSqlCommands, string insertTableName)
{
if (dataSet == null)
throw new Exception("要填充数据的DataSet不能为null");
if (string.IsNullOrEmpty(selectSqlCommands))
throw new Exception("获取数据的select语句不能为空");
if (string.IsNullOrEmpty(insertTableName))
throw new Exception("插入的表名不能为空");
SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(selectSqlCommands, SqlCnt);
try
{
sqlDataAdapter.Fill(dataSet, insertTableName); //通过SqlDataAdapter向DataSet中填充数据
}
catch (Exception e)
{
throw new Exception("select语句存在错误:" + e);
}
finally
{
CloseConnection();
}
}
/// <summary>
/// 添加数据到指定DataSet中
/// (添加到多张表)
/// </summary>
/// <param name="dataSet">被填充的DataSet</param>
/// <param name="selectSqlCommands">获取数据的select语句列表</param>
/// <param name="insertTableNames">对应sql语句列表的插入表名列表</param>
public void AddDataToDataSet(DataSet dataSet, List<string> selectSqlCommands, List<string> insertTableNames)
{
if (dataSet == null)
throw new Exception("要填充数据的DataSet不能为null");
if (selectSqlCommands == null || selectSqlCommands.Count == 0)
throw new Exception("获取数据的select语句列表不能为空");
if (insertTableNames == null || insertTableNames.Count == 0)
throw new Exception("插入表名列表不能为空");
if (selectSqlCommands.Count != insertTableNames.Count)
throw new Exception("select语句列表与插入表名列表长度不一致");
//拼接select语句列表,获取最终执行的select语句
string selectCommand = string.Empty;
foreach (string cmd in selectSqlCommands)
if (cmd.Last() == ';')
selectCommand += cmd;
else
selectCommand += (cmd + ";");
SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(selectCommand, SqlCnt);
//通过插入表名列表,指定数据插入的数据表名称
sqlDataAdapter.TableMappings.Add("Table", insertTableNames.ElementAt(0));
for (int i = 1; i < insertTableNames.Count; i++)
sqlDataAdapter.TableMappings.Add("Table" + i, insertTableNames.ElementAt(i));
try
{
sqlDataAdapter.Fill(dataSet); //通过SqlDataAdapter向DataSet中填充数据
}
catch (Exception e)
{
throw new Exception("select语句列表中存在错误的sql语句:" + e);
}
finally
{
CloseConnection();
}
}
/// <summary>
/// 提交对数据表进行的修改
/// </summary>
/// <param name="dataTable">修改的数据表</param>
/// <param name="createTableSqlCommand">创建数据表的sql语句</param>
public void UpdateTable(DataTable dataTable, string createTableSqlCommand)
{
if (dataTable == null)
throw new Exception("修改的数据表不能为空");
if (string.IsNullOrEmpty(createTableSqlCommand))
throw new Exception("创建数据表的sql语句不能为空");
SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(createTableSqlCommand, SqlCnt);
//为SqlDataAdapter赋予SqlCommandBuilder功能
SqlCommandBuilder sqlCommandBuilder = new SqlCommandBuilder(sqlDataAdapter);
try
{
sqlDataAdapter.Update(dataTable); //批量提交表中的所有修改
}
catch (Exception e)
{
throw new Exception("向数据库批量提交修改失败:" + e);
}
}
/// <summary>
/// 提交对数据表进行的修改
/// (在DataSet中的数据表)
/// </summary>
/// <param name="dataset">修改的数据表所在的DataSet</param>
/// <param name="TableName">被修改的数据表名</param>
/// <param name="createTableSqlCommand">创建数据表的sql语句</param>
public void UpdateTable(DataSet dataset, string TableName, string createTableSqlCommand)
{
if (dataset == null)
throw new Exception("修改过的DataSet不能为null");
if (TableName == null || TableName == string.Empty)
throw new Exception("数据表名不能为空");
if (string.IsNullOrEmpty(createTableSqlCommand))
throw new Exception("创建数据表的select语句不能为空");
SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(createTableSqlCommand, SqlCnt);
//为SqlDataAdapter赋予SqlCommandBuilder功能
SqlCommandBuilder sqlCommandBuilder = new SqlCommandBuilder(sqlDataAdapter);
try
{
sqlDataAdapter.Update(dataset, TableName); //批量提交表中的所有修改
}
catch (Exception e)
{
throw new Exception("向数据库批量提交修改失败:" + e);
}
}
}
}
\ No newline at end of file
...@@ -16,7 +16,10 @@ ...@@ -16,7 +16,10 @@
--> -->
<connectionStrings> <connectionStrings>
<add name="DefaultConnection" <add name="DefaultConnection"
connectionString="Data Source=47.91.213.74,6002;Initial Catalog=IPEasy;Persist Security Info=True;User ID=ipeasy;Password=ipeasy.123" providerName="System.Data.SqlClient" connectionString="Data Source=172.18.134.232,50608;Initial Catalog=IPEasy;Persist Security Info=True;User ID=ipeasy;Password=ipeasy.123" providerName="System.Data.SqlClient"
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
<add name="eflow_cur"
connectionString="Data Source=172.18.134.232,50608;Initial Catalog=IPEasy;Persist Security Info=True;User ID=ipeasy;Password=ipeasy.123" providerName="System.Data.SqlClient"
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/> xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings> </connectionStrings>
<system.web> <system.web>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<!--報價規則--> <!--報價規則-->
<add name="DefaultConnection" connectionString="Data Source=47.91.213.74,6002;Initial Catalog=IPEasy_test;Persist Security Info=True;User ID=ipeasyTest;Password=ipeasy.123" providerName="System.Data.SqlClient" /> <add name="DefaultConnection" connectionString="Data Source=47.91.213.74,6002;Initial Catalog=IPEasy_test;Persist Security Info=True;User ID=ipeasyTest;Password=ipeasy.123" providerName="System.Data.SqlClient" />
<!--核稿歷史--> <!--核稿歷史-->
<add name="eflow_cur" connectionString="Data Source=47.91.213.74,6002;Initial Catalog=IPEasy;Persist Security Info=True;User ID=account;Password=accounttp" providerName="System.Data.SqlClient" /> <add name="eflow_cur" connectionString="Data Source=47.91.213.74,6002;Initial Catalog=IPEasy_test;Persist Security Info=True;User ID=ipeasyTest;Password=ipeasy.123" providerName="System.Data.SqlClient" />
</connectionStrings> </connectionStrings>
<appSettings> <appSettings>
<add key="webpages:Version" value="3.0.0.0" /> <add key="webpages:Version" value="3.0.0.0" />
...@@ -25,19 +25,17 @@ ...@@ -25,19 +25,17 @@
<remove name="ExtensionlessUrlHandler-Integrated-4.0" /> <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<remove name="OPTIONSVerbHandler" /> <remove name="OPTIONSVerbHandler" />
<remove name="TRACEVerbHandler" /> <remove name="TRACEVerbHandler" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /> <remove name="WebDAV" />
<!--<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />-->
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*."
verb="GET,HEAD,POST,PUT,DELETE,OPTIONS"
type="System.Web.Handlers.TransferRequestHandler"
preCondition="integratedMode,runtimeVersionv4.0" />
</handlers> </handlers>
<modules> <modules>
<add name="HelloWorldModule" type="HelloWorldModule" /> <add name="HelloWorldModule" type="HelloWorldModule" />
<remove name="WebDAVModule" />
</modules> </modules>
<!--<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Methods" value="GET,PUT,POST,DELETE,OPTIONS" />
<add name="Access-Control-Allow-Headers" value="Content-Type,Accept" />
<add name="Access-Control-Allow-Credentials" value="true" />
</customHeaders>
</httpProtocol>-->
<staticContent> <staticContent>
<clientCache cacheControlCustom="public" /> <clientCache cacheControlCustom="public" />
</staticContent> </staticContent>
...@@ -74,6 +72,14 @@ ...@@ -74,6 +72,14 @@
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" /> <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-5.2.7.0" newVersion="5.2.7.0" /> <bindingRedirect oldVersion="1.0.0.0-5.2.7.0" newVersion="5.2.7.0" />
</dependentAssembly> </dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.1" newVersion="4.0.1.1" />
</dependentAssembly>
</assemblyBinding> </assemblyBinding>
</runtime> </runtime>
<system.codedom> <system.codedom>
......
...@@ -45,6 +45,9 @@ ...@@ -45,6 +45,9 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="BouncyCastle.Crypto, Version=1.8.3.0, Culture=neutral, PublicKeyToken=0e99375e54769942">
<HintPath>packages\BouncyCastle.1.8.3.1\lib\BouncyCastle.Crypto.dll</HintPath>
</Reference>
<Reference Include="ClosedXML, Version=0.95.3.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="ClosedXML, Version=0.95.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\ClosedXML.0.95.3\lib\net46\ClosedXML.dll</HintPath> <HintPath>packages\ClosedXML.0.95.3\lib\net46\ClosedXML.dll</HintPath>
</Reference> </Reference>
...@@ -63,12 +66,35 @@ ...@@ -63,12 +66,35 @@
<Reference Include="ExcelNumberFormat, Version=1.0.10.0, Culture=neutral, PublicKeyToken=23c6f5d73be07eca, processorArchitecture=MSIL"> <Reference Include="ExcelNumberFormat, Version=1.0.10.0, Culture=neutral, PublicKeyToken=23c6f5d73be07eca, processorArchitecture=MSIL">
<HintPath>packages\ExcelNumberFormat.1.0.10\lib\net20\ExcelNumberFormat.dll</HintPath> <HintPath>packages\ExcelNumberFormat.1.0.10\lib\net20\ExcelNumberFormat.dll</HintPath>
</Reference> </Reference>
<Reference Include="Google.Protobuf, Version=3.11.4.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
<HintPath>packages\Google.Protobuf.3.11.4\lib\net45\Google.Protobuf.dll</HintPath>
</Reference>
<Reference Include="K4os.Compression.LZ4, Version=1.1.11.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
<HintPath>packages\K4os.Compression.LZ4.1.1.11\lib\net46\K4os.Compression.LZ4.dll</HintPath>
</Reference>
<Reference Include="K4os.Compression.LZ4.Streams, Version=1.1.11.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
<HintPath>packages\K4os.Compression.LZ4.Streams.1.1.11\lib\net46\K4os.Compression.LZ4.Streams.dll</HintPath>
</Reference>
<Reference Include="K4os.Hash.xxHash, Version=1.0.6.0, Culture=neutral, PublicKeyToken=32cd54395057cec3, processorArchitecture=MSIL">
<HintPath>packages\K4os.Hash.xxHash.1.0.6\lib\net46\K4os.Hash.xxHash.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.VisualBasic" /> <Reference Include="Microsoft.VisualBasic" />
<Reference Include="MySql.Data, Version=8.0.22.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>packages\MySql.Data.8.0.22\lib\net452\MySql.Data.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath> <HintPath>packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference> </Reference>
<Reference Include="Renci.SshNet, Version=2016.1.0.0, Culture=neutral, PublicKeyToken=1cee9f8bde3db106, processorArchitecture=MSIL">
<HintPath>packages\SSH.NET.2016.1.0\lib\net40\Renci.SshNet.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.Buffers.4.5.1\lib\netstandard1.1\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.ComponentModel" />
<Reference Include="System.Configuration.Install" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
<Reference Include="System.IO.Compression" /> <Reference Include="System.IO.Compression" />
...@@ -78,6 +104,14 @@ ...@@ -78,6 +104,14 @@
<Reference Include="System.IO.Packaging, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <Reference Include="System.IO.Packaging, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>packages\System.IO.Packaging.4.0.0\lib\net46\System.IO.Packaging.dll</HintPath> <HintPath>packages\System.IO.Packaging.4.0.0\lib\net46\System.IO.Packaging.dll</HintPath>
</Reference> </Reference>
<Reference Include="System.Management" />
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.Memory.4.5.3\lib\netstandard1.1\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard1.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Transactions" />
<Reference Include="System.Web.Cors, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <Reference Include="System.Web.Cors, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.AspNet.Cors.5.2.7\lib\net45\System.Web.Cors.dll</HintPath> <HintPath>packages\Microsoft.AspNet.Cors.5.2.7\lib\net45\System.Web.Cors.dll</HintPath>
</Reference> </Reference>
...@@ -140,6 +174,9 @@ ...@@ -140,6 +174,9 @@
<Private>True</Private> <Private>True</Private>
<HintPath>.\packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.WebPages.Razor.dll</HintPath> <HintPath>.\packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
</Reference> </Reference>
<Reference Include="Ubiety.Dns.Core, Version=2.2.1.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>packages\MySql.Data.8.0.22\lib\net452\Ubiety.Dns.Core.dll</HintPath>
</Reference>
<Reference Include="WebGrease"> <Reference Include="WebGrease">
<Private>True</Private> <Private>True</Private>
<HintPath>.\packages\WebGrease.1.6.0\lib\WebGrease.dll</HintPath> <HintPath>.\packages\WebGrease.1.6.0\lib\WebGrease.dll</HintPath>
...@@ -149,6 +186,9 @@ ...@@ -149,6 +186,9 @@
<HintPath>.\packages\Antlr.3.5.0.2\lib\Antlr3.Runtime.dll</HintPath> <HintPath>.\packages\Antlr.3.5.0.2\lib\Antlr3.Runtime.dll</HintPath>
</Reference> </Reference>
<Reference Include="WindowsBase" /> <Reference Include="WindowsBase" />
<Reference Include="Zstandard.Net, Version=1.1.7.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>packages\MySql.Data.8.0.22\lib\net452\Zstandard.Net.dll</HintPath>
</Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform"> <Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform">
...@@ -156,6 +196,17 @@ ...@@ -156,6 +196,17 @@
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Controllers\DictionaryController.cs" />
<Compile Include="Controllers\FileController.cs" />
<Compile Include="Controllers\InventorController.cs" />
<Compile Include="Controllers\SubProcInfoController.cs" />
<Compile Include="Controllers\ProcInfoController.cs" />
<Compile Include="Models\ParamModel.cs" />
<Compile Include="Models\CommonResponseMsg.cs" />
<Compile Include="Tool\Common.cs" />
<Compile Include="Tool\CorsHandle.cs" />
<Compile Include="Tool\MySqlHelper.cs" />
<Compile Include="Tool\SqlServerHelper.cs" />
<Content Include="App_Code\HelloWorldModule.cs" /> <Content Include="App_Code\HelloWorldModule.cs" />
<Compile Include="App_Start\BundleConfig.cs" /> <Compile Include="App_Start\BundleConfig.cs" />
<Compile Include="App_Start\FilterConfig.cs" /> <Compile Include="App_Start\FilterConfig.cs" />
......
...@@ -2,13 +2,18 @@ ...@@ -2,13 +2,18 @@
<packages> <packages>
<package id="Antlr" version="3.5.0.2" targetFramework="net46" /> <package id="Antlr" version="3.5.0.2" targetFramework="net46" />
<package id="bootstrap" version="3.4.1" targetFramework="net46" /> <package id="bootstrap" version="3.4.1" targetFramework="net46" />
<package id="BouncyCastle" version="1.8.3.1" targetFramework="net46" />
<package id="ClosedXML" version="0.95.3" targetFramework="net46" /> <package id="ClosedXML" version="0.95.3" targetFramework="net46" />
<package id="DocumentFormat.OpenXml" version="2.7.2" targetFramework="net46" /> <package id="DocumentFormat.OpenXml" version="2.7.2" targetFramework="net46" />
<package id="EastAsiaNumericFormatter" version="1.0.0" targetFramework="net46" /> <package id="EastAsiaNumericFormatter" version="1.0.0" targetFramework="net46" />
<package id="ExcelDataReader" version="3.6.0" targetFramework="net46" /> <package id="ExcelDataReader" version="3.6.0" targetFramework="net46" />
<package id="ExcelDataReader.DataSet" version="3.6.0" targetFramework="net46" /> <package id="ExcelDataReader.DataSet" version="3.6.0" targetFramework="net46" />
<package id="ExcelNumberFormat" version="1.0.10" targetFramework="net46" /> <package id="ExcelNumberFormat" version="1.0.10" targetFramework="net46" />
<package id="Google.Protobuf" version="3.11.4" targetFramework="net46" />
<package id="jQuery" version="3.4.1" targetFramework="net46" /> <package id="jQuery" version="3.4.1" targetFramework="net46" />
<package id="K4os.Compression.LZ4" version="1.1.11" targetFramework="net46" />
<package id="K4os.Compression.LZ4.Streams" version="1.1.11" targetFramework="net46" />
<package id="K4os.Hash.xxHash" version="1.0.6" targetFramework="net46" />
<package id="Microsoft.AspNet.Cors" version="5.2.7" targetFramework="net46" /> <package id="Microsoft.AspNet.Cors" version="5.2.7" targetFramework="net46" />
<package id="Microsoft.AspNet.Mvc" version="5.2.7" targetFramework="net46" /> <package id="Microsoft.AspNet.Mvc" version="5.2.7" targetFramework="net46" />
<package id="Microsoft.AspNet.Mvc.zh-Hant" version="5.2.7" targetFramework="net46" /> <package id="Microsoft.AspNet.Mvc.zh-Hant" version="5.2.7" targetFramework="net46" />
...@@ -31,8 +36,13 @@ ...@@ -31,8 +36,13 @@
<package id="Microsoft.CSharp" version="4.7.0" targetFramework="net46" /> <package id="Microsoft.CSharp" version="4.7.0" targetFramework="net46" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net46" /> <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net46" />
<package id="Modernizr" version="2.8.3" targetFramework="net46" /> <package id="Modernizr" version="2.8.3" targetFramework="net46" />
<package id="MySql.Data" version="8.0.22" targetFramework="net46" />
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net46" /> <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net46" />
<package id="SSH.NET" version="2016.1.0" targetFramework="net46" />
<package id="System.Buffers" version="4.5.1" targetFramework="net46" />
<package id="System.IO.FileSystem.Primitives" version="4.0.1" targetFramework="net46" /> <package id="System.IO.FileSystem.Primitives" version="4.0.1" targetFramework="net46" />
<package id="System.IO.Packaging" version="4.0.0" targetFramework="net46" /> <package id="System.IO.Packaging" version="4.0.0" targetFramework="net46" />
<package id="System.Memory" version="4.5.3" targetFramework="net46" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.2" targetFramework="net46" />
<package id="WebGrease" version="1.6.0" targetFramework="net46" /> <package id="WebGrease" version="1.6.0" targetFramework="net46" />
</packages> </packages>
\ No newline at end of file
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