public void Execute(object parameter) { // 保存可能かチェック if (CheckEnable() == false) { MessageBox.Show("プロジェクト期間を入力してください。"); return; } // ファイル保存ダイアログ var sfd = new SaveFileDialog(); sfd.Filter = "Accessファイル形式|*.accdb"; sfd.DefaultExt = ".accdb"; var isOK = sfd.ShowDialog(); if (isOK == false) { return; } var input = new SaveAsInput(); input.MasterFilePath = appContext.MasterDbFile; input.SrcPath = appContext.ProjectDbFile; input.SavePath = sfd.FileName; input.StartDate = this.projectSettingPageViewModel.ProjectStartDate; input.EndDate = this.projectSettingPageViewModel.ProjectEndDate; input.Processes = mapper.Map <List <Process> >(this.projectSettingPageViewModel.ProcessNames); input.Functions = mapper.Map <List <Function> >(this.projectSettingPageViewModel.FunctionNames); input.Holidays = mapper.Map <List <Holiday> >(this.projectSettingPageViewModel.Holidays); input.RestDays = mapper.Map <List <WeekDay> >(this.projectSettingPageViewModel.Weekdays); input.Members = this.appContext.Members; input.Tasks = this.appContext.Tasks; input.ProcessDependencies = this.appContext.ProcessDependencies; input.FunctionDependencies = this.appContext.FunctionDependencies; input.Edges = this.appContext.PertEdges; appContext.ProjectDbFile = input.SavePath; appContext.ProjectFolder = Path.GetDirectoryName(input.SavePath); var output = this.businessLogic.Execute(input); this.shellViewModel.ProjectPath = output?.ProjectPath ?? input.SrcPath; this.appContext.IsSaved = true; }
public SaveAsOutput Execute(SaveAsInput input) { var output = new SaveAsOutput(); if (this.dbFileAccessService.Exists(input.SrcPath)) { this.dbFileAccessService.CopyDbFile(input.SrcPath, input.SavePath); } else { this.dbFileAccessService.CopyDbFile(input.MasterFilePath, input.SavePath); } this.dbMigrationService.Upgrade(); this.projectSettingsAccessService.Update( input.StartDate, input.EndDate, input.Processes, input.Functions, input.Holidays, input.RestDays); this.memberAccessService.Update( input.Members); this.taskAccessService.Update( input.Tasks); this.processDependencyAccessService.Update( input.ProcessDependencies); this.functionDependencyAccessService.Update( input.FunctionDependencies); this.pertAccessService.Update( input.Edges); output.ProjectPath = input.SavePath; return(output); }