static void postRedJson(RedViewModel viewModel, string url, string type) { InvoiceRed invoice = new InvoiceRed(); invoice.taxpayerNum = viewModel.TaxpayerNum; invoice.invoiceReqSerialNo = SerialNoHelper.GetInvoiceReqSerialNo(mcPrefix); invoice.amount = viewModel.Amount; invoice.invoiceCode = viewModel.InvoiceCode; invoice.invoiceNo = viewModel.InvoiceNo; invoice.redReason = viewModel.RedReason; string content = JsonHelper.Object2String <InvoiceRed>(invoice).Replace("\\", ""); mLogger.Info("红票业务内容JSON串"); Task.Factory.StartNew(() => { MsgResponse rsp = mApi.PostJson(url, content); if (OnHttpPost != null) { OnHttpPost(type + "红票开票" + rsp.msg); } }); }
/// <summary> /// 开具纸质红票 /// </summary> /// <param name="viewModel"></param> internal static void DrawPaperRed(RedViewModel viewModel) { string url = ConfigurationManager.AppSettings["PaperRed"]; postRedJson(viewModel, url, "纸质"); }
/// <summary> /// 开具电子红票 /// </summary> /// <param name="viewModel"></param> internal static void DrawElectronicRed(RedViewModel viewModel) { string url = ConfigurationManager.AppSettings["ElectronicRed"]; postRedJson(viewModel, url, "电子"); }