chore: 初始化平芝126kV隔离开关MesProject项目
This commit is contained in:
132
Common/02WebApiCall/WebApiCall/CallWebApi.SQLCommon.cs
Normal file
132
Common/02WebApiCall/WebApiCall/CallWebApi.SQLCommon.cs
Normal file
@@ -0,0 +1,132 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
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.Threading.Tasks;
|
||||
|
||||
namespace DtWebApi
|
||||
{
|
||||
public class DataAccess
|
||||
{
|
||||
|
||||
public static bool ExecuteNonQuery(StringCollection sql, string connectionString, out string errorMessage)
|
||||
{
|
||||
errorMessage = "";
|
||||
|
||||
string api = "";
|
||||
string type = "POST";
|
||||
string controlStr = "SQLCommon";
|
||||
string actionStr = "ExecuteNonQuery1";
|
||||
Dictionary<string, string> dic = new Dictionary<string, string>();
|
||||
dic.Add("sql", JsonConvert.SerializeObject(sql));
|
||||
|
||||
return new CallWebApi().InvokeWebapiBool(controlStr, actionStr, api, type, dic);
|
||||
}
|
||||
public static bool ExecuteNonQuery(string sql, string connectionString, out string errorMessage)
|
||||
{
|
||||
errorMessage = "";
|
||||
|
||||
string api = "";
|
||||
string type = "POST";
|
||||
string controlStr = "SQLCommon";
|
||||
string actionStr = "ExecuteNonQuery";
|
||||
Dictionary<string, string> dic = new Dictionary<string, string>();
|
||||
dic.Add("sql", sql);
|
||||
|
||||
return new CallWebApi().InvokeWebapiBool(controlStr, actionStr, api, type, dic);
|
||||
}
|
||||
|
||||
|
||||
public static bool ExecuteOutNum(string sql, string connectionString, out int count, out string errorMessage)
|
||||
{
|
||||
errorMessage = "";
|
||||
|
||||
string api = "";
|
||||
string type = "POST";
|
||||
string controlStr = "SQLCommon";
|
||||
string actionStr = "ExecuteOutNum";
|
||||
Dictionary<string, string> dic = new Dictionary<string, string>();
|
||||
dic.Add("sql", sql);
|
||||
|
||||
count = new CallWebApi().InvokeWebapiInt(controlStr, actionStr, api, type, dic);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool ExecuteDataset(string sql, string connectionString, out DataSet ds, out string errorMessage)
|
||||
{
|
||||
errorMessage = "";
|
||||
|
||||
string api = "";
|
||||
string type = "GET";
|
||||
string controlStr = "SQLCommon";
|
||||
string actionStr = "ExecuteDataset";
|
||||
Dictionary<string, string> dic = new Dictionary<string, string>();
|
||||
dic.Add("sql", sql);
|
||||
ds = new CallWebApi().InvokeWebapiDataSet(controlStr, actionStr, api, type, dic);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool ExecuteDataTable(string sql, string connectionString, out DataTable dt, out string errorMessage)
|
||||
{
|
||||
errorMessage = "";
|
||||
|
||||
string api = "";
|
||||
string type = "GET";
|
||||
string controlStr = "SQLCommon";
|
||||
string actionStr = "ExecuteDataTable";
|
||||
Dictionary<string, string> dic = new Dictionary<string, string>();
|
||||
dic.Add("sql", sql);
|
||||
dt = new CallWebApi().InvokeWebapiDataTable(controlStr, actionStr, api, type, dic);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public static bool ExecuteDataReader(string sql, string connectionString, out SqlDataReader dr, out string errorMessage)
|
||||
{
|
||||
errorMessage = "";
|
||||
|
||||
string api = "";
|
||||
string type = "GET";
|
||||
string controlStr = "SQLCommon";
|
||||
string actionStr = "ExecuteDataReader";
|
||||
Dictionary<string, string> dic = new Dictionary<string, string>();
|
||||
dic.Add("sql", sql);
|
||||
dr = new CallWebApi().InvokeWebapiSqlDataReader(controlStr, actionStr, api, type, dic);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool ExecuteSql(string sql, string connectionString, out string errorMessage)
|
||||
{
|
||||
errorMessage = "";
|
||||
|
||||
string api = "";
|
||||
string type = "GET";
|
||||
string controlStr = "SQLCommon";
|
||||
string actionStr = "ExecuteSql";
|
||||
Dictionary<string, string> dic = new Dictionary<string, string>();
|
||||
dic.Add("sql", sql);
|
||||
new CallWebApi().InvokeWebapiString(controlStr, actionStr, api, type, dic);
|
||||
return true;
|
||||
}
|
||||
public static bool ExecuteSql(string sql, string connectionString, out DataTable dt, out string errorMessage)
|
||||
{
|
||||
errorMessage = "";
|
||||
|
||||
string api = "";
|
||||
string type = "GET";
|
||||
string controlStr = "SQLCommon";
|
||||
string actionStr = "ExecuteSqlDataTable";
|
||||
Dictionary<string, string> dic = new Dictionary<string, string>();
|
||||
dic.Add("sql", sql);
|
||||
dt = new CallWebApi().InvokeWebapiDataTable(controlStr, actionStr, api, type, dic);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user