//private void datePicker2_SelectedDateChanged(object sender, SelectionChangedEventArgs e) //{ // datePicker2.Text = (DateTime.Parse(datePicker2.Text)).ToString("yyyy-MM-dd"); //} //private void tBoxRefundAmount_TextChanged(object sender, TextChangedEventArgs e) //{ // if (tBoxRefundAmount.Text.Length > 0) // lbInputRefundAmount.Content = ""; // else // lbInputRefundAmount.Content = "搜索关键字"; //} private void updateRefundStatus_Click(object sender, RoutedEventArgs e) { string refund_order_id = string.Empty; string status = string.Empty; string remark = string.Empty; string merchant_id = string.Empty; string tmp = string.Empty; string msg = string.Empty; PayInterface payInterface = new PayInterface(); DataRowView dr = OrderRefundQueryPage.SelectedItem as DataRowView; Dictionary <string, string> result = new Dictionary <string, string>(); Dictionary <string, string> describe = new Dictionary <string, string>(); bool bret = PayApi.ApiGet_all_RefundStatus(Var.ltoken, out msg, out describe); if (!bret) { MessageBox.Show("获取状态失败!", "错误提示", MessageBoxButton.OK, MessageBoxImage.Error); } if (dr != null) { refund_order_id = (dr["refund_order_id"].ToString()); merchant_id = (dr["merchant_id"].ToString()); if (payInterface.ApiRefundStatusQuery(refund_order_id, merchant_id, out result) == false) { return; } result.TryGetValue("status", out tmp); result.TryGetValue("msg", out remark); describe.TryGetValue(tmp, out status); dr["_status"] = status; //dr["remark"] = remark; MessageBox.Show(remark, "系统提示", MessageBoxButton.OK, MessageBoxImage.None); } else { MessageBox.Show("操作失败", "错误提示", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void updateInformation_Click(object sender, RoutedEventArgs e) { string order_id = string.Empty; string status = string.Empty; string remark = string.Empty; string merchant_id = string.Empty; string tmp = string.Empty; string msg = string.Empty; PayInterface payInterface = new PayInterface(); DataRowView dr = OrderQueryPage.SelectedItem as DataRowView; Dictionary <string, string> result = new Dictionary <string, string>(); //bool bret = PayApi.ApiGet_all_OrderStatus(Var.ltoken, out msg, out Var.g_all_payment_Order_Status); //if (!bret) //{ // MessageBox.Show("获取状态失败!"); //} if (dr != null) { order_id = (dr["order_id"].ToString()); merchant_id = (dr["merchant_id"].ToString()); if (payInterface.ApiOrderStatusQuery(order_id, merchant_id, out result) == false) { MessageBox.Show("查询失败", "错误提示", MessageBoxButton.OK, MessageBoxImage.Error); return; } result.TryGetValue("status", out tmp); result.TryGetValue("msg", out remark); Var.g_all_payment_Order_Status.TryGetValue(tmp, out status); dr["_status"] = status; dr["remark"] = remark; MessageBox.Show(remark, "系统提示", MessageBoxButton.OK, MessageBoxImage.None); } else { MessageBox.Show("操作失败", "错误提示", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void btn_refund_Click(object sender, RoutedEventArgs e) { if (close_Flag) { return; } close_Flag = true; if (execute_Flag) { execute_Flag = false; this.Close(); return; //有可能关不到,这里退出 } PayInterface payInterface = new PayInterface(); if (tx_refund_amount.Text.Length == 0 && lab_order_id.Content != null) { return; } Dictionary <string, string> result = new Dictionary <string, string>(); bool bRet = payInterface.ApiAddRefund(lab_order_id.Content.ToString(), tx_refund_amount.Text, Var.operator_id, Var.merchant_id, out result); //状态查询 if (bRet) { string str = string.Empty; result.TryGetValue("refund_order_id", out str); lab_refund_order_id.Content = str; QueryRefundStatusThreadProcess = new Thread(new ParameterizedThreadStart(GetRefundStatus)); QueryRefundStatusThreadProcess.Start(str); } else { MessageBox.Show("退款失败", "错误提示", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void GetRefundStatus(object obj) { string refund_order_id = obj as string; MediaPlayer media = new MediaPlayer(); string msg = string.Empty; string tmp = string.Empty; string status = string.Empty; //int i = 3; Dictionary <string, string> result = new Dictionary <string, string>(); PayInterface payInterface = new PayInterface(); while (close_Flag) { Thread.Sleep(5000); if (payInterface.ApiRefundStatusQuery(refund_order_id, Var.merchant_id, out result) == false) { if (Var.sound == 1) { media.Open(new Uri("./prompt/查询订单状态失败,请手工查询.mp3", UriKind.Relative)); media.Play(); } execute_Flag = true; MessageBox.Show("查询退款状态失败,请手工查询", "错误提示", MessageBoxButton.OK, MessageBoxImage.Error); return; } result.TryGetValue("status", out tmp); result.TryGetValue("msg", out msg); Var.g_all_payment_refund_status.TryGetValue(tmp, out status); Dispatcher.Invoke(new Action(() => { lab_Refund_Status.Content = status; })); if (status.Contains("退款成功") || status.Contains("退款失败")) { execute_Flag = true; if (Var.sound == 1) { if (status.Contains("退款成功")) { media.Open(new Uri("./prompt/退款成功.mp3", UriKind.Relative)); } else { media.Open(new Uri("./prompt/退款失败.mp3", UriKind.Relative)); } media.Play(); } break; } } execute_Flag = true; close_Flag = false; Dispatcher.Invoke(new Action(() => { lab_Refund_Status.Content = status; })); //获取焦点,为支付成功关窗口做准备 this.Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action)(() => { Keyboard.Focus(btn_refund); })); }
private void payment() { if (close_Flag) { return; } close_Flag = true; if (execute_Flag) { execute_Flag = false; this.Close(); return; //有可能关不到,这里退出 } if (textBox1.Text.ToString() == "0.00") { return; } if (tBoxBarCode.Text.Trim().Replace(" ", "").Length < 18) { return; } double dMoney = 0; try { dMoney = Convert.ToDouble(textBox1.Text.ToString()); } catch (Exception) { MessageBox.Show("支付金额有错", "系统提示", MessageBoxButton.OK, MessageBoxImage.Error); return; } Dictionary <string, string> result = new Dictionary <string, string>(); string order_id = string.Empty; string Barcode = tBoxBarCode.Text.Trim().Replace(" ", ""); string msg = string.Empty; string tmp = string.Empty; PayInterface payInterface = new PayInterface(); //Var.channel,需要在支付的时候赋值 modfiy 20181201 bool bRet = payInterface.InterfaceAddOrder(Var.channel, Var.payment, dMoney.ToString(), Barcode, Var.subject, Var.body, Var.merchant_id, Var.store_id, Var.operator_id, Var.device_id, Var.gkey, out order_id, out result); //add 状态查询 if (bRet) { //更新订单号 Pay_Order.Content = order_id; //判定是不是支付失败 下单返回status=4的时候是下单失败了,要把失败的信息显示出来 result.TryGetValue("status", out tmp); if (tmp.Contains("4")) { result.TryGetValue("msg", out msg); Pay_Status.Content = "status:" + tmp + msg; return; } QueryThreadProcess = new Thread(new ParameterizedThreadStart(GetPayMentStatus)); QueryThreadProcess.Start(order_id); } else { Pay_Status.Content = "交易失败,请重试"; } }