代码拉取完成,页面将自动刷新
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace HIS.EHC
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
//Helper.InitPayEnvironment();
//string url = tb_url.Text.ToString().Trim();
//string appid = tb_appid.Text.ToString().Trim();
//string appsec = tb_appsec.Text.ToString().Trim();
//string indata = "{\"transType\":\"hop.trade.setinfo\",\"param\":{\"serveraddr\":\"" + url + "\",\"appid\":\"" + appid + "\",\"appsecret\":\"" + appsec + "\"}}";
//Byte[] outdata = new Byte[2048];
//IntPtr a = Helper.payTrans(indata, ref outdata[0]);
//string strGet = System.Text.Encoding.Default.GetString(outdata, 0, outdata.Length);
//string strRet = Marshal.PtrToStringAnsi(a);
//string outstring = strRet + "\r\n" + strGet.TrimEnd('\0');
//MessageBox.Show(outstring);
}
private void button2_Click(object sender, EventArgs e)
{
//string abc= "{\"transType\":\"hop.account.info\",\"param\":{\"operatorId\":\"" + tb_operatorId.Text.ToString().Trim() + "\",\"termNo\":\"" + tb_terNo.Text.ToString().Trim() + "\",\"operatorName\":\"" + tb_operName.Text.ToString().Trim() + "\",\"cardType\":\"" + tb_cardType.Text.ToString().Trim() + "\",\"cardNo\":\"" + tb_cardNo.Text.ToString().Trim() + "\",\"accountType\":\"" + tb_accType.Text.ToString().Trim() + "\",\"idNo\":\"" + tb_idNo.Text.ToString().Trim() + "\",\"notes\":\"\"}}";
string lsh = "abc123";
string payInfo = " {\"transType\":\"hop.trade.recharge\",\"param\":{\"operatorId\":\"001\",\"termNo\":\"001\",\"operatorName\":\"张三\",\"cardType\":\"01\",\"hisCustId\":\"\",\"userName\":\"李四\",\"amount\":\"0.01\",\"outChargeNo\":\"" + lsh + "\",\"depositType\":\"all_bar\",\"PosNo\":\"\",\"HZJDFlag\":\"\",\"ShowMsg\":\"\",\"extra\":{\"hopname\":\"\",\"hopid\":\"\",\"deskflak\":\"1\"},\"cardNo\":\"1A95490805\",\"accountType\":\"01\",\"idNo\":\"340121199301154617\",\"notes\":\"\"}}";
Helper.Pay(payInfo);
}
private void buttonORM_Click(object sender, EventArgs e)
{
Helper.PayInitEnvironment();
var query = JsonHelper.DeserializeJSON<Model.query._in.query_in_Root>(richTextBox1.Text);
using (EHCEntities chis = new EHCEntities())
{
//chis.Database.Log = s => WEISHENG.COMM.LogHelper.LogToFile("ef6调试", s);
using (var dbContextTransaction = chis.Database.BeginTransaction())
{
try
{
chis.in_roots.Add(query);
chis.SaveChanges();
dbContextTransaction.Commit();
//HIS.COMM.msgHelper.BalloonShow("数据保存成功");
}
catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)
{
StringBuilder stringBuilder = new StringBuilder();
foreach (var validationErrors in dbEx.EntityValidationErrors)
{
foreach (var validationError in validationErrors.ValidationErrors)
{
stringBuilder.Append(string.Format("Class: {0}, Property: {1}, Error: {2}",
validationErrors.Entry.Entity.GetType().FullName,
validationError.PropertyName,
validationError.ErrorMessage));
}
}
dbContextTransaction.Rollback();
//HIS.COMM.msgHelper.BalloonShow(stringBuilder.ToString());
}
catch (Exception ex)
{
string errorMsg = "错误:";
if (ex.InnerException == null)
errorMsg += ex.Message + ",";
else if (ex.InnerException.InnerException == null)
errorMsg += ex.InnerException.Message + ",";
else if (ex.InnerException.InnerException.InnerException == null)
errorMsg += ex.InnerException.InnerException.Message;
dbContextTransaction.Rollback();
//HIS.COMM.msgHelper.BalloonShow(errorMsg);
}
}
chis.Database.Log = null;
}
richTextBox2.Text = JsonHelper.SerializeJSON(query);
var str = Helper.Pay(richTextBox1.Text);
var str2 = JsonHelper.GetJsonstr(str);
Model.query._out.query_out_Root root = JsonHelper.DeserializeJSON<Model.query._out.query_out_Root>(str2);
}
private void button3_Click(object sender, EventArgs e)
{
try
{
var query = JsonHelper.DeserializeJSON<Model.mf_Root>(richTextBox2.Text);
//var queryin = JsonHelper.DeserializeJSON<Model.query._out.query_out_Root>(richTextBox1.Text);
using (EHCEntities chis = new EHCEntities())
{
chis.mf_Roots.Add(query);
//chis.in_roots.Add(queryin)
chis.SaveChanges();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void button4_Click(object sender, EventArgs e)
{
EHCEntities chis = new EHCEntities();
var query2 = chis.in_roots.FirstOrDefault();
var query = chis.mf_Roots.FirstOrDefault();
//var test = query.mxlist;
richTextBox2.Text = JsonHelper.SerializeJSON(query);
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。