/// <summary>
        /// Cancel button closes this dialog
        /// </summary>
        /// <param name="sender">Object that fired the event</param>
        /// <param name="e">.NET supplied event parameters</param>
        private void btnCancel_Click(object sender, System.EventArgs e)
        {
            this.project          = null;
            this.MetaDataProvider = null;
            this.SelectedTable    = null;

            this.Close();
        }
Example #2
0
        /// <summary>
        /// Returns the source data for this DDL
        /// </summary>
        /// <returns>Source Data</returns>
        public DataTable GetSourceData()
        {
            if (string.IsNullOrEmpty(SourceTableName))
            {
                return(null);
            }

            DataTable dataTable = new DataTable();

            View view = this.view;
            Page page = ((RenderableField)this).Page;

            Epi.Data.Services.IMetadataProvider metadata = view.GetMetadata();

            string tableName = SourceTableName;

            Project project          = this.GetProject();
            string  filterExpression = string.Empty;

            if (project.CollectedData.TableExists(tableName) == false)
            {
                string separator = " - ";

                if (tableName.Contains(separator))
                {
                    string[] view_page  = tableName.Replace(separator, "^").Split('^');
                    string   viewName   = view_page[0].ToString();
                    string   pageName   = view_page[1].ToString();
                    View     targetView = project.Metadata.GetViewByFullName(viewName);

                    if (targetView == null)
                    {
                        return(null);
                    }

                    DataTable targetPages = project.Metadata.GetPagesForView(targetView.Id);
                    DataView  dataView    = new DataView(targetPages);

                    filterExpression = string.Format("Name = '{0}'", pageName);

                    DataRow[] pageArray = targetPages.Select(filterExpression);

                    if (pageArray.Length > 0)
                    {
                        int pageId = (int)pageArray[0]["PageId"];
                        tableName = viewName + pageId;
                    }
                }
            }

            if (this.GetProject().CollectedData.TableExists(tableName))
            {
                dataTable = GetProject().GetTableData(tableName);
            }

            return(dataTable);
        }
        /// <summary>
        /// Dialog to select a tble 
        /// </summary>       
        /// <param name="frm">The main form</param>
        public TableSelectionDialog(Epi.Windows.MakeView.Forms.MakeViewMainForm frm)
            : base(frm)
        {
            // This call is required by the Windows Form Designer.
            InitializeComponent();

            if (frm.projectExplorer != null)
            {
                if (frm.projectExplorer.currentPage != null)
                {
                    this.project = frm.projectExplorer.currentPage.view.Project;
                    this.MetaDataProvider = this.project.Metadata;
                }
            }
        }
        /// <summary>
        /// Dialog to select a tble
        /// </summary>
        /// <param name="frm">The main form</param>
        public TableSelectionDialog(Epi.Windows.MakeView.Forms.MakeViewMainForm frm)
            : base(frm)
        {
            // This call is required by the Windows Form Designer.
            InitializeComponent();


            if (frm.projectExplorer != null)
            {
                if (frm.projectExplorer.currentPage != null)
                {
                    this.project          = frm.projectExplorer.currentPage.view.Project;
                    this.MetaDataProvider = this.project.Metadata;
                }
            }
        }
        private void Button3_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            // openFileDialog.Filter = "Epi2000 and Epi7 Project Files (*.mdb;*.prj)|*.mdb;*.prj|Epi2000 Project files (*.mdb)|*.mdb |Epi7 Project Files (*.prj)|*.prj";
#if LINUX_BUILD
            openFileDialog.Filter = "*.prj";
#else
            openFileDialog.Filter = "Epi2000 and Epi7 Project Files (*.mdb;*.prj)|*.mdb;*.prj|Epi2000 Project files (*.mdb)|*.mdb|Epi7 Project Files (*.prj)|*.prj";
#endif

            openFileDialog.FilterIndex = 1;
            openFileDialog.Multiselect = false;
            DialogResult res = openFileDialog.ShowDialog();
            if (res == DialogResult.OK)
            {
                string filePath = openFileDialog.FileName.Trim();
                System.Collections.Generic.List <string> TableList;

                if (filePath.EndsWith(".prj"))
                {
                    this.project          = new Project(filePath);
                    this.MetaDataProvider = this.project.Metadata;
                    TableList             = this.project.Metadata.GetDataTableList();
                }
                else
                {
                    // to do
                    TableList = new System.Collections.Generic.List <string>();
                    TableList.Add("to do add datatables for non epi7 projects");
                }
                ListBox1.Items.Clear();
                this.Text = "Selected Project: " + this.project.Name;
                foreach (string t in TableList)
                {
                    if (!string.IsNullOrEmpty(t))
                    {
                        ListBox1.Items.Add(t);
                    }
                }
            }
        }
        /// <summary>
        /// Cancel button closes this dialog 
        /// </summary>
        /// <param name="sender">Object that fired the event</param>
        /// <param name="e">.NET supplied event parameters</param>
        private void btnCancel_Click(object sender, System.EventArgs e)
        {
            this.project = null;
            this.MetaDataProvider = null;
            this.SelectedTable = null;

            this.Close();
        }
        private void Button3_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            // openFileDialog.Filter = "Epi2000 and Epi7 Project Files (*.mdb;*.prj)|*.mdb;*.prj|Epi2000 Project files (*.mdb)|*.mdb |Epi7 Project Files (*.prj)|*.prj";
            #if LINUX_BUILD
            openFileDialog.Filter = "*.prj";
            #else
            openFileDialog.Filter = "Epi2000 and Epi7 Project Files (*.mdb;*.prj)|*.mdb;*.prj|Epi2000 Project files (*.mdb)|*.mdb|Epi7 Project Files (*.prj)|*.prj";
            #endif

            openFileDialog.FilterIndex = 1;
            openFileDialog.Multiselect = false;
            DialogResult res = openFileDialog.ShowDialog();
            if (res == DialogResult.OK)
            {

                string filePath = openFileDialog.FileName.Trim();
                System.Collections.Generic.List<string> TableList;

                if (filePath.EndsWith(".prj"))
                {
                    this.project = new Project(filePath);
                    this.MetaDataProvider = this.project.Metadata;
                    TableList = this.project.Metadata.GetDataTableList();
                }
                else
                {
                    // to do
                    TableList = new System.Collections.Generic.List<string>();
                    TableList.Add("to do add datatables for non epi7 projects");
                }
                ListBox1.Items.Clear();
                this.Text = "Selected Project: " + this.project.Name;
                foreach (string t in TableList)
                {
                    if (!string.IsNullOrEmpty(t))
                    {
                        ListBox1.Items.Add(t);
                    }
                }

            }
        }