/// <summary> /// 输出用户操作日志 /// </summary> /// <param name="LogType">日志的类型</param> public void WriteLog(OThinker.H3.Tracking.UserLogType LogType) { OThinker.H3.Tracking.UserLog log = new OThinker.H3.Tracking.UserLog( LogType, this.User.UserID, this.SchemaCode, this.BizObjectID, this.InstanceId, this.WorkItemID, this.WorkItem == null ? null : this.WorkItem.DisplayName, null, SheetUtility.GetClientIP(this.Request), SheetUtility.GetClientPlatform(this.Request), SheetUtility.GetClientBrowser(this.Request)); this.Engine.UserLogWriter.Write(log); }
/// <summary> /// 增加当前在线用户数 /// </summary> /// <param name="User"></param> /// <param name="Request"></param> /// <param name="PortalType"></param> public static void OnUserLogin(UserValidator User, HttpRequest Request, Site.PortalType PortalType = Site.PortalType.Portal) { lock (_OnlineUserIdAliasTable) { OThinker.H3.Tracking.UserLog log = new Tracking.UserLog( Tracking.UserLogType.Login, User.UserID, null, null, null, null, null, null, SheetUtility.GetClientIP(Request), SheetUtility.GetClientPlatform(Request), SheetUtility.GetClientBrowser(Request)); if (_OnlineUserIdAliasTable.ContainsKey(User.UserID.ToLower())) { //_OnlineUserIdAliasTable.Remove(User.UserID); //_OnlineUserIdLoginTimeTable.Remove(User.UserID); return; } _OnlineUserIdAliasTable.Add(User.UserID, User.UserCode); _OnlineUserIdLoginTimeTable.Add(User.UserID, DateTime.Now); log.UserCode = User.UserCode; log.SiteType = PortalType; if (OThinker.H3.Controllers.AppConfig.ConnectionMode == OThinker.H3.ConnectionStringParser.ConnectionMode.Mono) { // 私有云模式批量写入 if (!_UserLogTable.ContainsKey(User.UserID.ToLower())) { _UserLogTable.Add(User.UserID.ToLower(), log); } } else { // 公有云模式登录即写入 User.Engine.UserLogWriter.Write(log); } } }
/// <summary> /// 用户登出事件 /// </summary> /// <param name="User"></param> /// <param name="Request"></param> public static void OnUserLogout(UserValidator User, HttpRequest Request) { if (User == null) { return; } // 减少当前用户数 //lock (_UserLogTable) lock (_OnlineUserIdAliasTable) { //if (!_UserLogTable.ContainsKey(User.UserID.ToLower())) //{ // return; //} if (!_OnlineUserIdAliasTable.ContainsKey(User.UserID.ToLower())) { return; } _OnlineUserIdAliasTable.Remove(User.UserID); _OnlineUserIdLoginTimeTable.Remove(User.UserID); OThinker.H3.Tracking.UserLog log = new Tracking.UserLog( Tracking.UserLogType.Logout, User.UserID, null, null, null, null, null, null, SheetUtility.GetClientIP(Request), SheetUtility.GetClientPlatform(Request), SheetUtility.GetClientBrowser(Request)); if (!_UserLogTable.ContainsKey(User.UserID.ToLower())) { _UserLogTable.Add(User.UserID.ToLower(), log); } } }
private BizBus.Filter.Filter GetFilter() { BizBus.Filter.Filter filter = new BizBus.Filter.Filter(); And and = new And(); filter.Matcher = and; if (this.BizQuery == null) { return(filter); } //读取默认值和传入的映射 Dictionary <string, object> items = new Dictionary <string, object>(); Dictionary <string, DataModel.BizQueryItem> QueryItems = new Dictionary <string, DataModel.BizQueryItem>(); if (this.BizQuery.QueryItems == null) { this.BizQuery.QueryItems = new DataModel.BizQueryItem[] {} } ; foreach (DataModel.BizQueryItem QueryItem in this.BizQuery.QueryItems) { QueryItems.Add(QueryItem.PropertyName, QueryItem); if (QueryItem.FilterType == OThinker.H3.DataModel.FilterType.SystemParam) { items.Add(QueryItem.PropertyName, SheetUtility.GetSystemParamValue(this.UserValidator, QueryItem.DefaultValue)); } else { //设置默认值 if (!string.IsNullOrWhiteSpace(QueryItem.DefaultValue)) { items.Add(QueryItem.PropertyName, SheetUtility.GetSystemParamValue(this.UserValidator, QueryItem.DefaultValue)); } //设置映射传入的值 if (this.InputMapping != null) { if (this.InputMapping.ContainsKey(QueryItem.PropertyName)) { if (items.ContainsKey(QueryItem.PropertyName)) { items[QueryItem.PropertyName] = this.InputMapping[QueryItem.PropertyName]; } else { items.Add(QueryItem.PropertyName, this.InputMapping[QueryItem.PropertyName]); } } } } } //页面传过来的值 string FilterStr = Request["Filters"] ?? ""; if (!string.IsNullOrWhiteSpace(FilterStr)) { Dictionary <string, string> Filters = Newtonsoft.Json.JsonConvert.DeserializeObject <Dictionary <string, string> >(FilterStr); foreach (string key in Filters.Keys) { if (!QueryItems.ContainsKey(key)) { continue; } DataModel.BizQueryItem QueryItem = QueryItems[key]; if (QueryItem.FilterType == OThinker.H3.DataModel.FilterType.SystemParam) { continue; } if (QueryItem.Visible == OThinker.Data.BoolMatchValue.False) { continue; } if (items.ContainsKey(key)) { items[key] = Filters[key]; } else { items.Add(key, Filters[key]); } } } //添加到过滤集合 foreach (string key in items.Keys) { DataModel.BizQueryItem QueryItem = QueryItems[key]; if (QueryItem.FilterType == OThinker.H3.DataModel.FilterType.Equals || QueryItem.FilterType == OThinker.H3.DataModel.FilterType.SystemParam) { and.Add(new ItemMatcher(key, OThinker.Data.ComparisonOperatorType.Equal, items[key])); } else if (QueryItem.FilterType == OThinker.H3.DataModel.FilterType.Contains) { and.Add(new ItemMatcher(key, OThinker.Data.ComparisonOperatorType.Contain, items[key])); } else if (QueryItem.FilterType == OThinker.H3.DataModel.FilterType.Scope) { string[] vals = items[key].ToString().Split(';'); if (vals.Length > 1) { and.Add(new ItemMatcher(key, OThinker.Data.ComparisonOperatorType.NotBelow, vals[0])); } if (vals.Length > 2) { and.Add(new ItemMatcher(key, OThinker.Data.ComparisonOperatorType.NotAbove, vals[1])); } } } //设置排序 filter.AddSortBy(new SortBy(this.BizQuery.Columns.FirstOrDefault().PropertyName, SortDirection.Ascending)); return(filter); } }
/// <summary> /// 从服务器读取数据 /// </summary> private void GetDataFromServer() { if (!_GetDataFromServer) { _GetDataFromServer = true; string strWorkItemId = OThinker.Data.Convertor.SqlInjectionPrev(this.Request.QueryString[Param_WorkItemID]); string strInstanceId = OThinker.Data.Convertor.SqlInjectionPrev(this.Request.QueryString[Param_InstanceId]); string strWorkflowCode = OThinker.Data.Convertor.SqlInjectionPrev(this.Request.QueryString[Param_WorkflowCode]); string strSchemaCode = OThinker.Data.Convertor.SqlInjectionPrev(this.Request.QueryString[Param_SchemaCode]); int workflowVersion = WorkflowTemplate.PublishedWorkflowTemplate.NullWorkflowVersion; int.TryParse(this.Request.QueryString[Param_WorkflowVersion], out workflowVersion); string strSheetCode = OThinker.Data.Convertor.SqlInjectionPrev(this.Request.QueryString[OThinker.H3.Controllers.SheetEnviroment.Param_SheetCode] + string.Empty); if (!string.IsNullOrEmpty(strWorkItemId) || !string.IsNullOrEmpty(strInstanceId) || (this.IsOriginateMode && !string.IsNullOrEmpty(strWorkflowCode))) { // 流程模式 this._SheetDataType = SheetDataType.Workflow; } else if (!string.IsNullOrEmpty(strSchemaCode)) { // 开发平台模式 this._SheetDataType = SheetDataType.BizObject; } if (this.SheetDataType == SheetDataType.Workflow) { this.Engine.Interactor.GetDataForWorkflow( (InteractiveType)this.SheetMode, strWorkflowCode, workflowVersion, strInstanceId, strWorkItemId, strSheetCode, this.User.UserID, SheetUtility.GetClientIP(this.Request), SheetUtility.GetClientPlatform(this.Request), SheetUtility.GetClientBrowser(this.Request), out this._Authorized, out this._InstanceContext, out this._WorkItem, out this._CirculateItem, out this._Workflow, out this._Schema, out this._ActivityCode, out this._Sheet, out this._PostUnits, out this._SheetDisplayName, out this._LockValidation, out this._Message); } else { this.Engine.Interactor.GetDataForBizObject( strSchemaCode, strSheetCode, out this._Schema, out this._Sheet); } } }