public IQueryable <ProcessSequenceLineIndexViewModel> GetProcessSequenceLineListForProductCollectionIndex(int ProductCollectionId) { int RefDocTypeId = new DocumentTypeService(_unitOfWork).Find(MasterDocTypeConstants.ProductCollection).DocumentTypeId; var temp = from L in db.ProcessSequenceLine join P in db.Process on L.ProcessId equals P.ProcessId into ProcessTable from ProcessTab in ProcessTable.DefaultIfEmpty() join t in db.ProcessSequenceHeader on L.ProcessSequenceHeaderId equals t.ProcessSequenceHeaderId where t.ReferenceDocId == ProductCollectionId && t.ReferenceDocTypeId == RefDocTypeId orderby L.Sequence select new ProcessSequenceLineIndexViewModel { ProcessSequenceHeaderId = L.ProcessSequenceHeaderId, ProcessSequenceLineId = L.ProcessSequenceLineId, ProcessId = L.ProcessId, ProcessName = ProcessTab.ProcessName, Sequence = L.Sequence, Days = L.Days, CreatedBy = L.CreatedBy, CreatedDate = L.CreatedDate, ModifiedBy = L.ModifiedBy, ModifiedDate = L.ModifiedDate, }; return(temp); }
public ProcessSequenceHeader GetProcessSequenceHeaderForProductCollection(int id) { int RefDocTypeId = new DocumentTypeService(_unitOfWork).Find(MasterDocTypeConstants.ProductCollection).DocumentTypeId; var temp = (from p in db.ProcessSequenceHeader where p.ReferenceDocId == id && p.ReferenceDocTypeId == RefDocTypeId select p).FirstOrDefault(); if (temp != null) { return(temp); } else { ProcessSequenceHeader Header = new ProcessSequenceHeader(); Header.ReferenceDocTypeId = RefDocTypeId; return(Header); } }