public IWorkFile MakeFile(List <IWorkFile> workFileList, string path) { List <List <Work> > allWorks = new List <List <Work> >(); List <Work> contrWorks = new List <Work>(); CASCombine result = new CASCombine(); result.Path = path; foreach (var temp in workFileList) { MakeWorkFunction makeWorkFunction = TypeWorkList[temp.Extension]; if (temp is SubcontrWorkFile) { allWorks.Add(makeWorkFunction(temp)); } else { contrWorks = makeWorkFunction(temp); } } MakeFileFunction makeFileFunction = TypeOutFile[result.Extension]; makeFileFunction(contrWorks, allWorks, result.Path); return(result); }
public void MakeFile(List <IWorkFile> workFileList, string path) { List <Subcontractor> allSubcrotractors = new List <Subcontractor>(); Contractor contractor = new Contractor(); foreach (var temp in workFileList) { MakeWorkFunction makeWorkFunction = TypeWorkList[temp.Extension]; if (temp is SubcontrWorkFile) { allSubcrotractors.Add((Subcontractor)makeWorkFunction(temp)); } else { contractor = (Contractor)makeWorkFunction(temp); } } string extension = path.Split('.').Last(); MakeFileFunction makeFileFunction = TypeOutFile[extension]; makeFileFunction(contractor, allSubcrotractors, path); }