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

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

            throw new NotImplementedException();
        }
Example #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();
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public bool Delete(WeixinBaseConfigure entity)
        {
            HibernateTemplate.Delete(entity);
            return(true);

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

            foreach (Container container in result)
            {
                HibernateTemplate.Delete(container);
            }
        }
Example #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);
                }
            }
        }
Example #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);
            }
        }
Example #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);
            }
        }
Example #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);
         }
     }
 }
Example #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);
            }
        }
        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);
        }
Example #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;
            }
        }
Example #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);
         }
     }
 }
Example #17
0
 public void Delete(Dialog dialog)
 {
     HibernateTemplate.Delete(dialog);
 }
 public void Delete(Issue issue)
 {
     HibernateTemplate.Delete(issue);
 }
Example #19
0
 public void Delete(TechInfo obj)
 {
     HibernateTemplate.Delete(obj);;
 }
Example #20
0
 public void Remove(T entity)
 {
     HibernateTemplate.Delete(entity);
 }
Example #21
0
 public void Delete(UXApplication uxApplication)
 {
     HibernateTemplate.Delete(uxApplication);
 }
 public void Delete(ReportQuery reportQuery)
 {
     HibernateTemplate.Delete(reportQuery);
 }
Example #23
0
 public void Delete(Service service)
 {
     HibernateTemplate.Delete(service);
 }
 public void Delete(int id)
 {
     HibernateTemplate.Delete(new User {
         Id = id
     });
 }
 public void Delete(UXAction action)
 {
     HibernateTemplate.Delete(action);
 }
Example #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);
        }
Example #27
0
 public void DeleteEntity(object entity)
 {
     HibernateTemplate.Delete(entity);
 }
Example #28
0
 public void Delete(ViewComponentPropertyReference viewComponentPropertyReference)
 {
     HibernateTemplate.Delete(viewComponentPropertyReference);
 }
 public void Delete(Property property)
 {
     HibernateTemplate.Delete(property);
 }
Example #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());
                }
            }
        }