private static void QueryToFindExistingMember(Member member) { IAssetType memberType = Program.MetaModel.GetAssetType("Member"); IAttributeDefinition memberUserName = memberType.GetAttributeDefinition("Username"); Query query = new Query(memberType); query.Selection.Add(memberUserName); FilterTerm term = new FilterTerm(memberUserName); term.Equal(member.UserName); query.Filter = term; QueryResult result = Program.Services.Retrieve(query); member.Id = result.Assets[0].Oid.Momentless.Token; }
private static void VerifyLicense() { Project project = new Project("System", DateTime.Now, DateTime.Now); project.Id = "Scope:0"; IList<Member> members = new List<Member>(); for (int i = 0; i < 6; i++) { Member member = new Member("test", "test", Guid.NewGuid().ToString().Substring( 0, 16 ), "test", "*****@*****.**", Utils.TeamMember); members.Add(member); } project.Members = members; try { Member.SaveMembers(project); Utils.Logger.Info("VersionOne license verified."); } catch (Exception ex) { Utils.Logger.Info("You need to place the customer license file in the bin directory of the configured v1 instance: " + _v1Url); throw new ApplicationException("You need to place the customer license file in the bin directory of the configured v1 instance: " + _v1Url, ex); } finally { IOperation delete = MetaModel.GetOperation("Member.Delete"); foreach (Member member in members) { if (member.Id != null) { Services.ExecuteOperation(delete, Oid.FromToken(member.Id, MetaModel)); } } } }