本文整理汇总了C#中ObjectCriteria.AddBetweenCriteria方法的典型用法代码示例。如果您正苦于以下问题:C# ObjectCriteria.AddBetweenCriteria方法的具体用法?C# ObjectCriteria.AddBetweenCriteria怎么用?C# ObjectCriteria.AddBetweenCriteria使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectCriteria
的用法示例。
在下文中一共展示了ObjectCriteria.AddBetweenCriteria方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddAll
public void AddAll(List<ProductMaster> productMasters)
{
//string deptId = string.Format("{0:000}", CurrentDepartment.Get().DepartmentId);
// always insert goods at main stock
string deptId = "000";
var criteria = new ObjectCriteria();
criteria.AddBetweenCriteria("ProductMasterId", deptId + "0000000000", deptId + "9999999999");
object maxId = ProductMasterDAO.SelectSpecificType(criteria, Projections.Max("ProductMasterId"));
long id = 0;
if (maxId != null)
{
id = Int64.Parse(maxId.ToString()) + 1;
//data.ProductMasterId = string.Format("{0:0000000000000}", Int64.Parse(maxId.ToString()) + 1);
}
else
{
id = Int64.Parse("0000000000001");
//data.ProductMasterId = deptId + "0000000001";
}
foreach (ProductMaster productMaster in productMasters)
{
criteria = new ObjectCriteria();
criteria.AddEqCriteria("ProductName", productMaster.ProductName);
criteria.AddEqCriteria("Packager", productMaster.Packager);
criteria.AddEqCriteria("Distributor", productMaster.Distributor);
criteria.AddEqCriteria("Manufacturer", productMaster.Manufacturer);
criteria.AddEqCriteria("ProductType", productMaster.ProductType);
criteria.AddEqCriteria("ProductSize", productMaster.ProductSize);
criteria.AddEqCriteria("ProductColor", productMaster.ProductColor);
criteria.AddEqCriteria("Country", productMaster.Country);
IList list = ProductMasterDAO.FindAll(criteria);
if (list.Count == 0)
{
productMaster.ProductMasterId = string.Format("{0:0000000000000}", id++);
productMaster.Barcode = productMaster.ProductMasterId;
ProductMasterDAO.Add(productMaster);
}
}
/* if (data.ProductType != null)
{
data.Barcode = string.Format("{0:000}", data.ProductType.TypeId) + data.ProductMasterId;
} else
{
data.Barcode = "000" + data.ProductMasterId;
}*/
}
示例2: 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);
}