private void WriteTranslateHeader(CsvFileWriter file) { CsvManage hearderCSVManage = new CsvManage(file); hearderCSVManage.SetTranslateHeader(); file.Flush(); }
private void WriteBlockInformations() { this.catalogStatus = "Blocs"; this.progessBarMax = reference.BlockLinesNb - 1; this.Status_BGW.ReportProgress(0); int lineIndex = 0; for (int sectionRank = 0; sectionRank <= reference.SectionLinesNb - 1; sectionRank++)// { reference = new Reference(appli, sectionRank, 0, 0); int blockNb = reference.Section_BlockNb; for (int blockRank = 0; blockRank <= blockNb - 1; blockRank++)// { reference = new Reference(appli, sectionRank, blockRank, 0); sceneInfo = new SceneInfo(reference); blockCSVManage = new CsvManage(blockCSVFile, reference, sceneInfo); if (blockCSVManage.IsSectionValid(reference.Section_Code, reference.Section_Name)) { blockCSVManage.SetBlockRow(); blockCSVFile.Flush(); } this.Status_BGW.ReportProgress(lineIndex); lineIndex++; } } this.DisposeCSVFile(blockCSVFile); }
private void WriteErrorHeader(CsvFileWriter file) { CsvManage hearderCSVManage = new CsvManage(file); hearderCSVManage.SetErrorHeader(); file.Flush(); }
public void SetTranslatePlacedRow(CsvFileWriter csvError) { translateCatalogNameRow = new CsvRow(); translateSectionNameRow = new CsvRow(); translateBlockNameRow = new CsvRow(); translateBlockDescriptionRow = new CsvRow(); foreach (string language in DicoRow.AllLanguagesCode) { if (language != DicoRow.AllLanguagesCode[0]) { if (_sceneInfo.GenerateSceneInformations(language)) { translateCatalogNameRow.AddRange(_sceneInfo.TranslateCatalogNameRow()); translateSectionNameRow.AddRange(_sceneInfo.TranslateSectionNameRow()); translateBlockNameRow.AddRange(_sceneInfo.TranslateBlockNameRow()); translateBlockDescriptionRow.AddRange(_sceneInfo.TranslateBlockDescriptionRow()); } else { this.SetErrorRow(csvError, _reference.Article_Key); csvError.Flush(); } } } this.WriteTranslateRow(translateCatalogNameRow); this.WriteTranslateRow(translateSectionNameRow); this.WriteTranslateRow(translateBlockNameRow); this.WriteTranslateRow(translateBlockDescriptionRow); }
public static void GenerateFilteredPageReport(string host, string path, string reportName, Func <PageEntity, string, bool> rowFilter) { if (!(path.StartsWith("/sv") || path.StartsWith("/en"))) { Console.WriteLine("URL '" + path + "' not valid. Must start with /sv or /en"); return; } using (SPSite oSite = new SPSite(host)) { using (SPWeb oWeb = oSite.OpenWeb(path)) { reportName = reportName ?? "PageReport"; rowFilter = rowFilter ?? ((p, c) => true); string langCode = path.Substring(1, 2); string langRootUrl = string.Format("/{0}", langCode); Uri siteUri = new Uri(oSite.Url); DateTime datestamp = DateTime.Now; string fileName = string.Format("{0}-{1}-{2}-{3:yyyy-MM-dd-HH-mm-ss}.txt", reportName, siteUri.Host, langCode, datestamp); ContactPersonRepository contactRepository = new ContactPersonRepository(oWeb) { ServerRelativeWebUrl = langRootUrl }; using (CsvFileWriter writer = new CsvFileWriter(fileName, ';')) { CsvRow headerRow = new CsvRow(); headerRow.Add("Title"); headerRow.Add("URL"); headerRow.Add("Page responsible"); headerRow.Add("Created"); headerRow.Add("Modified"); writer.WriteRow(headerRow); using (SPWeb langRootWeb = oSite.OpenWeb(path)) { List <SPWeb> websToProcess = new List <SPWeb>(); websToProcess.Add(langRootWeb); for (int i = 0; i < websToProcess.Count(); i++) { Console.WriteLine(string.Format("Processing web {0}/{1}: {2}", i + 1, websToProcess.Count(), websToProcess[i].Name)); var moreWebs = GetPageReport(rowFilter, siteUri, contactRepository, writer, websToProcess[i]); foreach (SPWeb w in moreWebs) { websToProcess.Add(w); } } } writer.Flush(); } } } }
private void WriteArticleInformations() { this.catalogStatus = "Articles"; if (GenerateTranslate_CHB.Checked) { this.catalogStatus += " et Traductions"; } this.progessBarMax = reference.ReferenceLinesNb - 1; this.Status_BGW.ReportProgress(0); int lineIndex = 0; for (int sectionRank = 0; sectionRank <= reference.SectionLinesNb - 1; sectionRank++)// { reference = new Reference(appli, sectionRank, 0, 0); int blockNb = reference.Section_BlockNb; for (int blockRank = 0; blockRank <= blockNb - 1; blockRank++) { reference = new Reference(appli, sectionRank, blockRank, 0); int articleNb = reference.Block_ArticleNb; for (int articleRank = 0; articleRank <= articleNb - 1; articleRank++) { int blockLineIndex = appli.Catalog.TableGetFirstLineRankFromClusterRank(CatalogEnum.TableId.BLOCKS, sectionRank); reference = new Reference(appli, sectionRank, blockRank + blockLineIndex, articleRank); sceneInfo = new SceneInfo(reference); articleCSVManage = new CsvManage(articleCSVFile, reference, sceneInfo); translateCSVManage = new CsvManage(translateCSVFile, reference, sceneInfo); //errorCSVManage = new CsvManage(errorCSVFile); if (articleCSVManage.IsSectionValid(reference.Section_Code, reference.Section_Name)) { articleCSVManage.SetArticlePlacedRow(errorCSVFile); articleCSVFile.Flush(); if (GenerateTranslate_CHB.Checked) { translateCSVManage.SetTranslatePlacedRow(errorCSVFile); translateCSVFile.Flush(); } } this.Status_BGW.ReportProgress(lineIndex); lineIndex++; } } } this.DisposeCSVFile(articleCSVFile); this.DisposeCSVFile(translateCSVFile); this.DisposeCSVFile(errorCSVFile); }
private void WriteSectionInformations() { this.catalogStatus = "Chapitres"; this.progessBarMax = reference.SectionLinesNb - 1; this.Status_BGW.ReportProgress(0); for (int sectionRank = 0; sectionRank <= reference.SectionLinesNb - 1; sectionRank++)// { reference = new Reference(appli, sectionRank, 0, 0); sceneInfo = new SceneInfo(reference); sectionCSVManage = new CsvManage(sectionCSVFile, reference, sceneInfo); if (sectionCSVManage.IsSectionValid(reference.Section_Code, reference.Section_Name)) { sectionCSVManage.SetSectionRow(); sectionCSVFile.Flush(); } this.Status_BGW.ReportProgress(sectionRank); } this.DisposeCSVFile(sectionCSVFile); }
public void SetArticlePlacedRow(CsvFileWriter csvError) { articleRow = new CsvRow(); articleRow.Add(_reference.Article_Key); articleRow.Add(_reference.Article_Hinge); articleRow.Add(_reference.Article_Width.ToString()); articleRow.Add(_reference.Article_Depth.ToString()); articleRow.Add(_reference.Article_Height.ToString()); if (_sceneInfo.GenerateSceneInformations()) { articleRow.AddRange(_sceneInfo.ArticleRow()); } else { this.SetErrorRow(csvError, _reference.Article_Key); csvError.Flush(); } _csvFile.WriteRow(articleRow); }
void Done_FileOut() { const string kSubFolder = @"dones\"; string fileName = String.Format("{0}_dones.csv", _today.ToString("yyyy_MM_dd")); string path = String.Format("{0}{1}{2}", kFolder, kSubFolder, fileName); CsvFileWriter writer = new CsvFileWriter(path); WriteDoneFileOutHeader(writer); foreach (KtbSpotDonePosition done in this.Dones) { WriteDoneBody(done, writer); } writer.Flush(); writer.Close(); }
void RemainLongFileOut() { CsvFileWriter writer = new CsvFileWriter(_todayLongRemainFileName_Output); WriteRemainLongFileOutHeader(writer); foreach (KtbSpotPosition longPos in this.RemainLongs) { WriteRemainLongBody(longPos, writer); } writer.Flush(); writer.Close(); }
void LongFileOut() { CsvFileWriter writer = new CsvFileWriter(_curLongFileName_Output); foreach (KtbSpotPosition longPos in this.Longs) { WriteLongBody(longPos, writer); } writer.Flush(); writer.Close(); }
void DoneFileOut() { { CsvFileWriter writer = new CsvFileWriter(_todayDoneFileName_Output); WriteDoneFileOutHeader(writer); foreach (KtbSpotDonePosition done in this.Dones) { WriteDoneBody(done, writer); } writer.Flush(); writer.Close(); } { CsvFileWriter writer = new CsvFileWriter(_curDoneFileName_Output); foreach (KtbSpotDonePosition done in this.Dones) { WriteDoneBody(done, writer); } writer.Flush(); writer.Close(); } }
public Boolean getMailMergeTickets(Stream outputStream) { SqlConnection conn = new SqlConnection(DBHelper.ConnectionString); SqlCommand command = new SqlCommand(); command.Connection = conn; command.CommandText = "getMailMergeTickets"; command.CommandType = System.Data.CommandType.StoredProcedure; command.Parameters.Add(new SqlParameter("accSignature", this.owner)); command.Parameters.Add(new SqlParameter("projetoID", this.ProjectoID)); SqlDataAdapter da = new SqlDataAdapter(command); DataSet ds = new DataSet(); try { conn.Open(); da.Fill(ds); conn.Close(); if (ds.Tables[0].Rows.Count <= 0) return true; List<String> result = new List<string>(); CsvFileWriter writer = new CsvFileWriter(outputStream, Encoding.GetEncoding(1252)); CsvRow row; foreach (DataRow dr in ds.Tables[0].Rows) { row = new CsvRow(); row.Add(Convert.ToString(dr["email"])); row.Add(Convert.ToString(dr["nome"])); row.Add(Convert.ToString(dr["apelido"])); row.Add(Convert.ToString(dr["ticket"])); writer.WriteRow(row); } writer.Flush(); //writer.Close(); return true; } catch { return false; } }
private void SaveCoordinates(string filename) { if (!Directory.Exists(Path.GetDirectoryName(filename))) Directory.CreateDirectory(Path.GetDirectoryName(filename)); //filename = string.Format(filename + Path.DirectorySeparatorChar + // string.Format("sample{0}.csv", DateTime.Now.ToBinary())); CsvFileWriter writer = new CsvFileWriter(filename); for (int i = 0; i < winners.Count; i++) { CsvRow row = new CsvRow(); SOM.Neuron n = winners[i]; row.Add(n.X); row.Add(n.Y); if (labels[i].Contains("A")) { row.Add(1); } else if (labels[i].Contains("B")) { row.Add(2); } else if (labels[i].Contains("C")) { row.Add(3); } else if (labels[i].Contains("Neutral")) { row.Add(4); } writer.WriteRow(row); writer.Flush(); } writer.Close(); }
void ReportStatistic() { List<PropReport> reports = GetReports(); // header : key, cum_pnl, avgInvestment, pnl_rate CsvFileWriter writer = new CsvFileWriter(String.Format("C:\\report\\statistic_{0}.csv", this.Key)); WriteHeader(writer); WriteBody(writer, reports); writer.Flush(); writer.Close(); }
void PbTLog_FileOut() { const string kSubFolder = @"pb_tlog\"; string fileName = String.Format("{0}_pb_tlog.csv", _today.ToString("yyyy_MM_dd")); string path = String.Format("{0}{1}{2}", kFolder, kSubFolder, fileName); CsvFileWriter writer = new CsvFileWriter(path); //TODO writer.Flush(); writer.Close(); }
void RemainLong_FileOut() { const string kSubFolder = @"remains\"; string fileName = String.Format("{0}_remains.csv", _today.ToString("yyyy_MM_dd")); string remains_path = String.Format("{0}{1}{2}", kFolder, kSubFolder, fileName); CsvFileWriter writer = new CsvFileWriter(remains_path); WriteRemainLongFileOutHeader(writer); foreach (KtbSpotPosition longPos in this.RemainLongs) { WriteRemainLongBody(longPos, writer); } writer.Flush(); writer.Close(); }
public void ToCsv(String path) { CsvFileWriter writer = new CsvFileWriter(path); List<String> headers = WriteHeader(writer); WriteBody(headers, writer); writer.Flush(); writer.Close(); }