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

C# ObjectCriteria类代码示例

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

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



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

示例1: Get

        public static Department Get(long deptId)
        {
            Department _currentDepartment = null;
            /*if (_currentDepartment == null)
            {*/
            IApplicationContext ctx = ContextRegistry.GetContext();
            var departmentLogic = ctx.GetObject("AppFrame.Service.IDepartmentLogic") as IDepartmentLogic;
            var criteria = new ObjectCriteria();
            criteria.AddEqCriteria("Active", 1);
            criteria.AddEqCriteria("DelFlg", (long)0);
            criteria.AddEqCriteria("DepartmentId", deptId);
            if (departmentLogic != null)
            {
                IList deptList = departmentLogic.FindAll(criteria);
                if (deptList != null && deptList.Count > 0)
                {
                    _currentDepartment = deptList[0] as Department;
                }
            }
            if (_currentDepartment == null)
            {
                return null;
            }
            // detach object to session

            return _currentDepartment;
            /*}
            else
            {
                return _currentDepartment;
            }*/
        }
开发者ID:DelLitt,项目名称:opmscoral,代码行数:32,代码来源:CurrentDepartment.cs


示例2: Working

 public override object Working()
 {
     IList productMasters = (IList)MainStockLogic.FetchAll(new LinqCriteria<MainStock>());
     //IList productMasters = ProductMasterLogic.LoadAllProductMasterWithType("%%");
     Flow.Session.Put(FlowConstants.PRODUCT_NAMES_LIST, productMasters);
     ObjectCriteria<Department> objectCriteria = new ObjectCriteria<Department>();
     objectCriteria.Add(x => x.DepartmentId > 0); // we don't get department 0 because department 0 is MAIN STOCK.
     IList<Department> departments = DepartmentLogic.FindAll(objectCriteria);
     Flow.Session.Put(FlowConstants.DEPARTMENTS, departments);
     return null;
 }
开发者ID:DelLitt,项目名称:opmscoral,代码行数:11,代码来源:StockOutPreLoadAction.cs


示例3: AddSubStock

        public void AddSubStock(Department department)
        {
            // lower range
            long subStockMin = Int64.Parse(department.DepartmentId.ToString().PadRight(4,'0').PadRight(5,'0'));
            // higher range
            long subStockMax = Int64.Parse(department.DepartmentId.ToString().PadRight(4, '0').PadRight(5,'9'));
            ObjectCriteria objectCriteria = new ObjectCriteria();
            objectCriteria.AddBetweenCriteria("DepartmentId",subStockMin,subStockMax );
            var maxId = DepartmentDAO.SelectSpecificType(objectCriteria, Projections.Max("DepartmentId"));
            var departmentId = maxId == null ?  Int64.Parse(department.DepartmentId.ToString().PadRight(4,'0').PadRight(5,'0')) + 1 : (Int64.Parse(maxId.ToString()) + 1);

            department.DepartmentId = departmentId;
            DepartmentDAO.Add(department);
        }
开发者ID:DelLitt,项目名称:opmscoral,代码行数:14,代码来源:DepartmentLogicImpl.cs


示例4: Working

        public override object Working()
        {
            var stockOutCriteria = new ObjectCriteria<CoralPOS.Models.StockOut>();
            stockOutCriteria.Add(x => x.ConfirmFlg == 1);
            var confirmingStockOuts = (IList) StockOutLogic.FindAll(stockOutCriteria);
            IList<CoralPOS.Models.StockOut> fetchedStockOuts = new List<CoralPOS.Models.StockOut>();
            foreach (CoralPOS.Models.StockOut confirmingStockOut in confirmingStockOuts)
            {
                CoralPOS.Models.StockOut fetchedStockOut = StockOutLogic.Fetch(confirmingStockOut);
                MainStockLogic.UpdateStockQuantity(fetchedStockOut.StockOutDetails);
                fetchedStockOuts.Add(fetchedStockOut);
            }

            Flow.Session.Put(FlowConstants.CONFIRMING_STOCK_OUT_LIST,confirmingStockOuts);
            return null;
        }
开发者ID:DelLitt,项目名称:opmscoral,代码行数:16,代码来源:StockOutConfirmPreLoadAction.cs


示例5: FindAll

        /// <summary>
        /// Find all StockIn from database. No pagination.
        /// </summary>
        /// <param name="criteria"></param>
        /// <returns></returns>
        public IList FindAll(ObjectCriteria criteria)
        {
            return (IList) HibernateTemplate.Execute(
                               delegate(ISession session)
                                   {
                                       //ISession session = HibernateTemplate.SessionFactory.OpenSession();
                                       try
                                       {
                                           ICriteria hibernateCriteria = session.CreateCriteria(typeof (StockIn));
                                           if (criteria != null)
                                           {
                                               IDictionary<string, SubObjectCriteria> map = criteria.GetSubCriteria();
                                               if (map.Count > 0)
                                               {
                                                   foreach (string key in map.Keys)
                                                   {
                                                       hibernateCriteria.CreateAlias(key, key);
                                                   }
                                                   AddCriteriaAndOrder(hibernateCriteria, criteria.GetWhere(),
                                                                       criteria.GetOrder());

                                                   foreach (string key in map.Keys)
                                                   {
                                                       SubObjectCriteria subCriteria = null;
                                                       map.TryGetValue(key, out subCriteria);
                                                       AddCriteriaAndOrder(hibernateCriteria, subCriteria.GetWhere(),
                                                                           subCriteria.GetOrder());
                                                   }
                                               }
                                               else
                                               {
                                                   AddCriteriaAndOrder(hibernateCriteria, criteria.GetWhere(),
                                                                       criteria.GetOrder());
                                               }
                                           }
                                           return hibernateCriteria.List();
                                       }
                                       finally
                                       {
                                           /*if (session != null)
                                           {
                                               session.Disconnect();
                                           }*/
                                       }
                                   });
        }
开发者ID:DelLitt,项目名称:opmscoral,代码行数:51,代码来源:StockInDAOImpl.cs


示例6: Add

        public Department Add(Department data)
        {
            ObjectCriteria objectCriteria = new ObjectCriteria();
            objectCriteria.AddLesserCriteria("DepartmentId", (long)10000);
            var maxId = DepartmentDAO.SelectSpecificType(objectCriteria, Projections.Max("DepartmentId"));
            var departmentId = maxId == null ? 1 : (Int64.Parse(maxId.ToString()) + 1);
            data.DepartmentId = departmentId;
            if (data.Active == 1)
            {
                DepartmentDAO.SetInActiveAll();
            }

            DepartmentDAO.Add(data);
            IList employees = data.Employees;
            SaveEmployees(employees,departmentId);

            return data;
        }
开发者ID:DelLitt,项目名称:opmscoral,代码行数:18,代码来源:DepartmentLogicImpl.cs


示例7: FindAll

        /// <summary>
        /// Find all ProductMaster from database. No pagination.
        /// </summary>
        /// <param name="criteria"></param>
        /// <returns></returns>
        public IList FindAll(ObjectCriteria criteria)
        {
            ISession session = DbUtility.getSession(HibernateTemplate);
            try
            {
                ICriteria hibernateCriteria = session.CreateCriteria(typeof(ProductMaster));
                if (criteria != null)
                {
                    IDictionary<string, SubObjectCriteria> map = criteria.GetSubCriteria();
                    if (map.Count > 0)
                    {
                        foreach (string key in map.Keys)
                        {
                            hibernateCriteria.CreateAlias(key, key);
                        }
                        AddCriteriaAndOrder(hibernateCriteria, criteria.GetWhere(), criteria.GetOrder());

                        foreach (string key in map.Keys)
                        {
                            SubObjectCriteria subCriteria = null;
                            map.TryGetValue(key, out subCriteria);
                            AddCriteriaAndOrder(hibernateCriteria, subCriteria.GetWhere(), subCriteria.GetOrder());
                        }
                    }
                    else
                    {
                        AddCriteriaAndOrder(hibernateCriteria, criteria.GetWhere(), criteria.GetOrder());
                    }
                }
                if(criteria.MaxResult > 0 )
                {
                    hibernateCriteria.SetMaxResults(criteria.MaxResult);
                }
                return hibernateCriteria.List();
            }
            finally
            {
                if (session != null)
                {
                    session.Close();
                }
            }
        }
开发者ID:DelLitt,项目名称:opmscoral,代码行数:48,代码来源:ProductMasterDAOImpl.cs


示例8: FindAll

        /// <summary>
        /// Find all PurchaseOrder from database. No pagination.
        /// </summary>
        /// <param name="criteria"></param>
        /// <returns></returns>
        public IList FindAll(ObjectCriteria criteria)
        {
            ISession session = HibernateTemplate.SessionFactory.OpenSession();
            try
            {
                ICriteria hibernateCriteria = session.CreateCriteria(typeof(PurchaseOrder));
                if (criteria != null)
                {
                    IDictionary<string, SubObjectCriteria> map = criteria.GetSubCriteria();
                    if (map.Count > 0)
                    {
                        foreach (string key in map.Keys)
                        {
                            hibernateCriteria.CreateAlias(key, key);
                        }
                        AddCriteriaAndOrder(hibernateCriteria, criteria.GetWhere(), criteria.GetOrder());

                        foreach (string key in map.Keys)
                        {
                            SubObjectCriteria subCriteria = null;
                            map.TryGetValue(key, out subCriteria);
                            AddCriteriaAndOrder(hibernateCriteria, subCriteria.GetWhere(), subCriteria.GetOrder());
                        }
                    }
                    else
                    {
                        AddCriteriaAndOrder(hibernateCriteria, criteria.GetWhere(), criteria.GetOrder());
                    }
                }
                return hibernateCriteria.List();
            }
            finally
            {
                if (session != null)
                {
                    session.Close();
                }
            }
        }
开发者ID:DelLitt,项目名称:opmscoral,代码行数:44,代码来源:PurchaseOrderDAOImpl.cs


示例9: FindPaging

        /// <summary>
        /// Find all ReceiptOut from database. Has pagination.
        /// </summary>
        /// <param name="criteria"></param>
        /// <returns></returns>
        public QueryResult FindPaging(ObjectCriteria criteria)
        {
            QueryResult queryResult = new QueryResult();
            if (criteria == null)
            {
                return null;
            }

            ISession session = HibernateTemplate.SessionFactory.OpenSession();
            try
            {
                int page = criteria.PageIndex;
                int pageSize = criteria.PageSize;
                queryResult.Page = page;

                int count = Count(criteria);
                if (count == 0)
                {
                   return null;
                }
                queryResult.TotalPage = (((count % pageSize == 0) ? (count / pageSize) : (count / pageSize + 1)));

                ICriteria hibernateCriteria = session.CreateCriteria(typeof(ReceiptOut));

                IDictionary<string, SubObjectCriteria> map = criteria.GetSubCriteria();
                if (map.Count > 0)
                {
                    foreach (string key in map.Keys)
                    {
                        hibernateCriteria.CreateAlias(key, key);
                    }
                    AddCriteriaAndOrder(hibernateCriteria, criteria.GetWhere(), criteria.GetOrder());

                    SubObjectCriteria subCriteria = null;
                    foreach (string key in map.Keys)
                    {
                        map.TryGetValue(key, out subCriteria);
                        AddCriteriaAndOrder(hibernateCriteria, subCriteria.GetWhere(), subCriteria.GetOrder());
                    }
                }
                else
                {
                    AddCriteriaAndOrder(hibernateCriteria, criteria.GetWhere(), criteria.GetOrder());
                }
                hibernateCriteria.SetFirstResult((page - 1) * pageSize);
                hibernateCriteria.SetMaxResults(pageSize);
                IList list = hibernateCriteria.List();
                if (list.Count == 0)
                {
                   return null;
                }
                else
                {
                   queryResult.Result = list;
                }
            }
            finally
            {
                if (session != null)
                {
                    session.Disconnect();
                }
            }

            return queryResult;
        }
开发者ID:DelLitt,项目名称:opmscoral,代码行数:71,代码来源:ReceiptOutDAOImpl.cs


示例10: FindPaging

 /// <summary>
 /// Find all EmployeeWorkingDay from database. Has pagination.
 /// </summary>
 /// <param name="criteria"></param>
 /// <returns></returns>
 public QueryResult FindPaging(ObjectCriteria criteria)
 {
     return EmployeeWorkingDayDAO.FindPaging(criteria);
 }
开发者ID:DelLitt,项目名称:opmscoral,代码行数:9,代码来源:EmployeeWorkingDayLogicImpl.cs


示例11: FindPaging

 /// <summary>
 /// Find all DepartmentManagement from database. Has pagination.
 /// </summary>
 /// <param name="criteria"></param>
 /// <returns></returns>
 public QueryResult FindPaging(ObjectCriteria criteria)
 {
     return DepartmentManagementDAO.FindPaging(criteria);
 }
开发者ID:DelLitt,项目名称:opmscoral,代码行数:9,代码来源:DepartmentManagementLogicImpl.cs


示例12: FindByMaxDate

 public IList FindByMaxDate(ObjectCriteria criteria)
 {
     var sqlString = new StringBuilder("select stock, max(stock.CreateDate) FROM StockHistory stock, Product p WHERE stock.Product.ProductId = p.ProductId ");
     foreach (SQLQueryCriteria crit in criteria.GetQueryCriteria())
     {
         sqlString.Append(" AND ")
                .Append(crit.PropertyName)
                .Append(" ")
                .Append(crit.SQLString)
                .Append(" :")
                .Append(crit.PropertyName)
                .Append(" ");
     }
     sqlString.Append(" Group BY pm.ProductMasterId");
     //criteria.AddQueryCriteria("productName", "Ao%");
     //var sqlString = "select * FROM Stock stock, Product p WHERE stock.Product_Id = p.Product_Id";
     return StockHistoryDAO.FindByMaxDate(sqlString.ToString(), criteria);
 }
开发者ID:DelLitt,项目名称:opmscoral,代码行数:18,代码来源:StockHistoryLogicImpl.cs


示例13: Process

        public void Process(StockHistory defect)
        {
            // find exist stock base on productid
            ObjectCriteria objectCriteria = new ObjectCriteria();
            objectCriteria.AddEqCriteria("Product.ProductId", defect.Product.ProductId);
            IList existList = StockHistoryDAO.FindAll(objectCriteria);

            if (existList.Count > 0) // exist stock ?
            {
                StockHistory existDefect = (StockHistory)existList[0];
                existDefect.DamageCount = defect.DamageCount;
                existDefect.Description = defect.Description;
                existDefect.ErrorCount = defect.ErrorCount;
                existDefect.LostCount = defect.LostCount;
                existDefect.GoodCount = defect.GoodCount;
                existDefect.Product = defect.Product;
                existDefect.ProductMaster = defect.ProductMaster;
                existDefect.Quantity = defect.Quantity;
                existDefect.Stock = defect.Stock;
                existDefect.UnconfirmCount = defect.UnconfirmCount;
                existDefect.UpdateDate = defect.UpdateDate;
                existDefect.UpdateId = defect.UpdateId;

                existDefect.ExclusiveKey = existDefect.ExclusiveKey + 1;
                defect.StockHistoryId = existDefect.StockHistoryId;

                StockHistoryDAO.Update(existDefect);
            }
            else
            {
                StockHistoryDAO.Add(defect);
            }
        }
开发者ID:DelLitt,项目名称:opmscoral,代码行数:33,代码来源:StockHistoryLogicImpl.cs


示例14: TempSave

 public void TempSave(IList saveStockViewList)
 {
     foreach (DepartmentStockView view in saveStockViewList)
     {
         foreach (DepartmentStock stock in view.DepartmentStocks)
         {
             DepartmentStockTemp temp = new DepartmentStockTempMapper().Convert(stock);
             ObjectCriteria crit = new ObjectCriteria();
             crit.AddEqCriteria("TempSave", 1);
             crit.AddEqCriteria("Fixed", 0);
             crit.AddEqCriteria("DelFlg", 0);
             crit.AddEqCriteria("DepartmentStockTempPK.DepartmentId",temp.DepartmentStockTempPK.DepartmentId);
             crit.AddEqCriteria("DepartmentStockTempPK.ProductId", temp.DepartmentStockTempPK.ProductId);
             IList list =DepartmentStockTempDAO.FindAll(crit);
             if(list == null || list.Count == 0)
             {
                 temp.TempSave = 1;
                 DepartmentStockTempDAO.Add(temp);
             }
             else
             {
                 DepartmentStockTemp tempSave = (DepartmentStockTemp) list[0];
                 tempSave.Quantity = temp.Quantity;
                 tempSave.GoodQuantity = temp.GoodQuantity;
                 tempSave.ErrorQuantity = temp.ErrorQuantity;
                 tempSave.LostQuantity = temp.LostQuantity;
                 tempSave.UnconfirmQuantity = temp.UnconfirmQuantity;
                 tempSave.DamageQuantity = temp.DamageQuantity;
                 tempSave.TempSave = 1;
                 DepartmentStockTempDAO.Update(tempSave);
             }
         }
     }
 }
开发者ID:DelLitt,项目名称:opmscoral,代码行数:34,代码来源:DepartmentStockTempLogicImpl.cs


示例15: FindByQuery

        public IList FindByQuery(string sqlString, ObjectCriteria criteria)
        {
            List<SQLQueryCriteria> query = criteria.GetQueryCriteria();
            var paramNames = new List<string>();
            var values = new List<object>();
            foreach (SQLQueryCriteria crit in query)
            {
                //sqlString += " AND " + crit.PropertyName + " " + crit.SQLString + " :" + crit.PropertyName + " ";
                paramNames.Add(crit.PropertyName);
                values.Add(crit.Value);
            }

            IList list = HibernateTemplate.FindByNamedParam(sqlString, paramNames.ToArray(), values.ToArray());

            IList returnList = new ArrayList();
            for (int i = 0; i < list.Count; i++)
            {
                object[] obj = (object[]) list[i];
                long qty = Int64.Parse(obj[1].ToString());
                var result = new DepartmentStockSearchResult
                                 {
                                     DepartmentStock = ((DepartmentStock)obj[0]),
                                     SumQuantity = qty,
                                     SumInPrice = Int64.Parse(obj[2].ToString()),
                                     SumSellPrice = obj[3] != null ? ((DepartmentPrice)obj[3]).Price * qty : 0//Int64.Parse(obj[3].ToString())
                                 };
                returnList.Add(result);
            }
            return returnList;
        }
开发者ID:DelLitt,项目名称:opmscoral,代码行数:30,代码来源:DepartmentStockDAOImpl.cs


示例16: FindAll

 /// <summary>
 /// Find all DepartmentStockTemp from database. No pagination.
 /// </summary>
 /// <param name="criteria"></param>
 /// <returns></returns>
 public IList FindAll(ObjectCriteria criteria)
 {
     return DepartmentStockTempDAO.FindAll(criteria);
 }
开发者ID:DelLitt,项目名称:opmscoral,代码行数:9,代码来源:DepartmentStockTempLogicImpl.cs


示例17: FindPaging

 /// <summary>
 /// Find all DepartmentStockTemp from database. Has pagination.
 /// </summary>
 /// <param name="criteria"></param>
 /// <returns></returns>
 public QueryResult FindPaging(ObjectCriteria criteria)
 {
     return DepartmentStockTempDAO.FindPaging(criteria);
 }
开发者ID:DelLitt,项目名称:opmscoral,代码行数:9,代码来源:DepartmentStockTempLogicImpl.cs


示例18: FindByQueryForDeptStock

 public IList FindByQueryForDeptStock(string sqlString, ObjectCriteria criteria)
 {
     ISession session = DbUtility.getSession(HibernateTemplate);
     try
     {
         List<SQLQueryCriteria> query = criteria.GetQueryCriteria();
         var paramNames = new List<string>();
         var values = new List<object>();
         foreach (SQLQueryCriteria crit in query)
         {
             //sqlString += " AND " + crit.PropertyName + " " + crit.SQLString + " :" + crit.PropertyName + " ";
             paramNames.Add(crit.PropertyName);
             values.Add(crit.Value);
         }
         HibernateTemplate.MaxResults = criteria.MaxResult;
         IList list = HibernateTemplate.FindByNamedParam(sqlString, paramNames.ToArray(), values.ToArray());
         IList returnList = new ArrayList();
         for (int i = 0; i < list.Count; i++)
         {
             var stock = (DepartmentStock)((object[])list[i])[0];
             stock.Quantity = Int64.Parse(((object[])list[i])[1].ToString());
             returnList.Add(stock);
         }
         return returnList;
     }
     finally
     {
         session.Close();
     }
 }
开发者ID:DelLitt,项目名称:opmscoral,代码行数:30,代码来源:DepartmentStockDAOImpl.cs


示例19: FindPaging

 /// <summary>
 /// Find all StockHistory from database. Has pagination.
 /// </summary>
 /// <param name="criteria"></param>
 /// <returns></returns>
 public QueryResult FindPaging(ObjectCriteria criteria)
 {
     return StockHistoryDAO.FindPaging(criteria);
 }
开发者ID:DelLitt,项目名称:opmscoral,代码行数:9,代码来源:StockHistoryLogicImpl.cs


示例20: FindStockQuantityForPurchaseOrder

        public IList FindStockQuantityForPurchaseOrder(string sqlString, ObjectCriteria criteria)
        {
            List<SQLQueryCriteria> query = criteria.GetQueryCriteria();
            var paramNames = new List<string>();
            var values = new List<object>();
            foreach (SQLQueryCriteria crit in query)
            {
                paramNames.Add(crit.PropertyName);
                values.Add(crit.Value);
            }

            IList list = HibernateTemplate.FindByNamedParam(sqlString, paramNames.ToArray(), values.ToArray());

            IList returnList = new ArrayList();
            for (int i = 0; i < list.Count; i++)
            {
                var obj = (object[])list[i];
                var result = new DepartmentStockSearchResult
                {
                    DepartmentStock = ((DepartmentStock)obj[0]),
                    DepartmentPrice = ((DepartmentPrice)obj[1])
                };
                returnList.Add(result);
            }
            return returnList;
        }
开发者ID:DelLitt,项目名称:opmscoral,代码行数:26,代码来源:DepartmentStockDAOImpl.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# ObjectData类代码示例发布时间:2022-05-24
下一篇:
C# ObjectCreationExpressionSyntax类代码示例发布时间: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