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

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

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

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

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

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

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

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

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