Ejemplo n.º 1
0
        public NewCanvasWindow(Project project)
        {
            InitializeComponent();
            Construct();

            LoadFormsFromProject(project);
        }
Ejemplo n.º 2
0
        public SetDataSource(Project project)
        {
            InitializeComponent();
            Construct();

            LoadFormsFromProject(project);
        }
Ejemplo n.º 3
0
 public BaseReadDialog(Project project)
 {
     InitializeComponent();
     Construct();
     selectedDataSource = project;
     selectedProject = project;
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Constructor for Read dialog
        /// </summary>
        public ReadDialog(Epi.Windows.MakeView.Forms.MakeViewMainForm frm)
            : base(frm)
        {
            InitializeComponent();
            Construct();
            SourceProjectNames = new Hashtable();

            if (frm.projectExplorer != null)
            {
                if (frm.projectExplorer.currentPage != null)
                {
                    this.sourceProject = frm.projectExplorer.currentPage.view.Project;
                    this.selectedProject = this.sourceProject;
                    this.selectedDataSource = this.selectedProject;
                    //--EI-48
                    //Adds datatable names to viewlist to enable other tables in project
                    List<string> SourceViewnames = this.sourceProject.GetViewNames();
                    SourceNonViewnames = this.sourceProject.GetNonViewTableNames();
                    foreach(string str in SourceViewnames)
                    {
                        View MView = this.sourceProject.GetViewByName(str);
                        DataTable ViewPages = MView.GetMetadata().GetPagesForView(MView.Id);
                        foreach(DataRow dt in ViewPages.Rows)
                        {
                            string ViewdataTable = MView.TableName + dt[ColumnNames.PAGE_ID];
                            Sourcedatatables.Add(ViewdataTable);
                        }
                        if (SourceNonViewnames.Contains(str)) { SourceNonViewnames.Remove(str); }
                    }
                    foreach(string str in Sourcedatatables)
                    {
                        SourceViewnames.Add(str);
                        if (SourceNonViewnames.Contains(str)) { SourceNonViewnames.Remove(str);}
                    }

                   //--

                    foreach (string s in this.sourceProject.GetNonViewTableNames())
                    {
                        string key = s.ToUpper().Trim();
                        if (!SourceProjectNames.Contains(key))
                        {
                           if (SourceViewnames.Contains(s))
                             {
                                SourceProjectNames.Add(key, true);
                             }
                        }
                    }
                    foreach (string s in this.sourceProject.GetViewNames())
                    {
                        string key = s.ToUpper().Trim();
                        if (!SourceProjectNames.Contains(key))
                        {
                            SourceProjectNames.Add(key, true);
                        }
                    }

                }
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Constructor for the class
 /// </summary>
 /// <param name="frm">The main form</param>
 /// <param name="currentProject">The current project</param>
 /// <param name="initialViewName">A user-specified default view name.</param>
 public CreateViewDialog(MainForm frm, Project currentProject, string initialViewName)
     : base(frm)
 {
     InitializeComponent();
     project = currentProject;
     defaultViewName = initialViewName;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Constructor for the class
 /// </summary>
 /// <param name="frm">The main form</param>
 /// <param name="project">The current project</param>
 public ViewSelectionDialog(MainForm frm, Project project)
     : base(frm)
 {
     // This call is required by the Windows Form Designer.
     InitializeComponent();
     currentProject = project;
 }
Ejemplo n.º 7
0
        /// <summary>
        /// CopyCodeTablesTo()
        /// </summary>
        /// <param name="destination"></param>
        public void CopyCodeTablesTo(Epi.Project destination)
        {
            List <string> codeTableList = Metadata.GetCodeTableNames();

            foreach (string codeTableName in codeTableList)
            {
                RaiseEventTableCopyBegin(codeTableName + StringLiterals.ELLIPSIS);

                string[] columnNames = Metadata.GetCodeTableColumnNames(codeTableName);

                destination.CreateCodeTable(codeTableName, columnNames);

                DataTable CodeTable = this.Metadata.GetCodeTableData(codeTableName);
                int       rowIndex  = 0;

                foreach (DataRow CodeRow in CodeTable.Rows)
                {
                    RaiseEventTableCopyStatus(codeTableName, rowIndex, CodeTable.Rows.Count);

                    rowIndex++;
                    string[] columnData = new string[columnNames.Length];

                    for (int i = 0; i < columnNames.Length; i++)
                    {
                        columnData[i] = CodeRow[columnNames[i]].ToString();
                    }

                    destination.Metadata.CreateCodeTableRecord(codeTableName, columnNames, columnData);
                }

                RaiseEventTableCopyEnd(codeTableName + StringLiterals.ELLIPSIS);
            }
        }
        public PackageGridRemovalDialog(Project sourceProject, string formName, Dictionary<string, List<string>> gridFieldsToNull)
        {
            InitializeComponent();
            this.sourceProject = sourceProject;
            this.formName = formName;

            FillGrids();

            if (gridFieldsToNull != null)
            {
                this.fieldsToNull = gridFieldsToNull;
            }
            else
            {
                this.fieldsToNull = new Dictionary<string, List<string>>();
            }

            DeselectFields();

            if (fieldsToNull.Count == 0)
            {
                foreach (View currentView in sourceProject.Views)
                {
                    foreach (GridField gridField in currentView.Fields.GridFields)
                    {
                        fieldsToNull.Add(currentView.Name + ":" + gridField.Name, new List<string>());
                    }
                }
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Constructor for Read dialog
        /// </summary>
        public ReadDialog(Epi.Windows.MakeView.Forms.MakeViewMainForm frm)
            : base(frm)
        {
            InitializeComponent();
            Construct();
            SourceProjectNames = new Hashtable();

            if (frm.projectExplorer != null)
            {
                if (frm.projectExplorer.currentPage != null)
                {
                    this.sourceProject = frm.projectExplorer.currentPage.view.Project;
                    this.selectedProject = this.sourceProject;
                    this.selectedDataSource = this.selectedProject;

                    foreach (string s in this.sourceProject.GetNonViewTableNames())
                    {
                        string key = s.ToUpper().Trim();
                        if (!SourceProjectNames.Contains(key))
                        {
                            SourceProjectNames.Add(key, true);
                        }
                    }
                    foreach (string s in this.sourceProject.GetViewNames())
                    {
                        string key = s.ToUpper().Trim();
                        if (!SourceProjectNames.Contains(key))
                        {
                            SourceProjectNames.Add(key, true);
                        }
                    }

                }
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Constructor for the class.
        /// </summary>
        /// <param name="proj">Project the metadata belongs to</param>
        //public MetadataDbProvider(Project proj, bool createDatabase)
        public MetadataDataSet(Project project)
            : base(project)
        {
            #region Input validation
            if (project == null)
            {
                throw new System.ArgumentNullException("project");
            }
            #endregion Input validation

            _project = project;

            AttachDbDriver(_project.CollectedData.GetDbDriver());
            _dataSet = new DataSet();

            TableSchema.TablesDataTable schema = db.GetTableSchema();

            foreach (DataRow row in schema.Rows)
            {
                string name = row[schema.TABLE_NAMEColumn].ToString();

                if (name.StartsWith("meta") || name.StartsWith("code"))
                {
                    _dataSet.Tables.Add(db.GetTableData(name));
                }
            }
        }
Ejemplo n.º 11
0
 /// <summary>
 /// Constructor for the class
 /// </summary>
 /// <param name="givenView">The View to load check code for</param>
 /// <param name="givenMainForm">The main form</param>
 public DataDictionary(View givenView, MainForm givenMainForm)
 {
     view = givenView;
     project = view.Project;
     mainForm = givenMainForm;
     Construct();
 }
 /// <summary>
 /// Constructor
 /// </summary>        
 /// <param name="destinationView">The form within the project that will accept the packaged data</param>
 /// <param name="mergeType">Determines how to handle data merging during the import.</param>
 public ImportEncryptedDataPackageDialog(View destinationView, DataMergeType mergeType = DataMergeType.UpdateAndAppend)
 {
     InitializeComponent();
     this.destinationView = destinationView;
     destinationProject = this.destinationView.Project;
     Construct(mergeType);
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Constructor of the Dialog Config dialog
 /// </summary>
 /// <param name="frm">The main form</param>
 public DialogConfigDialog(MainForm frm ,Project Project)
     : base(frm)
 {
     this.project = Project;
     InitializeComponent();
     Construct();
 }
        public PackageColumnRemovalDialog(Project sourceProject, string formName, Dictionary<string, List<string>> fieldsToNull)
        {
            InitializeComponent();
            this.sourceProject = sourceProject;
            this.formName = formName;

            if (fieldsToNull != null)
            {
                this.fieldsToNull = fieldsToNull;
            }
            else
            {
                this.fieldsToNull = new Dictionary<string, List<string>>();
            }

            DeselectFields();

            if (fieldsToNull.Count == 0)
            {
                foreach (View view in sourceProject.Views)
                {
                    fieldsToNull.Add(view.Name, new List<string>());
                }
            }

            FillForms();
        }
Ejemplo n.º 15
0
 /// <summary>
 /// Constructor for the class.
 /// </summary>
 /// <param name="proj">Project the metadata belongs to</param>
 //public MetadataDbProvider(Project proj, bool createDatabase)
 public MetadataDbProvider(Project proj)
 {
     #region Input validation
     if (proj == null)
         throw new System.ArgumentNullException("proj");
     #endregion Input validation
     project = proj;
 }
Ejemplo n.º 16
0
 /// <summary>
 /// Constructor for Dialog dialog that passes the project
 /// </summary>
 /// <param name="frm">The main form</param>
 /// <param name="project">The current project</param>
 public DialogDialog(Epi.Windows.Analysis.Forms.AnalysisMainForm frm, Project project)
     : base(frm)
 {
     InitializeComponent();
     mainForm = frm;
     this.project = project;
     Construct();
 }
Ejemplo n.º 17
0
 /// <summary>
 /// The constructor
 /// </summary>
 /// <param name="destinationView">The destination form.</param>
 /// <param name="packagePaths">The file paths for the packages to be imported.</param>
 /// <param name="password">The password for the encryption.</param>
 public ProjectUnpackager(View destinationView, List<string> packagePaths, string password)
 {
     this.destinationView = destinationView;
     this.destinationProject = destinationView.Project;
     this.packagePaths = packagePaths;
     this.password = password;
     gch = GCHandle.Alloc(password, GCHandleType.Pinned);
 }
Ejemplo n.º 18
0
 /// <summary>
 /// Creates a View object based on the Project XML file's view element
 /// </summary>
 /// <param name="viewElement"></param>
 /// <param name="proj"></param>
 public View(Project proj, XmlElement viewElement)
 {
     this.project = proj;
     this.viewElement = viewElement;
     this.Id = int.Parse(this.viewElement.Attributes["ViewId"].Value);
     this.Name = (this.viewElement.Attributes["Name"].Value);
     this.fieldLockToken = new ArrayList();
 }
 /// <summary>
 /// Default constructor
 /// </summary>
 /// <param name="pProject">The project that will contain the converted metadata</param>
 /// <param name="pFormName">The name of the form that will be created in the Epi Info 7 project</param>
 /// <param name="pSourceDriver">The data driver for the external data source</param>
 /// <param name="pTableName">The name of the table within the external data source</param>        
 /// <param name="pColumnMapping">The column mappings that determine how the fields in the form will be created</param>
 public TableToFormMetadataConverter(Project pProject, string pFormName, IDbDriver pSourceDriver, string pTableName, List<ColumnConversionInfo> pColumnMapping)
 {
     project = pProject;
     formName = pFormName;
     sourceDriver = pSourceDriver;
     tableName = pTableName;
     columnMapping = pColumnMapping;
     destinationDriver = project.CollectedData.GetDatabase();
 }
Ejemplo n.º 20
0
 /// <summary>
 /// Constructor
 /// </summary>
 public FormDataImporter(Project sourceProject, Project destinationProject, View destinationView, List<View> viewsToProcess)
 {
     this.formsToProcess = viewsToProcess;
     this.sourceProject = sourceProject;
     this.destinationProject = destinationProject;
     this.sourceView = sourceProject.Views[destinationView.Name];
     this.destinationView = destinationView;
     Construct();
 }
Ejemplo n.º 21
0
        /// <summary>
        /// Constructor for the class.
        /// </summary>
        /// <param name="proj">Project the collected data belongs to</param>
        // public CollectedDataProvider(Project proj, bool createDatabase)
        public CollectedDataProvider(Project proj)
        {
            if (proj == null)
            {
                throw new System.ArgumentNullException("proj");
            }

            project = proj;
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Constructor
        /// </summary>        
        /// <param name="destinationView">The destination form; should be the currently-open view</param>
        public ImportWebDataForm(View destinationView)
        {
            InitializeComponent();

            this.destinationProject = destinationView.Project;
            this.destinationView = destinationView;

            Construct();
        }
Ejemplo n.º 23
0
 /// <summary>
 /// Disposes object
 /// </summary>
 public override void Dispose()
 {
     if (Project != null)
     {
         Project.Dispose();
         Project = null;
     }
     base.Dispose();
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="sourceProject">The source project</param>
 /// <param name="formName">The name of the top-level form</param>
 public PackageRecordSelectionDialog(Project sourceProject, string formName)
 {
     InitializeComponent();
     this.sourceProject = sourceProject;
     this.formName = formName;
     rowFilterConditions = new List<IRowFilterCondition>();
     FillFields();
     config = Configuration.GetNewInstance();
 }
Ejemplo n.º 25
0
 /// <summary>
 /// The constructor
 /// </summary>
 /// <param name="sourceProject">The project from which to create the package.</param>
 /// <param name="packagePath">The file path to where the package will reside.</param>
 /// <param name="formName">The name of the form within the project to package.</param>
 /// <param name="password">The password for the encryption.</param>
 public ProjectPackagerBase(Project sourceProject, string packagePath, string formName, string password)
 {
     this.sourceProject = sourceProject;
     this.packagePath = packagePath;
     this.formName = formName;
     this.password = password;
     this.columnsToNull = new Dictionary<string, List<string>>();
     this.gridColumnsToNull = new Dictionary<string, List<string>>();
     this.config = Configuration.GetNewInstance();
 }
Ejemplo n.º 26
0
 public ReadRelatedDialog(Project project, Dictionary<string, string> parentTableColumnNames)
 {
     InitializeComponent();
     Construct();
     selectedDataSource = project;
     selectedProject = project;
     this.parentTableColumnNames = parentTableColumnNames;
     SelectedItemType = Dialogs.SelectedItemType.Form;
     RefreshForm();
 }
Ejemplo n.º 27
0
 /// <summary>
 /// Constructor for Project Node
 /// </summary>
 /// <param name="project">The current project</param>
 public ProjectNode(Project project)
 {
     Initialize();
     this.Project = project;
     this.Text = project.Name;
     foreach (View view in project.Views)
     {
         Nodes.Add(new ViewNode(view));
     }
 }
Ejemplo n.º 28
0
 /// <summary>
 /// Constructor for Preview Table Dialog dialog
 /// </summary>
 /// <param name="frm">The main form</param>
 /// <param name="project">The current project</param>
 /// <param name="tableFields">Selected fields collection</param>
 /// <param name="tableName">The table name</param>
 public PreviewTableDialog(MainForm frm, Project project, ComboBox.ObjectCollection tableFields, string tableName)
     : base(frm)
 {
     InitializeComponent();
     currentProject = project;
     currentTableName = tableName;
     fields = tableFields;
     columnCollection = new List<string>();
     btnOK.Visible = false;
     lblInstruction.Text = "The grid below displays the fields from the selected table.  Click Back to go to the Match Fields screen.";
 }
Ejemplo n.º 29
0
        public DashboardProperties(DashboardHelper dashboardHelper)
        {
            #region Input Validation
            if (dashboardHelper == null) { throw new ArgumentNullException("dashboardHelper"); }
            #endregion // Input Validation

            InitializeComponent();
            this.DashboardHelper = dashboardHelper;

            if (DashboardHelper.IsUsingEpiProject)
            {
                txtProjectPath.Text = dashboardHelper.View.Project.FilePath;

                if (System.IO.File.Exists(txtProjectPath.Text))
                {
                    cmbFormName.Items.Clear();
                    Project project = new Project(txtProjectPath.Text);
                    foreach (View view in project.Views)
                    {
                        cmbFormName.Items.Add(view.Name);
                    }
                }

                cmbFormName.Text = dashboardHelper.View.Name;
            }
            else
            {
                if (!string.IsNullOrEmpty(dashboardHelper.CustomQuery))
                {
                    SqlQuery = DashboardHelper.CustomQuery;
                }
            }

            tblockRows.Text = dashboardHelper.DataSet.Tables[0].Rows.Count.ToString() + " unfiltered rows";
            tblockColumns.Text = dashboardHelper.DataSet.Tables[0].Columns.Count.ToString() + " columns";
            tblockCacheDateTime.Text = "Data last cached at " + dashboardHelper.LastCacheTime.ToShortDateString() + " " + dashboardHelper.LastCacheTime.ToShortTimeString();
            tblockCacheTimeElapsed.Text = "Took " + dashboardHelper.TimeToCache + " to locally cache data";

            Epi.ApplicationIdentity appId = new Epi.ApplicationIdentity(typeof(Configuration).Assembly);
            tblockCurrentEpiVersion.Text = "Epi Info " + appId.Version;

            lbxRelatedDataSources.Items.Clear();
            if (dashboardHelper.ConnectionsForRelate.Count > 0)
            {
                // Related Data
                foreach (RelatedConnection rConn in dashboardHelper.ConnectionsForRelate)
                {
                    lbxRelatedDataSources.Items.Add(rConn.db.ConnectionString);
                }
            }
        }
Ejemplo n.º 30
0
        /// <summary>
        /// Constructor for the class.
        /// </summary>
        /// <param name="proj">Project the metadata belongs to</param>
        public MetadataXmlProvider(Project proj)
        {
            #region Input validation
            if (proj == null)
                throw new System.ArgumentNullException("proj");
            #endregion Input validation

            project = proj;

            // Create Views node in the XML file.
            XmlNode root = GetRootNode();
            root.AppendChild(GetXmlDocument().CreateElement("Views"));
            Save();
        }
Ejemplo n.º 31
0
        /// <summary>
        /// Constructor for the Field Selection Dialog
        /// </summary>
        /// <param name="frm">The main form</param>
        /// <param name="project">The project</param>
        /// <param name="tableName">The table name</param>
        public FieldSelectionDialog(MainForm frm, Project project, string tableName)
            : base(frm)
        {
            // This call is required by the Windows Form Designer.
            InitializeComponent();
            DataTable columns = project.CollectedData.GetTableColumnSchema(tableName);

            columns.PrimaryKey = new DataColumn[] {columns.Columns[ColumnNames.COLUMN_NAME]};
            if (columns.Columns.Contains(ColumnNames.UNIQUE_KEY))
            {
                columns.Rows.Remove(columns.Rows.Find(ColumnNames.UNIQUE_KEY));
            }

            lbxFields.DataSource = columns;
            lbxFields.DisplayMember = ColumnNames.COLUMN_NAME;
            lbxFields.ValueMember = ColumnNames.COLUMN_NAME;
        }
        /// <summary>
        /// Loads default settings into the form
        /// </summary>
        private void LoadFormData()
        {
            Configuration config = Configuration.GetNewInstance();
            FontStyle     style  = FontStyle.Regular;

            if (config.Settings.EditorFontBold)
            {
                style |= FontStyle.Bold;
            }

            if (config.Settings.EditorFontItalics)
            {
                style |= FontStyle.Italic;
            }

            if ((field.ControlFont == null) || ((field.ControlFont.Name == "Microsoft Sans Serif") && (field.ControlFont.Size == 8.5)))
            {
                field.ControlFont = new Font(config.Settings.EditorFontName, (float)config.Settings.EditorFontSize, style);
            }

            txtPrompt.Text    = field.PromptText;
            txtPrompt.Font    = field.ControlFont;
            txtFieldName.Text = field.Name;

            List <EpiInfo.Plugin.IVariable> vars = this.memoryRegion.Context.GetVariablesInScope();

            foreach (EpiInfo.Plugin.IVariable v in vars)
            {
                if (v.VariableScope == VariableScope.Standard || v.VariableScope == VariableScope.DataSource)
                {
                    cbxVariables.Items.Add(v.Name);
                    cbxVariables.SelectedIndex = -1;
                }
            }

            cbxVariables.Sorted = true;
            DataTable cbxDs = new DataTable();

            cbxDs.Columns.Add("RelatedFormId", typeof(int));
            cbxDs.Columns.Add("FormName", typeof(string));
            int SelectedIndex = -1;

            object[] row = new object[2];
            row[0] = -1;
            row[1] = "(create new form)";
            cbxDs.Rows.Add(row);

            Epi.Project project = field.GetView().Project;

            View viewPointer   = field.GetView();
            int  currentViewId = viewPointer.Id;

            List <int> lineage = new List <int>();

            lineage.Add(currentViewId);

            while (viewPointer.ParentView != null)
            {
                lineage.Add(viewPointer.ParentView.Id);
                viewPointer = viewPointer.ParentView;
            }

            foreach (Epi.View view in project.Views)
            {
                if (lineage.Contains(view.Id) == false)
                {
                    cbxRelatedView.Items.Add(view.Name);
                    row    = new object[2];
                    row[0] = view.Id;
                    row[1] = view.Name;
                    cbxDs.Rows.Add(row);

                    if (view.Id == field.RelatedViewID)
                    {
                        SelectedIndex = cbxDs.Rows.Count - 1;
                    }
                }
            }

            cbxRelatedView.DataSource    = cbxDs;
            cbxRelatedView.ValueMember   = "RelatedFormId";
            cbxRelatedView.DisplayMember = "FormName";
            cbxRelatedView.SelectedIndex = SelectedIndex;

            if (field.ChildView != null)
            {
                cbxRelatedView.Text = field.ChildView.Name;
            }

            if (field.Condition.Length > 0)
            {
                rdbAccessibleWithConditions.Checked = true;
                txtCondition.Text = field.Condition;
            }
            else
            {
                rdbAccessibleAlways.Checked = true;
                txtCondition.Text           = string.Empty;
            }

            controlFont = field.ControlFont;
            chkReturnToParent.Checked = field.ShouldReturnToParent;
        }
Ejemplo n.º 33
0
 /// <summary>
 ///
 /// </summary>
 public SplashDialog(Epi.Epi2000.Project sourceProj, Epi.Project targetProj)
 {
     this.sourceProject = sourceProj;
     this.targetProject = targetProj;
     InitializeComponent();
 }