public void createDocuments(int appID) { var CADocRepo = new ClientApplicationDocumentRepository(); var docList = (from x in CADocRepo.GetAll() where x.applicationID == appID select x).ToList(); var CArepo = new ClientApplicationRepository(); ClientApplication client = CArepo.Find(x => x.applicationID == appID).SingleOrDefault(); // find client in the applications table var polRepo = new PolicyHolderRepository(); foreach (var doc in docList) { using (var polDocRepo = new PolicyDocumentRepository()) { PolicyDocument pd = new PolicyDocument() { policyNo = polRepo.Find(x => x.IDNumber == client.IDNumber).SingleOrDefault().policyNo, IDNumber = doc.IDNumber, fullname = doc.fullname, documentName = doc.documentName, document = doc.document }; polDocRepo.Insert(pd); } } }
public Response <List <PolicyDocument> > GetAllPolicyDocuments(string filePath, string categoryName) { var repo = new PolicyDocumentRepository(); Response <List <PolicyDocument> > response = new Response <List <PolicyDocument> >(); List <PolicyDocument> policyDocs = repo.GetAllPolicyDocuments(filePath, categoryName); try { if (policyDocs != null) { if (policyDocs.Count > 0) { response.Success = true; response.Data = policyDocs; } else { response.Success = false; response.Message = "There are no files to display."; } } else { response.Success = false; response.Message = "That category does not currently exist"; } } catch (Exception ex) { response.Success = false; response.Message = ex.Message; } return(response); }
public void AddPolicyDocument(PolicyDocument policyDocument, string folderPath) { var repo = new PolicyDocumentRepository(); repo.AddNewPolicyDocument(policyDocument, folderPath); List <Category> categories = repo.GetAllPolicyDocCategories(folderPath); }
public void GetAllCategoriesTest() { var repo = new PolicyDocumentRepository(); var folderPath = @"C:\Users\Apprentice\Desktop\GitHub\KileyDowling\SGCorpHRV2\SGCorpHR\SGCorpHR.TEST\PolicyDocuments"; var allCategories = repo.GetAllPolicyDocCategories(folderPath); Assert.AreEqual("DressCode", allCategories.First()); }
public Response <List <Category> > GetAllCategories(string folderPath) { var repo = new PolicyDocumentRepository(); Response <List <Category> > response = new Response <List <Category> >(); List <Category> allCategories = repo.GetAllPolicyDocCategories(folderPath); response.Data = allCategories; response.Success = true; return(response); }