public Boolean CreatePaymentDetail(ref PaymentDetailsBDO paymentDetailsBDO, ref string message) { message = "Payment Detail Added Successfully"; bool ret = true; PaymentDetail paymentDetail = new PaymentDetail(); try { ConvertPaymentDetailsBDOToPaymentDetails(paymentDetailsBDO, paymentDetail); using (var DCEnt = new DCFIEntities()) { DCEnt.PaymentDetails.Attach(paymentDetail); DCEnt.Entry(paymentDetail).State = System.Data.Entity.EntityState.Added; int num = DCEnt.SaveChanges(); if (num != 1) { ret = false; message = "Adding of Payment Details 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; }
public void ConvertPaymentDetailsBDOToPaymentDetails(PaymentDetailsBDO paymentDetailsBDO, PaymentDetail pd) { pd.Amount = paymentDetailsBDO.Amout; pd.DetailNumber = paymentDetailsBDO.DetailNumber; pd.FeeID = paymentDetailsBDO.FeeID; pd.ORNo = paymentDetailsBDO.ORNo; }
private List<PaymentDetail> ToPaymentDetailsList(List<PaymentDetailsBDO> paymentDetails) { List<PaymentDetail> pdList = new List<PaymentDetail>(); foreach (PaymentDetailsBDO pdbdo in paymentDetails) { PaymentDetail pd = new PaymentDetail(); pd.Amount = pdbdo.Amout; pd.DetailNumber = pdbdo.DetailNumber; pd.FeeID = pdbdo.FeeID; pd.ORNo = pdbdo.ORNo; } return pdList; }
private void ConvertPaymentDetailsToPaymentDetailsBDO(PaymentDetail pd, PaymentDetailsBDO paymentDetailsBDO) { paymentDetailsBDO.Amout = (float) pd.Amount; paymentDetailsBDO.DetailNumber = pd.DetailNumber; paymentDetailsBDO.FeeID = pd.FeeID; paymentDetailsBDO.ORNo = (int) pd.ORNo; }