Exemplo n.º 1
0
        private void ItemReportEdit_Click(object sender, EventArgs e)
        {
            frmPubDesign frm = new frmPubDesign(Report, ItemReportEdit.Text + "[" + title + "]", reportFile, TableName, reportName);
            bool         ret = (frm.ShowDialog() == DialogResult.OK);

            if (ret)
            {
                string ConnStr = Report.DetailGrid.Recordset.ConnectionString;
                string sql     = Report.DetailGrid.Recordset.QuerySQL;
                try
                {
                    printView.Stop();
                    Report.LoadFromFile(reportFile);
                    Report.DetailGrid.Recordset.ConnectionString = ConnStr;
                    Report.DetailGrid.Recordset.QuerySQL         = sql;
                    printView.Start();
                }
                catch
                {
                }
                finally
                {
                    printView.Refresh();
                }
            }
        }
Exemplo n.º 2
0
        private void ShowReport(bool IsDesign)
        {
            DataRowView drv        = (DataRowView)bindingSource.Current;
            string      SysID      = ReportHeader + drv.Row["GUID"].ToString();
            string      ReportName = drv.Row["ReportName"].ToString();
            string      ReportView = drv.Row["ReportView"].ToString();
            string      ReportData = "";
            string      OrderField = drv.Row["OrderField"].ToString();
            byte        DateFlag   = 0;

            byte.TryParse(drv.Row["DateFlag"].ToString(), out DateFlag);
            string          DateField = drv.Row["DateField"].ToString();
            DataTableReader dr        = null;
            bool            IsError   = false;

            try
            {
                dr = db.GetDataReader(Pub.GetSQL(DBCode.DB_000001, new string[] { "604", ReportTable, ReportName }));
                if (dr.Read())
                {
                    ReportData = dr["ReportData"].ToString();
                    Report.Register(SystemInfo.ReportRegister);
                    Report.LoadFromStr(ReportData);
                }
                else
                {
                    IsError = true;
                }
            }
            catch (Exception E)
            {
                IsError = true;
                Pub.ShowErrorMsg(E);
            }
            finally
            {
                if (dr != null)
                {
                    dr.Close();
                }
                dr = null;
            }
            if (IsError)
            {
                return;
            }
            if (IsDesign)
            {
                frmPubDesign frm = new frmPubDesign(Report, ReportName, "", ReportTable, ReportName);
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    ExecItemRefresh();
                }
            }
            else
            {
                frmPubShowReport frm = new frmPubShowReport(ReportTable, ReportName, ReportView, ReportData,
                                                            OrderField, DateFlag, DateField);
                frm.Tag  = SysID;
                frm.Name = "frm" + ReportHeader + ReportName;
                frm.Text = ReportName;
                if (appMainForm != null)
                {
                    appMainForm.ExecShowReport(frm);
                }
            }
        }