Example #1
0
        private void Save(object sender, ReportEventArgs e)
        {
            Dispatcher.BeginInvoke(new Action(delegate()
            {
                taskBar.ProgressState = System.Windows.Shell.TaskbarItemProgressState.None;
                progressBar.Close();
            }));

            string defaultFilePath = e.DefaultFilePath;
            string saveDefault = string.Format("Сохранить отчет в файле по умолчанию:\n{0}?", defaultFilePath);
            MessageBoxResult result = MessageBox.Show(saveDefault, "Сохранение отчета",
                        MessageBoxButton.YesNo, MessageBoxImage.Question);
            if (sender is Report)
            {
                Report report = (Report)sender;
                if (result == MessageBoxResult.Yes)
                {
                    try
                    {
                        if (System.IO.File.Exists(defaultFilePath))
                        {
                            throw new System.IO.IOException(string.Format("Файл {0} уже существует.", defaultFilePath));
                        }
                        else
                        {
                            report.Save();
                        }
                    }
                    catch (System.IO.IOException ex)
                    {
                        ErrorSave(defaultFilePath, report, ex);
                    }
                }
                else
                {
                    SaveFile(defaultFilePath, report);
                }

                if (ReportComplete != null)
                {
                    ReportComplete(this, new RoutedEventArgs());
                }
            }
        }
Example #2
0
        public void Create()
        {
            Reader reader = new Reader();
            table = reader.ReadFile(fileName, out separator);

            if (Start != null)
            {
                Start(this, new EventArgs());
            }

            CreateSheetBasic(SheetName.Corporate);
            CreateSheetBasic(SheetName.MvzOrder);
            CreateSheetBasic(SheetName.MvzPhone);
            CreateSheetStatistic(RegionType.All);
            CreateSheetStatistic(RegionType.Gts);
            CreateSheetStatistic(RegionType.Rtk);
            CreateSheetMvz(RegionType.Gts);
            CreateSheetMvz(RegionType.Rtk);
            SheetLimits sheetLimits = new SheetLimits(workbook, dateString());
            sheetLimits.Create();

            ReportEventArgs reportEventArgs = new ReportEventArgs();
            if (Complete != null)
            {
                reportEventArgs.DefaultFilePath = GetOutFilePath();
                Complete(this, reportEventArgs);
            }
        }