Ejemplo n.º 1
0
        //public ICommand CsvExportCommand
        //{
        //    get
        //    {
        //        if (m_exportCsvCommand == null)
        //        {
        //            m_exportCsvCommand = new RelayCommand(param => exportCsvData());
        //        }
        //        return m_exportCsvCommand;
        //    }
        //    set
        //    {
        //        m_exportCsvCommand = value;
        //    }
        //}

        private bool exportCsvData()
        {
            if (AllServiceSheets == null)
            {
                return(false);
            }
            //Need to go through the submissions and check that each has been approved.
            foreach (ServiceSheetViewModel sheet in AllServiceSheets)
            {
                if (!sheet.OfficeApproval)
                {
                    MessageBox.Show("Service sheets need approving before they can be exported.", "Error");
                    return(false);
                }
            }

            int noOfSheets          = AllServiceSheets.Count;
            MessageBoxResult result = MessageBox.Show(noOfSheets.ToString() + " sheets will be exported to csv.  Do you want to continue?", "Export", MessageBoxButton.YesNo);

            if (result == MessageBoxResult.No)
            {
                return(true);
            }

            //This exports all the downloaded service sheets to csv
            CsvServiceExport exporter = new CsvServiceExport();
            bool             success  = exporter.exportDataToCsv(AllServiceSheets);

            if (success)
            {
                MessageBox.Show("Canvas data exported to CSV", "Exported");
                return(true);
            }
            else
            {
                return(false);
            }
        }
        private void exportCsvData()
        {
            //Need to go through the submissions and check that each has been approved.
            foreach (ServiceSheetViewModel sheet in AllServiceSheets)
            {
                if(!sheet.OfficeApproval)
                {
                    MessageBox.Show("Service sheets need approving before they can be exported.", "Error");
                    return;
                }
            }

            int noOfSheets = AllServiceSheets.Count;
            MessageBoxResult result = MessageBox.Show(noOfSheets.ToString() + " sheets will be exported to csv.  Do you want to continue?", "Export", MessageBoxButton.YesNo);
            if (result == MessageBoxResult.No)
            {
                return;
            }

            //This exports all the downloaded service sheets to csv
            CsvServiceExport exporter = new CsvServiceExport();
            bool success = exporter.exportDataToCsv(AllServiceSheets);

            if (success)
            {
                MessageBox.Show("Canvas data exported to CSV", "Exported");
            }
        }