Merge from booking branch

This commit is contained in:
Paul Schneider 2015-11-17 22:03:42 +01:00
commit 25906d0227
60 changed files with 6228 additions and 0 deletions

View file

@ -0,0 +1,110 @@
//
// PerformerProfile.cs
//
// Author:
// Paul Schneider <paul@pschneider.fr>
//
// 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 <http://www.gnu.org/licenses/>.
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
{
/// <summary>
/// Performer profile.
/// </summary>
public class PerformerProfile: IRating, IIdentified
{
/// <summary>
/// Initializes a new instance of the <see cref="Yavsc.Model.Skill.PerformerProfile"/> class.
/// </summary>
public PerformerProfile()
{
}
/// <summary>
/// Gets or sets the name of the user.
/// </summary>
/// <value>The name of the user.</value>
[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; }
/// <summary>
/// Gets or sets the skills.
/// </summary>
/// <value>The skills.</value>
public virtual IEnumerable<UserSkill> Skills { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="Yavsc.FrontOffice.PerformerProfile"/> class.
/// </summary>
/// <param name="username">Username.</param>
public PerformerProfile(string username)
{
UserName = username;
}
/// <summary>
/// Gets the user.
/// </summary>
/// <returns>The user.</returns>
public MembershipUser GetUser()
{
return Membership.GetUser (UserName);
}
private Profile yavscCLientProfile = null;
/// <summary>
/// Gets the yavsc C lient profile.
/// </summary>
/// <value>The yavsc C lient profile.</value>
public Profile YavscCLientProfile
{
get {
if (yavscCLientProfile == null)
yavscCLientProfile = new Profile (
ProfileBase.Create (UserName));
return yavscCLientProfile;
}
}
/// <summary>
/// Gets or sets the rate.
/// </summary>
/// <value>The rate.</value>
public int Rate {
get ;
set ;
}
/// <summary>
/// Determines whether this instance references the specified skillId.
/// </summary>
/// <returns><c>true</c> if this instance has skill the specified skillId; otherwise, <c>false</c>.</returns>
/// <param name="skillId">Skill identifier.</param>
public bool HasSkill(long skillId)
{
return Skills.Any (x => x.SkillId == skillId);
}
}
}

55
yavscModel/Skill/Skill.cs Normal file
View file

@ -0,0 +1,55 @@
//
// Skill.cs
//
// Author:
// Paul Schneider <paul@pschneider.fr>
//
// 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 <http://www.gnu.org/licenses/>.
using System;
using System.Configuration;
using System.Reflection;
using System.Configuration.Provider;
using System.ComponentModel.DataAnnotations;
namespace Yavsc.Model.Skill
{
/// <summary>
/// Skill.
/// </summary>
public class Skill : IRating {
/// <summary>
/// Gets or sets the identifier.
/// </summary>
/// <value>The identifier.</value>
public long Id { get; set; }
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
[Required(ErrorMessage = "Please, specify a skill name")]
public string Name { get; set; }
/// <summary>
/// Gets or sets the rate.
/// </summary>
/// <value>The rate.</value>
public int Rate { get; set; }
}
}

View file

@ -0,0 +1,127 @@
//
// SkillManager.cs
//
// Author:
// Paul Schneider <paul@pschneider.fr>
//
// 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 <http://www.gnu.org/licenses/>.
using System;
using System.Configuration;
using System.Reflection;
using System.Configuration.Provider;
namespace Yavsc.Model.Skill
{
/// <summary>
/// Skill manager.
/// </summary>
public static class SkillManager
{
private static SkillProvider provider = null;
/// <summary>
/// Gets the provider.
/// </summary>
/// <value>The provider.</value>
private static SkillProvider Provider {
get {
if (provider == null)
provider = ManagerHelper.GetDefaultProvider<SkillProvider>
("system.web/skillProviders");
return provider;
}
}
/// <summary>
/// Create or modifies the specified skill.
/// </summary>
/// <param name="skill">the skill.</param>
public static long DeclareSkill(Skill skill) {
Provider.Declare(skill);
return skill.Id;
}
/// <summary>
/// Declares the skill.
/// </summary>
/// <returns>The skill.</returns>
/// <param name="dec">Dec.</param>
public static long DeclareUserSkill(UserSkillDeclaration dec) {
return Provider.Declare(dec);
}
/// <summary>
/// Rates the user skill.
/// </summary>
/// <returns>The user skill.</returns>
/// <param name="username">Username.</param>
/// <param name="userSkill">User skill.</param>
public static long RateUserSkill(string username, UserSkillRating userSkill) {
return Provider.Rate(userSkill);
}
/// <summary>
/// Rates the skill.
/// </summary>
/// <param name="username">Username.</param>
/// <param name="skill">Skill.</param>
public static void RateSkill(string username, SkillRating skill) {
Provider.Rate(skill);
}
/// <summary>
/// Finds the skills.
/// </summary>
/// <returns>The skill identifier.</returns>
/// <param name="pattern">Pattern.</param>
public static Skill [] FindSkill(string pattern){
return Provider.FindSkill(pattern);
}
/// <summary>
/// Finds the performer.
/// </summary>
/// <returns>The performer.</returns>
/// <param name="skillIds">Skill identifiers.</param>
public static string [] FindPerformer(long []skillIds){
return Provider.FindPerformer(skillIds);
}
/// <summary>
/// Deletes the skill.
/// </summary>
/// <param name="skillId">Skill identifier.</param>
public static void DeleteSkill (long skillId)
{
Provider.DeleteSkill (skillId);
}
/// <summary>
/// Deletes the user skill.
/// </summary>
/// <param name="skillId">Skill identifier.</param>
public static void DeleteUserSkill (long skillId)
{
Provider.DeleteUserSkill (skillId);
}
/// <summary>
/// Gets the user skills.
/// </summary>
/// <returns>The user skills.</returns>
/// <param name="userName">User name.</param>
public static PerformerProfile GetUserSkills(string userName)
{
return Provider.GetUserSkills (userName);
}
}
}

View file

@ -0,0 +1,89 @@
//
// SkillProvider.cs
//
// Author:
// Paul Schneider <paul@pschneider.fr>
//
// 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 <http://www.gnu.org/licenses/>.
using System;
using System.Configuration.Provider;
namespace Yavsc.Model.Skill
{
/// <summary>
/// Skill provider.
/// </summary>
public abstract class SkillProvider: ProviderBase
{
/// <summary>
/// Declare the specified skill.
/// </summary>
/// <param name="skill">Skill.</param>
public abstract long Declare(Skill skill) ;
/// <summary>
/// Declare the specified user skill.
/// </summary>
/// <param name="userskill">Userskill.</param>
public abstract long Declare(UserSkillDeclaration userskill) ;
/// <summary>
/// Rate the specified user skill.
/// </summary>
/// <param name="userskill">Userskill.</param>
public abstract long Rate(UserSkillRating userskill) ;
/// <summary>
/// Rate the specified skill.
/// </summary>
/// <param name="skill">Skill.</param>
public abstract void Rate(SkillRating skill) ;
/// <summary>
/// Finds the skill identifier.
/// </summary>
/// <returns>The skill identifier.</returns>
/// <param name="pattern">Pattern.</param>
public abstract Skill [] FindSkill(string pattern);
/// <summary>
/// Gets the user skills.
/// </summary>
/// <returns>The user skills.</returns>
/// <param name="username">Username.</param>
public abstract PerformerProfile GetUserSkills(string username) ;
/// <summary>
/// Finds the performer.
/// </summary>
/// <returns>The performer.</returns>
/// <param name="skillIds">Skill identifiers.</param>
public abstract string [] FindPerformer(long []skillIds);
/// <summary>
/// Deletes the skill.
/// </summary>
/// <param name="skillId">Skill identifier.</param>
public abstract void DeleteSkill(long skillId);
/// <summary>
/// Deletes the user skill.
/// </summary>
/// <param name="userSkillId">User skill identifier.</param>
public abstract void DeleteUserSkill(long userSkillId);
}
}

View file

@ -0,0 +1,49 @@
//
// SkillRating.cs
//
// Author:
// Paul Schneider <paul@pschneider.fr>
//
// 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 <http://www.gnu.org/licenses/>.
using System;
namespace Yavsc.Model.Skill
{
/// <summary>
/// Skill rating.
/// </summary>
public class SkillRating : IRating, IAuthorized
{
/// <summary>
/// Gets or sets the skill identifier.
/// </summary>
/// <value>The skill identifier.</value>
public long Id { get;set ; }
/// <summary>
/// Gets or sets the rate.
/// </summary>
/// <value>The rate.</value>
public int Rate { get; set; }
/// <summary>
/// Gets or sets the author.
/// </summary>
/// <value>The author.</value>
public string Author { get; set; }
}
}

View file

@ -0,0 +1,64 @@
//
// SkillDeclaration.cs
//
// Author:
// Paul Schneider <paul@pschneider.fr>
//
// 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 <http://www.gnu.org/licenses/>.
using System;
namespace Yavsc.Model.Skill
{
/// <summary>
/// User skill.
/// </summary>
public class UserSkill : IComment, IRating
{
/// <summary>
/// Gets or sets the identifier for this
/// user's skill.
/// </summary>
/// <value>The user's skill identifier.</value>
public long Id { get ; set ; }
/// <summary>
/// Gets or sets the skill identifier.
/// </summary>
/// <value>The skill identifier.</value>
public long SkillId { get ; set ; }
/// <summary>
/// Gets or sets the name of the skill.
/// </summary>
/// <value>The name of the skill.</value>
public string SkillName { get; set; }
/// <summary>
/// Gets or sets the rate.
/// </summary>
/// <value>The rate.</value>
public int Rate { get ; set ; }
/// <summary>
/// Gets or sets the comment.
/// </summary>
/// <value>The comment.</value>
public string Comment { get; set; }
}
}

View file

@ -0,0 +1,40 @@
//
// UserSkillComment.cs
//
// Author:
// Paul Schneider <paul@pschneider.fr>
//
// 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 <http://www.gnu.org/licenses/>.
using System;
namespace Yavsc.Model.Skill
{
/// <summary>
/// User skill comment.
/// </summary>
public class UserSkillComment: UserSkillReference, IComment
{
/// <summary>
/// Gets or sets the comment.
/// </summary>
/// <value>The comment.</value>
public string Comment { get; set; }
}
}

View file

@ -0,0 +1,36 @@
//
// UserSkillDeclaration.cs
//
// Author:
// Paul Schneider <paul@pschneider.fr>
//
// 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 <http://www.gnu.org/licenses/>.
using System;
namespace Yavsc.Model.Skill
{
public class UserSkillDeclaration : UserSkill {
/// <summary>
/// Gets or sets the name of the user.
/// </summary>
/// <value>The name of the user.</value>
public string UserName { get; set; }
}
}

View file

@ -0,0 +1,45 @@
//
// SkillRating.cs
//
// Author:
// Paul Schneider <paul@pschneider.fr>
//
// 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 <http://www.gnu.org/licenses/>.
using System;
namespace Yavsc.Model.Skill
{
/// <summary>
/// Skill rating.
/// </summary>
public class UserSkillRating: UserSkillReference, IRating, IAuthorized
{
/// <summary>
/// Gets or sets the rate.
/// </summary>
/// <value>The rate.</value>
public int Rate { get; set; }
/// <summary>
/// Gets or sets the author.
/// </summary>
/// <value>The author.</value>
public string Author { get; set; }
}
}

View file

@ -0,0 +1,49 @@
//
// UserSkillReference.cs
//
// Author:
// Paul Schneider <paul@pschneider.fr>
//
// 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 <http://www.gnu.org/licenses/>.
using System;
namespace Yavsc.Model.Skill
{
/// <summary>
/// User skill reference.
/// </summary>
public class UserSkillReference {
/// <summary>
/// Gets or sets the user's skill identifier.
/// </summary>
/// <value>The skill identifier.</value>
public long Id { get;set ; }
/// <summary>
/// Gets or sets the skill identifier.
/// </summary>
/// <value>The skill identifier.</value>
public long SkillId { get;set ; }
/// <summary>
/// Gets or sets the name of the performer.
/// </summary>
/// <value>The name of the user.</value>
public string Performer { get; set; }
}
}