Example #1
0
        public OperationResult Delete(TEntity entity, bool onlyChangeFlag)
        {
            var result = EngineContext.Current.Resolve <OperationResult>();

            if (entity == null)
            {
                return(result.AddError(Messages.Common_NullEntity));
            }

            if (entity.IsTransient() || HasNotExistsOnDatabase(entity))
            {
                return(result.AddError(Messages.Common_UnknownEntity));
            }

            entity.Version++;

            try {
                if (onlyChangeFlag)
                {
                    entity.IsEnabled = false;
                    CurrentSession.Update(entity);
                }
                else
                {
                    CurrentSession.Delete(entity);
                }
            } catch (Exception) {
                _activeSessionManager.RenewSession();

                return(result.AddError(Messages.Common_DeleteFailed));
            }

            return(result);
        }
Example #2
0
 public int DeleteAuthenticated(DateTime userInactiveSinceDate)
 {
     return(CurrentSession.Delete(
                string.Format("from ProfileValue p where p.{0}<:date and p.{1}=:anonymous", LastActivityDateProperty,
                              AnonymousProperty),
                new object[] { userInactiveSinceDate, false }, new IType[] { NHibernateUtil.Date, NHibernateUtil.Boolean }));
 }
        public void Delete(ISellableInventoryItemEntryState state)
        {
            ISellableInventoryItemEntryState s = state;
            var saveable = s as ISaveable;

            if (saveable != null)
            {
                saveable.Save();
            }
            CurrentSession.Delete(s);
        }
 public void Delete(object domainObject)
 {
     try
     {
         CurrentSession.Delete(domainObject);
     }
     catch (Exception exception)
     {
         Log.Error(exception.Message);
     }
 }
Example #5
0
        public void DeleteByTitle(String title)
        {
            var queryResult = CurrentSession.QueryOver <AnnouncementDTO>()
                              .Where(p => p.Title == title);

            if (queryResult != null && queryResult.RowCount() > 0)
            {
                IList <AnnouncementDTO> peopleToBeDeleted = queryResult.List();
                peopleToBeDeleted.ForEach(personToBeDeleted => CurrentSession.Delete(personToBeDeleted));
                CurrentSession.Flush();
            }
        }
Example #6
0
        public void Remove(string id)
        {
            var industry = CurrentSession.Load <Domain.Model.Industry>(id);
            var clients  = CurrentSession.Query <Domain.Model.Client>()
                           .Where(c => c.Industry.Id == industry.Id);

            if (clients.Any())
            {
                throw new InvalidOperationException("There clients mapped to this industry.");
            }

            CurrentSession.Delete(industry);
        }
        public void Delete(IShipmentPackageContentState state)
        {
            IShipmentPackageContentState s = state;

            if (ReadOnlyProxyGenerator != null)
            {
                s = ReadOnlyProxyGenerator.GetTarget <IShipmentPackageContentState>(state);
            }
            var saveable = s as ISaveable;

            if (saveable != null)
            {
                saveable.Save();
            }
            CurrentSession.Delete(s);
        }
Example #8
0
        public void Delete(IInOutLineState state)
        {
            IInOutLineState s = state;

            if (ReadOnlyProxyGenerator != null)
            {
                s = ReadOnlyProxyGenerator.GetTarget <IInOutLineState>(state);
            }
            var saveable = s as ISaveable;

            if (saveable != null)
            {
                saveable.Save();
            }
            CurrentSession.Delete(s);
        }
Example #9
0
        public int Delete(string[] userName)
        {
            var disjunction = new Disjunction();
            int i           = 0;

            foreach (string user in userName)
            {
                disjunction.Add(Restrictions.Eq(LoginIdProperty, user));
            }
            foreach (ProfileValue profile in CreateCriteria().Add(disjunction).List <ProfileValue>())
            {
                i++;
                CurrentSession.Delete(profile);
            }
            return(i);
        }
Example #10
0
        public void Delete(IOrderItemShipGroupAssociationState state)
        {
            IOrderItemShipGroupAssociationState s = state;

            if (ReadOnlyProxyGenerator != null)
            {
                s = ReadOnlyProxyGenerator.GetTarget <IOrderItemShipGroupAssociationState>(state);
            }
            var saveable = s as ISaveable;

            if (saveable != null)
            {
                saveable.Save();
            }
            CurrentSession.Delete(s);
        }
Example #11
0
        public void Delete(IAttributeSetInstanceExtensionFieldState state)
        {
            IAttributeSetInstanceExtensionFieldState s = state;

            if (ReadOnlyProxyGenerator != null)
            {
                s = ReadOnlyProxyGenerator.GetTarget <IAttributeSetInstanceExtensionFieldState>(state);
            }
            var saveable = s as ISaveable;

            if (saveable != null)
            {
                saveable.Save();
            }
            CurrentSession.Delete(s);
        }
Example #12
0
        public void Delete(string[] ids)
        {
            var  builder = new StringBuilder("From UserGroup ug where ug in (");
            bool isFirst = true;

            foreach (string id in ids)
            {
                if (!isFirst)
                {
                    builder.Append(",");
                }
                else
                {
                    isFirst = false;
                }
                builder.Append("'" + id + "'");
            }
            builder.Append(")");
            CurrentSession.Delete(builder.ToString());
        }
 public bool Delete(int id)
 {
     using (var tran = CurrentSession.BeginTransaction())
     {
         try
         {
             var schueler = Get(id);
             if (schueler != null)
             {
                 CurrentSession.Delete(schueler);
                 tran.Commit();
             }
             return(true);
         }
         catch (Exception ex)
         {
             tran.Rollback();
             throw ex;
         }
     }
 }
Example #14
0
        public void Remove(string id)
        {
            var position = CurrentSession.Load <Domain.Model.Position>(id);

            var productivities = CurrentSession.Query <Domain.Model.Productivity>()
                                 .Where(p => p.Position == position);

            var clients = CurrentSession.Query <Domain.Model.Client>()
                          .Where(c => c.Positions.Any(p => p.Id == position.Id));

            foreach (var productivity in productivities)
            {
                CurrentSession.Delete(productivity);
            }

            foreach (var client in clients)
            {
                client.Positions.ToList().Remove(position);
            }

            CurrentSession.Delete(position);
        }
Example #15
0
        public bool Delete(int id)
        {
            using (var tran = CurrentSession.BeginTransaction())
            {
                try
                {
                    var mitgliedschaftKontakt = Get(id);
                    if (mitgliedschaftKontakt != null)
                    {
                        CurrentSession.Delete(mitgliedschaftKontakt);
                        tran.Commit();
                    }

                    return(true);
                }
                catch (Exception ex)
                {
                    tran.Rollback();
                    throw ex;
                }
            }
        }
Example #16
0
 public void Delete(DefaultProductionOrderBatchStage entity)
 {
     CurrentSession.Delete(entity);
 }
 public void Delete(Document entity)
 {
     CurrentSession.Delete(entity);
 }
        public void Remove(string id)
        {
            var client = CurrentSession.Load <Domain.Model.Client>(id);

            CurrentSession.Delete(client);
        }
Example #19
0
 /// <summary>
 ///     The remove.
 /// </summary>
 /// <param name="item">
 ///     The item.
 /// </param>
 /// <typeparam name="TEntity">
 /// </typeparam>
 /// <returns>
 ///     The <see cref="bool" />.
 /// </returns>
 public virtual bool Remove <TEntity>(TEntity item)
     where TEntity : class
 {
     CurrentSession.Delete(item);
     return(true);
 }
Example #20
0
 public void DeletePendingItem(Guid id)
 {
     CurrentSession.Delete(CurrentSession.Get <PendingInvoiceItem>(id));
 }
        public void Remove(string id)
        {
            var candidate = CurrentSession.Load <Domain.Model.Candidate>(id);

            CurrentSession.Delete(candidate);
        }
 public void DeletePendingItem(Guid id)
 {
     CurrentSession.Delete(CurrentSession.Get <PendingConsignmentItem>(id));
 }
 public void Delete(Order entity)
 {
     CurrentSession.Delete(entity);
 }
Example #24
0
 public void Delete(Client entity)
 {
     CurrentSession.Delete(entity);
 }
Example #25
0
 public void Delete(Deal entity)
 {
     CurrentSession.Delete(entity);
 }
Example #26
0
 public void Delete(ArticleGroup Value)
 {
     CurrentSession.Delete(Value);
 }
 public void Delete(Appointment entity)
 {
     CurrentSession.Delete(entity);
 }
Example #28
0
 protected void Delete <T>(T entity)
 {
     CurrentSession.Delete(entity);
 }
Example #29
0
 protected void Delete(TEntity entity)
 {
     CurrentSession.Delete(entity);
 }
        public void Remove(string id)
        {
            var recruiter = CurrentSession.Load <Domain.Model.Recruiter>(id);

            CurrentSession.Delete(recruiter);
        }