private void webKitBrowser1_DocumentTitleChanged(object sender, EventArgs e) { if (isPaying) { isPaying = false; //充值返回了数据 try { Message msg = JsonConvert.DeserializeObject <Message>(this.webKitBrowser1.DocumentTitle); if (msg.Result) { //充值成功,提示打印票据 PayResult pay = JsonConvert.DeserializeObject <PayResult>(msg.TxtMessage); Print(pay); using (CompanyAccountServiceBF bf = new CompanyAccountServiceBF()) { Iot_TopUpRecord topUpRecord = new Iot_TopUpRecord() { ID = pay.ID, Address = this._user.Address, Amount = pay.Amount, Context = pay.Context, MeterID = pay.MeterID, MeterNo = pay.MeterNo, Oper = pay.Oper, OrgCode = "", PayType = pay.PayType, Ser = pay.Ser, CompanyID = "", State = (char)pay.State, TaskID = pay.TaskID, TopUpDate = pay.TopUpDate, TopUpType = (char)pay.TopUpType, UserID = pay.UserID, UserName = _user.UserName }; bf.ICompanyAccount.AddTopUpRecord(topUpRecord); } } else { //充值失败 this.btnClose.Enabled = true; this.btnPay.Enabled = true; MessageBox.Show("充值失败,原因:" + msg.TxtMessage, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ee) { this.btnClose.Enabled = true; this.btnPay.Enabled = true; MessageBox.Show("充值失败,原因:服务器返回错误数据。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
public string AddTopUpRecord(Iot_TopUpRecord record) { this.GetTable <Iot_TopUpRecord>().InsertOnSubmit(record); try { this.SubmitChanges(); return(""); } catch (Exception e) { return(e.Message); } }