private List <StackBLL> MergeWithCommodityGrade(List <StackBLL> list) { List <StackBLL> mergedListComplete = new List <StackBLL>(); List <CommodityGradeBLL> CommodityGradeList = new List <CommodityGradeBLL>(); CommodityGradeList = CommodityGradeBLL.GetAllCommodityDetail(); List <ShedBLL> listShed = new List <ShedBLL>(); listShed = ShedBLL.GetAllShed(); List <WarehouseBLL> listWarehouse = new List <WarehouseBLL>(); listWarehouse = WarehouseBLL.GetAllActiveWarehouse(); if (CommodityGradeList == null) { throw new Exception("Can not get Commodity Grade list."); } if (listShed == null) { throw new Exception("Can not get Shed list."); } if (listWarehouse == null) { throw new Exception("Can not get Warehouse list."); } var q = from stack in list join CommGrade in CommodityGradeList on stack.CommodityGradeid equals CommGrade.CommodityGradeId join Shed in listShed on stack.ShedId equals Shed.Id join warehouse in listWarehouse on Shed.WarehouseId equals warehouse.WarehouseId select new { stack.Id, stack.ShedId, stack.StackNumber, stack.Status, stack.DateStarted, stack.CommodityGradeid, Shed.ShedNumber, warehouse.WarehouseName, CommGrade.GradeName }; foreach (var i in q) { StackBLL obj = new StackBLL(); obj.Id = i.Id; obj.ShedId = i.ShedId; obj.ShedName = i.ShedNumber; obj.CommodityGradeName = i.GradeName; obj.StackNumber = i.StackNumber; obj.Status = i.Status; obj.DateStarted = DateTime.Parse(i.DateStarted.ToShortDateString()); obj.WarehouseName = i.WarehouseName; mergedListComplete.Add(obj); } return(mergedListComplete); }
public List <GRNSentBLL> getCount(DateTime dataSent, out int totalCount) { totalCount = 0; List <GRNSentBLL> list = null; List <WarehouseBLL> listWH = null; listWH = WarehouseBLL.GetAllActiveWarehouse(); // intailize for all WH. list = new List <GRNSentBLL>(); foreach (WarehouseBLL w in listWH) { GRNSentBLL oSentGRN = new GRNSentBLL(); oSentGRN.warehouseId = w.WarehouseId; oSentGRN.warehousename = w.WarehouseName; oSentGRN.count = 0; oSentGRN.dataSent = dataSent; list.Add(oSentGRN); } List <GRNSentBLL> listTemp = null; listTemp = GRNSentDAL.getCountApprovedGRNSentbyDate(dataSent); if (listTemp != null) { foreach (GRNSentBLL w in list) { foreach (GRNSentBLL s in listTemp) { if (s.warehouseId == w.warehouseId) { totalCount += s.count; w.count = s.count; } } } } return(list); }