public FindViewModel(Visitor enteredVisitor, VisitorListViewModel visitorListVM) { _realm = RealmHelper.GetRealm(); FindContactsCommand = new Command <string>(FindContacts); EnteredVisitor = enteredVisitor; ListViewModel = visitorListVM; }
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 IsEntity() { Assert.IsTrue(RealmHelper.IsEntity(new BaseEntity1().GetType())); Assert.IsTrue(RealmHelper.IsEntity(new SubEntity1().GetType())); Assert.IsTrue(RealmHelper.IsEntity(new SubEntity2().GetType())); Assert.IsTrue(RealmHelper.IsEntity(new SubSubEntity1().GetType())); Assert.IsFalse(RealmHelper.IsEntity(new NotEntity().GetType())); }
public void Delete(Event entity) { var db = RealmHelper.GetInstance(); db.Write(() => { entity.RecordStatus = RecordStatusType.Deleted; }); }
public void DeleteById(string id) { var db = RealmHelper.GetInstance(); db.Write(() => { var e = db.Find <Event>(id); e.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 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; } }); }
private void Submit(object sender, EventArgs e) { var realm = RealmHelper.GetRealm(); var visitor = realm.All <Visitor>().FirstOrDefault(x => x.Name.Equals(logEntry.Text.Trim()) && x.Password.Equals(passEntry.Text.Trim())); if (visitor != null) { App.NavigationService.NavigateTo(Locator.VisitorListPage, new object[] { visitor }); //App.NavigationService.NavigateTo(Locator.MainAppPage, new object[] {visitor, new TranslationsViewModel()}); } else { DisplayAlert("Error!", "User doesn't exist!", "OK"); } }
public void resolve() { var entities1 = new List <SubEntity1>(); entities1.Add(new SubEntity1()); entities1.Add(new SubEntity1()); BaseEntity1 element = new BaseEntity1() { sub1 = entities1, sub2 = new SubEntity2(), b1 = 11111 }; var list = new List <RealmObject>(); RealmHelper.Resolve(element, list); Assert.AreEqual(3, list.Count); }
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 Donor GetById(string id) { var db = RealmHelper.GetInstance(); return(db.Find <Donor>(id)); }
public Event Find(Expression <Func <Event, bool> > predicate) { var db = RealmHelper.GetInstance(); return(db.All <Event>().Where(predicate).FirstOrDefault()); }
public DataAccessController() { realm = RealmHelper.GetInstance(); }
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()); }