public void VoidGroupBuyingTicket(int sysNo) { if (sysNo <= 0) { throw new ArgumentException("sysNo"); } var origin = m_GroupBuyingDA.LoadGroupBuyingTicketBySysNo(sysNo); if (origin == null) { //throw new BizException(string.Format("团购活动券[{0}]不存在!", origin.TicketID)); throw new BizException(string.Format(ResouceManager.GetMessageString("MKT.Promotion.GroupBuying", "GroupBuying_NotExsistGroupBuyingTicket"), origin.TicketID)); } if (origin.Status == GroupBuyingTicketStatus.Used || origin.Status == GroupBuyingTicketStatus.Abandon) { //throw new BizException(string.Format("团购活动券[{0}]已经使用或作废,不能作废!", origin.TicketID)); throw new BizException(string.Format(ResouceManager.GetMessageString("MKT.Promotion.GroupBuying", "GroupBuying_AlreadyUseGroupBuyingTicket"), origin.TicketID)); } TransactionOptions options = new TransactionOptions(); options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted; options.Timeout = TransactionManager.DefaultTimeout; using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options)) { if (origin.Status == GroupBuyingTicketStatus.Created) { m_GroupBuyingDA.UpdateGroupBuyingTicketStatus(sysNo, GroupBuyingTicketStatus.Abandon); } else { var soIncomeInfo = new SOIncomeInfo() { OrderSysNo = origin.SysNo.Value, OrderType = SOIncomeOrderType.GroupRefund, OrderAmt = origin.TicketAmt.Value * -1, IncomeAmt = origin.TicketAmt.Value * -1, GiftCardPayAmt = 0, PointPay = 0, IncomeStyle = SOIncomeOrderStyle.Advanced, //ReferenceID = origin.GroupBuyingSysNo.ToString(), Status = SOIncomeStatus.Origin, Note = "虚拟团购负收款单", CompanyCode = origin.CompanyCode, MasterSoSysNo = origin.OrderSysNo, }; //生成付款单 ExternalDomainBroker.CreateSOIncome(soIncomeInfo); var item = new GroupBuyingTicketInfo { SysNo = origin.SysNo, RefundDate = DateTime.Now, RefundStatus = RefundStatus.Origin, RefundMemo = "退款且作废团购券", Status = GroupBuyingTicketStatus.Abandon }; m_GroupBuyingDA.UpdateGroupBuyingTicketRefundInfo(item); } scope.Complete(); } }