Ejemplo n.º 1
0
        //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);
            }
        }
Ejemplo n.º 2
0
        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); }));
        }