Exemplo n.º 1
0
        /// <summary>
        /// 数据访问实现:删除用户
        /// </summary>
        /// <param name="entity">参数:实体对象(Consumer:用户)</param>
        /// <returns></returns>
        public bool DeleteConsumer(Consumer entity)
        {
            HibernateTemplate.Delete(entity);
            return(true);

            throw new NotImplementedException();
        }
Exemplo n.º 2
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public bool Delete(FavoriteItem entity)
        {
            HibernateTemplate.Delete(entity);
            return(true);

            throw new NotImplementedException();
        }
Exemplo n.º 3
0
        /// <summary>
        /// 数据访问实现:删除单个实体对象信息
        /// </summary>
        /// <param name="entity">参数:Product 实体对象</param>
        /// <returns>返回:bool</returns>
        public bool DeleteProducts(DemoProduct entity)
        {
            HibernateTemplate.Delete(entity);
            return(true);

            throw new NotImplementedException();
        }
Exemplo n.º 4
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public bool Delete(WeixinBaseConfigure entity)
        {
            HibernateTemplate.Delete(entity);
            return(true);

            throw new NotImplementedException();
        }
Exemplo n.º 5
0
 public void Delete(TObj obj)
 {
     if (obj is null)
     {
         throw new ArgumentNullException(nameof(obj));
     }
     HibernateTemplate.Delete(obj);
 }
Exemplo n.º 6
0
        public void DeleteContainer(string containerName)
        {
            IList <Container> result = FindContainer(containerName);

            foreach (Container container in result)
            {
                HibernateTemplate.Delete(container);
            }
        }
Exemplo n.º 7
0
 public void TearDown()
 {
     Ca.Infoway.Messagebuilder.CollUtils.Reverse(this.createdObjects);
     for (IIterator <Object> iterator = new ILOG.J2CsMapping.Collections.Generics.IteratorAdapter <System.Object>(this.createdObjects.GetEnumerator()); iterator
          .HasNext();)
     {
         Object createdObj = iterator.Next();
         HibernateTemplate.Delete(createdObj);
     }
     ILOG.J2CsMapping.Collections.Generics.Collections.Clear(this.createdObjects);
 }
        public void DeleteBlob(string containerName, string blobName)
        {
            IList <Blob> result = FindContainerBlob(containerName, blobName);

            if (result != null)
            {
                foreach (Blob blob in result)
                {
                    HibernateTemplate.Delete(blob);
                }
            }
        }
Exemplo n.º 9
0
        public void DeleteByViewId(int viewId)
        {
            string[] paramNames  = { "viewId" };
            object[] paramValues = { viewId };

            IList <ViewComponentPropertyReference> l = HibernateTemplate.FindByNamedQueryAndNamedParam <ViewComponentPropertyReference>("ViewComponentPropertyReference.FindByViewId", paramNames, paramValues);

            foreach (ViewComponentPropertyReference vpr in l)
            {
                HibernateTemplate.Delete(vpr);
            }
        }
Exemplo n.º 10
0
 public virtual void Delete(T daoObj)
 {
     if (daoObj is BaseEntity)
     {
         long id = (daoObj as BaseEntity).ID;
         DoDeleteEntities(new long[] { id });
         OnDaoEntitiesChanged(id);
     }
     else
     {
         HibernateTemplate.Delete(daoObj);
     }
 }
        public void DeleteAllForQuery(Guid queryId)
        {
            string[] paramNames  = { "queryId" };
            object[] paramValues = { queryId };

            IList <QueryProperty> result = HibernateTemplate.FindByNamedQueryAndNamedParam <QueryProperty>(
                "QueryProperty.FindAllByQueryId",
                paramNames, paramValues);

            foreach (QueryProperty qp in result)
            {
                HibernateTemplate.Delete(qp);
            }
        }
Exemplo n.º 12
0
 public void Delete(ReuseTech obj, UserProfiles up, IList matchList)
 {
     HibernateTemplate.Delete(obj);
     if (up != null)
     {
         HibernateTemplate.Delete(up);
     }
     if (matchList != null)
     {
         foreach (Match item in matchList)
         {
             HibernateTemplate.Update(item);
         }
     }
 }
Exemplo n.º 13
0
        public void DeleteAll(IList obj, UserProfiles up)
        {
            if (obj != null)
            {
                foreach (ReuseTech item in obj)
                {
                    HibernateTemplate.Delete(item);
                }
            }

            if (up != null)
            {
                HibernateTemplate.Delete(up);
            }
        }
Exemplo n.º 14
0
        public bool RemoveAuthorityList(List <int> idList, int uid, int gid)
        {
            var authorityList = HibernateTemplate.ExecuteFind <AuthorityInfo>(x =>
            {
                var c = x.CreateCriteria <AuthorityInfo>()
                        .Add(Restrictions.And(Restrictions.In("ActionId", idList),
                                              Restrictions.Or(Expression.Eq("UserId", uid), Expression.Eq("GroupId", gid))));
                return(c.List <AuthorityInfo>());
            });

            foreach (var a in authorityList)
            {
                HibernateTemplate.Delete(a);
            }
            return(true);
        }
Exemplo n.º 15
0
        public void Delete(string id)
        {
            var entity = Get(id);

            if (entity == null)
            {
                return;
            }
            try
            {
                HibernateTemplate.Delete(entity);
            }
            catch (Exception e)
            {
                Log.Error(
                    $"Exception occured when application tried to delete the object with id = {id}", e);
                throw;
            }
        }
Exemplo n.º 16
0
 public virtual void DeleteList(IList list)
 {
     if ((list != null) && (list.Count > 0))
     {
         List <long> ids = new List <long>();
         foreach (T obj in list)
         {
             if (obj is BaseEntity)
             {
                 ids.Add((obj as BaseEntity).ID);
             }
             else
             {
                 HibernateTemplate.Delete(obj);
             }
         }
         if (ids.Count > 0)
         {
             DoDeleteEntities(ids);
             OnDaoEntitiesChanged(ids);
         }
     }
 }
Exemplo n.º 17
0
 public void Delete(Dialog dialog)
 {
     HibernateTemplate.Delete(dialog);
 }
Exemplo n.º 18
0
 public void Delete(Issue issue)
 {
     HibernateTemplate.Delete(issue);
 }
Exemplo n.º 19
0
 public void Delete(TechInfo obj)
 {
     HibernateTemplate.Delete(obj);;
 }
Exemplo n.º 20
0
 public void Remove(T entity)
 {
     HibernateTemplate.Delete(entity);
 }
Exemplo n.º 21
0
 public void Delete(UXApplication uxApplication)
 {
     HibernateTemplate.Delete(uxApplication);
 }
 public void Delete(ReportQuery reportQuery)
 {
     HibernateTemplate.Delete(reportQuery);
 }
Exemplo n.º 23
0
 public void Delete(Service service)
 {
     HibernateTemplate.Delete(service);
 }
Exemplo n.º 24
0
 public void Delete(int id)
 {
     HibernateTemplate.Delete(new User {
         Id = id
     });
 }
 public void Delete(UXAction action)
 {
     HibernateTemplate.Delete(action);
 }
Exemplo n.º 26
0
        //private HibernateTemplate ht;
        //public ISessionFactory sf { set; get; }

        //private void setHibernateTemplate()
        //{
        //    if (null == ht)
        //    {
        //        ht = new HibernateTemplate(this.sf);
        //        ht.TemplateFlushMode = TemplateFlushMode.Auto;
        //        ht.CacheQueries = true;
        //    }
        //}

        public void delete(User user)
        {
            //sf.GetCurrentSession().Delete(tb_user);
            HibernateTemplate.Delete(user);
        }
Exemplo n.º 27
0
 public void DeleteEntity(object entity)
 {
     HibernateTemplate.Delete(entity);
 }
Exemplo n.º 28
0
 public void Delete(ViewComponentPropertyReference viewComponentPropertyReference)
 {
     HibernateTemplate.Delete(viewComponentPropertyReference);
 }
 public void Delete(Property property)
 {
     HibernateTemplate.Delete(property);
 }
Exemplo n.º 30
0
        protected virtual void DoDeleteEntities(IEnumerable <long> idlist)
        {
            if (idlist != null)
            {
                User u = AuthorizationService.GetCurrentUser();
                if (!u.UserRoleID.HasValue)
                {
                    throw new AccessDeniedException("User have no rights to delete entity");
                }
                UserRoleId role = (UserRoleId)(u.UserRoleID.Value);
                if (role == UserRoleId.Controlling)
                {
                    throw new AccessDeniedException("User have no rights to delete entity");
                }

                /*
                 * if (role != UserRoleId.GlobalAdmin)
                 * {
                 *  List<string> pNames = new List<string>();
                 *  List<object> pValues = new List<object>();
                 *  string idListStr = QueryUtils.GenIDList(idlist, pNames, pValues);
                 *  // nothing to delete?
                 *  if ((idListStr == null) || (idListStr.Length == 0))
                 *  {
                 *      return;
                 *  }
                 *  IList list =
                 *      FindByNamedParam(new string[] {"entity.ID"}, null,
                 *                       string.Format("entity.ID IN ({0})", idListStr), null,
                 *                       pNames.ToArray(), pValues.ToArray(), false);
                 *  if ((list == null) || (list.Count != pNames.Count))
                 *  {
                 *      throw new AccessDeniedException("User have no rights to delete entity");
                 *  }
                 * }
                 * */

                StringBuilder sb = new StringBuilder();
                sb.AppendFormat("FROM {0} entity WHERE entity.ID IN (", typeof(T).Name);
                List <object>      values = new List <object>();
                List <IType>       types  = new List <IType>();
                IEnumerator <long> ie     = idlist.GetEnumerator();
                ie.Reset();
                if (ie.MoveNext())
                {
                    long current = (ie.Current);
                    sb.Append("?");
                    values.Add(current);
                    types.Add(NHibernateUtil.Int64);
                    while (ie.MoveNext())
                    {
                        current = (ie.Current);
                        sb.Append(",?");
                        values.Add(current);
                        types.Add(NHibernateUtil.Int64);
                    }
                }
                if (values.Count > 0)
                {
                    sb.Append(")");
                    HibernateTemplate.Delete(sb.ToString(), values.ToArray(), types.ToArray());
                }
            }
        }