public RefundResponse CreateRefund(RefundRequest req) { var response = new RefundResponse(); try { using (var container = new TransactionModelContainer()) { var refund = new Refund() { CreatedBy = req.CreateBy, CreatedDate = DateTime.Now, CustomerAddress = req.CustomerAddress, CustomerIdmPartyId = req.CustomerIdmPartyId, CustomerMobilePhoneNo = req.CustomerMobilePhoneNo, CustomerName = req.CustomerName, CustomerRefundAccountName = req.CustomerRefundAccountName, CustomerRefundAccountNo = req.CustomerRefundAccountNo, CustomerRefundBankId = req.CustomerRefundBankId, IsVoid = req.IsVoid, PaymentCode = req.PaymentCode, Ref1 = req.Ref1, Ref2 = req.Ref2, Ref3 = req.Ref3, Remark = req.Remark, Status = req.Status, UpdatedBy = req.UpdateBy, UpdatedDate = DateTime.Now, }; container.Refunds.AddObject(refund); foreach (var r in req.Items) { var refundItem = new RefundItem() { GroupRef1 = r.GroupRef1, GroupRef2 = r.GroupRef2, ItemDescription = r.ItemDescription, Qty = r.Qty, Remark = r.Remark, UnitAmount = r.UnitAmount, }; container.RefundItems.AddObject(refundItem); } container.SaveChanges(); //response.SetPaymentResponse(payment); response.Succeed(); } } catch (Exception ex) { response.Fail(ex); CreateLog(ex); } return response; }
/// <summary> /// Create a new RefundItem object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="qty">Initial value of the Qty property.</param> /// <param name="unitAmount">Initial value of the UnitAmount property.</param> /// <param name="refundId">Initial value of the RefundId property.</param> public static RefundItem CreateRefundItem(global::System.Int64 id, global::System.Int32 qty, global::System.Int32 unitAmount, global::System.Int64 refundId) { RefundItem refundItem = new RefundItem(); refundItem.Id = id; refundItem.Qty = qty; refundItem.UnitAmount = unitAmount; refundItem.RefundId = refundId; return refundItem; }
/// <summary> /// Deprecated Method for adding a new object to the RefundItems EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToRefundItems(RefundItem refundItem) { base.AddObject("RefundItems", refundItem); }