Пример #1
0
        /// <summary>
        /// 编辑数据表
        /// </summary>
        private void EditDataTable()
        {
            TreeNode Node = DataSourceView.SelectedNode;

            if (Node == null)
            {
                return;
            }

            TableData Source = Node.Tag as TableData;

            if (Source is DbTableData)//当TableData为DbTableData类型时
            {
                DataTableDialog TableDialog = new DataTableDialog();
                TableDialog.TableData = (Source as DbTableData);
                if (DialogResult.OK == TableDialog.ShowDialog())
                {
                    if (Report.Configuration.DataSources.IndexOf(TableDialog.TableData) == -1)
                    {
                        Report.Configuration.DataSources.Add(TableDialog.TableData);
                    }

                    ShowTableFields();
                }
            }
            else if (Source is ArrayTableData)//当TableData为ArrayTableData类型时
            {
                ConstantDataTableDialog ConstantDataTableDialog = new ConstantDataTableDialog();
                ConstantDataTableDialog.TableData = (Source as ArrayTableData);
                if (DialogResult.OK == ConstantDataTableDialog.ShowDialog())
                {
                    if (Report.Configuration.DataSources.IndexOf(ConstantDataTableDialog.TableData) == -1)
                    {
                        Report.Configuration.DataSources.Add(ConstantDataTableDialog.TableData);
                    }

                    ShowTableFields();
                }
            }
            else if (Source is JoinTableData)//当TableData为JoinTableData类型时
            {
                CustomDataTableDialog CustomDataTableDialog = new CustomDataTableDialog();
                Form Owner = Cache.CustomCache[SystemString.主窗口] as Form;
                CustomDataTableDialog.Location  = Owner.PointToScreen(Owner.ClientRectangle.Location);
                CustomDataTableDialog.Size      = Owner.ClientRectangle.Size;
                CustomDataTableDialog.TableData = (Source as JoinTableData);
                if (DialogResult.OK == CustomDataTableDialog.ShowDialog())
                {
                    if (Report.Configuration.DataSources.IndexOf(CustomDataTableDialog.TableData) == -1)
                    {
                        Report.Configuration.DataSources.Add(CustomDataTableDialog.TableData);
                    }

                    ShowTableFields();
                }
            }
        }
Пример #2
0
        /// <summary>
        /// 添加自定义数据表
        /// </summary>
        private void AppendCustomDataTable()
        {
            CustomDataTableDialog CustomDataTableDialog = new CustomDataTableDialog();
            Form Owner = Cache.CustomCache[SystemString.主窗口] as Form;

            CustomDataTableDialog.Location = Owner.PointToScreen(Owner.ClientRectangle.Location);
            CustomDataTableDialog.Size     = Owner.ClientRectangle.Size;
            if (DialogResult.OK == CustomDataTableDialog.ShowDialog())
            {
                if (Report.Configuration.DataSources.IndexOf(CustomDataTableDialog.TableData) == -1)
                {
                    Report.Configuration.DataSources.Add(CustomDataTableDialog.TableData);
                }

                ShowTableFields();
            }
        }