* ResetPassword.txt: Un message pour le mot de passe oublié * style.css: fixe un 404 * UpdatePassword.aspx: Implémente le formulaire de mise à jour du mot de passe, accessible depuis l'e-mail. * Contact.aspx: implémente la page de contact préstataire * UpdatePassword.cs: modèle de la modification de mot de passe au jeton de securité (qui est encore un fake en l'état) * CommandRegistration.cs: un enregistrement de commande * NominativeCommandRegistration.cs: un enregistrement de commande nominative * .gitignore: ignore ma config LuaDebug * NpgsqlMembershipProvider.cs: ne pas crasher à la lecture en base de la question de recupération du mot de passe quand elle est nulle. * BasketController.cs: renvoie l'objet décrivant la prise de commande * Global.asax.cs: ignorer les routes vers App_Data et App_Code * instdbws.sql: passage du type json à jsonb pour les paramètres de la commande * RegistrationMail.txt: un piti message à l'enregistrement * AccountController.cs: Envoi du message du mot de passe oublié, methode de changemnet du mot de passe. * AdminController.cs: xmldoc + refabrication helper Notify * HomeController.cs: * BlogsController.cs: * GoogleController.cs: refabrication helper Notify * FrontOfficeController.cs: Refabrication: Utilisation du nouvel enregistrement de commande. + refabrication helper Notify * YavscHelpers.cs: implémente la methode d'envoi du message de mot de passe oublié + refabrication helper Notify * App.master: Corrige la notification Html * AppAdmin.master: Le lien vers la page de contact était associé à tort à la classe css "thanks" * yavsc.js: message plus parlant en cas de requête Ajax mal formée. * Login.aspx: Implémente le lien vers le formulaire de recupération du mot de passe * UserPost.aspx: . * Booking.aspx: format du code * Performer.ascx: l'e-mail préstataire ne sera jamais fourni par l'application, aussi, on parlera de "prendre contact", d'échanger ... mais pas de donner l'adresse e-mail. L'information "son email" n'est donc pas disponible meme à l'utilisateur autorisé. La prise de contact, ou autre fux de comunication le sont. * Performers.aspx: affiche la notification à l'envoi de la demande de devis * Product.aspx: * Service.aspx: les periodes du catalogue et du calendrier sont fondue. * Contact.aspx: traduction en français * Web.config: * la procédure de recupération du mot de passe est activée * l'e-message envoyé est construit à partir d'un modèle, un fichier texte trouvé dans /App_Data, et indiqué à l'application par le paramêtre applicatif "LostPasswordMessage" * Yavsc.csproj: reference les nouveaux fichiers * Product.cs: utilise la période du calendrier * Commande.cs: renvoie un objet à la prise de commande, indiquant l'identifiant de commande, et les messages envoyés en cas de commande nominative. * GoogleHelpers.cs: icone à la notification mobile * LocalizedText.resx: * LocalizedText.fr.resx: * LocalizedText.Designer.cs: * LocalizedText.fr.Designer.cs: traductions * UserNameBase.cs: fixe la dé-sérialisation * WorkFlowManager.cs: refabrication de la prise de commande * YavscModel.csproj: nouveaux objets du modèle * OtherWebException.aspx: page obsolete * Period.cs: fondre la période: celle du catalogue disparait, au profit de celle du calendrier.
179 lines
5.1 KiB
C#
179 lines
5.1 KiB
C#
using System;
|
|
using Yavsc;
|
|
using System.Collections.Specialized;
|
|
using Yavsc.Model.WorkFlow;
|
|
using Yavsc.Model.FileSystem;
|
|
using System.Web;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Reflection;
|
|
using Yavsc.Model.WorkFlow;
|
|
|
|
namespace Yavsc.Model.FrontOffice
|
|
{
|
|
/// <summary>
|
|
/// Commande.
|
|
/// </summary>
|
|
public abstract class Command
|
|
{
|
|
/// <summary>
|
|
/// Gets or sets the creation date.
|
|
/// </summary>
|
|
/// <value>The creation date.</value>
|
|
public DateTime CreationDate { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the identifier.
|
|
/// </summary>
|
|
/// <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>
|
|
/// <value>The prod reference.</value>
|
|
public CommandStatus Status { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the product reference.
|
|
/// </summary>
|
|
/// <value>The product reference.</value>
|
|
public string ProductRef { get; set; }
|
|
|
|
/// <summary>
|
|
/// The parameters.
|
|
/// </summary>
|
|
public Dictionary<string,string> Parameters = new Dictionary<string,string> ();
|
|
|
|
IEnumerable<FileInfo> Files {
|
|
get {
|
|
return UserFileSystemManager.GetFiles (Id.ToString());
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.Command"/> class.
|
|
/// </summary>
|
|
public Command()
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// Sets the parameters.
|
|
/// </summary>
|
|
/// <param name="collection">Collection.</param>
|
|
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>
|
|
/// 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 CommandRegistration FromPost(Dictionary<string,string> collection, NameObjectCollectionBase files)
|
|
{
|
|
// string catref=collection["catref"]; // Catalog Url from which formdata has been built
|
|
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:
|
|
SetParameters(collection);
|
|
var registration = WorkFlowManager.RegisterCommand (this); // gives a value to this.Id
|
|
UserFileSystemManager.Put(Path.Combine("commandes",Id.ToString ()),files);
|
|
return registration;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Creates a command using the specified collection
|
|
/// as command parameters, handles the files upload,
|
|
/// ans register the command in db, positionning the
|
|
/// command id.
|
|
///
|
|
/// Required values in the command parameters :
|
|
///
|
|
/// * ref: the product reference,
|
|
/// * type: the command concrete class name.
|
|
///
|
|
/// </summary>
|
|
/// <returns>The command.</returns>
|
|
/// <param name="collection">Collection.</param>
|
|
/// <param name="files">Files.</param>
|
|
/// <param name="cmdreg">Cmdreg.</param>
|
|
public static Command CreateCommand (
|
|
Dictionary<string,string> collection,
|
|
NameObjectCollectionBase files,
|
|
out CommandRegistration cmdreg)
|
|
{
|
|
string type = collection ["type"];
|
|
if (type == null)
|
|
throw new InvalidOperationException (
|
|
"A command type cannot be blank");
|
|
var cmd = CreateCommand (type);
|
|
cmdreg = cmd.FromPost (collection, files);
|
|
return cmd;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Creates the command, for deserialisation,
|
|
/// do not register it in database.
|
|
/// </summary>
|
|
/// <returns>The command.</returns>
|
|
/// <param name="className">Class name.</param>
|
|
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[]{ });
|
|
return cmd as Command;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets the command textual description.
|
|
/// </summary>
|
|
/// <returns>The description.</returns>
|
|
public abstract string GetDescription ();
|
|
}
|
|
}
|
|
|