private void MergeQueryField(string progId, LibPermission curPermission, LibPermission otherPermission) { LibSqlModel sqlModel = null; LibSqlModelTable table = null; List <string> removeList = new List <string>(); foreach (var item in curPermission.QueryFieldDic) { if (otherPermission.QueryFieldDic.ContainsKey(item.Key)) { LibQueryField other = otherPermission.QueryFieldDic[item.Key][0]; bool exist = false; foreach (var subItem in item.Value) { if (table == null) { sqlModel = LibSqlModelCache.Default.GetSqlModel(progId); if (sqlModel != null) { table = (LibSqlModelTable)sqlModel.Tables[0]; } } if (table != null) { LibSqlModelColumn col = (LibSqlModelColumn)table.Columns[item.Key]; LibDataType dataType = (LibDataType)col.ExtendedProperties[FieldProperty.DataType]; exist = LibQueryConditionParser.GetQueryFieldStr(dataType, subItem).CompareTo(LibQueryConditionParser.GetQueryFieldStr(dataType, other)) == 0; if (exist) { break; } } } if (!exist) { item.Value.Add(other); } } else { removeList.Add(item.Key); } } foreach (var item in removeList) { curPermission.QueryFieldDic.Remove(item); } }
public DataSet BrowseByPK(object[] pks) { bool ret = CheckHasPermission(FuncPermissionEnum.Browse); if (ret) { LibQueryCondition condition = new LibQueryCondition(); DataColumn[] colums = this.DataSet.Tables[0].PrimaryKey; for (int i = 0; i < colums.Length; i++) { DataColumn col = colums[i]; LibQueryField queryField = new LibQueryField(); queryField.Name = col.ColumnName; queryField.QueryChar = LibQueryChar.Equal; queryField.Value.Add(pks[i]); condition.QueryFields.Add(queryField); } GetQueryData(condition); this.AfterChangeData(this.DataSet); this.DataSet.AcceptChanges(); } return(this.DataSet); }