Esempio n. 1
0
        public Company Add(Company 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;
        }
Esempio n. 2
0
 public void Visit(Company company)
 {
     TypeOfProfile = "Company";
 }
Esempio n. 3
0
 public void Delete(Company entity)
 {
     context.DeleteObject(entity);
 }
Esempio n. 4
0
 public Company Update(Company entity)
 {
     return entity;
 }
Esempio n. 5
0
        private void FixupCompany(Company previousValue)
        {
            if (previousValue != null && previousValue.Transaction.Contains(this))
            {
                previousValue.Transaction.Remove(this);
            }

            if (Company != null)
            {
                if (!Company.Transaction.Contains(this))
                {
                    Company.Transaction.Add(this);
                }
                if (Company_id != Company.Id)
                {
                    Company_id = Company.Id;
                }
            }
        }