Exemple #1
0
        private bool DoReportPreview()
        {
            if (tbReportSyntax.Text.Length < 1)
            {
                if (!DoReportSyntax())
                {
                    return(false);
                }
            }

            rdlViewer1.SourceRdl = tbReportSyntax.Text;
            fyiReporting.RDL.Report  rpt = rdlViewer1.Report;
            fyiReporting.RDL.DataSet ds  = rpt.DataSets["Data"];
            ds.SetData(DataTableConvert.ToDataTable(this.DataEntity));
            rdlViewer1.Rebuild();

            return(true);
        }
Exemple #2
0
        /// <summary>
        /// 生成表列名称列表。
        /// </summary>
        /// <param name="table"></param>
        /// <returns></returns>
        static internal ArrayList GetSqlColumns(BaseDataEntity DataEntity)
        {
            ArrayList cols = new ArrayList();

            if (DataEntity != null)
            {
                System.Data.DataTable dataTable = DataTableConvert.ToDataTable(DataEntity);

                foreach (System.Data.DataColumn dc in dataTable.Columns)
                {
                    SqlColumn sc = new SqlColumn();
                    sc.Name     = dc.ColumnName;
                    sc.DataType = dc.DataType;
                    cols.Add(sc);
                }
            }

            return(cols);
        }
Exemple #3
0
        /// <summary>
        /// 生成表列名称列表。
        /// </summary>
        /// <param name="table"></param>
        /// <returns></returns>
        static internal ArrayList GetSqlColumns(EAS.Data.ORM.ITable table)
        {
            ArrayList cols = new ArrayList();

            if (table != null)
            {
                System.Data.DataTable dataTable = DataTableConvert.ToDataTable(table);

                foreach (System.Data.DataColumn dc in dataTable.Columns)
                {
                    SqlColumn sc = new SqlColumn();
                    sc.Name     = dc.ColumnName;
                    sc.DataType = dc.DataType;
                    cols.Add(sc);
                }
            }

            return(cols);
        }
Exemple #4
0
        private void tcEHP_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            TabControl tc  = (TabControl)sender;
            string     tag = (string)tc.TabPages[tc.SelectedIndex].Tag;

            // Sync up the various pane whenever they switch so the editor is always accurate
            switch (_DesignChanged)
            {                   // Sync up the editor in every case
            case "design":
                // sync up the editor
                tbEditor.Text     = dcDesign.ReportSource;
                tbEditor.Modified = true;
                break;

            case "edit":
            case "preview":
                break;

            default:                            // this can happen the first time
                if (tbEditor.Text.Length <= 0)
                {
                    tbEditor.Text = dcDesign.ReportSource;
                }
                break;
            }

            // Below sync up the changed item
            if (tag == "preview")
            {
                if (rdlPreview.SourceRdl != tbEditor.Text)                                      // sync up preview
                {
                    this.rdlPreview.SourceRdl = this.tbEditor.Text;
                }

                if (tbEditor.Text.IndexOf("Component") > -1)
                {
                    int len    = ("<ConnectString>").Length;
                    int iStart = tbEditor.Text.IndexOf("<ConnectString>");
                    int iEnd   = tbEditor.Text.IndexOf("</ConnectString>");

                    try
                    {
                        string   text     = tbEditor.Text.Substring(iStart + len, iEnd - iStart - len);
                        string[] sv       = text.Split(',');
                        string   t        = sv[0];
                        string   f        = sv[1];
                        Assembly assembly = Assembly.LoadFrom(f);
                        if (assembly != null)
                        {
                            BaseDataEntity           dataEntity = assembly.CreateInstance(t) as BaseDataEntity;
                            DataTable                dt         = DataTableConvert.ToDataTable2(dataEntity);
                            fyiReporting.RDL.Report  rpt        = this.rdlPreview.Report;
                            fyiReporting.RDL.DataSet ds         = rpt.DataSets["Data"];
                            ds.SetData(dt);
                            this.rdlPreview.Rebuild();
                        }
                    }
                    catch { }
                }
            }
            else if (tag == "design")
            {
                if (_DesignChanged != "design" && _DesignChanged != null)
                {
                    try
                    {
                        dcDesign.ReportSource = tbEditor.Text;
                    }
                    catch (Exception ge)
                    {
                        MessageBox.Show(ge.Message, "Report");
                        tc.SelectedIndex = 1;                           // Force current tab to edit syntax
                        return;
                    }
                }
            }

            _CurrentTab = tag;
            if (OnDesignTabChanged != null)
            {
                OnDesignTabChanged(this, e);
            }
        }