public List<InventoryStockReport> GetInventoryStockReportBetweenDate(DateTime fromdate, DateTime todate) { List<InventoryStockReport> aInventoryStockReports = new List<InventoryStockReport>(); try { this.OpenConnection(); string sqlComm = String.Format(SqlQueries.GetQuery(Query.GetInventoryStockReportBetweenDate), fromdate, todate); IDataReader aReader = this.ExecuteReader(sqlComm); if (aReader != null) { while (aReader.Read()) { InventoryStockReport aReport = new InventoryStockReport(); aReport = ReaderToReadAllStock(aReader); aInventoryStockReports.Add(aReport); } } } catch (Exception ex) { throw new Exception("GetInventoryStockReportBetweenDate()", ex); } finally { this.CloseConnection(); } return aInventoryStockReports; }
public List<InventoryStockReport> GetAllKitchenStockForReport() { List<InventoryStockReport> aReports = new List<InventoryStockReport>(); try { this.OpenConnection(); string sqlComm = String.Format(SqlQueries.GetQuery(Query.AllInventoryKitchenStock)); IDataReader aReader = this.ExecuteReader(sqlComm); if (aReader != null) { while (aReader.Read()) { InventoryStockReport aReport = new InventoryStockReport(); aReport = ReaderToReadAllStock(aReader); aReports.Add(aReport); } } } catch (Exception ex) { throw new Exception("GetAllKitchenStockForReport()", ex); } finally { this.CloseConnection(); } return aReports; }
private InventoryStockReport ReaderToReadAllStock(IDataReader aReader) { InventoryStockReport aStockReport = new InventoryStockReport(); try { aStockReport.CategoryId = Convert.ToInt32(aReader["category_id"]); } catch { } try { aStockReport.CategoryName = (aReader["category_name"]).ToString(); } catch { } try { aStockReport.ItemId = Convert.ToInt32(aReader["item_id"]); } catch { } try { aStockReport.ItemName = (aReader["item_name"]).ToString(); } catch { } try { aStockReport.BalanceQty = Convert.ToDouble(aReader["balance"]); } catch { } try { aStockReport.SendQty = Convert.ToDouble(aReader["send"]); } catch { } try { aStockReport.ReceivedQty = Convert.ToDouble(aReader["received"]); } catch { } try { aStockReport.DamageQty = Convert.ToDouble(aReader["damage"]); } catch { } try { aStockReport.Date = Convert.ToDateTime(aReader["date"]); } catch { } return aStockReport; }
private InventoryStockReport ReaderToReadSaleReport(IDataReader aReader) { InventoryStockReport aStockReport = new InventoryStockReport(); try { aStockReport.Date = Convert.ToDateTime(aReader["date"]); } catch { } try { aStockReport.ItemId = Convert.ToInt32(aReader["item_id"]); } catch { } try { aStockReport.SaleQty = Convert.ToDouble(aReader["item_qty"]); } catch { } try { aStockReport.Price = Convert.ToDouble(aReader["sale_price"]); } catch { } return aStockReport; }
private InventoryStockReport ReaderToReadAllStock(IDataReader aReader) { InventoryStockReport aStockReport=new InventoryStockReport(); try { aStockReport.CategoryId = Convert.ToInt32(aReader["category_id"]); } catch { } try { aStockReport.CategoryName = (aReader["category_name"]).ToString(); } catch { } try { aStockReport.ItemId = Convert.ToInt32(aReader["item_id"]); } catch { } try { aStockReport.ItemName = (aReader["item_name"]).ToString(); } catch { } try { aStockReport.BalanceQty= Convert.ToDouble(aReader["stock"]); } catch { } try { aStockReport.Unit = (aReader["unit"]).ToString(); } catch { } try { aStockReport.UnitPrice = Convert.ToDouble(aReader["unit_price"]); } catch { } return aStockReport; }