コード例 #1
0
ファイル: FileManager.cs プロジェクト: VladimirApokrypha/PTD
        /// <summary>
        /// метод добавляет нового субподрядчика
        /// </summary>
        /// <param name="path"></param>
        public void AddSubcontractor(string path, string name)
        {
            SubcontrWorkFile newSubcontractor = new SubcontrWorkFile();

            newSubcontractor.Path        = Path.Combine(ReportPath, SubcontractorFolderName, findFullName(path));
            newSubcontractor.worker.Name = name;
            foreach (SubcontrWorkFile temp in Subcontractors)
            {
                if (temp.Path == newSubcontractor.Path)
                {
                    File.Delete(temp.Path);
                }
            }
            File.Copy(path, newSubcontractor.Path);
            Subcontractors.Add(newSubcontractor);
        }
コード例 #2
0
ファイル: FileManager.cs プロジェクト: VladimirApokrypha/PTD
        public void OpenProject(string name)
        {
            ReportPath = Path.Combine(CurrentReportPath, name);

            DirectoryInfo contrInfo = new DirectoryInfo(Path.Combine(ReportPath, ContractorFolderName));

            FileInfo[] contr = contrInfo.GetFiles();
            Contractor.Path = Path.Combine(ReportPath, ContractorFolderName, contr[0].Name);

            DirectoryInfo subcontrInfo = new DirectoryInfo(Path.Combine(ReportPath, SubcontractorFolderName));

            foreach (FileInfo temp in subcontrInfo.GetFiles())
            {
                Subcontractors.Add(new SubcontrWorkFile()
                {
                    Path = Path.Combine(ReportPath, SubcontractorFolderName, temp.Name)
                });
            }
        }