Пример #1
0
        public Organization Add(Organization entity)
        {
            if (entity.Id > 0) return entity;

            context.Profile.AddObject(entity);

            try
            {
                context.SaveChanges();
            }
            catch (OptimisticConcurrencyException e)
            {
                //An optimistic concurrency violation has occurred in the data source.
                throw new ConcurrencyException(e.Message);
            }

            return entity;
        }
Пример #2
0
 public void Visit(Organization organization)
 {
     TypeOfProfile = "ONG";
 }
Пример #3
0
        private void FixupOrganization(Organization previousValue)
        {
            if (previousValue != null && previousValue.Emergency.Contains(this))
            {
                previousValue.Emergency.Remove(this);
            }

            if (Organization != null)
            {
                if (!Organization.Emergency.Contains(this))
                {
                    Organization.Emergency.Add(this);
                }
                if (Organization_id != Organization.Id)
                {
                    Organization_id = Organization.Id;
                }
            }
        }
Пример #4
0
 public void Delete(Organization entity)
 {
     context.DeleteObject(entity);
 }
Пример #5
0
 public Organization Update(Organization entity)
 {
     return entity;
 }
Пример #6
0
        private void FixupOrganization(Organization previousValue)
        {
            if (previousValue != null && previousValue.Transaction.Contains(this))
            {
                previousValue.Transaction.Remove(this);
            }

            if (Organization != null)
            {
                if (!Organization.Transaction.Contains(this))
                {
                    Organization.Transaction.Add(this);
                }
                if (Organization_id != Organization.Id)
                {
                    Organization_id = Organization.Id;
                }
            }
            else if (!_settingFK)
            {
                Organization_id = null;
            }
        }