/// <summary> /// Initializes a new instance of the <see cref="ContractorAttrValues"/> class with a specified <see cref="Contractor"/> to attach to. /// </summary> /// <param name="parent"><see cref="Contractor"/> to attach to.</param> public ContractorAttrValues(Contractor parent) : base(parent, "attribute") { }
/// <summary> /// Initializes a new instance of the <see cref="ContractorAddresses"/> class with a specified <see cref="Contractor"/> to attach to. /// </summary> /// <param name="parent"><see cref="Contractor"/> to attach to.</param> public ContractorAddresses(Contractor parent) : base(parent, "address") { }
/// <summary> /// Validates the <see cref="BusinessObject"/>. /// </summary> public override void Validate() { if (this.Status == BusinessObjectStatus.New) { int catalogueLimit = ConfigurationMapper.Instance.CatalogueLimit; if (catalogueLimit > 0) { ContractorMapper mapper = DependencyContainerManager.Container.Get <ContractorMapper>(); int count = mapper.GetContractorsCount(); if (count >= catalogueLimit) { throw new ClientException(ClientExceptionId.CatalogueLimitError, null, "catalogueLimit:" + catalogueLimit.ToString(CultureInfo.InvariantCulture)); } } } Configuration.Configuration conf = ConfigurationMapper.Instance.GetConfiguration(SessionManager.User, "contractors.allowOneGroupMembership").FirstOrDefault(); if (conf != null && conf.Value.Value.ToUpperInvariant() == "TRUE" && this.GroupMemberships != null && this.GroupMemberships.Children.Count > 1) { throw new ClientException(ClientExceptionId.ContractorOneGroupMembershipEnforcement); } conf = ConfigurationMapper.Instance.GetConfiguration(SessionManager.User, "contractors.enforceGroupMembership").FirstOrDefault(); if (conf != null && conf.Value.Value.ToUpperInvariant() == "TRUE" && this.GroupMemberships != null && this.GroupMemberships.Children.Count == 0) { throw new ClientException(ClientExceptionId.ContractorGroupMembershipEnforcement); } base.Validate(); if (this.AlternateVersion != null) { Contractor alt = (Contractor)this.AlternateVersion; if (this.IsBank != alt.IsBank || this.IsEmployee != alt.IsEmployee) { throw new ClientException(ClientExceptionId.ContractorTypeChangeError); } } if (this.Accounts != null) { this.Accounts.Validate(); } if (this.Addresses != null) { this.Addresses.Validate(); } if (this.Attributes != null) { this.Attributes.Validate(); } if (this.GroupMemberships != null) { this.GroupMemberships.Validate(); } if (this.Relations != null) { this.Relations.Validate(); } }
} //for save object reflection purposes /// <summary> /// Initializes a new instance of the <see cref="ContractorAttrValue"/> class with a specified xml root element. /// </summary> /// <param name="parent">Parent <see cref="Contractor"/>.</param> public ContractorAttrValue(Contractor parent) : base(parent) { this.Value = new XElement("value"); }
} //for save object reflection purposes /// <summary> /// Initializes a new instance of the <see cref="ContractorAddress"/> class with a specified xml root element. /// </summary> /// <param name="parent">Parent <see cref="Contractor"/>.</param> public ContractorAddress(Contractor parent) : base(parent) { }
} //for save object reflection purposes /// <summary> /// Initializes a new instance of the <see cref="ContractorAccount"/> class with a specified xml root element. /// </summary> /// <param name="parent">Parent <see cref="Contractor"/>.</param> public ContractorAccount(Contractor parent) : base(parent) { }