public CswCommaDelimitedString SelectedUserNames() { CswCommaDelimitedString SelectedUserNames = new CswCommaDelimitedString(); //ICswNbtTree UsersTree = _CswNbtResources.Trees.getTreeFromObjectClass( CswNbtMetaDataObjectClassName.NbtObjectClass.UserClass ); //for( int c = 0; c < UsersTree.getChildNodeCount(); c++ ) //{ // UsersTree.goToNthChild( c ); CswNbtMetaDataObjectClass UserOC = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.UserClass); foreach (CswNbtNode UserNode in UserOC.getNodes(false, false)) { CswPrimaryKey ThisUserId = UserNode.NodeId; //UsersTree.getNodeIdForCurrentPosition(); string ThisUserName = UserNode.NodeName; // UsersTree.getNodeNameForCurrentPosition(); foreach (Int32 UserId in SelectedUserIds.ToIntCollection()) { if (UserId != Int32.MinValue) { if (ThisUserId.PrimaryKey == UserId) { SelectedUserNames.Add(ThisUserName); } } } // foreach( Int32 UserId in SelectedUserIds.ToIntCollection() ) //UsersTree.goToParentNode(); } // for( int c = 0; c < UsersTree.getChildNodeCount(); c++ ) // Sort alphabetically SelectedUserNames.Sort(); return(SelectedUserNames); } // SelectedUserNames()
// ToXml() public override void ToJSON(JObject ParentObject) { ParentObject[_SelectedUserIdsSubField.ToXmlNodeName()] = SelectedUserIds.ToString(); ParentObject[ElemName_Options] = new JObject(); CswCheckBoxArrayOptions CBAOptions = new CswCheckBoxArrayOptions(); CBAOptions.Columns.Add("Include"); DataTable Data = getUserOptions(); foreach (DataRow Row in Data.Rows) { bool isSelected = SelectedUserIds.Contains(Row[KeyColumn]); if (IsEditModeEditable || isSelected) { CswCheckBoxArrayOptions.Option Option = new CswCheckBoxArrayOptions.Option(); Option.Key = Row[KeyColumn].ToString(); Option.Label = Row[NameColumn].ToString(); Option.Values.Add(CswConvert.ToBoolean(Row[ValueColumn])); CBAOptions.Options.Add(Option); } } CBAOptions.ToJSON((JObject)ParentObject[ElemName_Options]); }
} // SelectedUserNames() public Collection <CswNbtObjClassUser> SelectedUsers() { Collection <CswNbtObjClassUser> Ret = new Collection <CswNbtObjClassUser>(); foreach (Int32 UserId in SelectedUserIds.ToIntCollection()) { CswNbtObjClassUser User = GetUser(UserId); if (null != User) { Ret.Add(User); } } return(Ret); } // SelectedUserNames()
public override void ReadDataRow(DataRow PropRow, Dictionary <string, Int32> NodeMap, Dictionary <Int32, Int32> NodeTypeMap) { string UserIds = CswTools.XmlRealAttributeName(PropRow[_SelectedUserIdsSubField.ToXmlNodeName()].ToString()); SelectedUserIds.FromString(UserIds); foreach (string UserIdString in SelectedUserIds) { Int32 UserId = Int32.MinValue; if (NodeMap != null && NodeMap.ContainsKey(UserIdString.ToLower())) { UserId = NodeMap[UserIdString.ToLower()]; } else if (CswTools.IsInteger(UserIdString)) { UserId = CswConvert.ToInt32(UserIdString); } if (UserId != Int32.MinValue) { SelectedUserIds.Replace(UserIdString, UserId.ToString()); } } PendingUpdate = true; }