示例#1
0
        private void ExportToCSV()
        {
            List<ContactDB> exportList = GetCheckedContactList();
            if(exportList.Count() == 0)
            {
                MessageBox.Show(ContactManagentLibrary.Properties.Resources.choose_contact_to_export);
                return;
            }
            string fileName = "contacts_" + (DateTime.Now.ToString("MM-dd-yyyy hhmmss"));
            saveFileDialog1.FileName = fileName;
            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                string path = saveFileDialog1.FileName;
                FileImExportController fileImEx = new FileImExportController();
                int res = fileImEx.ExportToCSVFile(exportList, path);

                if (res > 0)
                {
                    MessageBox.Show(ContactManagentLibrary.Properties.Resources.export_success);
                }
                else
                {
                    MessageBox.Show(ContactManagentLibrary.Properties.Resources.export_error);
                }
            }
        }
示例#2
0
        private void ExportToVCF()
        {
            List<ContactDB> exportList = GetCheckedContactList();
            if (exportList.Count() == 0)
            {
                MessageBox.Show(ContactManagentLibrary.Properties.Resources.choose_contact_to_export);
                return;
            }
            if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
            {
                string path = folderBrowserDialog1.SelectedPath;
                FileImExportController fileImEx = new FileImExportController();
                int res = fileImEx.ExportToVCFFile(exportList, path);

                if (res > 0)
                {
                    MessageBox.Show(ContactManagentLibrary.Properties.Resources.export_success);
                }
                else
                {
                    MessageBox.Show(ContactManagentLibrary.Properties.Resources.export_error);
                }
            }
        }
示例#3
0
        private void DoImportFromFile(string filePath)
        {
            FileImExportController imex = new FileImExportController();
            FileImportResult res = imex.ImportFromFile(filePath);

            if (res.errorCode == FileImExportController.CODE_FILE_NO_ERROR)
            {
                label_status.Text = String.Format(ContactManagentLibrary.Properties.Resources.import_num_contacts, res);
                if(uc_parent is UC_LocalContacts)
                {
                    ((UC_LocalContacts)uc_parent).NotifyNewContactAdded();
                }
            }
            else
            {
                string state = FileImExportController.FromCodeToString(res.errorCode);
                label_status.Text = state;
            }
            btn_back.Enabled = true;
        }