Merge from booking branch
This commit is contained in:
parent
8c5de206e1
commit
25906d0227
60 changed files with 6228 additions and 0 deletions
79
yavscModel/Calendar/BookingQuery.cs
Normal file
79
yavscModel/Calendar/BookingQuery.cs
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
//
|
||||
// AskForADate.cs
|
||||
//
|
||||
// Author:
|
||||
// Paul Schneider <paulschneider@free.fr>
|
||||
//
|
||||
// Copyright (c) 2014 Paul Schneider
|
||||
//
|
||||
// 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.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Yavsc.Model.Calendar
|
||||
{
|
||||
/// <summary>
|
||||
/// Ask for A date.
|
||||
/// </summary>
|
||||
public class BookingQuery
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the prefered date.
|
||||
/// </summary>
|
||||
/// <value>The prefered date.</value>
|
||||
[DataType(DataType.Date)]
|
||||
[DisplayFormat(DataFormatString = "{0:yyyy/MM/dd}", ApplyFormatInEditMode = true)]
|
||||
[Display(ResourceType=typeof(LocalizedText),Name="StartDate")]
|
||||
public DateTime StartDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the minimum time.
|
||||
/// </summary>
|
||||
/// <value>The minimum time.</value>
|
||||
[RegularExpression("\\d\\d:\\d\\d")]
|
||||
[Display(ResourceType=typeof(LocalizedText),Name="StartHour")]
|
||||
[Required(ErrorMessage= "S'il vous plait, saisissez une heure de début d'intervention")]
|
||||
public string StartHour { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the max date.
|
||||
/// </summary>
|
||||
/// <value>The max date.</value>
|
||||
[Display(Name="EndDate",ResourceType=typeof(LocalizedText))]
|
||||
[DataType(DataType.Date)]
|
||||
[DisplayFormat(DataFormatString = "{0:yyyy/MM/dd}", ApplyFormatInEditMode = true)]
|
||||
public DateTime EndDate { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the minimal duration.
|
||||
/// </summary>
|
||||
/// <value>The duration.</value>
|
||||
[RegularExpression("\\d\\d:\\d\\d")]
|
||||
[Required(ErrorMessage= "S'il vous plait, saisissez une heure de fin d'intervention")]
|
||||
[Display(Name="EndHour",ResourceType=typeof(LocalizedText))]
|
||||
public string EndHour { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the role.
|
||||
/// </summary>
|
||||
/// <value>The role.</value>
|
||||
[Required(ErrorMessage= "S'il vous plait, saisissez le ou les types d'intervention souhaité")]
|
||||
[Display(Name="Role",ResourceType=typeof(LocalizedText))]
|
||||
public string [] Roles { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
37
yavscModel/IAuthorized.cs
Normal file
37
yavscModel/IAuthorized.cs
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
//
|
||||
// IAuthorized.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
|
||||
{
|
||||
/// <summary>
|
||||
/// I authorized.
|
||||
/// </summary>
|
||||
public interface IAuthorized {
|
||||
/// <summary>
|
||||
/// Gets or sets the author.
|
||||
/// </summary>
|
||||
/// <value>The author.</value>
|
||||
string Author { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
30
yavscModel/IComment.cs
Normal file
30
yavscModel/IComment.cs
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
//
|
||||
// ICommented.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
|
||||
{
|
||||
|
||||
public interface IComment: IIdentified {
|
||||
string Comment { get; set; }
|
||||
}
|
||||
}
|
||||
30
yavscModel/IIdentified.cs
Normal file
30
yavscModel/IIdentified.cs
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
//
|
||||
// IIdentified.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
|
||||
{
|
||||
public interface IIdentified
|
||||
{
|
||||
long Id { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
38
yavscModel/IRating.cs
Normal file
38
yavscModel/IRating.cs
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
//
|
||||
// IIdentified.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
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// I rating.
|
||||
/// </summary>
|
||||
public interface IRating: IIdentified
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the rate.
|
||||
/// </summary>
|
||||
/// <value>The rate.</value>
|
||||
int Rate { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
63
yavscModel/Manager.cs
Normal file
63
yavscModel/Manager.cs
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
//
|
||||
// Manager.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 {
|
||||
/// <summary>
|
||||
/// Manager.
|
||||
/// </summary>
|
||||
public static class ManagerHelper {
|
||||
|
||||
/// <summary>
|
||||
/// Gets the provider.
|
||||
/// </summary>
|
||||
/// <value>The provider.</value>
|
||||
public static TProvider GetDefaultProvider<TProvider> (string configSetion) where TProvider: ProviderBase
|
||||
{
|
||||
DataProviderConfigurationSection config = ConfigurationManager.GetSection (configSetion) as DataProviderConfigurationSection;
|
||||
if (config == null)
|
||||
throw new ConfigurationErrorsException (
|
||||
string.Format(
|
||||
"The providers configuration bloc `{0}` was not found",
|
||||
configSetion));
|
||||
ProviderSettings celt =
|
||||
config.Providers [config.DefaultProvider];
|
||||
if (config == null)
|
||||
throw new ConfigurationErrorsException (
|
||||
string.Format (
|
||||
"The default provider `{0}` was not found ",
|
||||
config.DefaultProvider));
|
||||
Type provtype = Type.GetType (celt.Type);
|
||||
if (provtype == null)
|
||||
throw new ProviderException (
|
||||
string.Format (
|
||||
"Provider type '{0}' was not found",celt.Type));
|
||||
ConstructorInfo ci = provtype.GetConstructor (Type.EmptyTypes);
|
||||
ProviderBase bp = ci.Invoke (Type.EmptyTypes) as ProviderBase;
|
||||
bp.Initialize (celt.Name, celt.Parameters);
|
||||
return bp as TProvider;
|
||||
}
|
||||
}
|
||||
}
|
||||
39
yavscModel/RolesAndMembers/UserNameBase.cs
Normal file
39
yavscModel/RolesAndMembers/UserNameBase.cs
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
//
|
||||
// UserNameBase.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.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Yavsc.Model.RolesAndMembers
|
||||
{
|
||||
public class UserNameBase {
|
||||
/// <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; }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
43
yavscModel/RolesAndMembers/UserRole.cs
Normal file
43
yavscModel/RolesAndMembers/UserRole.cs
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
//
|
||||
// UserRole.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.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Yavsc.Model.RolesAndMembers
|
||||
{
|
||||
/// <summary>
|
||||
/// User role.
|
||||
/// </summary>
|
||||
public class UserRole : UserNameBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the role.
|
||||
/// </summary>
|
||||
/// <value>The role.</value>
|
||||
[Required]
|
||||
[StringLength(255)]
|
||||
[DisplayName("Nom du rôle")]
|
||||
public string Role
|
||||
{ get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
110
yavscModel/Skill/PerformerProfile.cs
Normal file
110
yavscModel/Skill/PerformerProfile.cs
Normal 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
55
yavscModel/Skill/Skill.cs
Normal 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; }
|
||||
}
|
||||
|
||||
}
|
||||
127
yavscModel/Skill/SkillManager.cs
Normal file
127
yavscModel/Skill/SkillManager.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
89
yavscModel/Skill/SkillProvider.cs
Normal file
89
yavscModel/Skill/SkillProvider.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
49
yavscModel/Skill/SkillRating.cs
Normal file
49
yavscModel/Skill/SkillRating.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
|
||||
64
yavscModel/Skill/UserSkill.cs
Normal file
64
yavscModel/Skill/UserSkill.cs
Normal 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; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
40
yavscModel/Skill/UserSkillComment.cs
Normal file
40
yavscModel/Skill/UserSkillComment.cs
Normal 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; }
|
||||
}
|
||||
|
||||
}
|
||||
36
yavscModel/Skill/UserSkillDeclaration.cs
Normal file
36
yavscModel/Skill/UserSkillDeclaration.cs
Normal 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; }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
45
yavscModel/Skill/UserSkillRating.cs
Normal file
45
yavscModel/Skill/UserSkillRating.cs
Normal 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; }
|
||||
}
|
||||
|
||||
}
|
||||
49
yavscModel/Skill/UserSkillReference.cs
Normal file
49
yavscModel/Skill/UserSkillReference.cs
Normal 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; }
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue