當前位置: 首頁>>代碼示例>>C#>>正文


C# ObjectCriteria.Add方法代碼示例

本文整理匯總了C#中POSServer.DataLayer.Implement.ObjectCriteria.Add方法的典型用法代碼示例。如果您正苦於以下問題:C# ObjectCriteria.Add方法的具體用法?C# ObjectCriteria.Add怎麽用?C# ObjectCriteria.Add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在POSServer.DataLayer.Implement.ObjectCriteria的用法示例。


在下文中一共展示了ObjectCriteria.Add方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: FindInventoryChecking

 public IList<DepartmentInventoryChecking> FindInventoryChecking(DateTime fromDate, DateTime toDate)
 {
     ObjectCriteria<DepartmentInventoryChecking> criteria = new ObjectCriteria<DepartmentInventoryChecking>();
     criteria.Add(a => a.CreateDate >= fromDate);
     criteria.Add(a => a.CreateDate <= toDate);
     criteria.Add(a => a.Fixed == 0);
     criteria.Add(a => a.ExFld2 == 0);
     return DepartmentInventoryCheckingDao.FindAll(criteria);
 }
開發者ID:DelLitt,項目名稱:opmscoral,代碼行數:9,代碼來源:DepartmentStockTempValidLogic.cs

示例2: FindByProductId

 public MainStock FindByProductId(string productId)
 {
     ObjectCriteria<MainStock> objectCriteria = new ObjectCriteria<MainStock>();
     objectCriteria.Add(mstk => mstk.Product.ProductId == productId);
     return (MainStock)MainStockDao.FindFirst(objectCriteria);
 }
開發者ID:DelLitt,項目名稱:opmscoral,代碼行數:6,代碼來源:MainStockLogic.cs

示例3: Update

 public void Update(StockOut data)
 {
     long definitionStatusId = data.DefinitionStatus.DefectStatusId;
     if (definitionStatusId == DefinitionStatus.TEMP_STOCKOUT
            || definitionStatusId == DefinitionStatus.PROTOTYPE) return;
     foreach (StockOutDetail outDetail in data.StockOutDetails)
     {
         string productId = outDetail.Product.ProductId;
         ObjectCriteria<MainStock> findStock = new ObjectCriteria<MainStock>();
         findStock.Add(stk => stk.Product.ProductId == productId);
         MainStock currentStock = MainStockDao.FindFirst(findStock) as MainStock;
         /*MainStock currentStock = (MainStock)MainStockDao.ExecuteExposedSession(delegate(ISession session)
                                                                                    {
                                                                                        var query =
                                                                                            session.QueryOver<MainStock>()
                                                                                                .Where(
                                                                                                    stk =>
                                                                                                    stk.Product.ProductId ==
                                                                                                    productId);
                                                                                        return query.SingleOrDefault();
                                                                                    });*/
         if (currentStock == null) // create new stock
         {
             throw new DataIntegrityViolationException("Could not find the product id in stock");
         }
         else // update current stock
         {
             // * ---- CHUA CO PHAN XUAT HANG HU LOI HONG MAT O DAY --------
             currentStock.Quantity -= outDetail.Quantity;
             currentStock.GoodQuantity -= outDetail.Quantity;
             currentStock.ExclusiveKey += 1;
             if (currentStock.Quantity < 0 || currentStock.GoodQuantity < 0)
                 throw new DataIntegrityViolationException("Stock quantity of " + currentStock.Product.ProductId + " is zero.");
             MainStockDao.Update(currentStock);
         }
     }
 }
開發者ID:DelLitt,項目名稱:opmscoral,代碼行數:37,代碼來源:MainStockLogic.cs

示例4: Add

        public StockIn Add(StockIn data)
        {
            IDictionary<string,MainPrice> prices = new Dictionary<string, MainPrice>();
            var maxIdResult = StockInDao.SelectSpecificType(null, Projections.Max("StockInId"));
            long nextStockInId = maxIdResult != null ? Int64.Parse(maxIdResult.ToString()) + 1 : 1;
            // add or update stock
            var maxStockIdResult = MainStockDao.SelectSpecificType(null, Projections.Max("StockId"));
            long nextStockId = maxStockIdResult != null ? Int64.Parse(maxStockIdResult.ToString()) + 1 : 1;

            data.StockInId = nextStockInId.ToString();
            StockInDao.Add(data);
            foreach (StockInDetail inDetail in data.StockInDetails)
            {
                inDetail.StockInDetailPK.StockInId = nextStockInId.ToString();
                Product current = ProductDao.FindById(inDetail.Product.ProductId);
                if (current != null)
                {
                    inDetail.Product = current;
                }
                else
                {
                    ProductDao.Add(inDetail.Product);
                }
                StockInDetailDao.Add(inDetail);

                ObjectCriteria<MainStock> findStock = new ObjectCriteria<MainStock>();
                string productId = inDetail.Product.ProductId;
                findStock.Add(stk => stk.Product.ProductId==productId);

                MainStock currentStock = MainStockDao.FindFirst(findStock) as MainStock;
                if(currentStock == null) // create new stock
                {
                   MainStock newStock = new MainStock
                                            {
                                                StockId = nextStockId++,
                                                CreateDate = DateTime.Now,
                                                UpdateDate = DateTime.Now,
                                                CreateId = "admin",
                                                UpdateId = "admin",
                                                DelFlg = 0,
                                                ExclusiveKey = 1,
                                                Product = inDetail.Product,
                                                ProductMaster = inDetail.ProductMaster,
                                                Quantity = inDetail.Quantity,
                                                GoodQuantity = inDetail.Quantity
                                            };
                    MainStockDao.Add(newStock);
                }
                else // update current stock
                {
                    currentStock.Quantity += inDetail.Quantity;
                    currentStock.GoodQuantity += inDetail.Quantity;
                    currentStock.ExclusiveKey += 1;
                    MainStockDao.Update(currentStock);
                }

                // add price for update later
                prices[inDetail.MainPrice.MainPricePK.ProductMasterId] = inDetail.MainPrice;
            }

            // update price if have
            foreach (KeyValuePair<string, MainPrice> mainPrice in prices)
            {
                ObjectCriteria<MainPrice> findPrice = new ObjectCriteria<MainPrice>();
                string productMasterId = mainPrice.Key;
                findPrice.Add(
                    price => price.MainPricePK.ProductMasterId == productMasterId);
                MainPrice currentPrice = MainPriceDao.FindFirst(findPrice) as MainPrice;
                if (currentPrice == null)
                {
                    MainPriceDao.Add(mainPrice.Value);
                }
                else
                {
                    currentPrice.Price = mainPrice.Value.Price;
                    currentPrice.WholeSalePrice = mainPrice.Value.WholeSalePrice;
                    MainPriceDao.Update(currentPrice);
                }
            }

            // color and size
            // the updating informs that specialized object has been used in stock in so it can not be deleted.
            IList<ExProductColor> colors = data.StockInDetails.Select(x => x.Product.ProductColor).Distinct().ToList();
            foreach (ExProductColor exProductColor in colors)
            {
                if(exProductColor.ExFld1 == 1) continue;
                exProductColor.ExFld1 = 1;
                ExProductColorDao.Update(exProductColor);
            }
            IList<ExProductSize> sizes = data.StockInDetails.Select(x => x.Product.ProductSize).Distinct().ToList();
            foreach (ExProductSize exProductSize in sizes)
            {
                if(exProductSize.ExFld1 == 1) continue;
                exProductSize.ExFld1 = 1;
                ExProductSizeDao.Update(exProductSize);
            }
            return data;
        }
開發者ID:DelLitt,項目名稱:opmscoral,代碼行數:98,代碼來源:StockInLogic.cs


注:本文中的POSServer.DataLayer.Implement.ObjectCriteria.Add方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。