public List <DocumentTypeObject> GetApplicationStageDocumentTypes(RequirementProp requirementProp) { try { var objList = _documentTypeManager.GetApplicationStageDocumentTypes(requirementProp); if (objList == null || !objList.Any()) { return(new List <DocumentTypeObject>()); } return(objList); } catch (Exception ex) { ErrorLogger.LoggError(ex.StackTrace, ex.Source, ex.Message); return(new List <DocumentTypeObject>()); } }
public List <DocumentTypeObject> GetApplicationStageDocumentTypes(RequirementProp requirementProp) { try { using (var db = new ImportPermitEntities()) { var docs = new List <DocumentTypeObject>(); requirementProp.ProductIds.ForEach(o => { var tempList = db.ProductDocumentRequirements.Where(w => w.ProductId == o).Include("DocumentType").ToList(); if (tempList.Any()) { tempList.ForEach(p => { if (!docs.Exists(z => z.DocumentTypeId == p.DocumentTypeId)) { docs.Add(new DocumentTypeObject { DocumentTypeId = p.DocumentTypeId, Name = p.DocumentType.Name }); } }); } }); const int appStage = (int)AppStage.Application; var classificationReqDocs = db.ImportClassificationRequirements.Where(ic => ic.ClassificationId == requirementProp.ImportClassId && ic.ImportStageId == appStage).Include("DocumentType").ToList(); if (classificationReqDocs.Any()) { classificationReqDocs.ForEach(r => { docs.Add(new DocumentTypeObject { DocumentTypeId = r.DocumentTypeId, Name = r.DocumentType.Name }); }); } requirementProp.StorageProviderTypeIds.ForEach(o => { var storageProviderReqDocs = db.StorageProviderRequirements.Where(i => i.StorageProviderTypeId == o).Include("DocumentType").ToList(); if (storageProviderReqDocs.Any()) { var p = storageProviderReqDocs[0]; if (!docs.Exists(z => z.DocumentTypeId == p.DocumentTypeId)) { docs.Add(new DocumentTypeObject { DocumentTypeId = p.DocumentTypeId, Name = p.DocumentType.Name }); } } }); return(!docs.Any() ? new List <DocumentTypeObject>() : docs); } } catch (Exception ex) { ErrorLogger.LoggError(ex.StackTrace, ex.Source, ex.Message); return(null); } }