public void Update(Donor entity) { var db = RealmHelper.GetInstance(); db.Write(() => { var donor = db.Find <Donor>(entity.Id); donor.DateExported = entity.DateExported; donor.DateModified = DateTimeOffset.Now; donor.AdditionalInformation = entity.AdditionalInformation; donor.Address1 = entity.Address1; donor.Address2 = entity.Address2; donor.BecomeAVolunteer = entity.BecomeAVolunteer; donor.BecomeCorporateSponsor = entity.BecomeCorporateSponsor; donor.BecomeMonthlyDonor = entity.BecomeMonthlyDonor; donor.BecomeAVolunteer = entity.BecomeAVolunteer; donor.City = entity.City; donor.ConnectOnSocialMedia = entity.ConnectOnSocialMedia; donor.Email = entity.Email; donor.FirstName = entity.FirstName; donor.HostFundraiser = entity.HostFundraiser; donor.LastName = entity.LastName; donor.Other = entity.Other; donor.Phone = entity.Phone; donor.RaffleDonations = entity.RaffleDonations; donor.ReceiveNewsletter = entity.ReceiveNewsletter; donor.SponsorFundraiser = entity.SponsorFundraiser; donor.State = entity.State; donor.Zip = entity.Zip; }); }
public void Delete(Event entity) { var db = RealmHelper.GetInstance(); db.Write(() => { entity.RecordStatus = RecordStatusType.Deleted; }); }
public void ResetExportDate(Donor entity) { var db = RealmHelper.GetInstance(); db.Write(() => { var donor = db.Find <Donor>(entity.Id); donor.DateExported = null; }); }
public void DeleteById(string id) { var db = RealmHelper.GetInstance(); db.Write(() => { var e = db.Find <Event>(id); e.RecordStatus = RecordStatusType.Deleted; }); }
public void AddToEvent(Event e, Donor entity) { var db = RealmHelper.GetInstance(); db.Write(() => { var evnt = db.Find <Event>(e.Id); entity.Id = Guid.NewGuid().ToString(); evnt.Donors.Add(entity); }); }
public void Exported(List <Donor> entities) { var db = RealmHelper.GetInstance(); db.Write(() => { foreach (var entity in entities) { var donor = db.Find <Donor>(entity.Id); donor.DateExported = DateTimeOffset.Now; } }); }
public void DeleteById(string id) { var db = RealmHelper.GetInstance(); db.Write(() => { var donor = db.Find <Donor>(id); if (donor != null) { donor.RecordStatus = RecordStatusType.Deleted; } }); }
public Donor Add(Donor entity) { var db = RealmHelper.GetInstance(); db.Write(() => { if (string.IsNullOrEmpty(entity.Id)) { entity.Id = Guid.NewGuid().ToString(); } db.Add(entity); }); return(entity); }
public Event Add(Event entity) { entity.RecordStatus = RecordStatusType.Active; var db = RealmHelper.GetInstance(); db.Write(() => { if (string.IsNullOrEmpty(entity.Id)) { entity.Id = Guid.NewGuid().ToString(); } db.Add(entity); }); return(entity); }
public void Update(Event entity) { var db = RealmHelper.GetInstance(); db.Write(() => { var e = db.Find <Event>(entity.Id); if (e != null) { e.Name = entity.Name; e.StartDate = entity.StartDate; e.EndDate = entity.EndDate; } }); }
public int DeleteExported(string eventId) { var db = RealmHelper.GetInstance(); var evnt = db.Find <Event>(eventId); var i = 0; if (evnt != null) { var donorsToDelete = evnt.Donors.Where(x => x.DateExported != null).ToList(); db.Write(() => { foreach (var donor in donorsToDelete) { db.Remove(donor); i++; } }); } return(i); }
public DataAccessController() { realm = RealmHelper.GetInstance(); }
public Event Find(Expression <Func <Event, bool> > predicate) { var db = RealmHelper.GetInstance(); return(db.All <Event>().Where(predicate).FirstOrDefault()); }
public Donor GetById(string id) { var db = RealmHelper.GetInstance(); return(db.Find <Donor>(id)); }
public Event GetById(string id) { var db = RealmHelper.GetInstance(); return(db.Find <Event>(id)); }
public IEnumerable <Event> List() { var db = RealmHelper.GetInstance(); return(db.All <Event>().ToList()); }
public IEnumerable <Event> List(Expression <Func <Event, bool> > predicate) { var db = RealmHelper.GetInstance(); return(db.All <Event>().Where(predicate).ToList()); }