// // PerformerProfile.cs // // Author: // Paul Schneider // // Copyright (c) 2015 GNU GPL // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License // along with this program. If not, see . using System; using Yavsc.Model.RolesAndMembers; using Yavsc.Model.Skill; using System.Web.Security; using System.Web.Profile; using System.Collections.Generic; using Yavsc.Model; using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Linq; namespace Yavsc.Model.Skill { /// /// Performer profile. /// public class PerformerProfile: IRating, IIdentified { /// /// Initializes a new instance of the class. /// public PerformerProfile() { } /// /// Gets or sets the name of the user. /// /// The name of the user. [Localizable(true), Required(ErrorMessage = "S'il vous plait, entrez un nom d'utilisateur") ,Display(ResourceType=typeof(LocalizedText),Name="User_name"),RegularExpression("([a-z]|[A-Z]|[0-9] )+")] public string UserName { get; set; } public long Id { get; set; } /// /// Gets or sets the skills. /// /// The skills. public virtual IEnumerable Skills { get; set; } /// /// Initializes a new instance of the class. /// /// Username. public PerformerProfile(string username) { UserName = username; } /// /// Gets the user. /// /// The user. public MembershipUser GetUser() { return Membership.GetUser (UserName); } private Profile yavscCLientProfile = null; /// /// Gets the yavsc C lient profile. /// /// The yavsc C lient profile. public Profile YavscCLientProfile { get { if (yavscCLientProfile == null) yavscCLientProfile = new Profile ( ProfileBase.Create (UserName)); return yavscCLientProfile; } } /// /// Gets or sets the rate. /// /// The rate. public int Rate { get ; set ; } /// /// Determines whether this instance references the specified skillId. /// /// true if this instance has skill the specified skillId; otherwise, false. /// Skill identifier. public bool HasSkill(long skillId) { return Skills.Any (x => x.SkillId == skillId); } } }