public void SaveFile(IFileHolder <XLWorkbook> fileHolder, string newFileName) { var wb = new XLWorkbook(); var ws = wb.Worksheets.Add("Contacts"); var rowNum = 1; foreach (var row in fileHolder.FileRowList.DataInFile) { var colNum = 1; foreach (var column in row.Columns) { ws.Cell(rowNum, colNum).Value = column.Value; //// colNum++; } rowNum++; } ws.Columns().AdjustToContents(); //ширина столбца по содержимому // вернем пользователю файл без сохранения его на сервере string xsltPath = Path.Combine(_hostingEnvironment.WebRootPath, "excel", newFileName); wb.SaveAs(xsltPath); }
private IEnumerable <IBuildAction> GetBuildActionsList( IEnumerable <IComponentBuilder> components, byte[] publishContent, IFileHolder latestPublishXml) { _logger.Info("Build actions list"); var buildActions = new List <IBuildAction>(); buildActions.Add(new CreateDeploymentContent(components)); buildActions.Add(new Bm2AsBeginAction()); foreach (var c in components) { buildActions.AddRange(c.GetPreCompileActions()); } buildActions.Add(new CompileAction()); foreach (var c in components) { buildActions.AddRange(c.GetPostCompileActions()); } foreach (var c in components) { buildActions.AddRange(c.GetDeployActions()); } foreach (var c in components) { buildActions.Add(new CreateComponentDescriptionTxtAction(c)); } #warning a better check-in comment ?? buildActions.Add(new CheckInAction($"Deliver {_ggpBranchName.ToString()}")); buildActions.Add(new WritePublishHistoryAction(latestPublishXml, publishContent)); buildActions.Add(new Bm2AsEndAction()); return(buildActions); }
private PublishPayloadHolder ReadPublishPayload(IFileHolder publishXml) { _logger.Info($"Reading {publishXml.GetServerPath().AsString()}"); if (!publishXml.Exists()) { throw new ApplicationException($"File {publishXml.GetServerPath().AsString()} doesn't exists!"); } var sourceControlFile = publishXml.ToSourceControlFile(); var publishFileContent = sourceControlFile.GetContent(); var publishPayload = _services.CreatePublishPayloadSerializer().Deserialize(sourceControlFile.GetContent()); var latestChangeSet = sourceControlFile.GetLatestChangeSet(); return(new PublishPayloadHolder(publishPayload, publishFileContent, _services.OperatingSystemServices.AccountManagement.GetAccountInfo(latestChangeSet.CommiterUserName).EmailAddress)); }
public WritePublishHistoryAction(IFileHolder latestPublishXml, byte[] fileContent) { _fileContent = fileContent; _latestPublishXml = latestPublishXml; }
public void SaveFile(IFileHolder <XLWorkbook> fileHolder, string newFileName) { throw new NotImplementedException(); }
private void Build(IFolderHolder qaMainFolder, Folders.ComponentsFolder componentsFolder, IFileHolder latestPublishXml, PublishPayloadHolder publishPayloadInfo, Optional <GGPDeploymentContent.InstallerCustomizationInfo> customizedInstaller) { var sourceControlAdapter = _services.CreateSourceControlAdapter(); _logger.Info($"Execute Get Latest for {qaMainFolder.GetServerPath().AsString()}"); sourceControlAdapter.GetLatest(qaMainFolder); var buildContext = new BuildContext(_services, GetBuildConfiguration(sourceControlAdapter, componentsFolder), new DeploymentContentBuilder(publishPayloadInfo.PublisherEmailAddress, _ggpBranchName, _buildType, customizedInstaller), sourceControlAdapter); var components = ReadComponentsBuilders(publishPayloadInfo.PublishPayload, componentsFolder); var actions = GetBuildActionsList(components, publishPayloadInfo.PublishFileContent, latestPublishXml); foreach (var a in actions) { a.Execute(buildContext); } }