示例#1
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         db.Dispose();
     }
     base.Dispose(disposing);
 }
        /// <summary>
        /// Gets all acceptors from the db.
        /// </summary>
        /// <returns>Observable collection of all acceptors</returns>
        public ObservableCollection <Acceptor> GetAcceptors()
        {
            ObservableCollection <Acceptor> Acceptors = new ObservableCollection <Acceptor>();

            context.Dispose();
            context = new dbModel();
            context.Acceptors.Load();
            Acceptors = context.Acceptors.Local;
            return(Acceptors);
        }
示例#3
0
        /// <summary>
        /// Gets all donors from the db.
        /// </summary>
        /// <returns>Observable collection of all donors</returns>
        public ObservableCollection <Donor> GetDonors()
        {
            ObservableCollection <Donor> Donors = new ObservableCollection <Donor>();

            context.Dispose();
            context = new dbModel();
            context.Donors.Load();
            Donors = context.Donors.Local;
            return(Donors);
        }
示例#4
0
        /// <summary>
        /// Gets all users from the db.
        /// </summary>
        /// <returns>Observable collection of all users</returns>
        public ObservableCollection <User> GetUsers()
        {
            ObservableCollection <User> Users = new ObservableCollection <User>();

            context.Dispose();
            context = new dbModel();
            context.Users.Load();
            Users = context.Users.Local;
            return(Users);
        }
示例#5
0
 /// <summary>
 /// Gets statistics value for <paramref name="BloodType"/> from db.
 /// </summary>
 /// <param name="BloodType">Type of the blood.</param>
 /// <returns>Percent of reserve for <paramref name="BloodType"/>
 /// or throws an NullReferenceException if there is no such blood type in Statistics table.</returns>
 /// <exception cref="System.NullReferenceException"></exception>
 public long GetStatistic(BloodTypeMarker BloodType)
 {
     try
     {
         context.Dispose();
         context = new dbModel();
         return((context.Statistics.Find(BloodType)).TotalAmount / 5000);
     }
     catch (NullReferenceException)
     {
         throw new NullReferenceException();
     }
 }