89 lines
3.6 KiB
C#
89 lines
3.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Configuration;
|
|
using System.Linq;
|
|
using System.Net;
|
|
using System.Web;
|
|
using Newtonsoft.Json;
|
|
using RestSharp;
|
|
namespace BLWWS
|
|
{
|
|
public class HttpSendData
|
|
{
|
|
//public static readonly string BaseURL = "http://www.higmkj.com:8056";
|
|
public static readonly string BaseURL = ConfigurationManager.AppSettings["BaoJing_BaseUrl"];
|
|
private static readonly NLog.Logger _logger = NLog.LogManager.GetCurrentClassLogger();
|
|
public static void SendData(PMSDataBase data)
|
|
{
|
|
//ssl 协议不兼容
|
|
//var A = (SecurityProtocolType)48;
|
|
//var B = (SecurityProtocolType)192;
|
|
//var C = (SecurityProtocolType)768;
|
|
//var D = (SecurityProtocolType)3072;
|
|
//var E = (SecurityProtocolType)12288;
|
|
//ServicePointManager.SecurityProtocol = A | B | C | D | E;
|
|
var a = Newtonsoft.Json.JsonConvert.SerializeObject(data);
|
|
_logger.Error("宝镜推送CheckIn数据:" + a);
|
|
//var client1 = new RestClient(BaseURL);
|
|
//var request1 = new RestRequest("/order/checkIn", Method.POST);
|
|
//request1.AddJsonBody(data);
|
|
//var Response = client1.Execute(request1).Content;
|
|
//string content = Response;
|
|
WebReference.WebService1 w = new WebReference.WebService1();
|
|
var Response = w.HelloWorld("C24cAfK", a, "/order/checkIn");
|
|
_logger.Error("宝镜推送CheckIn结果:" + Response);
|
|
}
|
|
public static void SendData_CheckOut(PMSDataBase data)
|
|
{
|
|
|
|
//ssl 协议不兼容
|
|
//var A = (SecurityProtocolType)48;
|
|
//var B = (SecurityProtocolType)192;
|
|
//var C = (SecurityProtocolType)768;
|
|
//var D = (SecurityProtocolType)3072;
|
|
//var E = (SecurityProtocolType)12288;
|
|
//ServicePointManager.SecurityProtocol = A | B | C | D | E;
|
|
var a = Newtonsoft.Json.JsonConvert.SerializeObject(data);
|
|
_logger.Error("宝镜推送SendData_CheckOut数据:" + a);
|
|
//var client1 = new RestClient(BaseURL);
|
|
//var request1 = new RestRequest("/order/checkOut", Method.POST);
|
|
//request1.AddJsonBody(data);
|
|
//var Response = client1.Execute(request1).Content;
|
|
|
|
WebReference.WebService1 w = new WebReference.WebService1();
|
|
var Response = w.HelloWorld("C24cAfK", a, "/order/checkOut");
|
|
_logger.Error("宝镜推送CheckOut:" + Response);
|
|
}
|
|
}
|
|
public class PMSDataBase
|
|
{
|
|
public string hotel_code { get; set; } = "";
|
|
public string time { get; set; } = "";
|
|
public string sign { get; set; } = "";
|
|
public string hotel_id { get; set; } = "";
|
|
public string order_no { get; set; } = "";
|
|
public string room_no { get; set; } = "";
|
|
public string check_out_original { get; set; }
|
|
}
|
|
|
|
public class PMSData : PMSDataBase
|
|
{
|
|
public string checkIn { get; set; }
|
|
public string checkOut { get; set; }
|
|
public ushort is_breakfast { get; set; }
|
|
public ushort breakfast { get; set; }
|
|
public string rateCode { get; set; }
|
|
public string amount { get; set; }
|
|
public string order_original { get; set; }
|
|
public List<Info> infos { get; set; }
|
|
}
|
|
public class Info
|
|
{
|
|
public string name { get; set; }
|
|
public string mobile { get; set; }
|
|
public int type { get; set; }
|
|
public string idcard { get; set; }
|
|
public int sex { get; set; }
|
|
public string address { get; set; }
|
|
}
|
|
} |