public IQueryable <RecipeLineViewModel> GetStockLineListForIndex(int StockHeaderId) { var temp = from p in _StockLineRepository.Instance join t in _unitOfWork.Repository <Dimension1>().Instance on p.Dimension1Id equals t.Dimension1Id into table from Dim1 in table.DefaultIfEmpty() join t1 in _unitOfWork.Repository <Dimension2>().Instance on p.Dimension2Id equals t1.Dimension2Id into table1 from Dim2 in table1.DefaultIfEmpty() join Se in _unitOfWork.Repository <StockLineExtended>().Instance on p.StockLineId equals Se.StockLineId into StockLineExtendedTable from StockLineExtendedTab in StockLineExtendedTable.DefaultIfEmpty() where p.StockHeaderId == StockHeaderId orderby p.Sr select new RecipeLineViewModel { Rate = p.Rate, Amount = p.Amount, UnitId = p.Product.UnitId, UnitName = p.Product.Unit.UnitName, UnitDecimalPlaces = p.Product.Unit.DecimalPlaces, Remark = p.Remark, ProductId = p.ProductId, ProductName = p.Product.ProductName, Qty = p.Qty, DyeingRatio = StockLineExtendedTab.DyeingRatio, TestingQty = StockLineExtendedTab.TestingQty, DocQty = StockLineExtendedTab.DocQty, ExcessQty = StockLineExtendedTab.ExcessQty, StockHeaderId = p.StockHeaderId, StockLineId = p.StockLineId, }; return(temp); }
public RecipeLineViewModel GetStockLine(int id) { var temp = (from p in _StockLineRepository.Instance join H in _unitOfWork.Repository <JobOrderHeader>().Instance on p.StockHeaderId equals H.StockHeaderId into JobOrderHeaderTable from JobOrderHeaderTab in JobOrderHeaderTable.DefaultIfEmpty() join Se in _unitOfWork.Repository <StockLineExtended>().Instance on p.StockLineId equals Se.StockLineId into StockLineExtendedTable from StockLineExtendedTab in StockLineExtendedTable.DefaultIfEmpty() where p.StockLineId == id select new RecipeLineViewModel { ProductId = p.ProductId, Qty = p.Qty, Remark = p.Remark, StockHeaderId = p.StockHeaderId, JobOrderHeaderId = JobOrderHeaderTab.JobOrderHeaderId, StockLineId = p.StockLineId, ProductName = p.Product.ProductName, LockReason = p.LockReason, DyeingRatio = StockLineExtendedTab.DyeingRatio, TestingQty = StockLineExtendedTab.TestingQty, DocQty = StockLineExtendedTab.DocQty, ExcessQty = StockLineExtendedTab.ExcessQty, Rate = p.Rate, Amount = p.Amount, UnitId = p.Product.UnitId, UnitName = p.Product.Unit.UnitName, UnitDecimalPlaces = p.Product.Unit.DecimalPlaces, }).FirstOrDefault(); return(temp); }
public LastValues GetLastValues(int JobOrderHeaderId) { var temp = (from H in _unitOfWork.Repository <JobOrderHeader>().Instance join L in _unitOfWork.Repository <StockLine>().Instance on H.StockHeaderId equals L.StockHeaderId into StockLineTable from StockLineTab in StockLineTable.DefaultIfEmpty() join Le in _unitOfWork.Repository <StockLineExtended>().Instance on StockLineTab.StockLineId equals Le.StockLineId into StockLineExtendedTable from StockLineExtendedTab in StockLineExtendedTable.DefaultIfEmpty() where H.JobOrderHeaderId == JobOrderHeaderId orderby StockLineExtendedTab.StockLineId descending select new LastValues { DyeingRatio = StockLineExtendedTab.DyeingRatio }).FirstOrDefault(); return(temp); }
public bool IsDuplicateLine(int StockHeaderId, int ProductId, Decimal?DyeingRatio, int?StockLineId) { var temp = (from L in _unitOfWork.Repository <StockLine>().Instance join Le in _unitOfWork.Repository <StockLineExtended>().Instance on L.StockLineId equals Le.StockLineId into StockLineExtendedTable from StockLineExtendedTab in StockLineExtendedTable.DefaultIfEmpty() where L.StockHeaderId == StockHeaderId && L.ProductId == ProductId && StockLineExtendedTab.DyeingRatio == DyeingRatio && L.StockLineId != StockLineId select L).FirstOrDefault(); if (temp != null) { return(true); } else { return(false); } }