11
This commit is contained in:
@@ -266,6 +266,11 @@ namespace BLL
|
||||
public const string BtnConTab13Modify = "承包商Modify";
|
||||
public const string BtnConTab13Delete = "承包商Delete";
|
||||
public const string BtnConTab13View = "承包商View";
|
||||
|
||||
public const string BtnConTab17Add = "确认函Add";
|
||||
public const string BtnConTab17Modify = "确认函Modify";
|
||||
public const string BtnConTab17Delete = "确认函Delete";
|
||||
public const string BtnConTab17View = "确认函View";
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
@@ -536,6 +541,8 @@ namespace BLL
|
||||
public const string ContractorEvaluationMenuId = "7E2A5BAA-1F3C-4930-9E76-0FBABBA40B20";
|
||||
|
||||
public const string EvaluationReportMenuId = "DD0202E2-0EBD-41A3-AA81-33684B8DE014";
|
||||
|
||||
public const string SafePerformanceReportMenuId = "4BA63D21-8745-4FD5-8472-4AD586F072CB";
|
||||
#endregion
|
||||
|
||||
#region 承包商质量事件调查
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using Microsoft.SqlServer.Dts.Runtime;
|
||||
using Org.BouncyCastle.Asn1.Ocsp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -32,7 +34,25 @@ namespace BLL.Common
|
||||
}
|
||||
return strGetResponse;
|
||||
}
|
||||
public static string HttpGetRequest(string url, string basicUsername, string basicPassword)
|
||||
{
|
||||
string strGetResponse = string.Empty;
|
||||
try
|
||||
{
|
||||
var getRequest = CreateHttpRequest(url, "GET", "");
|
||||
// 添加 Basic 认证头
|
||||
string credentials = Convert.ToBase64String(Encoding.UTF8.GetBytes($"{basicUsername}:{basicPassword}"));
|
||||
getRequest.Headers["Authorization"] = $"Basic {credentials}";
|
||||
|
||||
var getResponse = getRequest.GetResponse() as HttpWebResponse;
|
||||
strGetResponse = GetHttpResponse(getResponse, "GET");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
strGetResponse = ex.Message;
|
||||
}
|
||||
return strGetResponse;
|
||||
}
|
||||
/// <summary>
|
||||
/// Http Post Request
|
||||
/// </summary>
|
||||
@@ -41,14 +61,14 @@ namespace BLL.Common
|
||||
/// <returns></returns>
|
||||
public static string HttpPostRequest(string url, string postJsonData,string token)
|
||||
{
|
||||
BLL.ErrLogInfo.WriteLog("token=" + token);
|
||||
//BLL.ErrLogInfo.WriteLog("token=" + token);
|
||||
string strPostReponse = string.Empty;
|
||||
try
|
||||
{
|
||||
var postRequest = CreateHttpRequest(url, "POST",token, postJsonData);
|
||||
var postResponse = postRequest.GetResponse() as HttpWebResponse;
|
||||
strPostReponse = GetHttpResponse(postResponse, "POST");
|
||||
BLL.ErrLogInfo.WriteLog("result=" + strPostReponse);
|
||||
//BLL.ErrLogInfo.WriteLog("result=" + strPostReponse);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -92,6 +112,40 @@ namespace BLL.Common
|
||||
}
|
||||
}
|
||||
|
||||
public static string PostJsonByHttps(string url,string basicUsername,string basicPassword, string jsonParams )
|
||||
{
|
||||
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
|
||||
HttpWebRequest request = null;
|
||||
CookieContainer cookie = new CookieContainer();
|
||||
//HTTPSQ请求
|
||||
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);
|
||||
request = WebRequest.Create(url) as HttpWebRequest;
|
||||
request.CookieContainer = cookie;
|
||||
request.ProtocolVersion = HttpVersion.Version11;
|
||||
request.Method = "POST";
|
||||
request.ContentType = "application/x-www-form-urlencoded";
|
||||
request.KeepAlive = true;
|
||||
byte[] byteData = Encoding.UTF8.GetBytes(jsonParams);
|
||||
int length = byteData.Length;
|
||||
request.ContentLength = length;
|
||||
|
||||
// 添加 Basic 认证头
|
||||
string credentials = Convert.ToBase64String(Encoding.UTF8.GetBytes($"{basicUsername}:{basicPassword}"));
|
||||
request.Headers["Authorization"] = $"Basic {credentials}";
|
||||
|
||||
using (Stream stream = request.GetRequestStream())
|
||||
{
|
||||
stream.Write(byteData, 0, byteData.Length);
|
||||
}
|
||||
|
||||
var response = (HttpWebResponse)request.GetResponse();
|
||||
|
||||
using (StreamReader st = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding("utf-8")))
|
||||
{
|
||||
return st.ReadToEnd().ToString();
|
||||
}
|
||||
}
|
||||
|
||||
private static HttpWebRequest CreateHttpRequest(string url, string requestType, string token, params object[] strJson)
|
||||
{
|
||||
HttpWebRequest request = null;
|
||||
|
||||
Reference in New Issue
Block a user