* Web.csproj: * instdbws.sql: * packages.config: * TestByteA.cs: * App.master: * MyClass.cs: * LocalizedText.resx: * Index.aspx: * LocalizedText.fr.resx: * packages.config: * Details.aspx: * packages.config: * packages.config: * packages.config: * EventPub.aspx: * LocalizedText.Designer.cs: * FileSystemController.cs: * FrontOfficeController.cs: * NpgsqlContentProvider.cs: * ITContentProvider.csproj: * FileSystemManager.cs: * Circle.cs: * YaEvent.cs: * NpgsqlBlogProvider.csproj: * NpgsqlMRPProviders.csproj: * EventPub.cs: * NpgsqlContentProvider.csproj: * EventType.cs: * UserPrefs.cs: * CalendarController.cs: * EstablishmentType.cs: * ITCPNpgsqlProvider.cs: * NpgsqlBlogProvider.cs: * NpgsqlRoleProvider.cs: * NpgsqlProfileProvider.cs: * NpgsqlMembershipProvider.cs: Npgsql Command.Parameters.Add is obsolete * Commande.cs: FileSystem ctor needs a format parameter in order to use path by membership * google-services.json: intented to be used to build android application able to receive push notification via GCM
96 lines
2.5 KiB
C#
96 lines
2.5 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;
|
|
|
|
|
|
namespace Yavsc.Model.FrontOffice
|
|
{
|
|
/// <summary>
|
|
/// Commande.
|
|
/// </summary>
|
|
public 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 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> ();
|
|
|
|
FileInfoCollection Files {
|
|
get {
|
|
return GetFSM().GetFiles (Id.ToString());
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.Command"/> class.
|
|
/// </summary>
|
|
public Command()
|
|
{
|
|
}
|
|
/// <summary>
|
|
/// Froms the post.
|
|
/// </summary>
|
|
/// <param name="collection">Collection.</param>
|
|
/// <param name="files">Files.</param>
|
|
public void FromPost(NameValueCollection collection, NameObjectCollectionBase files)
|
|
{
|
|
// string catref=collection["catref"]; // Catalog Url from which formdata has been built
|
|
ProductRef=collection["ref"]; // Required product reference
|
|
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]);
|
|
}
|
|
WorkFlowManager wfm = new WorkFlowManager ();
|
|
wfm.RegisterCommand (this); // overrides this.Id
|
|
string strcmdid = Id.ToString ();
|
|
GetFSM().Put (strcmdid, files);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Creates a command using the specified collection
|
|
/// as command parameters, handles the files upload.
|
|
/// </summary>
|
|
/// <param name="collection">Collection.</param>
|
|
/// <param name="files">Files.</param>
|
|
public Command (NameValueCollection collection, NameObjectCollectionBase files)
|
|
{
|
|
FromPost (collection, files);
|
|
}
|
|
|
|
private FileSystemManager GetFSM() {
|
|
return new FileSystemManager ("~/commands/{0}");
|
|
}
|
|
}
|
|
}
|
|
|