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


C# ObjectCriteria.AddOrder方法代码示例

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


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

示例1: posLogView_SearchPosLogEvent

 private void posLogView_SearchPosLogEvent(object sender, PosLogEventArgs e)
 {
     var criteria = new ObjectCriteria();
     if(!string.IsNullOrEmpty(e.Username))
     {
         criteria.AddLikeCriteria("PosUser", e.Username + "%");
     }
     if(!string.IsNullOrEmpty(e.Action))
     {
         criteria.AddLikeCriteria("PosAction", e.Action + "%");
     }
     criteria.AddGreaterOrEqualsCriteria("Date", DateUtility.ZeroTime(e.LogDateFrom));
     criteria.AddLesserOrEqualsCriteria("Date", DateUtility.MaxTime(e.LogDateTo));
     criteria.AddOrder("Date", false);
     IList list = PosLogLogic.FindAll(criteria);
     e.PosLogList = list;
 }
开发者ID:DelLitt,项目名称:opmscoral,代码行数:17,代码来源:PosLogController.cs

示例2: productMasterView_InitProductMasterEvent

        private void productMasterView_InitProductMasterEvent(object sender, ProductMasterEventArgs e)
        {
            var criteria = new ObjectCriteria();
            criteria.AddEqCriteria("DelFlg", CommonConstants.DEL_FLG_NO);
            e.CountryList = CountryLogic.FindAll(criteria);
            e.CountryList.Insert(0, new Country());
            e.ManufacturerList = ManufacturerLogic.FindAll(criteria);
            e.ManufacturerList.Insert(0, new Manufacturer());
            e.PackagerList = PackagerLogic.FindAll(criteria);
            e.PackagerList.Insert(0, new Packager());
            e.DistributorList = DistributorLogic.FindAll(criteria);
            e.DistributorList.Insert(0, new Distributor());

            // product type
            criteria = new ObjectCriteria();
            criteria.AddEqCriteria("DelFlg", CommonConstants.DEL_FLG_NO);
            criteria.AddOrder("TypeName", true);
            e.ProductTypeList = SortType((ArrayList)ProductTypeLogic.FindAll(criteria));
            e.ProductTypeList.Insert(0, new ProductType());

            // product size
            criteria = new ObjectCriteria();
            criteria.AddEqCriteria("DelFlg", CommonConstants.DEL_FLG_NO);
            criteria.AddOrder("SizeName", true);
            e.ProductSizeList = SortSize((ArrayList)ProductSizeLogic.FindAll(criteria));
            e.ProductSizeList.Insert(0, new ProductSize());

            // product color
            criteria = new ObjectCriteria();
            criteria.AddEqCriteria("DelFlg", CommonConstants.DEL_FLG_NO);
            criteria.AddOrder("ColorName", true);
            e.ProductColorList = SortColor((ArrayList)ProductColorLogic.FindAll(criteria));
            e.ProductColorList.Insert(0, new ProductColor());

            if (e.ProductMasterForInit != null)
            {
                criteria = new ObjectCriteria();
                criteria.AddEqCriteria("DelFlg", CommonConstants.DEL_FLG_NO);
                criteria.AddEqCriteria("ProductName", e.ProductMasterForInit.ProductName);
                criteria.AddEqCriteria("ProductType", e.ProductMasterForInit.ProductType);
                /*criteria.AddEqCriteria("Manufacturer", e.ProductMasterForInit.Manufacturer);
                criteria.AddEqCriteria("Distributor", e.ProductMasterForInit.Distributor);
                criteria.AddEqCriteria("Packager", e.ProductMasterForInit.Packager);
                criteria.AddEqCriteria("Country", e.ProductMasterForInit.Country);*/

                e.SameProductMasterList = ProductMasterLogic.FindAll(criteria);
            }
        }
开发者ID:DelLitt,项目名称:opmscoral,代码行数:48,代码来源:ProductMasterController.cs

示例3: _departmentStockAdhocProcessingView_LoadAdhocStocksEvent

        void _departmentStockAdhocProcessingView_LoadAdhocStocksEvent(object sender, DepartmentStockAdhocProcessingEventArgs e)
        {
            ObjectCriteria criteria = new ObjectCriteria();
            criteria.AddEqCriteria("DelFlg", CommonConstants.DEL_FLG_NO);
            criteria.AddEqCriteria("Fixed", CommonConstants.DEL_FLG_NO);
            criteria.AddOrder("ProductMaster.ProductMasterId", true);
            IList list = DepartmentStockTempLogic.FindAll(criteria);
            IList deptStockTempList = null;
            if (list != null && list.Count > 0)
            {
                deptStockTempList = new ArrayList();

                foreach (DepartmentStockTemp stockTemp in list)
                {
                    int viewIndex = -1;
                    if(HasInList(stockTemp,deptStockTempList,out viewIndex))
                    {
                        DepartmentStockTempView view = (DepartmentStockTempView) deptStockTempList[viewIndex];
                        view.Quantity += stockTemp.Quantity;

                        view.GoodQuantity += stockTemp.GoodQuantity;
                        view.ErrorQuantity += stockTemp.ErrorQuantity;
                        view.DamageQuantity += stockTemp.DamageQuantity;
                        view.LostQuantity += stockTemp.LostQuantity;
                        view.UnconfirmQuantity += stockTemp.UnconfirmQuantity;
                        view.RealQuantity += stockTemp.GoodQuantity + stockTemp.ErrorQuantity + stockTemp.DamageQuantity +
                                        stockTemp.LostQuantity + stockTemp.UnconfirmQuantity;
                        view.DepartmentStockTemps.Add(stockTemp);
                    }
                    else
                    {
                        DepartmentStockTempView view = new DepartmentStockTempView();
                        view.Quantity += stockTemp.Quantity;
                        view.GoodQuantity += stockTemp.GoodQuantity;
                        view.ErrorQuantity += stockTemp.ErrorQuantity;
                        view.DamageQuantity += stockTemp.DamageQuantity;
                        view.LostQuantity += stockTemp.LostQuantity;
                        view.UnconfirmQuantity += stockTemp.UnconfirmQuantity;
                        view.RealQuantity += stockTemp.GoodQuantity + stockTemp.ErrorQuantity + stockTemp.DamageQuantity +
                                        stockTemp.LostQuantity + stockTemp.UnconfirmQuantity;

                        view.ProductMaster = stockTemp.ProductMaster;
                        view.DepartmentStockTemps = new ArrayList();
                        view.DepartmentStockTemps.Add(stockTemp);
                        deptStockTempList.Add(view);
                    }
                }

            }

            e.DeptStockAdhocList = deptStockTempList;
        }
开发者ID:DelLitt,项目名称:opmscoral,代码行数:52,代码来源:DepartmentStockAdhocProcessingController.cs

示例4: productMasterSearchDepartmentView_SearchProductEvent

        private void productMasterSearchDepartmentView_SearchProductEvent(object sender, ProductMasterSearchDepartmentEventArgs e)
        {
            ProductMaster searchProductMaster = e.SelectedProductMaster;
            ObjectCriteria searchByProductMasterCriteria = new ObjectCriteria();
            searchByProductMasterCriteria.AddEqCriteria("Department", CurrentDepartment.Get());
            searchByProductMasterCriteria.AddEqCriteria("ProductMaster", searchProductMaster);
            searchByProductMasterCriteria.AddOrder("CreateDate", false);
            searchByProductMasterCriteria.AddEqCriteria("DelFlg", CommonConstants.DEL_FLG_NO);
            IList productsStockIn = DepartmentStockInDetailLogic.FindAllProductMaster(searchProductMaster);
            IList productsInStock = new ArrayList();
            IList productIds = new ArrayList();
            foreach (DepartmentStockInDetail detail in productsStockIn)
            {
                productIds.Add(detail.Product.ProductId);
            }
            ObjectCriteria stockCrit = new ObjectCriteria();
            stockCrit.AddSearchInCriteria("DepartmentStockPK.ProductId", productIds);
            if(e.AvailableInStock)
            {
                stockCrit.AddGreaterCriteria("GoodQuantity", (long) 0);
            }
            IList stockList = DepartmentStockLogic.FindAll(stockCrit);
            if (stockList != null && stockList.Count > 0)
            {
                foreach (DepartmentStock departmentStock in stockList)
                {
                    departmentStock.Product = ProductLogic.FindById(departmentStock.DepartmentStockPK.ProductId);
                    productsInStock.Add(departmentStock);
                }

            }
            e.ProductsInDepartment = productsInStock;
        }
开发者ID:DelLitt,项目名称:opmscoral,代码行数:33,代码来源:ProductMasterSearchDepartmentController.cs

示例5: DepartmentStockAdhocProcessingViewLoadAdhocStocksEvent

        void DepartmentStockAdhocProcessingViewLoadAdhocStocksEvent(object sender, DepartmentStockFixingEventArgs e)
        {
            ObjectCriteria criteria = new ObjectCriteria();
            criteria.AddLesserCriteria("GoodQuantity", (long)0);
            criteria.AddEqCriteria("DelFlg", (long)0);
            criteria.AddOrder("DepartmentStockPK.DepartmentId", true);
            IList list = DepartmentStockLogic.FindAll(criteria);
            if (list != null && list.Count > 0)
            {

                e.DeptStockAdhocList = list;
            }
        }
开发者ID:DelLitt,项目名称:opmscoral,代码行数:13,代码来源:DepartmentStockFixingController.cs

示例6: departmentStockCheckingView_LoadTempInventoryCheckingEvent

        void departmentStockCheckingView_LoadTempInventoryCheckingEvent(object sender, DepartmentStockCheckingEventArgs e)
        {
            // search in temp stock
            ObjectCriteria criteria = new ObjectCriteria();
            criteria.AddEqCriteria("DepartmentStockTempPK.DepartmentId", CurrentDepartment.Get().DepartmentId);
            criteria.AddEqCriteria("DelFlg", CommonConstants.DEL_FLG_NO);
            criteria.AddEqCriteria("Fixed", CommonConstants.DEL_FLG_NO);
            criteria.AddEqCriteria("TempSave", CommonConstants.DEL_FLG_NO);
            criteria.AddOrder("ProductMaster.ProductMasterId", true);
            IList list = DepartmentStockTempLogic.FindAll(criteria);
            IList deptStockTempList = null;
            if (list != null && list.Count > 0)
            {
                deptStockTempList = new ArrayList();

                foreach (DepartmentStockTemp stockTempSave in list)
                {
                    int viewIndex = -1;
                    DepartmentStock stockTemp = new DepartmentStockMapper().Convert(stockTempSave);
                    if (HasInList(stockTemp, deptStockTempList, out viewIndex))
                    {
                        DepartmentStockView view = (DepartmentStockView)deptStockTempList[viewIndex];

                        view.Quantity += stockTemp.Quantity;
                        view.GoodQuantity += stockTemp.GoodQuantity;
                        view.ErrorQuantity += stockTemp.ErrorQuantity;
                        view.DamageQuantity += stockTemp.DamageQuantity;
                        view.LostQuantity += stockTemp.LostQuantity;
                        view.UnconfirmQuantity += stockTemp.UnconfirmQuantity;
                        view.DepartmentStocks.Add(stockTemp);
                    }
                    else
                    {
                        DepartmentStockView view = new DepartmentStockView();

                        view.Quantity += stockTemp.Quantity;
                        view.GoodQuantity += stockTemp.GoodQuantity;
                        view.ErrorQuantity += stockTemp.ErrorQuantity;
                        view.DamageQuantity += stockTemp.DamageQuantity;
                        view.LostQuantity += stockTemp.LostQuantity;
                        view.UnconfirmQuantity += stockTemp.UnconfirmQuantity;
                        view.ProductMaster = stockTemp.ProductMaster;
                        view.DepartmentStocks = new ArrayList();
                        view.DepartmentStocks.Add(stockTemp);
                        deptStockTempList.Add(view);
                    }
                }

            }

            e.ReturnStockViewList = deptStockTempList;
        }
开发者ID:DelLitt,项目名称:opmscoral,代码行数:52,代码来源:DepartmentStockViewCheckingController.cs

示例7: departmentStockCheckingView_LoadGoodsByProductIdEvent

        void departmentStockCheckingView_LoadGoodsByProductIdEvent(object sender, AppFrame.Presenter.GoodsIO.DepartmentGoodsIO.DepartmentStockCheckingEventArgs e)
        {
            string barCode = e.InputBarcode;
            Product product = ProductLogic.FindById(barCode);
            if(product==null)
            {
                return;
            }

            // search in temp stock
            ObjectCriteria criteria = new ObjectCriteria();
            criteria.AddEqCriteria("DepartmentStockTempPK.ProductId", product.ProductId);
            criteria.AddEqCriteria("DepartmentStockTempPK.DepartmentId", CurrentDepartment.Get().DepartmentId);
            criteria.AddEqCriteria("DelFlg", CommonConstants.DEL_FLG_NO);
            IList tempList =DepartmentStockTempLogic.FindAll(criteria);
            if(tempList!=null && tempList.Count > 0)
            {
                e.UnconfirmTempBarcode = true;
                throw new BusinessException("Mã vạch này đã kiểm trước đó và chưa được xác nhận. Xin liên hệ người quản lý kho.");
            }
            // search in stock
            ProductMaster searchProductMaster = product.ProductMaster;
            ObjectCriteria searchByProductMasterCriteria = new ObjectCriteria();
            /*searchByProductMasterCriteria.AddEqCriteria("Department", CurrentDepartment.Get());
            searchByProductMasterCriteria.AddEqCriteria("ProductMaster", searchProductMaster);
            searchByProductMasterCriteria.AddOrder("CreateDate", false);
            searchByProductMasterCriteria.AddEqCriteria("DelFlg", CommonConstants.DEL_FLG_NO);
            IList productsStockIn = DepartmentStockInDetailLogic.FindAllProductMaster(searchProductMaster);*/
            searchByProductMasterCriteria.AddEqCriteria("ProductMaster", searchProductMaster);
            IList productsStockIn = ProductLogic.FindAll(searchByProductMasterCriteria);
            IList productsInStock = new ArrayList();
            IList productIds = new ArrayList();
            //foreach (DepartmentStockInDetail detail in productsStockIn)
            foreach (Product detail in productsStockIn)
            {
                productIds.Add(detail.ProductId);
            }
            ObjectCriteria stockCrit = new ObjectCriteria();
            stockCrit.AddSearchInCriteria("DepartmentStockPK.ProductId", productIds);
            stockCrit.AddEqCriteria("DepartmentStockPK.DepartmentId", CurrentDepartment.Get().DepartmentId);
            stockCrit.AddEqCriteria("DelFlg", CommonConstants.DEL_FLG_NO);
            stockCrit.AddOrder("DepartmentStockPK.ProductId",true);
            IList departmentStocks = DepartmentStockLogic.FindAll(stockCrit);

            // create stock view
            if (departmentStocks != null && departmentStocks.Count > 0)
            {
                DepartmentStockView stockView = new DepartmentStockView();
                stockView.ProductMaster = product.ProductMaster;
                stockView.DepartmentStocks = departmentStocks;
                foreach (DepartmentStock departmentStock in departmentStocks)
                {

                    // empty old stock
                    departmentStock.GoodQuantity = 0;
                    departmentStock.ErrorQuantity = 0;
                    departmentStock.UnconfirmQuantity = 0;
                    departmentStock.LostQuantity = 0;
                    departmentStock.DamageQuantity = 0;

                    // sum new stock
                    stockView.Quantity += departmentStock.Quantity;
                    stockView.GoodQuantity += departmentStock.Quantity;
                    stockView.ErrorQuantity += departmentStock.ErrorQuantity;
                    stockView.UnconfirmQuantity += departmentStock.UnconfirmQuantity;
                    stockView.LostQuantity += departmentStock.LostQuantity;
                    stockView.DamageQuantity += departmentStock.DamageQuantity;
                    stockView.ProductId = product.ProductId;

                    stockView.ProductId = product.ProductId;

                }
                e.ScannedStockView = stockView;
            }
        }
开发者ID:DelLitt,项目名称:opmscoral,代码行数:75,代码来源:DepartmentStockViewCheckingController.cs

示例8: departmentCostSummaryView_CommitDepartmentCostEvent

        void departmentCostSummaryView_CommitDepartmentCostEvent(object sender, DepartmentCostEventArgs e)
        {
            // Save the end of period
            // select 5 day nearest
            //IList departmentTimelineList = new ArrayList();
            ObjectCriteria crit = new ObjectCriteria();
            crit.AddOrder("EmployeeMoneyPK.WorkingDay", false);
            crit.MaxResult = 5;
            IList prevList = EmployeeMoneyLogic.FindAll(crit);
            DateTime startTime = DateUtility.ZeroTime(DateTime.Now);
            if (prevList != null && prevList.Count > 0)
            {
                // update end time of nearest 5 timeline for sure transparency
                EmployeeMoney fixEmpMoney = (EmployeeMoney)prevList[0];
                DateTime lastSubmitEndTime = fixEmpMoney.EmployeeMoneyPK.WorkingDay;

                // get days which customer do not submit period
                TimeSpan timeSpan = DateUtility.ZeroTime(DateTime.Now).Subtract(DateUtility.ZeroTime(lastSubmitEndTime));
                // fix those days in order we can sync for today.

                //startTime = lastSubmitEndTime.AddSeconds(1);
                for (int i = 0; i < timeSpan.Days - 1; i++)
                {
                    DateTime nextDateTime = lastSubmitEndTime.AddDays(i + 1);
                    EmployeeMoney fixEmplMoney = new EmployeeMoney();
                    fixEmplMoney.WorkingDay = DateUtility.DateOnly(nextDateTime);
                    fixEmplMoney.CreateDate = DateUtility.MaxTime(nextDateTime);
                    fixEmplMoney.UpdateDate = DateUtility.MaxTime(nextDateTime);
                    fixEmplMoney.CreateId = ClientInfo.getInstance().LoggedUser.Name;
                    fixEmplMoney.UpdateId = ClientInfo.getInstance().LoggedUser.Name;
                    fixEmplMoney.DateLogin = DateUtility.MaxTime(nextDateTime);
                    fixEmplMoney.DateLogout = DateUtility.MaxTime(nextDateTime);
                    fixEmplMoney.InMoney = 0;
                    fixEmplMoney.OutMoney = 0;
                    EmployeeMoneyPK fixTimelinePK = new EmployeeMoneyPK
                    {
                        DepartmentId = CurrentDepartment.Get().DepartmentId,
                        EmployeeId = ClientInfo.getInstance().LoggedUser.Name,
                        WorkingDay = DateUtility.DateOnly(nextDateTime)
                    };

                    fixEmplMoney.EmployeeMoneyPK = fixTimelinePK;
                    EmployeeMoneyLogic.Add(fixEmplMoney);
                    //startTime = fixEmplMoney.EndTime.AddSeconds(1);
                }

            }
            #region unused code
            // If submit period ( ket so ) then we ' ket so '
            /*DepartmentTimeline timeline = null;
            if (isSubmitPeriod)
            {
                timeline = new DepartmentTimeline();
                timeline.WorkingDay = DateUtility.ZeroTime(DateTime.Now);
                timeline.CreateDate = DateTime.Now;
                timeline.UpdateDate = DateTime.Now;
                timeline.CreateId = ClientInfo.getInstance().LoggedUser.Name;
                timeline.UpdateId = ClientInfo.getInstance().LoggedUser.Name;
                timeline.StartTime = startTime;
                timeline.EndTime = DateTime.Now;
                DepartmentTimelinePK timelinePK = new DepartmentTimelinePK
                {
                    DepartmentId = CurrentDepartment.Get().DepartmentId,
                    Period = DateTime.Now.DayOfYear
                };
                var dbTimeline = DepartmentTimelineDAO.FindById(timelinePK);
                if (dbTimeline != null)
                {
                    throw new BusinessException("Ngày hôm nay đã kết sổ");
                }
                timeline.DepartmentTimelinePK = timelinePK;
                DepartmentTimelineDAO.Add(timeline);

                //departmentTimelineList.Add(timeline);
            }*/

            #endregion
            DateTime toDay = DateUtility.DateOnly(DateTime.Now);

            EmployeeMoney employeeMoney = new EmployeeMoney();
            employeeMoney.EmployeeMoneyPK = new EmployeeMoneyPK
                                                {
                                                    DepartmentId = CurrentDepartment.Get().DepartmentId,
                                                    EmployeeId = ClientInfo.getInstance().LoggedUser.Name,
                                                    WorkingDay = toDay
                                                };
            employeeMoney.WorkingDay = toDay;
            employeeMoney.CreateDate = DateTime.Now;
            employeeMoney.UpdateDate = DateTime.Now;
            employeeMoney.CreateId = ClientInfo.getInstance().LoggedUser.Name;
            employeeMoney.UpdateId = ClientInfo.getInstance().LoggedUser.Name;
            employeeMoney.DateLogin = DateTime.Now;
            employeeMoney.DateLogout = DateTime.Now;
            employeeMoney.InMoney = 0;

            DateTime nextDay = toDay.AddDays(1);
            EmployeeMoney nextMoney = new EmployeeMoney();
            nextMoney.EmployeeMoneyPK = new EmployeeMoneyPK
            {
                DepartmentId = CurrentDepartment.Get().DepartmentId,
//.........这里部分代码省略.........
开发者ID:DelLitt,项目名称:opmscoral,代码行数:101,代码来源:DepartmentCostController.cs

示例9: _departmentStockInView_FillProductToComboEvent

        void _departmentStockInView_FillProductToComboEvent(object sender, MainStockInEventArgs e)
        {
            ComboBox comboBox = (ComboBox) sender;
            string originalText = comboBox.Text;
            if (e.IsFillToComboBox)
            {
                ProductMaster searchPM = e.SelectedStockInDetail.Product.ProductMaster;
                System.Collections.IList result = null;
                if (e.ComboBoxDisplayMember.Equals("ProductMasterId"))
                {
                    result = ProductMasterLogic.FindProductMasterById(searchPM.ProductMasterId, 50,true);
                }
                else
                {
                    //result = ProductMasterLogic.FindProductMasterByName(searchPM.ProductName, 50,true);
                    ObjectCriteria criteria = new ObjectCriteria();
                    criteria.AddLikeCriteria("ProductName", "%" + searchPM.ProductName + "%");
                    criteria.AddOrder("ProductName", true);
                    criteria.MaxResult = 200;
                    result = ProductMasterLogic.FindAll(criteria);

                }
                if(result==null)
                {
                    return;
                }

                BindingList<ProductMaster> productMasters = new BindingList<ProductMaster>();
                if (result != null)
                {
                    result = RemoveDuplicateName(result);
                    foreach (ProductMaster master in result)
                    {

                        productMasters.Add(master);
                    }
                }
                BindingSource bindingSource = new BindingSource();
                bindingSource.DataSource = productMasters;
                comboBox.DataSource = bindingSource;
                comboBox.DisplayMember = "ProductName";
                comboBox.ValueMember = e.ComboBoxDisplayMember;
                comboBox.DropDownWidth = 300;
                comboBox.DropDownHeight = 200;
                // keep the original text
                comboBox.Text = originalText;
                if (result.Count > 0)
                {
                    comboBox.SelectedIndex = 0;
                }

                comboBox.SelectionStart = comboBox.Text.Length;
                //comboBox.DroppedDown = false;
                comboBox.MaxDropDownItems = 15;
            }
        }
开发者ID:DelLitt,项目名称:opmscoral,代码行数:56,代码来源:MainStockInController.cs

示例10: stockSearchView_BarcodeSearchStockEvent

        private void stockSearchView_BarcodeSearchStockEvent(object sender, StockSearchEventArgs e)
        {
            var subCriteria = new SubObjectCriteria("ProductMaster");
            if(!string.IsNullOrEmpty(e.ProductMasterId))
            {
                subCriteria.AddLikeCriteria("ProductMasterId", "%" + e.ProductMasterId + "%");
            }
            if(!string.IsNullOrEmpty(e.ProductMasterName))
            {
                subCriteria.AddLikeCriteria("ProductName", "%" + e.ProductMasterName + "%");
            }
            if (e.ProductType != null)
            {
                subCriteria.AddEqCriteria("ProductType", e.ProductType);
            }
            if (e.ProductSize != null)
            {
                subCriteria.AddEqCriteria("ProductSize", e.ProductSize);
            }
            if (e.ProductColor != null)
            {
                subCriteria.AddEqCriteria("ProductColor", e.ProductColor);
            }
            if (e.Country != null)
            {
                subCriteria.AddEqCriteria("Country", e.Country);
            }
            if(e.Manufacturer!=null)
            {
                subCriteria.AddEqCriteria("Manufacturer", e.Manufacturer);
            }
            if(e.Packager!=null)
            {
                subCriteria.AddEqCriteria("Packager", e.Packager);
            }
            if (e.Distributor != null)
            {
                subCriteria.AddEqCriteria("Distributor", e.Distributor);
            }
            if (!string.IsNullOrEmpty(e.Description))
            {
                subCriteria.AddLikeCriteria("Description", "%" + e.Description + "%");
            }

            var criteria = new ObjectCriteria(true);
            criteria.AddEqCriteria("DelFlg", CommonConstants.DEL_FLG_NO);
            bool searchByProductId = !string.IsNullOrEmpty(e.ProductId);
            if(searchByProductId)
            {
                criteria.AddLikeCriteria("Product.ProductId", "%" + e.ProductId + "%");
            }

            criteria.AddSubCriteria("ProductMaster", subCriteria);
            criteria.AddOrder("ProductMaster.ProductName", true);
            criteria.AddOrder("Product.ProductId",true);
            IList list = StockLogic.FindAll(criteria);
            if(searchByProductId && e.RelevantProductFinding)
            {
                if(list!=null && list.Count > 0)
                {
                    IList extraList = new ArrayList();
                    foreach (Stock stock in list)
                    {
                        Product product = stock.Product;
                        subCriteria = new SubObjectCriteria("ProductMaster");
                        subCriteria.AddEqCriteria("ProductName", product.ProductMaster.ProductName);
                        criteria = new ObjectCriteria(true);
                        criteria.AddEqCriteria("DelFlg", CommonConstants.DEL_FLG_NO);
                        criteria.AddSubCriteria("ProductMaster", subCriteria);
                        criteria.AddOrder("Product.ProductId", true);
                        IList subList = StockLogic.FindAll(criteria);
                        if(subList!=null && subList.Count > 0 )
                        {
                            foreach (Stock stock1 in subList)
                            {
                                AddStockToList(extraList, stock1);
                            }
                        }
                    }
                    // add to original list
                    foreach (Stock stock in extraList)
                    {
                        AddStockToList(list,stock);
                    }
                }
            }
            e.StockList = list;
        }
开发者ID:DelLitt,项目名称:opmscoral,代码行数:88,代码来源:StockSearchController.cs


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