Exemplo n.º 1
0
        ///<summary>
        /// Adds the doctor fees.
        /// </summary>
        /// <param name="doctorfees">The doctor fees.</param>
        public void AddDoctorFees(DoctorFees fees)
        {
            if (DoctorFees == null)
            {
                DoctorFees = new List <DoctorFees>();
            }

            // If there are not default fees, set this one as default
            if (DoctorFees.Where(x => x.IsDefault).Count() < 1)
            {
                fees.IsDefault = true;
            }

            // If this is the new default fees
            if (fees.IsDefault)
            {
                foreach (DoctorFees fee in DoctorFees)
                {
                    fee.IsDefault = false;
                }
            }

            // If the fees is not already in the list
            if (!DoctorFees.Any(x => x.PrimaryKey == fees.PrimaryKey))
            {
                DoctorFees.Add(fees);
                fees.Doctor = this;
            }
        }
Exemplo n.º 2
0
        ///<summary>
        /// Removes the doctor fees.
        /// </summary>
        /// <param name="doctorfees">The doctor fees.</param>
        public void RemoveDoctorFees(DoctorFees fees)
        {
            if (DoctorFees == null)
            {
                return;
            }

            DoctorFees.Remove(fees);

            if (fees.IsDefault)
            {
                DoctorFees.FirstOrDefault().IsDefault = true;
            }
        }