예제 #1
0
        /// <summary>
        /// Implements <see cref="IEventRepository.SaveEvents(string)" />
        /// </summary>
        public bool SaveEvents(string path)
        {
            bool exported = true;

            try
            {
                AllIO.ExportSingle(path, FileTypes.EVENT);
            }
            catch (Exception)
            {
                exported = false;
            }

            return(exported);
        }
예제 #2
0
        /// <summary>
        /// Implements <see cref="IMessageRepository.SaveMessages(string)" />
        /// </summary>
        public bool SaveMessages(string path)
        {
            bool exported = true;

            try
            {
                AllIO.ExportSingle(path, FileTypes.MESSAGE);
            }
            catch (Exception)
            {
                exported = false;
            }

            return(exported);
        }
예제 #3
0
        private void ExportEventsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DialogResult folderSelectResult = FolderBrowserDialog.ShowDialog();

            if (folderSelectResult == DialogResult.OK && !string.IsNullOrEmpty(FolderBrowserDialog.SelectedPath))
            {
                DirectoryInfo info = new DirectoryInfo(FolderBrowserDialog.SelectedPath);
                BackupIOConsts.ArchiveOldAll();

                if (info.Exists)
                {
                    try
                    {
                        AllIO.ExportSingle(info.FullName, FileTypes.EVENT);

                        MessageBox.Show("Successully exported events in requested location.", "All events saved", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("Unable to export some or all events.", "Error Occurred.", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    MessageBox.Show("Unable to export some or all events.", "Error Occurred.", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                DialogResult cancelExportResult = MessageBox.Show("You are cancelling export. Are you sure?", "Cancelling Export", MessageBoxButtons.YesNo);

                if (cancelExportResult == DialogResult.No)
                {
                    ExportAllDataToolStripMenuItem.PerformClick();
                }
            }
        }