public static void DeleteFromHelp(int rechnungsnummer, int kundenID)
        {
            try
            {
                using (IRepository repository = RepositoryFactory.Instance.CreateRepository <Repository>())
                {
                    IDictionary dic = new Dictionary <string, int>();
                    dic.Add("KundenID", kundenID);
                    dic.Add("Rechnungsnummer", rechnungsnummer);

                    repository.SelectManyWhere <Kundenrechhilfe>(DetachedCriteria.For <Kundenrechhilfe>()
                                                                 .Add(Restrictions.AllEq(dic)))
                    .ToList()
                    .ForEach(item => repository.Delete(item));
                }
            }
            catch (DatabaseException)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw (new DatabaseException(ex, "Error in delting messages!"));
            }
        }
 public IEnumerable WhereAllEq(Type targetType, IDictionary queryFields)
 {
     return(_session
            .CreateCriteria(targetType)
            .Add(Restrictions.AllEq(queryFields))
            .List());
 }
Example #3
0
        public T GetRandom <T>(IDictionary filterDictionary) where T : class
        {
            ICriteria criteria = SessionContainer.GetSession().CreateCriteria <T>();

            if (filterDictionary != null && filterDictionary.Count > 0)
            {
                criteria.Add(Restrictions.AllEq(filterDictionary));
            }

            return(GetRandom <T>(criteria));
        }
        public IEnumerable <T> WhereAllEq <T>(IDictionary queryFields, IDictionary <string, bool> orderByFields = null)
        {
            var criteria = _session.CreateCriteria(typeof(T));

            if (queryFields != null)
            {
                criteria.Add(Restrictions.AllEq(queryFields));
            }
            if (orderByFields != null)
            {
                foreach (var field in orderByFields)
                {
                    criteria.AddOrder(new Order(field.Key, field.Value));
                }
            }

            return(criteria.List <T>());
        }
 /// <summary>
 /// 지정된 속성-값을 나타내는 사전이 모두 같다는 질의를 추가합니다.
 /// </summary>
 public static ICriteria AddAllEq(this ICriteria criteria, IDictionary propertyNameValues)
 {
     propertyNameValues.ShouldNotBeNull("propertyNameValues");
     return(criteria.Add(Restrictions.AllEq(propertyNameValues)));
 }
Example #6
0
 /// <summary>
 /// Add AllEq (all equal) expression to detached criteria
 /// </summary>
 public static DetachedCriteria AddAllEq(this DetachedCriteria dc, IDictionary propertyNameValues)
 {
     return(dc.Add(Restrictions.AllEq(propertyNameValues)));
 }