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 Refund object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="createdDate">Initial value of the CreatedDate property.</param>
 /// <param name="createdBy">Initial value of the CreatedBy property.</param>
 /// <param name="updatedDate">Initial value of the UpdatedDate property.</param>
 /// <param name="updatedBy">Initial value of the UpdatedBy property.</param>
 /// <param name="version">Initial value of the Version property.</param>
 /// <param name="paymentCode">Initial value of the PaymentCode property.</param>
 /// <param name="status">Initial value of the Status property.</param>
 /// <param name="isVoid">Initial value of the IsVoid property.</param>
 /// <param name="customerIdmPartyId">Initial value of the CustomerIdmPartyId property.</param>
 /// <param name="customerName">Initial value of the CustomerName property.</param>
 /// <param name="customerAddress">Initial value of the CustomerAddress property.</param>
 public static Refund CreateRefund(global::System.Int64 id, global::System.DateTime createdDate, global::System.String createdBy, global::System.DateTime updatedDate, global::System.String updatedBy, global::System.Byte[] version, global::System.String paymentCode, global::System.String status, global::System.Boolean isVoid, global::System.Int64 customerIdmPartyId, global::System.String customerName, global::System.String customerAddress)
 {
     Refund refund = new Refund();
     refund.Id = id;
     refund.CreatedDate = createdDate;
     refund.CreatedBy = createdBy;
     refund.UpdatedDate = updatedDate;
     refund.UpdatedBy = updatedBy;
     refund.Version = version;
     refund.PaymentCode = paymentCode;
     refund.Status = status;
     refund.IsVoid = isVoid;
     refund.CustomerIdmPartyId = customerIdmPartyId;
     refund.CustomerName = customerName;
     refund.CustomerAddress = customerAddress;
     return refund;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Refunds EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToRefunds(Refund refund)
 {
     base.AddObject("Refunds", refund);
 }