예제 #1
0
 public PaymentBDO GetPaymentBDO(int ORNo)
 {
     PaymentBDO paymentBDO = null;
     try { 
     using (var DCEnt = new DCFIEntities())
     {
         Payment pymnt = (from p in DCEnt.Payments
                          where p.ORNo == ORNo
                          select p).FirstOrDefault();
         if (pymnt != null)
         {
             paymentBDO = new PaymentBDO();
             ConvertPaymentToPaymentBDO(pymnt, paymentBDO);
         }
     }
     }
     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 paymentBDO;
 }
예제 #2
0
        public List<PaymentBDO> GetAllPayments()
        {
            List<Payment> pList = new List<Payment>();
            List<PaymentBDO> pBDOList = new List<PaymentBDO>();
            try
            {
            using (var DCEnt = new DCFIEntities())
            {
                var allPayments = (DCEnt.Payments);
                pList = allPayments.ToList<Payment>();
            }

           
            foreach (Payment p in pList)
            {
                PaymentBDO pBDO = new PaymentBDO();
                ConvertPaymentToPaymentBDO(p, pBDO);
                pBDOList.Add(pBDO);
            }
            }
            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 pBDOList;
        }
예제 #3
0
 public PaymentBDO GetPayment(int ORNo)
 {
     PaymentBDO p = new PaymentBDO();
     p = pDAO.GetPaymentBDO(ORNo);
     if (p != null)
         p.PaymentDetails = pDAO.GetAllPaymentDetailsForPayment(p.ORNo);
     return p;
 }
예제 #4
0
 public bool CreatePayment(ref Payment payment, ref string message)
 {
     PaymentBDO pbdo = new PaymentBDO();
     TranslatePaymentToPaymentBDO(payment, pbdo);
     return plogic.CreatePayment(ref pbdo, ref message);
 }
예제 #5
0
 public void TranslatePaymentToPaymentBDO(Payment p, PaymentBDO pbdo)
 {
     pbdo.BusinessStyle = p.BusinessStyle;
     pbdo.Cancelled = p.Cancelled;
     pbdo.ORNo = p.ORNo;
     pbdo.PaidAt = p.PaidAt;
     pbdo.PaidTo = p.PaidTo;
     //pbdo.PaymentDetails = ToPaymentDetailsBDOList(p.PaymentDetails);
     pbdo.ReceivedFrom = p.ReceivedFrom;
     pbdo.SettlementFor = p.SettlementFor;
     pbdo.StudentId = p.StudentId;
     pbdo.TIN = p.TIN;
     pbdo.Amount = p.Amount;
     pbdo.Adres = p.Adres;
 }
예제 #6
0
 public void TranslatePaymentBDOToPaymentDTO(PaymentBDO pBDO, Payment pment)
 {
     pment.BusinessStyle = pBDO.BusinessStyle;
     pment.Cancelled = pBDO.Cancelled;
     pment.ORNo = pBDO.ORNo;
     pment.PaidAt = pBDO.PaidAt;
     pment.PaidTo = pBDO.PaidTo;
     //pment.PaymentDetails = ToPaymentDetailDTO(pBDO.PaymentDetails);
     pment.ReceivedFrom = pBDO.ReceivedFrom;
     pment.SettlementFor = pBDO.SettlementFor;
     pment.StudentId = pBDO.StudentId;
     pment.TIN = pBDO.TIN;
     pment.Amount = (float)pBDO.Amount;
     pment.Adres = pBDO.Adres;
 }
예제 #7
0
        public List<PaymentBDO> GetAllStudentsPayments(string studentID)
        {
            List<Payment> pList = new List<Payment>();
            using (var DCEnt = new DCFIEntities())
            {
                var allPayments = (from p in DCEnt.Payments
                                   where p.StudentId == studentID
                                   select p);
                pList = allPayments.ToList<Payment>();
               
            }

            List<PaymentBDO> pBDOList = new List<PaymentBDO>();
            foreach (Payment p in pList)
            {
                PaymentBDO pBDO = new PaymentBDO();
                ConvertPaymentToPaymentBDO(p, pBDO);
                pBDOList.Add(pBDO);
            }
            return pBDOList;
        }
예제 #8
0
 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);
 }
예제 #9
0
 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;
 }
예제 #10
0
        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;
        }
예제 #11
0
 public Boolean CreatePayment(ref PaymentBDO payment, ref string message)
 {
     return pDAO.CreatePayment(ref payment, ref message);
 }