protected void CurrentTenantField_SelectionChanged(object sender, EventArgs e) { string tenantID = CurrentTenantField.BusinessObjectUniqueIdentifier; Assertion.IsNotNull(tenantID); var possibleTenants = GetPossibleTenants(); CurrentTenantField.SetBusinessObjectList(possibleTenants); if (!possibleTenants.Where(s => s.UniqueIdentifier == tenantID).Any()) { CurrentTenantField.Value = null; _isCurrentTenantFieldReadOnly = false; return; } var oldSecurityManagerPrincipal = SecurityManagerPrincipal.Current; var newSecurityManagerPrincipal = ApplicationInstance.SecurityManagerPrincipalFactory.Create( ObjectID.Parse(tenantID).GetHandle <Tenant> (), oldSecurityManagerPrincipal.User.Handle, oldSecurityManagerPrincipal.Substitution != null ? oldSecurityManagerPrincipal.Substitution.Handle : null); ApplicationInstance.SetCurrentPrincipal(newSecurityManagerPrincipal); _isCurrentTenantFieldReadOnly = true; CurrentTenantField.IsDirty = false; }
private object DeserializePropertyValue(XmlReader reader, PropertyDefinition propertyDefinition) { Type valueType = propertyDefinition == null?DeserializeCustomValueType(reader) : propertyDefinition.PropertyType; reader.ReadStartElement("Property"); object value; if (reader.IsStartElement("null")) { reader.ReadStartElement("null"); // no end element for null value = null; } else if (ExtensibleEnumUtility.IsExtensibleEnumType(valueType)) { string idString = reader.ReadContentAsString(); value = ExtensibleEnumUtility.GetDefinition(valueType).GetValueInfoByID(idString).Value; } else if (IsObjectID(valueType)) { string objectIDString = reader.ReadContentAsString(); value = ObjectID.Parse(objectIDString); } else { var valueDeserializer = new XmlSerializer(valueType); value = valueDeserializer.Deserialize(reader); } reader.ReadEndElement(); return(value); }
private TenantConstraint GetTenantConstraint(string args) { if (string.IsNullOrEmpty(args)) { return(null); } return(new TenantConstraint(ObjectID.Parse(args).GetHandle <Tenant>())); }
public void DeserializeGuidValue() { string idString = "Order|5d09030c-25c2-4735-b514-46333bd28ac8|System.Guid"; ObjectID id = ObjectID.Parse(idString); Assert.That(id, Is.TypeOf <ObjectID>()); Assert.That(id.StorageProviderDefinition.Name, Is.EqualTo("TestDomain")); Assert.That(id.ClassID, Is.EqualTo("Order")); Assert.That(id.Value.GetType(), Is.EqualTo(typeof(Guid))); Assert.That(id.Value, Is.EqualTo(new Guid("{5D09030C-25C2-4735-B514-46333BD28AC8}"))); }
public void EqualsForObjectID() { var endPointID2 = RelationEndPointID.Create(ObjectID.Parse(_objectID.ToString()), _propertyName); var endPointID3 = RelationEndPointID.Create(DomainObjectIDs.Order3, _propertyName); Assert.That(_endPointID.Equals(endPointID2), Is.True); Assert.That(endPointID2.Equals(_endPointID), Is.True); Assert.That(_endPointID.Equals(endPointID3), Is.False); Assert.That(endPointID3.Equals(_endPointID), Is.False); Assert.That(endPointID2.Equals(endPointID3), Is.False); Assert.That(endPointID3.Equals(endPointID2), Is.False); }
public object CombineValue(IColumnValueProvider columnValueProvider) { ArgumentUtility.CheckNotNull("columnValueProvider", columnValueProvider); var value = _serializedIDProperty.CombineValue(columnValueProvider); if (value == null) { return(null); } return(ObjectID.Parse((string)value)); }
public void ReadXml(XmlReader reader) { ArgumentUtility.CheckNotNull("reader", reader); string idString = reader.GetAttribute("ID"); ObjectID id = ObjectID.Parse(idString); reader.Read(); List <KeyValuePair <string, object> > properties = DeserializeProperties(reader, id.ClassDefinition); reader.ReadEndElement(); _transportItem = CreateTransportItem(id, properties); }
private SecurityManagerSearchArguments CreateSearchArguments(ISearchAvailableObjectsArguments searchArguments) { if (searchArguments == null) { return(new SecurityManagerSearchArguments(null, null, null)); } var defaultSearchArguments = searchArguments as DefaultSearchArguments; if (defaultSearchArguments != null) { if (string.IsNullOrEmpty(defaultSearchArguments.SearchStatement)) { return(new SecurityManagerSearchArguments(null, null, null)); } var tenantHandle = ObjectID.Parse(defaultSearchArguments.SearchStatement).GetHandle <Tenant>(); return(new SecurityManagerSearchArguments(new TenantConstraint(tenantHandle), null, null)); } return(ArgumentUtility.CheckType <SecurityManagerSearchArguments> ("searchArguments", searchArguments)); }
public IBusinessObjectWithIdentity GetObject(BindableObjectClassWithIdentity classWithIdentity, string uniqueIdentifier) { ArgumentUtility.CheckNotNull("classWithIdentity", classWithIdentity); ArgumentUtility.CheckNotNullOrEmpty("uniqueIdentifier", uniqueIdentifier); var objectID = ObjectID.Parse(uniqueIdentifier); var domainObjectOrNull = LifetimeService.TryGetObject(ClientTransaction.Current, objectID); if (domainObjectOrNull == null) { return(null); } if (domainObjectOrNull.State == StateType.Invalid) { return(null); } if (domainObjectOrNull.State == StateType.Deleted) { return(null); } return((IBusinessObjectWithIdentity)domainObjectOrNull); }
protected void CurrentSubstitutionField_SelectionChanged(object sender, EventArgs e) { string substitutionID = CurrentSubstitutionField.BusinessObjectUniqueIdentifier; var possibleSubstitutions = GetPossibleSubstitutions(); CurrentSubstitutionField.SetBusinessObjectList(possibleSubstitutions); if (substitutionID != null && !possibleSubstitutions.Where(s => s.UniqueIdentifier == substitutionID).Any()) { CurrentSubstitutionField.Value = null; _isCurrentSubstitutionFieldReadOnly = false; return; } var oldSecurityManagerPrincipal = SecurityManagerPrincipal.Current; var newSecurityManagerPrincipal = ApplicationInstance.SecurityManagerPrincipalFactory.Create( oldSecurityManagerPrincipal.Tenant.Handle, oldSecurityManagerPrincipal.User.Handle, substitutionID != null ? ObjectID.Parse(substitutionID).GetHandle <Substitution>() : null); ApplicationInstance.SetCurrentPrincipal(newSecurityManagerPrincipal); _isCurrentSubstitutionFieldReadOnly = true; CurrentSubstitutionField.IsDirty = false; }
private TransportItem[] GetTransportItems(KeyValuePair <string, Dictionary <string, object> >[] deserializedData) { return(Array.ConvertAll(deserializedData, pair => new TransportItem(ObjectID.Parse(pair.Key), pair.Value))); }