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; }
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; }
private static object[] AddProductToDataGrid(DepartmentStockSearchResult stockInDetail) { var obj = new object[MAX_COLUMNS]; //obj[PRODUCT_ID_POS] = stockInDetail.DepartmentStock.Product.Price; obj[PRODUCT_IN_PRICE_POS] = stockInDetail.SumInPrice.ToString("#,##", CultureInfo.CreateSpecificCulture("de-DE")); obj[PRODUCT_QUANTITY_POS] = stockInDetail.SumQuantity.ToString("#,##", CultureInfo.CreateSpecificCulture("de-DE")); obj[PRODUCT_SELL_PRICE_POS] = stockInDetail.SumSellPrice.ToString("#,##", CultureInfo.CreateSpecificCulture("de-DE")); if (stockInDetail.DepartmentStock.Product.ProductMaster != null) { obj[PRODUCT_ID_POS] = stockInDetail.DepartmentStock.Product.ProductMaster.ProductMasterId; obj[PRODUCT_NAME_POS] = stockInDetail.DepartmentStock.Product.ProductMaster.ProductName; if (stockInDetail.DepartmentStock.Product.ProductMaster.ProductType != null) obj[PRODUCT_TYPE_POS] = stockInDetail.DepartmentStock.Product.ProductMaster.ProductType.TypeName; if (stockInDetail.DepartmentStock.Product.ProductMaster.ProductSize != null) obj[PRODUCT_SIZE_POS] = stockInDetail.DepartmentStock.Product.ProductMaster.ProductSize.SizeName; if (stockInDetail.DepartmentStock.Product.ProductMaster.ProductColor != null) obj[PRODUCT_COLOR_POS] = stockInDetail.DepartmentStock.Product.ProductMaster.ProductColor.ColorName; } return obj; }