Пример #1
0
        public virtual double CalculateCharges()
        {
            double total = 0;

            foreach (BedStay bs in Stay.BedstayList)
            {
                Bed b = bs.bed;
                if (b is ClassABed)
                {
                    b = (ClassABed)b;
                    if (bs.endBedstay == null)
                    {
                        Console.WriteLine("Patient not discharged");
                    }

                    else
                    {
                        int?days = (int?)(bs.endBedstay - bs.startBedstay)?.TotalDays;
                        if (days != null)
                        {
                            int total_days = Convert.ToInt32(days);
                            total += b.CalculateCharges(CitizenStatus, total_days);
                        }
                    }
                }

                else if (b is ClassBBed)
                {
                    b = (ClassBBed)b;

                    if (bs.endBedstay == null)
                    {
                        Console.WriteLine("Patient not discharged");
                    }

                    else
                    {
                        int?days = (int?)(bs.endBedstay - bs.startBedstay)?.TotalDays;
                        if (days != null)
                        {
                            int total_days = Convert.ToInt32(days);
                            total += b.CalculateCharges(CitizenStatus, total_days);
                        }
                    }
                }

                else if (b is ClassCBed)
                {
                    b = (ClassCBed)b;

                    if (bs.endBedstay == null)
                    {
                        Console.WriteLine("Patient not discharged");
                    }

                    else
                    {
                        int?days = (int?)(bs.endBedstay - bs.startBedstay)?.TotalDays;
                        if (days != null)
                        {
                            int total_days = Convert.ToInt32(days);
                            total += b.CalculateCharges(CitizenStatus, total_days);
                        }
                    }
                }
            }
            return(total);
        }
Пример #2
0
 public BedStay(DateTime s, Bed b)
 {
     startBedstay = s;
     bed          = b;
 }