Example #1
0
 public FindViewModel(Visitor enteredVisitor, VisitorListViewModel visitorListVM)
 {
     _realm = RealmHelper.GetRealm();
     FindContactsCommand = new Command <string>(FindContacts);
     EnteredVisitor      = enteredVisitor;
     ListViewModel       = visitorListVM;
 }
Example #2
0
        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()));
 }
Example #4
0
        public void Delete(Event entity)
        {
            var db = RealmHelper.GetInstance();

            db.Write(() =>
            {
                entity.RecordStatus = RecordStatusType.Deleted;
            });
        }
Example #5
0
        public void DeleteById(string id)
        {
            var db = RealmHelper.GetInstance();

            db.Write(() =>
            {
                var e          = db.Find <Event>(id);
                e.RecordStatus = RecordStatusType.Deleted;
            });
        }
Example #6
0
        public void ResetExportDate(Donor entity)
        {
            var db = RealmHelper.GetInstance();

            db.Write(() =>
            {
                var donor          = db.Find <Donor>(entity.Id);
                donor.DateExported = null;
            });
        }
Example #7
0
        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);
            });
        }
Example #8
0
        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;
                }
            });
        }
Example #9
0
        public void DeleteById(string id)
        {
            var db = RealmHelper.GetInstance();

            db.Write(() =>
            {
                var donor = db.Find <Donor>(id);
                if (donor != null)
                {
                    donor.RecordStatus = RecordStatusType.Deleted;
                }
            });
        }
Example #10
0
        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);
        }
Example #11
0
        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);
        }
Example #12
0
        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;
                }
            });
        }
Example #13
0
        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);
        }
Example #15
0
        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);
        }
Example #16
0
        public Donor GetById(string id)
        {
            var db = RealmHelper.GetInstance();

            return(db.Find <Donor>(id));
        }
Example #17
0
        public Event Find(Expression <Func <Event, bool> > predicate)
        {
            var db = RealmHelper.GetInstance();

            return(db.All <Event>().Where(predicate).FirstOrDefault());
        }
Example #18
0
 public DataAccessController()
 {
     realm = RealmHelper.GetInstance();
 }
Example #19
0
        public Event GetById(string id)
        {
            var db = RealmHelper.GetInstance();

            return(db.Find <Event>(id));
        }
Example #20
0
        public IEnumerable <Event> List()
        {
            var db = RealmHelper.GetInstance();

            return(db.All <Event>().ToList());
        }
Example #21
0
        public IEnumerable <Event> List(Expression <Func <Event, bool> > predicate)
        {
            var db = RealmHelper.GetInstance();

            return(db.All <Event>().Where(predicate).ToList());
        }