private void ExportToBriefcaseFile()
        {
            SaveFileDialog sfdlg = new SaveFileDialog();

            sfdlg.Filter = "(briefcase files *.sdf)|*.sdf";
            if (DialogResult.OK == sfdlg.ShowDialog())
            {
                if (this.dataGridViewVIQRegistry.SelectedRows.Count > 0)
                {
                    try
                    {
                        Portable.SaveSchema(sfdlg.FileName, ApplicationInfo.bfpassword);
                    }
                    catch (Exception e2)
                    {
                        MessageBox.Show("Metadata failed to be exported :" + e2.Message);
                        return;
                    }

                    if (!Questionnaire.TransferRegistryInfoToBriefcase(MyConnection.GetConnection(), sfdlg.FileName, ApplicationInfo.bfpassword))
                    {
                        MessageBox.Show("Registry data failed to be transfered.");

                        return;
                    }
                    foreach (DataGridViewRow dgv in this.dataGridViewVIQRegistry.SelectedRows)
                    {
                        var drv = (DataRowView)dgv.DataBoundItem;
                        int qid = (int)drv["Qid"];
                        try
                        {
                            if ((byte)drv["finalized"] != 1)
                            {
                                throw new Exception("not finalized");
                            }
                        }
                        catch (Exception e3)
                        {
                            MessageBox.Show(drv["Qid"].ToString() + " skipped :not finalized");
                            continue;
                        }


                        try
                        {
                            Portable.TransferQuestionnaireTemplate(MyConnection.GetConnection(), qid, sfdlg.FileName, ApplicationInfo.bfpassword);
                        }
                        catch (Exception e2)
                        {
                            MessageBox.Show("Questionnaire export failed :" + e2.Message);
                        }
                    }
                    MessageBox.Show(string.Format("Briefcase file {0} created.", sfdlg.FileName));
                }
            }
        }
Esempio n. 2
0
        private void bt_Transfer_Click(object sender, EventArgs e)
        {
            if (this.dataGridView1.SelectedRows.Count > 0)
            {
                foreach (DataGridViewRow dgv in this.dataGridView1.SelectedRows)
                {
                    var drv = (DataRowView)dgv.DataBoundItem;
                    int qid = (int)drv["Qid"];


                    Portable.TransferQuestionnaireTemplate(MyConnection.GetConnection(), qid, this.m_FilePath, this.m_password);
                }
            }
        }