Example #1
0
        private CasePaymentPlanVM Transform(CasePaymentPlan n)
        {
            var r = new CasePaymentPlanVM();

            r.Active    = n.Active;
            r.Amount    = n.Amount;
            r.CaseId    = n.CaseId;
            r.EndDate   = n.EndDate;
            r.Frequency = n.Frequency;
            r.Id        = n.Id;
            r.StartDate = n.StartDate;
            return(r);
        }
Example #2
0
        public CasePaymentPlanVM Transform(CasePaymentPlan n)
        {
            var r = new CasePaymentPlanVM
            {
                PaymentPlanActive  = n.Active,
                Amount             = n.Amount,
                PaymentPlanCaseId  = n.CaseId,
                PaymentPlanEndDate = n.EndDate,
                Frequency          = n.Frequency,
                Id = n.Id,
                PaymentPlanStartDate = n.StartDate,
                PatientID            = n.Case.PatientID,
                PatientName          = n.Case.Patient.CommonName,
                PatientGender        = !string.IsNullOrEmpty(n.Case.Patient.Gender) ? ((Domain.Gender)Enum.Parse(typeof(Domain.Gender), n.Case.Patient.Gender)).ToString().First().ToString() : string.Empty
            };

            return(r);
        }
Example #3
0
        public CasePaymentPlan Transform(CasePaymentPlanVM n)
        {
            CasePaymentPlan r;

            if (n.Id > 0)
            {
                r = _context.CasePaymentPlans.Where(p => p.Id == n.Id).FirstOrDefault();
            }
            else
            {
                r = _context.CasePaymentPlans.Create();
            }
            r.Active    = n.PaymentPlanActive;
            r.Amount    = n.Amount;
            r.CaseId    = n.PaymentPlanCaseId;
            r.EndDate   = n.PaymentPlanEndDate;
            r.Frequency = n.Frequency;
            r.StartDate = n.PaymentPlanStartDate;
            return(r);
        }
Example #4
0
        public void SavePaymentPlan(CasePaymentPlanVM n)
        {
            var m = Transform(n);

            if (m.Id == 0)
            {
                _context.CasePaymentPlans.Add(m);
            }
            _context.SaveChanges();
            if (m.Active)
            {
                var aPaymentPlans = _context.CasePaymentPlans.Where(p => p.CaseId == n.PaymentPlanCaseId && p.Id != m.Id);
                foreach (var p in aPaymentPlans)
                {
                    p.Active = false;
                }
                _context.SaveChanges();
            }
            n.Id = m.Id;
        }
Example #5
0
 public ActionResult SavePaymentPlan(CasePaymentPlanVM paymentPlan)
 {
     _service.SavePaymentPlan(paymentPlan);
     return(PaymentPlanForm(paymentPlan.PaymentPlanCaseId, paymentPlan.Id));
 }