Ejemplo n.º 1
0
        public void AddEntry(decimal BloodSugar, DateTime EntryDateTime, string TestType, string Meal)
        {
            var lookup = LookupEntry(EntryDateTime);

            if (lookup == null)
            {
                lookup = new BloodSugarEntry()
                {
                    EntryOwnerID  = EntryOwnerID,
                    Owner         = this,
                    EntryValue    = BloodSugar,
                    EntryDateTime = EntryDateTime,
                    EntryType     = BloodSugarEntry.GetEntryTypeFromString(TestType),
                    Meal          = Meal
                };
                lookup.CalcStats(this.EntryUnits);
                BloodSugarEntries.Add(lookup);

                // disabled for now Data.BloodSugarsDatabase.Database.InsertOrUpdateBloodSugarEntryAsync(lookup);
            }
            else
            {
                lookup.EntryType  = BloodSugarEntry.GetEntryTypeFromString(TestType);
                lookup.EntryValue = BloodSugar;
                lookup.Meal       = Meal;
                lookup.CalcStats(this.EntryUnits);
                if (EntryOwnerID == 0)
                {
                    Data.HealthStats.Database.CreateOrUpdateEntryOwnerAsync(this);
                }
                // disabled for now Data.BloodSugarsDatabase.Database.InsertOrUpdateBloodSugarEntryAsync(lookup);
            }
        }
Ejemplo n.º 2
0
 public BloodSugarEntry LookupEntry(DateTime EntryDateTime)
 {
     return(BloodSugarEntries.Where(e => e.EntryDateTime == EntryDateTime).FirstOrDefault());
 }