private void SavingResult_Click(object sender, RoutedEventArgs e) { string path = view.FolderSelection(); if (path != "") { if (GraphicsModeC.IsChecked == true) { try { int temp = 0; MarketExcelGenerator generator = new MarketExcelGenerator(); int countbloks = SearchResultsL.Items.Count / (Settings.CountLine + 1); for (int i = 0; i < countbloks; i++) { string[] mass = new string[Settings.CountLine + 1]; for (int j = 0; j < Settings.CountLine + 1; j++) { mass[j] = SearchResultsL.Items[temp].ToString(); temp++; } var reportData = new MarketReporter().GetReport(mass, Settings); generator.Bildblok(reportData, Settings, i); } var reportExcel = generator.Generate(); File.WriteAllBytes(path + "/" + "Report.xlsx", reportExcel); } catch { MessageBox.Show("Ошибка! Блоки не обнаружены, или они не полны"); } } else { StreamWriter fileW = new StreamWriter(path + "/" + DateTime.Now.Year + "_" + DateTime.Now.Month + "_" + DateTime.Now.Day + "_" + DateTime.Now.TimeOfDay.Hours + "_" + DateTime.Now.TimeOfDay.Minutes + "_" + "Search_" + ".txt"); for (int i = 0; i < SearchResultsL.Items.Count; i++) { fileW.WriteLine(SearchResultsL.Items[i]); } fileW.Close(); LogMenager log = new LogMenager(); log.CreateRecord(new string[] { "Вывод поиска в папку: " + path + " Выполнил: " + ActiveUser.user.Name + " " + ActiveUser.user.Surname + " ", "" }); } } }
private void Button_Click(object sender, RoutedEventArgs e) { PathRezT.Text = view.FolderSelection(); }