Exemplo n.º 1
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;
            });
        }
Exemplo n.º 2
0
        public void Delete(Event entity)
        {
            var db = RealmHelper.GetInstance();

            db.Write(() =>
            {
                entity.RecordStatus = RecordStatusType.Deleted;
            });
        }
Exemplo n.º 3
0
        public void ResetExportDate(Donor entity)
        {
            var db = RealmHelper.GetInstance();

            db.Write(() =>
            {
                var donor          = db.Find <Donor>(entity.Id);
                donor.DateExported = null;
            });
        }
Exemplo n.º 4
0
        public void DeleteById(string id)
        {
            var db = RealmHelper.GetInstance();

            db.Write(() =>
            {
                var e          = db.Find <Event>(id);
                e.RecordStatus = RecordStatusType.Deleted;
            });
        }
Exemplo n.º 5
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);
            });
        }
Exemplo n.º 6
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;
                }
            });
        }
Exemplo n.º 7
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;
                }
            });
        }
Exemplo n.º 8
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);
        }
Exemplo n.º 9
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);
        }
Exemplo n.º 10
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;
                }
            });
        }
Exemplo n.º 11
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);
        }
Exemplo n.º 12
0
 public DataAccessController()
 {
     realm = RealmHelper.GetInstance();
 }
Exemplo n.º 13
0
        public Event Find(Expression <Func <Event, bool> > predicate)
        {
            var db = RealmHelper.GetInstance();

            return(db.All <Event>().Where(predicate).FirstOrDefault());
        }
Exemplo n.º 14
0
        public Donor GetById(string id)
        {
            var db = RealmHelper.GetInstance();

            return(db.Find <Donor>(id));
        }
Exemplo n.º 15
0
        public Event GetById(string id)
        {
            var db = RealmHelper.GetInstance();

            return(db.Find <Event>(id));
        }
Exemplo n.º 16
0
        public IEnumerable <Event> List()
        {
            var db = RealmHelper.GetInstance();

            return(db.All <Event>().ToList());
        }
Exemplo n.º 17
0
        public IEnumerable <Event> List(Expression <Func <Event, bool> > predicate)
        {
            var db = RealmHelper.GetInstance();

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