private static PaymentTransaction createRandomPaymentTransaction()
 {
     PaymentTransaction pt = new PaymentTransaction();
     pt.PaymentType = createRandomPaymentType();
     pt.PaymentId = 0; // need to get this when saving holder
     pt.Amount = new decimal(rnd.NextDouble());
     pt.AuthCode = rnd.Next().ToString();
     pt.PaymentStatusCode = createRandomPaymentStatusCode();
     return pt;
 }
 private static void map(DAL.PaymentTransaction dalPaymentTransaction, PaymentTransaction paymentTransaction)
 {
     paymentTransaction.Id = dalPaymentTransaction.Id;
     paymentTransaction.PaymentId = dalPaymentTransaction.PaymentHeaderId;
     paymentTransaction.PaymentType = PaymentType.Load(dalPaymentTransaction.PaymentTypeId);
     paymentTransaction.Amount = dalPaymentTransaction.Amount;
     paymentTransaction.AuthCode = dalPaymentTransaction.AuthCode;
     paymentTransaction.PaymentStatusCode = PaymentStatusCode.LoadWithPaymentTransactionId(dalPaymentTransaction.Id);
 }
        private void map(DAL.CustomersDataContext dc, PaymentTransaction paymentTransaction, DAL.PaymentTransaction dalPaymentTransaction)
        {
            bool isNew = paymentTransaction.Id == 0;
            bool isModified = false;

            if (dalPaymentTransaction.PaymentTypeId != paymentTransaction.PaymentType.Id)
            {
                dalPaymentTransaction.PaymentTypeId = paymentTransaction.PaymentType.Id;
                isModified = true;
            }

            if (dalPaymentTransaction.PaymentHeaderId != paymentTransaction.PaymentId)
            {
                dalPaymentTransaction.PaymentHeaderId = paymentTransaction.PaymentId;
                isModified = true;
            }

            if (dalPaymentTransaction.Amount != paymentTransaction.Amount)
            {
                dalPaymentTransaction.Amount = paymentTransaction.Amount;
                isModified = true;
            }

            if (dalPaymentTransaction.AuthCode != paymentTransaction.AuthCode)
            {
                dalPaymentTransaction.AuthCode = paymentTransaction.AuthCode;
                isModified = true;
            }

            if (dalPaymentTransaction.StatusCode != Convert.ToInt32(paymentTransaction.PaymentStatusCode.StatusCode))
            {
                dalPaymentTransaction.StatusCode = Convert.ToInt32(paymentTransaction.PaymentStatusCode.StatusCode);
                isModified = true;
            }

            if (isNew)
            {
                dalPaymentTransaction.CreatedBy = paymentTransaction.LastChangedBy;
                dalPaymentTransaction.CreatedDate = DateTime.Now;
            }

            if (isModified)
            {
                dalPaymentTransaction.LastChangedBy = paymentTransaction.LastChangedBy;
                dalPaymentTransaction.LastChangedDate = DateTime.Now;
            }
        }
        internal static void Delete(DAL.CustomersDataContext dc, PaymentTransaction item)
        {
            DAL.PaymentTransaction dalPaymentTransaction = findRecord(dc, item.Id);
            dalPaymentTransaction.Deleted = true;
            dc.SubmitChanges();

            PaymentType.Delete(dc, item.PaymentType);
            PaymentStatusCode.Delete(dc, item.PaymentStatusCode);
        }