Un bouton "Demander un devis"
* INominative.cs: Interface d'un objet destiné à un préstataire spécifié, par une propriété `PerformerName` * NominativeSimpleBookingQuery.cs: implémente l'interface INominative * packages.config: * packages.config: * packages.config: * ITContentProvider.csproj: * NpgsqlBlogProvider.csproj: * NpgsqlContentProvider.csproj: mise à niveau Npgsql * NpgsqlContentProvider.cs: stocke la classe de commande * AccountController.cs: implémente la methode de login de l'API * BasketController.cs: implémente la methode de recupération du panier * AccountController.cs: enléve un commaentaire obsolète * YavscHelpers.cs: * FrontOfficeController.cs: refabrication de l'ajout au panier * yavsc.user.js: enlève un message de debuggage js * Performer.ascx: formattage * Performers.aspx: implémente le bouton de demande de reservation * Yavsc.csproj: validate unobtrusive * packages.config: référence M$ Owin * UserFileSystemManager.cs: Fixe: Ne pas créer un dossier de destination si on a aucun fichier à recevoir. * Commande.cs: * Ajoute le nom du client dans l'objet commande * Factorise le positionnement des paramêtres * La commande est une instance du type spécifié à la commande, dans son paramêtre `type` * SimpleBookingQuery.cs: refabrication * LocalizedText.resx: * LocalizedText.fr.resx: traducations * UserNameBase.cs: implemente l'interface `IUserName` * IContentProvider.cs: doc xml * YavscModel.csproj: reference le nouveau code source * Web.config: retour à une version d'équère * IUserName.cs: Définit l'interface d'un objet associé à un utilisateur.
This commit is contained in:
parent
1cb3a692ef
commit
2a1301d93c
34 changed files with 409 additions and 77 deletions
|
|
@ -1,3 +1,36 @@
|
|||
2015-12-23 Paul Schneider <paul@pschneider.fr>
|
||||
|
||||
* INominative.cs: Interface d'un objet destiné à un
|
||||
préstataire spécifié,
|
||||
par une propriété `PerformerName`
|
||||
|
||||
|
||||
* NominativeSimpleBookingQuery.cs: implémente l'interface
|
||||
INominative
|
||||
|
||||
* UserFileSystemManager.cs: Fixe: Ne pas créer un dossier de
|
||||
destination si on a aucun fichier à recevoir.
|
||||
|
||||
* Commande.cs: * Ajoute le nom du client dans l'objet commande
|
||||
* Factorise le positionnement des paramêtres
|
||||
* La commande est une instance du type spécifié à la commande,
|
||||
dans son paramêtre `type`
|
||||
|
||||
* SimpleBookingQuery.cs: refabrication
|
||||
|
||||
* LocalizedText.resx:
|
||||
* LocalizedText.fr.resx: traducations
|
||||
|
||||
* UserNameBase.cs: implemente l'interface `IUserName`
|
||||
|
||||
|
||||
* IContentProvider.cs: doc xml
|
||||
|
||||
* YavscModel.csproj: reference le nouveau code source
|
||||
|
||||
* IUserName.cs: Définit l'interface d'un objet associé à un
|
||||
utilisateur.
|
||||
|
||||
2015-12-15 Paul Schneider <paul@pschneider.fr>
|
||||
|
||||
* CircleMember.cs: un membre de cercle est un nom
|
||||
|
|
|
|||
|
|
@ -111,6 +111,8 @@ namespace Yavsc.Model.FileSystem
|
|||
/// <param name="files">Files.</param>
|
||||
public static void Put(string destDir, NameObjectCollectionBase files)
|
||||
{
|
||||
if (files.Count == 0)
|
||||
return;
|
||||
FileManager.ValidateSubDir (destDir);
|
||||
FileManager.Put(
|
||||
Path.Combine(CurrentUserFileRoot(),destDir),
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ using System.Collections.Generic;
|
|||
using System.IO;
|
||||
using System.Reflection;
|
||||
|
||||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
|
|
@ -28,6 +27,12 @@ namespace Yavsc.Model.FrontOffice
|
|||
/// <value>The identifier.</value>
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the client.
|
||||
/// </summary>
|
||||
/// <value>The name of the client.</value>
|
||||
public string ClientName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the product reference.
|
||||
/// </summary>
|
||||
|
|
@ -50,30 +55,55 @@ namespace Yavsc.Model.FrontOffice
|
|||
return UserFileSystemManager.GetFiles (Id.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.Command"/> class.
|
||||
/// </summary>
|
||||
public Command()
|
||||
{
|
||||
}
|
||||
public void SetParameters(Dictionary<string,string> collection)
|
||||
{
|
||||
Parameters.Clear ();
|
||||
foreach (string key in collection.Keys) {
|
||||
if (key != "productref" && key != "type" && key != "clientname" ) {
|
||||
|
||||
Parameters.Add (key, collection [key]);
|
||||
foreach (var prop in this.GetType().GetRuntimeProperties())
|
||||
{
|
||||
if (prop.Name == key && prop.CanWrite) {
|
||||
System.ComponentModel.TypeConverter tc = System.ComponentModel.TypeDescriptor.GetConverter(prop.PropertyType);
|
||||
prop.SetValue(this,tc.ConvertFromString(collection [key]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Froms the post.
|
||||
/// Creates a command from the http post request.
|
||||
/// This methods applies to one product reference,
|
||||
/// given in a required value "ref" in the given
|
||||
/// collection of name value couples.
|
||||
/// </summary>
|
||||
/// <param name="collection">Collection.</param>
|
||||
/// <param name="files">Files.</param>
|
||||
private void FromPost(NameValueCollection collection, NameObjectCollectionBase files)
|
||||
private void FromPost(Dictionary<string,string> collection, NameObjectCollectionBase files)
|
||||
{
|
||||
// string catref=collection["catref"]; // Catalog Url from which formdata has been built
|
||||
ProductRef=collection["ref"]; // Required product reference
|
||||
ProductRef = collection ["productref"];
|
||||
if (ProductRef == null)
|
||||
throw new InvalidOperationException (
|
||||
"A product reference cannot be blank at command time");
|
||||
ClientName = collection ["clientname"];
|
||||
if (ClientName == null)
|
||||
throw new InvalidOperationException (
|
||||
"A client name cannot be blank at command time");
|
||||
|
||||
CreationDate = DateTime.Now;
|
||||
Status = CommandStatus.Inserted;
|
||||
// stores the parameters:
|
||||
Parameters.Clear ();
|
||||
foreach (string key in collection.AllKeys) {
|
||||
if (key!="ref")
|
||||
Parameters.Add (key, collection [key]);
|
||||
}
|
||||
SetParameters(collection);
|
||||
WorkFlowManager.RegisterCommand (this); // gives a value to this.Id
|
||||
string strcmdid = Id.ToString ();
|
||||
UserFileSystemManager.Put(Path.Combine("commandes",strcmdid),files);
|
||||
|
|
@ -82,12 +112,22 @@ namespace Yavsc.Model.FrontOffice
|
|||
/// <summary>
|
||||
/// Creates a command using the specified collection
|
||||
/// as command parameters, handles the files upload.
|
||||
///
|
||||
/// Required values in the command parameters :
|
||||
///
|
||||
/// * ref: the product reference,
|
||||
/// * type: the command concrete class name.
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="collection">Collection.</param>
|
||||
/// <param name="files">Files.</param>
|
||||
public static Command CreateCommand (NameValueCollection collection, NameObjectCollectionBase files)
|
||||
public static Command CreateCommand (Dictionary<string,string> collection, NameObjectCollectionBase files)
|
||||
{
|
||||
var cmd = CreateCommand (collection ["type"]);
|
||||
string type = collection ["type"];
|
||||
if (type == null)
|
||||
throw new InvalidOperationException (
|
||||
"A command type cannot be blank");
|
||||
var cmd = CreateCommand (type);
|
||||
cmd.FromPost (collection, files);
|
||||
return cmd;
|
||||
}
|
||||
|
|
@ -100,9 +140,18 @@ namespace Yavsc.Model.FrontOffice
|
|||
public static Command CreateCommand (string className)
|
||||
{
|
||||
var type = Type.GetType (className);
|
||||
|
||||
if (type == null)
|
||||
throw new InvalidOperationException (
|
||||
"Cannot find the command class " + className);
|
||||
|
||||
if (!typeof(Command).IsAssignableFrom(type))
|
||||
throw new InvalidOperationException (
|
||||
"No command is assignable from a " + className);
|
||||
|
||||
ConstructorInfo ci = type.GetConstructor(new Type[]{});
|
||||
var cmd = ci.Invoke (new object[]{}) as Command;
|
||||
return cmd;
|
||||
var cmd = ci.Invoke (new object[]{ });
|
||||
return cmd as Command;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
35
yavscModel/FrontOffice/INominative.cs
Normal file
35
yavscModel/FrontOffice/INominative.cs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
//
|
||||
// INominative.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 Yavsc.Model.Skill;
|
||||
using Yavsc.Model.WorkFlow;
|
||||
using System.Linq;
|
||||
using Yavsc.Model.RolesAndMembers;
|
||||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
public interface INominative {
|
||||
string PerformerName { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
49
yavscModel/FrontOffice/NominativeSimpleBookingQuery.cs
Normal file
49
yavscModel/FrontOffice/NominativeSimpleBookingQuery.cs
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
//
|
||||
// NominativeSimpleBookingQuery.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 Yavsc.Model.Skill;
|
||||
using Yavsc.Model.WorkFlow;
|
||||
using System.Linq;
|
||||
using Yavsc.Model.RolesAndMembers;
|
||||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Nominative simple booking query.
|
||||
/// </summary>
|
||||
public class NominativeSimpleBookingQuery : SimpleBookingQuery, INominative {
|
||||
#region IUserName implementation
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the performer.
|
||||
/// </summary>
|
||||
/// <value>The name of the user.</value>
|
||||
public string PerformerName {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -23,9 +23,11 @@ using System.ComponentModel.DataAnnotations;
|
|||
using Yavsc.Model.Skill;
|
||||
using Yavsc.Model.WorkFlow;
|
||||
using System.Linq;
|
||||
using Yavsc.Model.RolesAndMembers;
|
||||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Simple booking query.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -14,14 +14,12 @@
|
|||
</resheader>
|
||||
|
||||
<data name="About"><value>À propos</value></data>
|
||||
<data name="AboutContent"><value>Je suis développeur indépendant à Suresnes depuis quelque mois.
|
||||
Je démarre une activité dans le domaine de l'edition logicielle,
|
||||
et je délivre principalement des applications pour mobiles.</value></data>
|
||||
<data name="additionally"><value>de plus</value></data>
|
||||
<data name="access_denied"><value>Accès refusé</value></data>
|
||||
<data name="Activities"><value>Activités</value></data>
|
||||
<data name="AnIMessageHasbeenSent"><value>Un message instantané a été envoyé à {0},
|
||||
lui présentant votre demande. Vous devriez être contacté très rapidement.</value></data>
|
||||
<data name="AskForAnEstimate"><value>Demander un devis</value></data>
|
||||
<data name="available"><value>disponible</value></data>
|
||||
<data name="AuthenticatedOnly"><value>Seuls les utilisateurs authentifiés peuvent accèder à cette information.</value></data>
|
||||
<data name="Basket"><value>Panier</value></data>
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
<data name="Activities"><value>Activities</value></data>
|
||||
<data name="AnIMessageHasbeenSent"><value>An instant message has been sent to {0},
|
||||
showing to him your query. You should be contacted very soon.</value></data>
|
||||
<data name="AskForAnEstimate"><value>Ask for an estimate</value></data>
|
||||
<data name="available"><value>available</value></data>
|
||||
<data name="AuthenticatedOnly"><value>You must be authenticated in order to access this information</value></data>
|
||||
<data name="Bill_edition"><value>Bill edition</value></data>
|
||||
|
|
|
|||
32
yavscModel/RolesAndMembers/IUserName.cs
Normal file
32
yavscModel/RolesAndMembers/IUserName.cs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
//
|
||||
// IUserName.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 interface IUserName {
|
||||
string UserName { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -28,7 +28,7 @@ namespace Yavsc.Model.RolesAndMembers
|
|||
/// <summary>
|
||||
/// User name base.
|
||||
/// </summary>
|
||||
public class UserNameBase : IIdentified<string> {
|
||||
public class UserNameBase : IUserName, IIdentified<string> {
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the user.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -25,6 +25,10 @@ namespace Yavsc.Model.WorkFlow
|
|||
/// <value>The final statuses.</value>
|
||||
bool [] FinalStatuses { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
string Name { get; }
|
||||
/// <summary>
|
||||
/// Creates the estimate.
|
||||
|
|
@ -133,6 +137,7 @@ namespace Yavsc.Model.WorkFlow
|
|||
/// <returns>The command id in db.</returns>
|
||||
/// <param name="com">COM.</param>
|
||||
long RegisterCommand (Command com);
|
||||
|
||||
/// <summary>
|
||||
/// Sets the writting status.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -243,6 +243,9 @@
|
|||
<Compile Include="Skill\SkillRating.cs" />
|
||||
<Compile Include="Circles\CircleMember.cs" />
|
||||
<Compile Include="Circles\ICircle.cs" />
|
||||
<Compile Include="FrontOffice\NominativeSimpleBookingQuery.cs" />
|
||||
<Compile Include="FrontOffice\INominative.cs" />
|
||||
<Compile Include="RolesAndMembers\IUserName.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue