当前位置: 首页>>代码示例>>C#>>正文


C# DetachedCriteria类代码示例

本文整理汇总了C#中DetachedCriteria的典型用法代码示例。如果您正苦于以下问题:C# DetachedCriteria类的具体用法?C# DetachedCriteria怎么用?C# DetachedCriteria使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DetachedCriteria类属于命名空间,在下文中一共展示了DetachedCriteria类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InitPageParameter

 public void InitPageParameter(DetachedCriteria criteria)
 {
     IList<PlannedBill> plannedBillList = TheCriteriaMgr.FindAll<PlannedBill>(criteria);
     this.MatchList = this.ConvertPlannedBillToTransformer(plannedBillList);
     this.BindList();
     this.tbItemCode.Focus();
 }
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:7,代码来源:Match.ascx.cs

示例2: CriteriaCompiled

        /// <summary>
        /// 
        /// </summary>
        /// <param name="rootAlias"></param>
        /// <param name="rootType"></param>
        /// <param name="matchMode"></param>
        /// <param name="entityMode"></param>
        /// <param name="instance"></param>
        /// <param name="classInfoProvider"></param>
        public CriteriaCompiled(string rootAlias, System.Type rootType, MatchMode matchMode, EntityMode entityMode,
                                object instance, Func<System.Type, IPersistentClassInfo> classInfoProvider)
        {
            
            if (rootAlias == null || rootAlias.Trim().Equals(string.Empty))
                throw new ArgumentException("The alias for making detached criteria cannot be empty or null", "rootAlias");

            if (rootType == null)
                throw new ArgumentNullException("rootType", "The type which can be used for maikng detached criteria cannot be null.");

            if (instance == null)
                throw new ArgumentNullException("instance", "The instance for building detached criteria cannot be null.");

            if (!rootType.IsInstanceOfType(instance))
                throw new ArgumentTypeException("The given instance for building detached criteria is not suitable for the given criteria type.", "instance", rootType, instance.GetType());

            this.matchMode = matchMode ?? MatchMode.Exact;
            this.entityMode = entityMode;
            this.instance = instance;
            this.classInfoProvider = classInfoProvider;

            this.relationshipTree = new RelationshipTree(rootAlias, rootType);
            this.criteria = DetachedCriteria.For(rootType, rootAlias);
            this.restrictions = new List<ICriterion>();
            this.Init();
        }
开发者ID:TheHunter,项目名称:NHibernate.Integration,代码行数:35,代码来源:CriteriaCompiled.cs

示例3: SubqueryExpression

		protected SubqueryExpression(String op, String quantifier, DetachedCriteria dc, bool prefixOp)
		{
			criteriaImpl = dc.GetCriteriaImpl();
			this.quantifier = quantifier;
			this.prefixOp = prefixOp;
			this.op = op;
		}
开发者ID:Ruhollah,项目名称:nhibernate-core,代码行数:7,代码来源:SubqueryExpression.cs

示例4: TransformToRowCount

 ///<summary>
 /// Returns a clone of the original criteria, which will return the count 
 /// of rows that are returned by the original criteria query.
 ///</summary>
 public static DetachedCriteria TransformToRowCount(DetachedCriteria criteria)
 {
     ICriteria clonedCriteria = TransformToRowCount(criteria.GetCriteriaImpl());
     DetachedCriteria detachedCriteria = DetachedCriteria.For(clonedCriteria.CriteriaClass, clonedCriteria.Alias);
     detachedCriteria.SetCriteriaImpl((CriteriaImpl) clonedCriteria);
     return detachedCriteria;
 }
开发者ID:zibler,项目名称:zibler,代码行数:11,代码来源:CriteriaTransformer.cs

示例5: AddUserSelectCriteria

        public void AddUserSelectCriteria(string cacheKey, DetachedCriteria selectCriteria, DetachedCriteria selectCountCriteria, IDictionary<string, string> alias)
        {
            if (_page.Session["SelectCriteriaCache"] == null)
            {
                _page.Session["SelectCriteriaCache"] =  new Dictionary<string, CachedSelectCriteria>();
            }

            IDictionary<string, CachedSelectCriteria> selectCriteriaCache = (IDictionary<string, CachedSelectCriteria>)_page.Session["SelectCriteriaCache"];
            if (!selectCriteriaCache.ContainsKey(cacheKey) && selectCriteriaCache.Count > UserSelectCriteriaCacheSize)
            {
                //Cache��������UserSelectCriteria
                DateTime lastestTime = DateTime.Now;
                string lastestkey = string.Empty;
                foreach (string key in selectCriteriaCache.Keys)
                {

                    CachedSelectCriteria cache = selectCriteriaCache[key];
                    if (lastestTime > cache.LastAccessTime)
                    {
                        lastestkey = key;
                    }
                }
                selectCriteriaCache.Remove(lastestkey);
            }

            if (selectCriteriaCache.ContainsKey(cacheKey))
            {
                selectCriteriaCache[cacheKey] = new CachedSelectCriteria(DateTime.Now, selectCriteria, selectCountCriteria, alias);
            }
            else
            {
                selectCriteriaCache.Add(cacheKey, new CachedSelectCriteria(DateTime.Now, selectCriteria, selectCountCriteria, alias));
            }
        }
开发者ID:Novthirteen,项目名称:yfkey-scms,代码行数:34,代码来源:SessionHelper.cs

示例6: Add

 public IMultiCriteria Add(DetachedCriteria detachedCriteria)
 {
     criteriaQueries.Add(
         detachedCriteria.GetExecutableCriteria(session)
         );
     return this;
 }
开发者ID:zibler,项目名称:zibler,代码行数:7,代码来源:MultiCriteriaImpl.cs

示例7: FindCount

 public int FindCount(DetachedCriteria selectCriteria)
 {
     IList list = CriteriaMgr.FindAll(selectCriteria);
     if (list != null && list.Count > 0)
     {
         if (list[0] is int)
         {
             return int.Parse(list[0].ToString());
         }
         else if (list[0] is object[])
         {
             return int.Parse(((object[])list[0])[0].ToString());
         }
         //由于性能问题,此后禁用该方法。
         //else if (list[0] is object)
         //{
         //    return list.Count;
         //}
         else
         {
             throw new Exception("unknow result type");
         }
     }
     else
     {
         return 0;
     }
 }
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:28,代码来源:ManagerProxy.cs

示例8: GetPermissionCriteriaByCategory

        public static DetachedCriteria[] GetPermissionCriteriaByCategory(User user, string category)
        {
            DetachedCriteria[] criteria = new DetachedCriteria[2];

            DetachedCriteria upSubCriteria = DetachedCriteria.For<UserPermission>();
            upSubCriteria.CreateAlias("User", "u");
            upSubCriteria.CreateAlias("Permission", "pm");
            upSubCriteria.CreateAlias("pm.Category", "pmc");
            upSubCriteria.Add(Expression.Eq("pmc.Type", category));
            upSubCriteria.Add(Expression.Eq("u.Code", user.Code));
            upSubCriteria.SetProjection(Projections.ProjectionList().Add(Projections.GroupProperty("pm.Code")));

            DetachedCriteria rpSubCriteria = DetachedCriteria.For<RolePermission>();
            rpSubCriteria.CreateAlias("Role", "r");
            rpSubCriteria.CreateAlias("Permission", "pm");
            rpSubCriteria.CreateAlias("pm.Category", "pmc");
            rpSubCriteria.Add(Expression.Eq("pmc.Type", category));
            rpSubCriteria.SetProjection(Projections.ProjectionList().Add(Projections.GroupProperty("pm.Code")));

            DetachedCriteria urSubCriteria = DetachedCriteria.For<UserRole>();
            urSubCriteria.CreateAlias("User", "u");
            urSubCriteria.CreateAlias("Role", "r");
            urSubCriteria.Add(Expression.Eq("u.Code", user.Code));
            urSubCriteria.SetProjection(Projections.ProjectionList().Add(Projections.GroupProperty("r.Code")));

            rpSubCriteria.Add(Subqueries.PropertyIn("r.Code", urSubCriteria));

            criteria[0] = upSubCriteria;
            criteria[1] = rpSubCriteria;

            return criteria;
        }
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:32,代码来源:SecurityHelper.cs

示例9: BindDataSource

 public void BindDataSource(DetachedCriteria selectCriteria)
 {
     IList<PlannedBill> plannedBillList = TheCriteriaMgr.FindAll<PlannedBill>(selectCriteria);
     this.AutoCalculate(plannedBillList);
     this.GV_List.DataSource = plannedBillList;
     this.GV_List.DataBind();
     UpdateView();
 }
开发者ID:Novthirteen,项目名称:yfkey-scms,代码行数:8,代码来源:List.ascx.cs

示例10: BindDataSource

    public void BindDataSource(DetachedCriteria selectCriteria, bool isExport)
    {
        IList<PlannedBill> plannedBills = TheCriteriaMgr.FindAll<PlannedBill>(selectCriteria);

        if (IsSupplier)
        {
            plannedBills = (from p in plannedBills
                            group p by new { p.Item, p.OrderNo, p.ReceiptNo, p.BillAddress, p.Uom, p.CreateDate, p.UnitPrice, p.Currency } into g
                            select new PlannedBill
                            {
                                Item = g.Key.Item,
                                OrderNo = g.Key.OrderNo,
                                ReceiptNo = g.Key.ReceiptNo,
                                BillAddress = g.Key.BillAddress,
                                Uom = g.Key.Uom,
                                CreateDate = g.Key.CreateDate,
                                UnitPrice = g.Key.UnitPrice,
                                Currency = g.Key.Currency,
                                PlannedQty = g.Sum(p => p.PlannedQty),
                                PlannedAmount = g.Sum(p => p.PlannedAmount),
                                ActingQty = g.Sum(p => p.ActingQty),
                                ActingAmount = g.Sum(p => p.ActingAmount)
                            })
                            //.Where(p => this.CurrentUser.HasPermission(p.BillAddress.Party.Code))
                            .ToList();
        }
        plannedBills = plannedBills.OrderBy(p => p.CreateDate).OrderBy(p => p.Item.Code).ToList();
        this.GV_List.DataSource = plannedBills;
        this.GV_List.DataBind();
        UpdateView();
        if (isExport && GV_List.Rows.Count > 0)
        {
            string dateTime = DateTime.Now.ToString("MMddhhmmss");
            int lastColumnIndex = GV_List.Columns.Count - 1;
            DataControlField dataControlField0 = null;
            //DataControlField dataControlFieldLast = null;
            if (!IsSupplier)
            {
                dataControlField0 = GV_List.Columns[0];
                //dataControlFieldLast = GV_List.Columns[lastColumnIndex];
                //GV_List.Columns.RemoveAt(lastColumnIndex);
                GV_List.Columns.RemoveAt(0);

            }

            this.ExportXLS(GV_List, "PlanBill" + dateTime + ".xls");

            if (!IsSupplier)
            {
                GV_List.Columns.Insert(0, dataControlField0);
                //GV_List.Columns.Insert(lastColumnIndex-1, dataControlFieldLast);
            }
        }

    }
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:55,代码来源:List.ascx.cs

示例11: SerializeAndList

		private void SerializeAndList(DetachedCriteria dc)
		{
			byte[] bytes = SerializationHelper.Serialize(dc);

			DetachedCriteria dcs = (DetachedCriteria)SerializationHelper.Deserialize(bytes);

			using (ISession s = OpenSession())
			{
				dcs.GetExecutableCriteria(s).List();
			}
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:11,代码来源:DetachedCriteriaSerializable.cs

示例12: AssertCriteriaAreNotEqual

		private void AssertCriteriaAreNotEqual(DetachedCriteria expected, DetachedCriteria actual)
		{
			try
			{
				AssertCriteriaAreEqual(expected, actual);
			}
			catch
			{
				return;
			}
			Assert.Fail("No exception thrown");
		}
开发者ID:hoangduc007,项目名称:nhibernate-core,代码行数:12,代码来源:CriteriaAssertFixture.cs

示例13: GetRootType

        public static Type GetRootType(DetachedCriteria criteria, ISession session)
        {
            Type rootType = criteria.GetRootEntityTypeIfAvailable();
            if (rootType != null)
            {
                return rootType;
            }

            ISessionFactoryImplementor factory = (ISessionFactoryImplementor)session.SessionFactory;
            IEntityPersister persister = factory.GetEntityPersister(criteria.EntityOrClassName);
            if (persister == null)
                throw new InvalidOperationException("Could not find entity named: " + criteria.EntityOrClassName);

            return persister.GetMappedClass(EntityMode.Poco);
        }
开发者ID:JackWangCUMT,项目名称:rhino-tools,代码行数:15,代码来源:CriteriaUtil.cs

示例14: InitPageParameter

    public void InitPageParameter(DetachedCriteria selectCriteria)
    {
        this.InspectCriteria = selectCriteria;
        IList<InspectOrderDetail> pendingInspectOrderDetailList = TheCriteriaMgr.FindAll<InspectOrderDetail>(selectCriteria);

        this.GV_List.DataSource = pendingInspectOrderDetailList;
        this.GV_List.DataBind();
        if (pendingInspectOrderDetailList.Count == 0)
        {
            this.lblMessage.Visible = true;
            this.lblMessage.Text = "${Common.GridView.NoRecordFound}";
        }
        else
        {
            this.lblMessage.Visible = false;
        }
    }
开发者ID:Novthirteen,项目名称:yfkey-scms,代码行数:17,代码来源:List.ascx.cs

示例15: InitPageParameter

    public void InitPageParameter(DetachedCriteria selectCriteria)
    {
        IList<OrderHead> orderHeadList = TheCriteriaMgr.FindAll<OrderHead>(selectCriteria);

        this.GV_List.DataSource = orderHeadList;
        this.GV_List.DataBind();
        if (orderHeadList.Count == 0)
        {
            this.lblMessage.Visible = true;
            this.lblMessage.Text = "${Common.GridView.NoRecordFound}";
            this.btnPrint.Visible = false;
        }
        else
        {
            this.lblMessage.Visible = false;
            this.btnPrint.Visible = true;
        }
    }
开发者ID:Novthirteen,项目名称:yfkey-scms,代码行数:18,代码来源:List.ascx.cs


注:本文中的DetachedCriteria类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。