private void ConvertPaymentToPaymentBDO(Payment p, PaymentBDO paymentBDO) { paymentBDO.BusinessStyle = p.BusinessStyle; paymentBDO.Cancelled = p.Cancelled; paymentBDO.ORNo = p.ORNo; paymentBDO.PaidAt = p.PaidAt; paymentBDO.PaidTo = (int)p.PaidTo; paymentBDO.ReceivedFrom = p.ReceivedFrom; paymentBDO.SettlementFor = p.SettlementFor; paymentBDO.StudentId = p.StudentId; paymentBDO.TIN = p.TIN; paymentBDO.Amount = (float?)p.Amount; paymentBDO.Adres = p.Adres; }
private void ConvertPaymentBDOToPayment(PaymentBDO pbdo, Payment p) { p.BusinessStyle = pbdo.BusinessStyle; p.Cancelled = pbdo.Cancelled; p.ORNo = pbdo.ORNo; p.PaidAt = pbdo.PaidAt; p.PaidTo = (int)pbdo.PaidTo; p.ReceivedFrom = pbdo.ReceivedFrom; p.SettlementFor = pbdo.SettlementFor; p.StudentId = pbdo.StudentId; p.TIN = pbdo.TIN; p.Amount = pbdo.Amount; p.Adres = pbdo.Adres; //p.PaymentDetails = ToPaymentDetailsList(pbdo.PaymentDetails); }
public Boolean CreatePayment(ref PaymentBDO payBDO, ref string message) { message = "Payment Added Successfully"; bool ret = true; Payment p = new Payment(); try { ConvertPaymentBDOToPayment(payBDO, p); using (var DCEnt = new DCFIEntities()) { DCEnt.Payments.Add(p); DCEnt.Entry(p).State = System.Data.Entity.EntityState.Added; int num = DCEnt.SaveChanges(); payBDO.ORNo = p.ORNo; if (num < 1) { ret = false; message = "Adding of Payment failed"; } } } catch (DbEntityValidationException dbEx) { foreach (var validationErrors in dbEx.EntityValidationErrors) { foreach (var validationError in validationErrors.ValidationErrors) { Trace.TraceInformation("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage); } } } return ret; }