using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Text; using System.Windows; using HttpServices; namespace UPPPayDll { /// /// DGPay.xaml 的交互逻辑 /// public partial class DGPay : Window { public JObject InjObject { get; set; } public JObject inParamsobj { get; set; } public JObject OutjObject { get; private set; } IniFile ini = new IniFile(); public DGPay() { InitializeComponent(); } private void Button_Click(object sender, RoutedEventArgs e) { } public string PosPay(string authcode) { //System.Diagnostics.Debugger.Launch(); string errorCode = "-1"; string errorMessage = ""; string readData = ""; try { InjObject.Add("authcode", authcode); //{ "totalFee":"0.01","authcode":"134734650042765256","hisTradeNo":"1","body":"1111","businessType":"WXSM","hospitalCode":"44030001","userCode":"xys","patID":"000000001", "patName":"namwe", "idCardNo":"idCardNo", "mobile":""} string PayCode = ini.IniReadValue("HIS", "PayCode"); // 创建一个 JObject 对象 JObject hisParamsobj = new JObject(); // 创建一个 JArray 对象 JArray paramsArray = new JArray(); paramsArray.Add(InjObject); hisParamsobj["params"] = paramsArray; hisParamsobj["code"] = PayCode; hisParamsobj["session"] = inParamsobj["session"]; //调用his进行数据保存 RestClient restClient = new RestClient(); string hisResult = restClient.HISHTTPServices(hisParamsobj.ToString()); //调用HIS回调 OutjObject = JObject.Parse(hisResult); return OutjObject.ToString(); } catch (Exception ex2) { errorCode = "-1"; errorMessage = ex2.Message; } OutjObject.Add("errorCode", errorCode); OutjObject.Add("errorMessage", errorMessage); OutjObject.Add("posData", readData); return OutjObject.ToString(); } } }