コード例 #1
0
ファイル: Association.cs プロジェクト: vvyashin/OW.Experts
        public virtual void UpdateTypes([NotNull] NotionType type, [CanBeNull] string offerType)
        {
            if (type == null)
            {
                throw new ArgumentNullException(nameof(type));
            }

            Type      = type;
            OfferType = offerType;
        }
コード例 #2
0
        public Node([NotNull] string notion, [NotNull] NotionType type)
        {
            if (string.IsNullOrWhiteSpace(notion))
            {
                throw new ArgumentException("Notion should not be empty", nameof(notion));
            }
            if (type == null)
            {
                throw new ArgumentNullException(nameof(type));
            }

            Notion             = notion;
            Type               = type;
            _sessionsOfExperts = new List <SessionOfExperts>();
            _ingoingVerges     = new List <Verge>();
            _outgoingVerges    = new List <Verge>();
        }
コード例 #3
0
ファイル: Expert.cs プロジェクト: vvyashin/OW.Experts
        /// <summary>
        /// Sets type to the association found by id.
        /// </summary>
        /// <param name="associationId">Id of the association for updating.</param>
        /// <param name="type">Type from list of known types.</param>
        /// <param name="offerType">New type name suggested by the expert.</param>
        public virtual void SetTypeForAssociation(
            Guid associationId,
            [NotNull] NotionType type,
            [CanBeNull] string offerType)
        {
            if (associationId == Guid.Empty)
            {
                throw new ArgumentException("Id should not be empty", nameof(associationId));
            }
            if (type == null)
            {
                throw new ArgumentNullException(nameof(type));
            }

            var expertAssociation = Associations.SingleOrDefault(m => m.Id == associationId);

            if (expertAssociation == null)
            {
                throw new InvalidOperationException(
                          $"It's not possible set types for non existence association {associationId} for expert {this}");
            }

            expertAssociation.UpdateTypes(type, offerType);
        }