Exemple #1
0
        ///<summary>
        /// Adds the doctorfeeshistory.
        /// </summary>
        /// <param name="doctorfeeshistory">The doctorfeeshistory.</param>
        public void AddDoctorFeesHistory(DoctorFeesHistory feesHistory)
        {
            if (DoctorFeesHistories == null)
            {
                DoctorFeesHistories = new List <DoctorFeesHistory>();
            }

            // set this one as latest.
            feesHistory.IsLatest = true;

            // If this is the new latest feeshistory.
            if (feesHistory.IsLatest)
            {
                foreach (DoctorFeesHistory history in DoctorFeesHistories)
                {
                    history.IsLatest = false;
                }
            }

            // If the feeshistory is not already in the list
            if (!DoctorFeesHistories.Any(x => x.PrimaryKey == feesHistory.PrimaryKey))
            {
                DoctorFeesHistories.Add(feesHistory);
                feesHistory.Doctor = this;
            }
        }
Exemple #2
0
        ///<summary>
        /// Removes the doctorfeeshistory.
        /// </summary>
        /// <param name="doctorfeeshistory">The doctorfeeshistory.</param>
        public void RemoveDoctorFeesHistory(DoctorFeesHistory feesHistory)
        {
            if (DoctorFeesHistories == null)
            {
                return;
            }

            DoctorFeesHistories.Remove(feesHistory);

            if (feesHistory.IsLatest)
            {
                DoctorFeesHistories.LastOrDefault().IsLatest = true;
            }
        }