private void ReportButtonClick(object sender, EventArgs e) { var item = ((Button)sender); FolderBrowserDialog dialog = new FolderBrowserDialog { Description = "Выберите папку для сохранения отчета", RootFolder = Environment.SpecialFolder.MyComputer, ShowNewFolderButton = true }; switch (Mode.SelectedIndex) { case 0: // Путевые листы switch (item.Name) { case "B_Trackinglist": if (dialog.ShowDialog() == DialogResult.OK) { if (DataList_Report.SelectedRows.Count > 1) { // Получаем индексы выделенных ячеек int[] indexes = new int[DataList_Report.SelectedRows.Count]; for (int i = 0; i < DataList_Report.SelectedRows.Count; i++) { indexes[i] = DataList_Report.SelectedRows[i].Cells[0].Value.exToInt(); } Trackinglists.Report(ReportType.Trackinglist, dialog.SelectedPath, ArrayOfIDs: indexes); } else { Trackinglists.Report(ReportType.Trackinglist, dialog.SelectedPath, ID); } } break; case "B_Reference": if (new Reference().ShowDialog() == DialogResult.OK) { if (dialog.ShowDialog() == DialogResult.OK) { Trackinglists.Report(ReportType.Reference, dialog.SelectedPath, ID); } } break; case "B_Registry": if (new Duration().ShowDialog() == DialogResult.OK) { Trackinglists.Report(ReportType.Registry, ID: ID); } break; } break; case 1: // Смета switch (item.Name) { case "B_Trackinglist": int T_ID = Convert.ToInt32(DataCommon.GetFieldValue(ID, "Estimate_tracklist", "Estimate")); Trackinglists.Report(ReportType.Trackinglist, ID: T_ID); break; } break; } }