本文整理汇总了C#中AppFrame.ObjectCriteria.AddGreaterCriteria方法的典型用法代码示例。如果您正苦于以下问题:C# ObjectCriteria.AddGreaterCriteria方法的具体用法?C# ObjectCriteria.AddGreaterCriteria怎么用?C# ObjectCriteria.AddGreaterCriteria使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppFrame.ObjectCriteria
的用法示例。
在下文中一共展示了ObjectCriteria.AddGreaterCriteria方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: goodsSaleReturnView_LoadGoodsEvent
void goodsSaleReturnView_LoadGoodsEvent(object sender, GoodsSaleEventArgs e)
{
PurchaseOrderDetail detail = e.SelectedPurchaseOrderDetail;
/*ProductMaster prodMaster = ProductMasterLogic.FindById(e.SelectedPurchaseOrderDetail.ProductMaster.ProductMasterId);
if (prodMaster == null)
{
return;
}*/
//Product product = ProductLogic.FindById(e.SelectedPurchaseOrderDetail.Product.ProductId);
ObjectCriteria objectCriteria = new ObjectCriteria();
objectCriteria.AddEqCriteria("DepartmentStockPK.ProductId", e.SelectedPurchaseOrderDetail.Product.ProductId);
objectCriteria.AddEqCriteria("DepartmentStockPK.DepartmentId", CurrentDepartment.Get().DepartmentId);
objectCriteria.AddGreaterCriteria("GoodQuantity", (long)0);
IList result = DepartmentStockLogic.FindAll(objectCriteria);
if (result == null)
{
throw new BusinessException("Mặt hàng này không tồn tại trong kho !");
}
DepartmentStock stock = (DepartmentStock)result[0];
Product product = stock.Product;
detail.Product = product;
detail.ProductMaster = product.ProductMaster;
DepartmentPrice price = DepartmentPriceLogic.FindById(new DepartmentPricePK { DepartmentId = 0, ProductMasterId = detail.ProductMaster.ProductMasterId });
if (price == null)
{
return;
}
detail.Price = price.Price;
e.SelectedPurchaseOrderDetail = detail;
}
示例2: 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;
}
示例3: goodsSaleView_LoadGoodsEvent
void goodsSaleView_LoadGoodsEvent(object sender, GoodsSaleEventArgs e)
{
PurchaseOrderDetail detail = e.SelectedPurchaseOrderDetail;
bool NotAvailableInStock = e.NotAvailableInStock;
/*ProductMaster prodMaster = ProductMasterLogic.FindById(e.SelectedPurchaseOrderDetail.ProductMaster.ProductMasterId);
if (prodMaster == null)
{
return;
}*/
//Product product = ProductLogic.FindProduct(e.SelectedPurchaseOrderDetail.Product.ProductId,CurrentDepartment.Get().DepartmentId);
// TEMP FIXING
//NotAvailableInStock = false;
ObjectCriteria objectCriteria = new ObjectCriteria();
objectCriteria.AddEqCriteria("DepartmentStockPK.ProductId", e.SelectedPurchaseOrderDetail.Product.ProductId);
objectCriteria.AddEqCriteria("DepartmentStockPK.DepartmentId", CurrentDepartment.Get().DepartmentId);
if(!NotAvailableInStock)
{
objectCriteria.AddGreaterCriteria("GoodQuantity", (long) 0);
}
IList result = DepartmentStockLogic.FindAll(objectCriteria) ;
if(!NotAvailableInStock)
{
if ((result == null || result.Count == 0))
{
throw new BusinessException("Mặt hàng này không tồn tại hoặc đã hết !");
}
}
if ((result == null || result.Count == 0))
{
throw new BusinessException("Mặt hàng này không tồn tại !");
}
Product product = null;
bool NeedSwitchPrdId = false;
if (result.Count == 1)
{
DepartmentStock stock = (DepartmentStock) result[0];
product = stock.Product;
if(stock.GoodQuantity <= 0)
{
NeedSwitchPrdId = true;
}
}
// START ---- don ma
/*if (product != null && NeedSwitchPrdId)
{
ObjectCriteria prdCrit = new ObjectCriteria();
prdCrit.AddEqCriteria("ProductMaster.ProductName", product.ProductMaster.ProductName);
IList productIdsList = ProductLogic.FindAll(prdCrit);
if (productIdsList != null && productIdsList.Count > 0)
{
IList productIds = new ArrayList();
foreach (Product prd in productIdsList)
{
productIds.Add(prd.ProductId);
}
prdCrit = new ObjectCriteria();
prdCrit.AddSearchInCriteria("DepartmentStockPK.ProductId", productIds);
prdCrit.AddEqCriteria("DepartmentStockPK.DepartmentId", CurrentDepartment.Get().DepartmentId);
IList allStocks = DepartmentStockLogic.FindAll(prdCrit);
if(allStocks != null && allStocks.Count > 0)
{
SortByGoodQuantity(allStocks);
}
}
}*/
// END ---- don ma
/*else
{
if(CommonConstants.UNDEFINED_BARCODE.Equals(e.SelectedPurchaseOrderDetail.Product.ProductId))
{
Product undefProduct = ProductLogic.FindById(e.SelectedPurchaseOrderDetail.Product.ProductId);
product = undefProduct;
}
}*/
detail.Product = product;
detail.ProductMaster = product.ProductMaster;
DepartmentPrice price = DepartmentPriceLogic.FindById(new DepartmentPricePK { DepartmentId = 0,ProductMasterId = detail.ProductMaster.ProductMasterId} );
if (price == null || price.Price == 0 )
{
throw new BusinessException("Giá của mặt hàng " + product.ProductMaster.ProductName + " không có hoặc là 0. Xin kiểm tra lại.");
}
detail.Price = price.Price;
e.SelectedPurchaseOrderDetail = detail;
}