private static OrderModel getOrderDetail(OrderModel order) { OrderBLL ob = new OrderBLL(); string xml = ob.getOrderDetail(order.Out_trade_no); try { string is_success = XMLStrHelper.GetXmlNodeByXpath(xml, "Alipay/is_success").InnerText; if (is_success == "T") { //order.Out_trade_no = XMLStrHelper.GetXmlNodeByXpath(xml, "Alipay/order/out_trade_no").InnerText; order.Subject = XMLStrHelper.GetXmlNodeByXpath(xml, "Alipay/order/subject").InnerText; order.Total_fee = Convert.ToDecimal(XMLStrHelper.GetXmlNodeByXpath(xml, "Alipay/order/total_fee").InnerText); //order.Buyer_email = om.Buyer_email; order.Trade_no = XMLStrHelper.GetXmlNodeByXpath(xml, "Alipay/order/trade_no").InnerText; order.Gmt_create = XMLStrHelper.GetXmlNodeByXpath(xml, "Alipay/order/gmt_create").InnerText; order.Gmt_payment = XMLStrHelper.GetXmlNodeByXpath(xml, "Alipay/order/gmt_payment").InnerText; return order; } else { return order; } } catch (Exception ex) { return order; } }
public void printOrder(OrderModel order) { if (StaticData.Config.dualPrint == "1") { this.PrintLine(order); } this.PrintLine(order); }
public FormPaySuccess(OrderModel order) { InitializeComponent(); lblFee.Text = order.Total_fee.ToString(); lblBuyEmail.Text = order.Buyer_email; timer1.Enabled = true; BeginAnimate(); }
private void orderDetail(OrderModel order) { lblEmail.Text = order.Buyer_email; lblOrderId.Text = order.Out_trade_no; lblTotalFee.Text = order.Total_fee.ToString(); lblTradeNo.Text = order.Trade_no; lblDate.Text = order.Gmt_payment; lblDevice_name.Text = StaticData.Device.device_name; lblCashier_no.Text = StaticData.Cashier.cashier_no; lblPname.Text = StaticData.Device.pname; }
public static void printOrder(OrderModel order) { order = getOrderDetail(order); if (StaticData.Config.isPrint == "1") { if (StaticData.Config.userLptPrint == "1") { LPTPrinter lptPrinter = new LPTPrinter(); lptPrinter.printOrder(order); } else { PrintOrder printOrder = new PrintOrder(order); printOrder.Show(); printOrder.print(); } } }
private void PrintLine(OrderModel order) { IntPtr iHandle = CreateFile(prnPort, 0x50000000, 0, 0, OPEN_EXISTING, 0, 0); if (iHandle.ToInt32() == -1) { Console.WriteLine(iHandle.ToString()); MessageHelper.ShowTips("没有连接打印机或者打印机端口不正确"); } else { Console.WriteLine(iHandle.ToString()); FileStream fs = new FileStream(iHandle, FileAccess.ReadWrite); StreamWriter sw = new StreamWriter(fs, System.Text.Encoding.Default); sw.WriteLine(); sw.WriteLine(" 支付宝收款单"); sw.WriteLine(); sw.WriteLine("支付宝账户:"); sw.WriteLine(order.Buyer_email); sw.WriteLine("订单号:"); sw.WriteLine(order.Out_trade_no); sw.WriteLine("支付宝交易号:"); sw.WriteLine(order.Trade_no); sw.WriteLine(); sw.WriteLine("交易金额:"); sw.WriteLine(" RMB:"+order.Total_fee); sw.WriteLine("日期/时间:"); sw.WriteLine(order.Gmt_payment); sw.WriteLine(); sw.WriteLine("设备名称: " + StaticData.Device.device_name); sw.WriteLine("收银员编号:" + StaticData.Cashier.cashier_no); sw.WriteLine("商户名称: " + StaticData.Device.pname); sw.WriteLine(); sw.WriteLine(); sw.WriteLine("---------------------------"); sw.WriteLine(); sw.Close(); fs.Close(); } }
private void payProcess() { ORDER = new OrderModel(); string total_fee = txtTotal_fee.Text.Trim(); string dym_id = txtDynamic_id.Text.Trim(); ORDER.Total_fee = Convert.ToDecimal(total_fee); AlipayBLL ab = new AlipayBLL(); string xml = ab.pay(dym_id,total_fee); try { string is_success = XMLStrHelper.GetXmlNodeByXpath(xml, "Alipay/is_success").InnerText; if (is_success == "T") { string result_code = XMLStrHelper.GetXmlNodeByXpath(xml, "Alipay/result_code").InnerText; ORDER.Out_trade_no = XMLStrHelper.GetXmlNodeByXpath(xml, "Alipay/out_trade_no").InnerText; ORDER.Buyer_email = XMLStrHelper.GetXmlNodeByXpath(xml, "Alipay/buyer_email").InnerText; if (result_code == "ORDER_SUCCESS_PAY_SUCCESS") { paySuccess(); } else if (result_code == "ORDER_SUCCESS_PAY_INPROCESS") { WaiteMM = 0; ESC1MM = 60; this.timer1.Enabled = true; this.btnClear.Enabled = false; this.lblMsg2.Text = "待支付中...10秒后可按Esc退出"; Thread thread = new Thread(this.waitPay); thread.IsBackground = true; thread.Start(ORDER); //payFinish(); } } else { string error_msg = XMLStrHelper.GetXmlNodeByXpath(xml, "Alipay/error_msg").InnerText; MessageHelper.ShowWarning("失败:" + error_msg); payFinish(); } } catch (Exception ex) { MessageHelper.ShowError("异常:" + ex.Message); payFinish(); } }
public PrintOrder(OrderModel om) { InitializeComponent(); orderDetail(om); }
private void btnPrint_Click(object sender, EventArgs e) { try { string pay_status = dgvList.SelectedRows[0].Cells[4].Value.ToString();; if (pay_status == "已支付") { OrderModel om = new OrderModel(); om.Out_trade_no = dgvList.SelectedRows[0].Cells[1].Value.ToString(); om.Buyer_email = dgvList.SelectedRows[0].Cells[7].Value.ToString(); PrintUtils.printOrder(om); } else { MessageHelper.ShowTips("此订单未付款!" + pay_status); } }catch(Exception ex) { MessageHelper.ShowError("没有选择任何订单!"); } }