コード例 #1
0
ファイル: PrintController.cs プロジェクト: nash306/TaoPrinter
        /// <summary>
        /// 直接订单打印
        /// </summary>
        /// <returns></returns>
        public ActionResult Print(int tradeId)
        {
            string error = "";
            TradePrintInfo tradePrintInfo = new TradePrintInfo();
            Trade trade;
            if (TradeUtilizer.GetTrade(tradeId, Session["SessionKey"].ToString(), out trade))
            {
                tradePrintInfo.tradeInfo = trade;
                Sender sender = ServiceUtilizer.GetCurrentEntity<Sender>(Session[Constants.User_Id]);
                if (null != sender)
                {
                    SenderInfoPrintSettings senderInfoPrintSettings = ServiceUtilizer.GetCurrentEntity<SenderInfoPrintSettings>(Session[Constants.User_Id]);
                    if (null == senderInfoPrintSettings)//如果没有,则按照默认值使用
                    {
                        senderInfoPrintSettings = new SenderInfoPrintSettings();
                    }
                    tradePrintInfo.senderInfoPrintSettings = senderInfoPrintSettings;

                    ReceiverInfoPrintSettings receiverInfoPrintSettings = ServiceUtilizer.GetCurrentEntity<ReceiverInfoPrintSettings>(Session[Constants.User_Id]);
                    if (null == receiverInfoPrintSettings)//如果没有,则按照默认值使用
                    {
                        receiverInfoPrintSettings = new ReceiverInfoPrintSettings();
                    }
                    tradePrintInfo.receiverInfoPrintSettings = receiverInfoPrintSettings;

                    return View(tradePrintInfo);
                }
                else
                {
                    error = ServiceUtilizer.ErrorMsg;
                }
            }
            return Content(error);
        }
コード例 #2
0
 public ActionResult ChangeSenderInfoPrintSettings(SenderInfoPrintSettings sender)
 {
     IService<SenderInfoPrintSettings> senderService = ServiceUtilizer.GetCurrentService<SenderInfoPrintSettings>();
     if (senderService.UpdateEntity(sender))
     {
         return RedirectToAction("ViewSenderInfoPrintSettings");
     }
     else
     {
         return Content(senderService.ErrorMsg);
     }
 }