public override IDbConnection openDbConnection(CXLReportConfig cfg) { IDbConnection v_conn = null; if (!String.IsNullOrEmpty(cfg.connStr)) { v_conn = new SqlConnection(cfg.connStr); v_conn.Open(); } return v_conn; }
//constructor public CXLReport(Object opener, CXLReportConfig cfg, HttpContext httpContext, Excel.Application excelInst) { this.State = RemoteProcState.Redy; this.FOpener = opener; this.FRptDefinition = new CXLRDefinition(this, cfg); this.FHttpContext = httpContext; this.FDataSources = new XLRDataSources(this, cfg.dss); this.FExcelSrvIsOutter = (excelInst != null); this.FExcelSrv = new ExcelSrv(excelInst); this.FLastReportResultFile = this.FRptDefinition.GetNewTempFileName(); }
public override IDbConnection openDbConnection(CXLReportConfig cfg) { if (cfg.dbSession != null) return cfg.dbSession.GetConnection(); else { if((this._dbSess == null) && !String.IsNullOrEmpty(cfg.connStr)) this._dbSess = new DBSession(cfg.connStr); if (this._dbSess != null) return this._dbSess.GetConnection(); else return null; } }
public CXLRDefinition(CXLReport owner, CXLReportConfig rptCfg) { this._owner = owner; this._rptCfg = rptCfg; this._rptCfg.detectTemplateFileName(); if (!this.InParams.ParamExists("SYS_CURUSERUID", true)) this.InParams.Add("SYS_CURUSERUID", this._rptCfg.extAttrs.userUID); if (!this.InParams.ParamExists("SYS_CURUSERIP", true)) this.InParams.Add("SYS_CURUSERIP", this._rptCfg.extAttrs.remoteIP); if (!this.InParams.ParamExists("SYS_CURUSERROLES", true)) this.InParams.Add("SYS_CURUSERROLES", this._rptCfg.extAttrs.roles); if (!this.InParams.ParamExists("SYS_CURODEPUID", true)) this.InParams.Add("SYS_CURODEPUID", this._rptCfg.extAttrs.userUID); if (!this.InParams.ParamExists("SYS_TITLE", true)) this.InParams.Add("SYS_TITLE", this._rptCfg.title); }
private void _doOnRunEventXls(RmtThreadHandler sender, out IRemoteProcInst instance) { var title = this.BioRequest<RmtClientRequest>().title; title = title != null ? title.Replace("<br>", "\n") : ""; var io = this.BioSession.IObj_get(this.bioCode); if (io == null) throw new Exception(String.Format("Bio {0} не найден!", this.bioCode)); var defaultTmpl = this.BioSession.Cfg.IniPath + "iod\\bio2xl_default.xlsm"; var customTmpl = io.ioTemplate2XL; if ((!File.Exists(defaultTmpl)) && (String.IsNullOrEmpty(customTmpl))) throw this.creBioEx("Шаблон для экспорта не найден в системе.", null); var isDefaultTempl = true; var seldTempl = defaultTmpl; if (!String.IsNullOrEmpty(customTmpl)) { seldTempl = customTmpl; isDefaultTempl = false; } var rptCfg = new CXLReportConfig(); rptCfg.fullCode = io.bioCode; rptCfg.extAttrs.roles = "all"; rptCfg.debug = false; rptCfg.extAttrs.liveScripts = false; rptCfg.templateAdv = seldTempl; rptCfg.title = title; rptCfg.filenameFmt = "{$code}_{$now}"; rptCfg.dbSession = this.BioSession.Cfg.dbSession; rptCfg.extAttrs.sessionID = this.BioSession.CurSessionID; rptCfg.extAttrs.userUID = this.BioSession.Cfg.CurUser.UID; rptCfg.extAttrs.remoteIP = this.BioSession.CurSessionRemoteIP; rptCfg.extAttrs.workPath = this.BioSession.Cfg.WorkspacePath; foreach (var prm in this.bioParams) rptCfg.inPrms.Add((Param) prm.Clone()); foreach (var prm in this.bioParams) rptCfg.rptPrms.Add(prm.Name, prm.Value, "str"); rptCfg.debug = Xml.getAttribute<Boolean>(io.IniDocument.XmlDoc.DocumentElement, "debug", false); rptCfg.dss.Add(CXLReportDSConfig.DecodeFromBio( io.IniDocument.XmlDoc.DocumentElement, io.LocalPath, "cdsRpt", "mRng", rptCfg.title, null)); instance = new CXLReport(io, rptCfg, this.Context); if (isDefaultTempl) (instance as CXLReport).OnPrepareTemplate += this.DoOnPrepareTemplate; }
protected override void doOnDispose() { this._owner = null; this._rptCfg = null; }
public CXLReport(CXLReportConfig cfg) : this(null, cfg, null, null) { }
public CXLReport(Object opener, CXLReportConfig cfg) : this(opener, cfg, null, null) { }
public CXLReport(Object opener, CXLReportConfig cfg, HttpContext httpContext) : this(opener, cfg, httpContext, null) { }
/// <summary> /// Синхронный вызов построителя отчета /// </summary> /// <param name="cfg"></param> /// <returns></returns> public static String BuildReportSync(CXLReportConfig cfg) { String vResult = null; //String vRptDefDoc = BuildReportConfigXml(rpt_title, rpt_desc, rpt_template, null, dataFactoryTypeName, reportResultFileName, dss, connStr, debug); //CXLReport xlReportDocument = new CXLReport(null, vRptDefDoc, null, null); CXLReport xlReportDocument = new CXLReport(cfg); try { //xlReportDocument.DataSources.Add("cdsRpt", "mRng", null, dataFactoryTypeName); //xlReportDocument.RptDefinition.RptParams.AddRange(rpt_params); //xlReportDocument.RptDefinition.InParams.AddRange(rpt_params); xlReportDocument.BuildReportSync(); vResult = xlReportDocument.LastResultFile; } finally { xlReportDocument.Dispose(); } return vResult; }