using System; 
 | 
using System.Collections.Generic; 
 | 
using System.Text; 
 | 
using gregn6Lib; 
 | 
//using AxgrproLib; 
 | 
using System.Data; 
 | 
  
 | 
namespace BLL 
 | 
{ 
 | 
    class ReportCls 
 | 
    { 
 | 
        //public static string spName = string.Empty; 
 | 
        //public static object[] parameterValues; 
 | 
        //public static string ExecuteStr = string.Empty; 
 | 
        //public static bool IsDate = false; 
 | 
        //public static DateTime FirstDate = DateTime.Today; 
 | 
        //public static DateTime LastDate = DateTime.Today; 
 | 
  
 | 
        private string _spName = string.Empty; 
 | 
        private object[] _parameterValues; 
 | 
        private bool _IsDate = false; 
 | 
        private DateTime _FirstDate = DateTime.Today; 
 | 
        private DateTime _LastDate = DateTime.Today; 
 | 
        private DataTable _Dt; 
 | 
  
 | 
        public DataTable Dt 
 | 
        { 
 | 
            get { return _Dt; } 
 | 
            set { _Dt = value; } 
 | 
        } 
 | 
  
 | 
        public String spName 
 | 
        { 
 | 
            get { return _spName; } 
 | 
            set { _spName = value; } 
 | 
        } 
 | 
  
 | 
        public object[] parameterValues 
 | 
        { 
 | 
            get { return _parameterValues; } 
 | 
            set { _parameterValues = value; } 
 | 
        } 
 | 
  
 | 
        public bool IsDate 
 | 
        { 
 | 
            get { return _IsDate; } 
 | 
            set { _IsDate = value; } 
 | 
        } 
 | 
  
 | 
        public DateTime FirstDate 
 | 
        { 
 | 
            get { return _FirstDate; } 
 | 
            set { _FirstDate = value; } 
 | 
        } 
 | 
  
 | 
        public DateTime LastDate 
 | 
        { 
 | 
            get { return _LastDate; } 
 | 
            set { _LastDate = value; } 
 | 
        } 
 | 
  
 | 
        private GridppReport Report = new GridppReport(); 
 | 
  
 | 
        public void LoadReport(String sFileName) 
 | 
        { 
 | 
            Report.LoadFromFile(sFileName+ ".grf"); 
 | 
            Report.BeforePostRecord += new _IGridppReportEvents_BeforePostRecordEventHandler(ReportBeforePostRecord); 
 | 
            Report.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(ReportFetchRecord); 
 | 
        } 
 | 
  
 | 
        //public void LoadReport(AxGRDisplayViewer sGR, String sFileName) 
 | 
        //{ 
 | 
  
 | 
        //    //Report.LoadFromFile(System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + (@"Report\") + sFileName + ".grf"); 
 | 
        //    Report.LoadFromFile(sFileName); 
 | 
        //    Report.BeforePostRecord += new _IGridppReportEvents_BeforePostRecordEventHandler(ReportBeforePostRecord); 
 | 
        //    Report.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(ReportFetchRecordByDataTable); 
 | 
        //    sGR.Report = Report; 
 | 
        //    sGR.Start(); 
 | 
        //} 
 | 
  
 | 
        public void ReportBeforePostRecord() 
 | 
        { 
 | 
            if (_IsDate == true) 
 | 
            { 
 | 
                Report.FieldByName("FirstDate").AsDateTime = _FirstDate; 
 | 
                Report.FieldByName("LastDate").AsDateTime = _LastDate; 
 | 
            } 
 | 
        } 
 | 
  
 | 
        public void ReportFetchRecord() 
 | 
        { 
 | 
            //SqlDataReader Dr = SqlHelper.ExecuteReader(Configs.GetConnectionString(), CommandType.Text, ExecuteStr); 
 | 
            // Dr = SqlHelper.ExecuteReader(Configs.GetConnectionString(), _spName, _parameterValues); 
 | 
            //GridppReportCls.Utility.FillRecordToReport(Report, Dr); 
 | 
            //Dr.Close(); 
 | 
            //Dr.Dispose(); 
 | 
        } 
 | 
  
 | 
        public void ReportFetchRecordByDataTable() 
 | 
        { 
 | 
  
 | 
            Utility.FillRecordToReport(Report, Dt); 
 | 
            Dt.Dispose(); 
 | 
        } 
 | 
  
 | 
        public void ReportPreview() 
 | 
        { 
 | 
            Report.PrintPreview(true); 
 | 
        } 
 | 
  
 | 
        public void ReportPrint() 
 | 
        { 
 | 
            Report.Print(true); 
 | 
        } 
 | 
  
 | 
        public void ReportExport() 
 | 
        { 
 | 
            Report.ExportDirect(GRExportType.gretXLS, Report.Title, false, true); 
 | 
        } 
 | 
    } 
 | 
} 
 |