public TreeViewSearchBox() { InitializeComponent(); SetInactiveSearchStyle(); _searchResultView = SearchResultView.List; _searchLevel = SearchLevel.Root; _inactiveSearchText = "Search..."; _inactiveColor = Color.LightGray; _activeColor = Color.Gray; _mouseOnControlColor = Color.Silver; _toolTip = string.Empty; _clearButtonToolTip = string.Empty; _clearButtonImage = new Bitmap(btnClear.Image); btnClear.Image = null; }
/// <summary> /// /// </summary> /// <typeparam name="T"></typeparam> /// <param name="matchString"></param> /// <param name="includeSideLine"></param> /// <param name="level"></param> /// <param name="returnCount"></param> /// <returns></returns> public OguObjectCollection <T> QueryChildren <T>(string matchString, bool includeSideLine, SearchLevel level, int returnCount) where T : IOguObject { return(BaseOrganization.QueryChildren <T>(matchString, includeSideLine, level, returnCount)); }
/// <summary> /// 在子对象进行查询(所有级别深度) /// </summary> /// <typeparam name="T">期望的类型</typeparam> /// <param name="parent">父机构对象</param> /// <param name="matchString">模糊查询的字符串</param> /// <param name="includeSideLine">是否包含兼职的人员</param> /// <param name="level">查询的深度</param> /// <param name="returnCount">返回的记录数</param> /// <returns>得到查询的子对象</returns> public OguObjectCollection <T> QueryChildren <T>(IOrganization parent, string matchString, bool includeSideLine, SearchLevel level, int returnCount) where T : IOguObject { //SCObjectAndRelationCollection objRelations = PC.Adapters.SCSnapshotAdapter.Instance.QueryObjectAndRelationByKeyword(parent.ID, matchString, null, returnCount, level == SearchLevel.SubTree, DateTime.MinValue); //TODO: 修改正确 SCObjectAndRelationCollection objRelations = PC.Adapters.SCSnapshotAdapter.Instance.QueryObjectAndRelationByKeywordAndParentIDs(new string[] { "Users", "Groups", "Organizations", "Applications", "Permissions", "Roles", "Conditions" }, new string[] { parent.ID }, matchString, returnCount, level == SearchLevel.SubTree, true, false, DateTime.MinValue); return(GetObjects <T>(SearchOUIDType.Guid, objRelations.ToIDArray())); }
private static void FillOrganizationChildren <T>(string parentID, bool includeSideline, SearchLevel searchLevel, List <T> result) where T : IOguObject { SCObjectAndRelationCollection relations = PC.Adapters.SCSnapshotAdapter.Instance.QueryObjectAndRelationByParentIDs(typeof(T).ToSchemaTypes(), new string[] { parentID }, false, includeSideline, Util.GetContextIncludeDeleted(), DateTime.MinValue); relations.Sort((x, y) => Math.Sign(x.InnerSort - y.InnerSort)); List <T> tempResult = relations.ConvertToOguObjects <T>(); tempResult.ForEach(obj => result.Add(obj)); if (searchLevel == SearchLevel.SubTree) { // 先将下级组织查询出来 SCObjectAndRelationCollection subRelations = PC.Adapters.SCSnapshotAdapter.Instance.QueryObjectAndRelationByParentIDs(typeof(IOrganization).ToSchemaTypes(), new string[] { parentID }, false, includeSideline, Util.GetContextIncludeDeleted(), DateTime.MinValue); subRelations.Sort((x, y) => Math.Sign(x.InnerSort - y.InnerSort)); List <IOrganization> tempSubResult = subRelations.ConvertToOguObjects <IOrganization>(); foreach (IOrganization obj in tempSubResult) { FillOrganizationChildren(obj.ID, includeSideline, searchLevel, result); } } }
public OguObjectCollection <T> GetChildren <T>(IOrganization parent, bool includeSideline, SearchLevel searchLevel) where T : IOguObject { List <T> result = new List <T>(20); FillOrganizationChildren(parent.ID, includeSideline, searchLevel, result); return(new OguObjectCollection <T>(result)); }
/// <summary> /// 在子对象进行查询(所有级别深度) /// </summary> /// <typeparam name="T">期望的类型</typeparam> /// <param name="parent">父机构对象</param> /// <param name="matchString">模糊查询的字符串</param> /// <param name="includeSideLine">是否包含兼职的人员</param> /// <param name="level">查询的深度</param> /// <param name="returnCount">返回的记录数</param> /// <returns>得到查询的子对象</returns> public OguObjectCollection <T> QueryChildren <T>(IOrganization parent, string matchString, bool includeSideLine, SearchLevel level, int returnCount) where T : IOguObject { ExceptionHelper.FalseThrow <ArgumentNullException>(parent != null, "parent"); //ExceptionHelper.CheckStringIsNullOrEmpty(matchString, "matchString"); SchemaType objType = OguObjectHelper.GetSchemaTypeFromInterface <T>(); if (includeSideLine) { objType |= SchemaType.Sideline; } int nDep = 0; if (level == SearchLevel.OneLevel) { nDep = 1; } DataTable table = OguReaderServiceBroker.Instance.QueryOGUByCondition3( parent.ID, (int)SearchOUIDType.Guid, matchString, true, Common.DefaultAttrs, (int)objType, (int)ServiceBrokerContext.Current.ListObjectCondition, nDep, string.Empty, returnCount).Tables[0]; if ((objType & SchemaType.Organizations) == SchemaType.Organizations) { RemoveParentDeptRow(table.Rows, parent); } return(new OguObjectCollection <T>(Common.BuildObjectsFromTable <T>(table, parent))); }
/// <summary> /// 返回机构对象的子对象 /// </summary> /// <typeparam name="T">期望返回的结果对象的类型,IOrganization、IUser、IGroup或IOguObject</typeparam> /// <param name="parent">父机构对象</param> /// <param name="includeSideline">对象的类型</param> /// <param name="searchLevel">查询的深度,单级或所有子对象</param> /// <returns></returns> public OguObjectCollection <T> GetChildren <T>(IOrganization parent, bool includeSideline, SearchLevel searchLevel) where T : IOguObject { ExceptionHelper.FalseThrow <ArgumentNullException>(parent != null, "parent"); SchemaType objType = OguObjectHelper.GetSchemaTypeFromInterface <T>(); if (includeSideline) { objType |= SchemaType.Sideline; } DataTable table = OguReaderServiceBroker.Instance.GetOrganizationChildren( parent.ID, (int)SearchOUIDType.Guid, (int)objType, (int)ServiceBrokerContext.Current.ListObjectCondition, (int)searchLevel, string.Empty, string.Empty, string.Empty, Common.DefaultAttrs).Tables[0]; if ((objType & SchemaType.Organizations) == SchemaType.Organizations) { RemoveParentDeptRow(table.Rows, parent); } return(new OguObjectCollection <T>(Common.BuildObjectsFromTable <T>(table, parent))); }
/// <summary> /// Procedura przygotowująca parametry widma do odpowiedniego typu procedury minimalizacyjnej /// - Pole pod krzywą w zależności od wybranego zakresu /// - Intensywności funkcji zdolności rozdzielczej /// </summary> /// <param name="sm"></param> public override void prepareToSearch(SearchLevel sl, PrepareOptions po) { int i, c, g; ParameterStatus status = ParameterStatus.Free; switch (sl) { case SearchLevel.Local: status |= ParameterStatus.Local; break; case SearchLevel.Global: status |= ParameterStatus.Common; break; } if ((po & PrepareOptions.GlobalArea) == PrepareOptions.GlobalArea) { //pole pod krzywą eksperymentalną w wybranym zakresie this._rangeArea = 0; //for (i = 0; i < this._experimentalSpectrum.Length-1; i++) // this._rangeArea += this._experimentalSpectrum[i]; //this._rangeArea -= (int)((this._experimentalSpectrum.Length - 2) * _parameters[4].Components[0][3].Value); for (i = this._dataBufferStart; i <= this._dataBufferStop; i++) { this._rangeArea += this._container.Data[i]; } this._rangeArea -= (int)(this._dataLength * _parameters[4].Components[0][3].Value); } if ((po & PrepareOptions.ComponentIntensities) == PrepareOptions.ComponentIntensities) { for (g = 1; g < 3; g++) { if (_parameters[g].Components.Size > 0) { if ((_parameters[g].Components[0][0].Status & status) == status && _parameters[g].Components.IntensitiesState != ComponentIntsState.PreparedToSearch) { _parameters[g].Components.IntensitiesState = ComponentIntsState.PreparedToSearch; for (c = 1; c < _parameters[g].Components.Size; c++) { if ((_parameters[g].Components[c][0].Status & status) == status) // && !_parameters[g].Components[c][0].HasReferenceValue) { _parameters[g].Components[c][0].Value = Math.Sqrt(Math.Abs(_parameters[g].Components[c][0].Value / _parameters[g].Components[0][0].Value)); } } } //if ((_parameters[g].Components[0][0].Status & status) == status) _parameters[g].Components[0][0].Value = 1.0; } } if ((((ContributedGroup)_parameters[2]).contribution.Status & status) == status && !((ContributedGroup)_parameters[2]).contribution.HasReferenceValue) { ((ContributedGroup)_parameters[2]).contribution.Value = 1 / (1 / ((ContributedGroup)_parameters[2]).contribution.Value - 1); } } if ((po & PrepareOptions.PromptIntensities) == PrepareOptions.PromptIntensities) { //intensywności funkcji zdolności rozdzielczej. Muszą być tak przekonwertowane, by //pierwszy wyraz był równy 1 if (_parameters[3].Components.Size > 0) { if ((_parameters[3].Components[0][0].Status & status) == status && _parameters[3].Components.IntensitiesState != ComponentIntsState.PreparedToSearch) { _parameters[3].Components.IntensitiesState = ComponentIntsState.PreparedToSearch; for (c = 1; c < _parameters[3].Components.Size; c++) { if ((_parameters[3].Components[c][0].Status & status) == status) // && !_parameters[3].Components[c][0].HasReferenceValue) { _parameters[3].Components[c][0].Value = Math.Sqrt(_parameters[3].Components[c][0].Value / _parameters[3].Components[0][0].Value); } } } //if ((_parameters[3].Components[0][0].Status & status) == status) _parameters[3].Components[0][0].Value = 1.0; } } }
public override void normalizeAfterSearch(SearchLevel sl, PrepareOptions po, bool flagOnly) { int gid, cid; double sum, ifree; ParameterStatus status = ParameterStatus.Free; switch (sl) { case SearchLevel.Local: status |= ParameterStatus.Local; break; case SearchLevel.Global: status |= ParameterStatus.Common; break; //case SearchLevel.Preliminary: status |= ParameterStatus.Local | ParameterStatus.Common; break; } //sample, source, prompt for (gid = 1; gid < 4; gid++) { if (_parameters[gid].Components.Size == 0) { continue; } if (gid < 3 && (po & PrepareOptions.ComponentIntensities) == 0) { continue; } if (gid == 3 && (po & PrepareOptions.PromptIntensities) == 0) { continue; } sum = 1; ifree = 1; if (_parameters[gid].Components.IntensitiesState == ComponentIntsState.PreparedToSearch) { if ((_parameters[gid].Components[0][0].Status & status) == status) { if (!flagOnly) { for (cid = 1; cid < _parameters[gid].Components.Size; cid++) { if ((_parameters[gid].Components[cid][0].Status & ParameterStatus.Fixed) > 0) { ifree -= _parameters[gid].Components[cid][0].Value; } else { sum += _parameters[gid].Components[cid][0].Value * _parameters[gid].Components[cid][0].Value; } } for (cid = 0; cid < _parameters[gid].Components.Size; cid++) { if (((_parameters[gid].Components[cid][0].Status & ParameterStatus.Free) > 0)) // && !_parameters[gid].Components[cid][0].HasReferenceValue) { _parameters[gid].Components[cid][0].Value = ifree * _parameters[gid].Components[cid][0].Value * _parameters[gid].Components[cid][0].Value / sum; } } } _parameters[gid].Components.IntensitiesState = ComponentIntsState.Normed; } } } if ((po & PrepareOptions.ComponentIntensities) > 0) { if ((((ContributedGroup)_parameters[2]).contribution.Status & status) == status && !((ContributedGroup)_parameters[2]).contribution.HasReferenceValue) { ((ContributedGroup)_parameters[2]).contribution.Value = Math.Abs(((ContributedGroup)_parameters[2]).contribution.Value) / (1 + Math.Abs(((ContributedGroup)_parameters[2]).contribution.Value)); } } }
public IEnumerable <Schedule> SelectTables(IEnumerable <Schedule> tables, Regex regExFilter, SearchLevel level) { switch (level) { case SearchLevel.InScheduleName: { return(tables.Where(t => regExFilter.Matches(t.Name).Count > 0)); } case SearchLevel.InNodesAuditoriums: { return(tables.Where(t => t.TablesList.Any(s => s.LectionList.Any(f => f.GetType() == typeof(IAuditoryNode) && regExFilter.Matches(((IAuditoryNode)f).AuditoryName).Count > 0)))); } case SearchLevel.InNodesGroups: { return(tables.Where(t => t.TablesList.Any(s => s.LectionList.Any(f => f.GetType() == typeof(IStudentNode) && regExFilter.Matches(((IStudentNode)f).GroupName).Count > 0)))); } case SearchLevel.InNodesProfessors: { return(tables.Where(t => t.TablesList.Any(s => s.LectionList.Any(f => f.GetType() == typeof(IProfessorNode) && regExFilter.Matches(((IProfessorNode)f).ProfessorName).Count > 0)))); } default: return(new List <Schedule>()); } }
/// <summary> /// 得到该部门的子成员 /// </summary> /// <typeparam name="T">子成员的类型</typeparam> /// <param name="includeSideLine">是否包含兼职</param> /// <param name="searchLevel">是否递归</param> /// <returns>该部门的子成员</returns> protected override OguObjectCollection <T> GetChildren <T>(bool includeSideLine, SearchLevel searchLevel) { OguObjectCollection <T> children = base.GetChildren <T>(includeSideLine, searchLevel); List <T> list = new List <T>(); foreach (T obj in children) { if (obj.ObjectType == SchemaType.Users) { IUser user = (IUser)obj; if (user.Rank >= this.AccessLevel) { list.Add(obj); } } else { list.Add(obj); } } return(new OguObjectCollection <T>(list)); }
/// <summary> /// 得到该部门的子成员 /// </summary> /// <typeparam name="T">子成员的类型</typeparam> /// <param name="includeSideLine">是否包含兼职</param> /// <param name="searchLevel">是否递归</param> /// <returns>该部门的子成员</returns> protected virtual OguObjectCollection <T> GetChildren <T>(bool includeSideLine, SearchLevel searchLevel) where T : IOguObject { OguObjectCollection <T> result = OguPermissionSettings.GetConfig().OguObjectImpls.GetChildren <T>(this, includeSideLine, searchLevel); NormalizeChildrenFullPath(this, result); return(result); }
/// <summary> /// 查询子成员 /// </summary> /// <typeparam name="T">子成员的类型</typeparam> /// <param name="matchString">查询串</param> /// <param name="includeSideLine">是否包含兼职</param> /// <param name="level">是否递归查找</param> /// <param name="returnCount">返回的记录数</param> /// <returns>查询结果</returns> public OguObjectCollection <T> QueryChildren <T>(string matchString, bool includeSideLine, SearchLevel level, int returnCount) where T : IOguObject { return(OguPermissionSettings.GetConfig().OguObjectImpls.QueryChildren <T>(this, matchString, includeSideLine, level, returnCount)); }
public OguObjectCollection <T> QueryChildren <T>(string matchString, bool includeSideLine, SearchLevel level, int returnCount) where T : IOguObject { throw new NotImplementedException(); }