• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# DetachedCriteria类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: InitPageParameter

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

        this.GV_List.DataSource = unqualifiedGoodsList;
        this.GV_List.DataBind();
        if (unqualifiedGoodsList.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


示例17: GetPartyPermissionCriteria

        public static DetachedCriteria[] GetPartyPermissionCriteria(string userCode, params string[] partyType)
        {
            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", BusinessConstants.CODE_MASTER_PERMISSION_CATEGORY_TYPE_VALUE_ORGANIZATION));
            if (partyType != null && partyType.Length > 0)
            {
                upSubCriteria.Add(Expression.In("pmc.Code", partyType));
            }
            upSubCriteria.Add(Expression.Eq("u.Code", userCode));
            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", BusinessConstants.CODE_MASTER_PERMISSION_CATEGORY_TYPE_VALUE_ORGANIZATION));
            if (partyType != null && partyType.Length > 0)
            {
                rpSubCriteria.Add(Expression.In("pmc.Code", partyType));
            }
            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", userCode));
            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,代码行数:40,代码来源:SecurityHelper.cs


示例18: SetSearchCriteria

 public void SetSearchCriteria(DetachedCriteria SelectCriteria, DetachedCriteria SelectCountCriteria, IDictionary<string, string> alias, int range)
 {
     switch (range)
     {
         case 1:
             this.ucOrderTracerList.Visible = false;
             this.ucIpDetList.Visible = false;
             this.ucOrderDetailList.Visible = false;
             this.ucBillList.Visible = true;
             this.ucBillList.SetSearchCriteria(SelectCriteria, SelectCountCriteria, alias);
             this.ucBillList.UpdateView();
             break;
         case 2:
             this.ucOrderTracerList.Visible = false;
             this.ucBillList.Visible = false;
             this.ucOrderDetailList.Visible = false;
             this.ucIpDetList.Visible = true;
             this.ucIpDetList.SetSearchCriteria(SelectCriteria, SelectCountCriteria, alias);
             this.ucIpDetList.UpdateView();
             break;
         case 3:
             this.ucIpDetList.Visible = false;
             this.ucBillList.Visible = false;
             this.ucOrderDetailList.Visible = false;
             this.ucOrderTracerList.Visible = true;
             this.ucOrderTracerList.SetSearchCriteria(SelectCriteria, SelectCountCriteria, alias);
             this.ucOrderTracerList.UpdateView();
             break;
         case 4:
             this.ucIpDetList.Visible = false;
             this.ucBillList.Visible = false;
             this.ucOrderDetailList.Visible = true;
             this.ucOrderTracerList.Visible = false;
             this.ucOrderDetailList.SetSearchCriteria(SelectCriteria, SelectCountCriteria, alias);
             this.ucOrderDetailList.UpdateView();
             break;
     }
 }
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:38,代码来源:Detail.ascx.cs


示例19: VisitMethodCall

		protected override Expression VisitMethodCall(MethodCallExpression expr)
		{
			Type = BinaryCriterionType.Criteria;

			//TODO: don't hardcode this alias 'sub'
			Criteria = DetachedCriteria.ForEntityName(rootCriteria.GetEntityOrClassName(), "sub");

			EntityExpression rootEntity = EntityExpressionVisitor.RootEntity(expr);
			if (rootEntity != null)
			{
				string identifierName = rootEntity.MetaData.IdentifierPropertyName;
				Criteria.Add(Restrictions.EqProperty(rootCriteria.Alias + "." + identifierName, "sub." + identifierName));
			}

			if (SelectArgumentsVisitor.SupportsMethod(expr.Method.Name))
			{
				var projectionVisitor = new SelectArgumentsVisitor(Criteria.Adapt(session), session);
				projectionVisitor.Visit(expr);
				Criteria.SetProjection(projectionVisitor.Projection);
			}

			return expr;
		}
开发者ID:560889223,项目名称:56.NHibernate.Linq,代码行数:23,代码来源:BinaryCriterionVisitor.cs


示例20: SimpleSubqueryExpression

		internal SimpleSubqueryExpression(Object value, String op, String quantifier, DetachedCriteria dc)
			: base(op, quantifier, dc)

		{
			this.value = value;
		}
开发者ID:pallmall,项目名称:WCell,代码行数:6,代码来源:SimpleSubqueryExpression.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# DetailCollection类代码示例发布时间:2022-05-24
下一篇:
C# DestructorDeclaration类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap