protected virtual void OnSessionWorkerInit(SessionWorkerArgs args) { if (SessionWorkerInit != null) { SessionWorkerInit(this, args); } }
protected void swReport_SessionWorkerInit(object sender, SessionWorkerArgs e) { Type type = null; if (webReportManager.Plugin != null && webReportManager.Plugin.Table != null) { type = webReportManager.Plugin.Table.DataSet.GetType(); } var sessionWorker = new SessionWorker(Page, swReport.Key); var obj = sessionWorker.Object; if (type == null) { sessionWorker.RemoveObject(); } if (((obj != null && obj.GetType() != type) || obj == null) && type != null) { sessionWorker.Object = Activator.CreateInstance(type); } e.SessionWorker = sessionWorker; }
protected SessionWorker InitSessionWorker() { SessionWorkerArgs args = new SessionWorkerArgs(); OnSessionWorkerInit(args); if (args.SessionWorker == null) { SessionWorker worker = new SessionWorker(Page, Key); if (!string.IsNullOrEmpty(typeName)) { Type type = BuildManager.GetType(typeName, false, true); if (type != null) { ConstructorInfo info = type.GetConstructor(new Type[] {}); if (info == null) { throw new Exception(string.Format("“ип '{0}' не содержит пустого конструктора. ({1})", type.FullName, ID)); } worker.Object = info.Invoke(new object[0]); } } else { throw new Exception("SessionWorker не инициализирован"); } return(worker); } if (string.IsNullOrEmpty(args.SessionWorker.Key)) { args.SessionWorker.Key = Key; } if (args.SessionWorker.Session == null) { args.SessionWorker.SetSession(Page.Session); } return(args.SessionWorker); }