private void buttonSave_Click(object sender, EventArgs e) { using (var dialog = new SaveFileDialog { Filter = "pdf|*.pdf" }) { if (dialog.ShowDialog() == DialogResult.OK) { try { logic.SaveDopsToPdfFile(new ReportBindingModel { FileName = dialog.FileName, DateFrom = dateTimePickerFrom.Value.Date, DateTo = dateTimePickerTo.Value.Date, }); MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }