using System;
using Yavsc;
using System.Collections.Specialized;
using Yavsc.Model.WorkFlow;
using Newtonsoft.Json;
namespace Yavsc.Model.FrontOffice
{
///
/// Commande.
///
public class Commande
{
///
/// Gets or sets the creation date.
///
/// The creation date.
public DateTime CreationDate { get; set; }
///
/// Gets or sets the identifier.
///
/// The identifier.
public long Id { get; set; }
///
/// Gets or sets the prod reference.
///
/// The prod reference.
public string ProdRef { get; set; }
///
/// The parameters.
///
public StringDictionary Parameters = new StringDictionary();
///
/// Initializes a new instance of the class.
///
public Commande() {
}
///
/// Create the specified collection.
///
/// Collection.
public static Commande Create(NameValueCollection collection)
{
Commande cmd = new Commande ();
// string catref=collection["catref"]; // Catalog Url from which formdata has been built
cmd.ProdRef=collection["ref"]; // Required product reference
cmd.CreationDate = DateTime.Now;
// stores the parameters:
foreach (string key in collection.AllKeys) {
cmd.Parameters.Add (key, collection [key]);
}
WorkFlowManager wm = new WorkFlowManager ();
wm.RegisterCommand (cmd); // sets cmd.Id
return cmd;
}
}
}