- a module for IT services business
- Mvc-like action binding in the WF web api ... ? * Yavsc.sln: * Web.csproj: * MvcActionValueBinder.cs: * yavscModel.csproj: * WFOrder.cs: * IWFOrder.cs: * BasketImpact.cs: * ProjectInfo.cs: * IWFModule.cs: * IWFCommand.cs: * WorkFlowController.cs: * NewProjectModel.cs: * IContentProvider.cs: * ITCPNpgsqlProvider.cs: * WorkFlowProvider.csproj: * ITContentProvider.csproj: * AssemblyInfo.cs: * OrderStatusChangedEventArgs.cs: * NpgsqlContentProvider.cs:
This commit is contained in:
parent
04804b89a9
commit
fa93ce7fee
19 changed files with 412 additions and 122 deletions
|
|
@ -1,12 +1,22 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace yavscModel.WorkFlow
|
||||
{
|
||||
public interface IContentProvider: IDisposable
|
||||
{
|
||||
string Order (IWFCommand c);
|
||||
IContent Get (string orderId);
|
||||
IWFOrder CreateOrder ();
|
||||
IWFOrder ImapctOrder (string orderid, FormCollection col);
|
||||
IContent GetBlob (string orderId);
|
||||
int GetStatus (string orderId);
|
||||
/// <summary>
|
||||
/// Gets the status labels.
|
||||
/// 0 is the starting status
|
||||
/// </summary>
|
||||
/// <value>The status labels.</value>
|
||||
bool [] IsFinalStatus { get; }
|
||||
string [] StatusLabels {get;}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace yavscModel.WorkFlow
|
||||
{
|
||||
public interface IWFCommand
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2,12 +2,24 @@ using System;
|
|||
using yavscModel.WorkFlow;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace WorkFlow
|
||||
namespace yavscModel.WorkFlow
|
||||
{
|
||||
public interface IWFModule
|
||||
{
|
||||
int GetState (IWFCommand c);
|
||||
int Handle (IWFCommand c,FormCollection collection);
|
||||
/// <summary>
|
||||
/// Gets the state for an order (assuming it was passed to <c>Handle</c>).
|
||||
/// </summary>
|
||||
/// <returns>The state.</returns>
|
||||
/// <param name="c">C.</param>
|
||||
int GetState (IWFOrder c);
|
||||
/// <summary>
|
||||
/// Handle the specified order and form input value collection.
|
||||
/// </summary>
|
||||
/// <param name="order">l'ordre</param>
|
||||
/// <param name="collection">La collection de valeur de champs d'entée de formulaires.</param>
|
||||
/// <returns>0 when the module accepts to handle the order, non null value otherwize<returns>
|
||||
int Handle (IWFOrder order,FormCollection collection);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
18
yavscModel/WorkFlow/IWFOrder.cs
Normal file
18
yavscModel/WorkFlow/IWFOrder.cs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace yavscModel.WorkFlow
|
||||
{
|
||||
public interface IWFOrder
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the unique Identifier for this order, in this application.
|
||||
/// </summary>
|
||||
/// <value>The unique I.</value>
|
||||
string UniqueID {
|
||||
get;
|
||||
}
|
||||
event EventHandler<OrderStatusChangedEventArgs> StatusChanged;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4,6 +4,7 @@ using System.ComponentModel;
|
|||
|
||||
namespace yavscModel.WorkFlow
|
||||
{
|
||||
[Obsolete("This should be define in an IT specific module")]
|
||||
public class NewProjectModel
|
||||
{
|
||||
[DisplayName("Nom du projet")]
|
||||
|
|
|
|||
17
yavscModel/WorkFlow/OrderStatusChangedEventArgs.cs
Normal file
17
yavscModel/WorkFlow/OrderStatusChangedEventArgs.cs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
using System;
|
||||
|
||||
namespace yavscModel.WorkFlow
|
||||
{
|
||||
public class OrderStatusChangedEventArgs: EventArgs
|
||||
{
|
||||
public OrderStatusChangedEventArgs (int oldstatus, int newstatus, string reason)
|
||||
{
|
||||
oldstat = oldstatus;
|
||||
newstat = newstatus;
|
||||
}
|
||||
private int oldstat, newstat;
|
||||
public int OldStatus { get { return oldstat; } }
|
||||
public int NewStatus { get { return newstat; } }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2,28 +2,35 @@ using System;
|
|||
using SalesCatalog.Model;
|
||||
using yavscModel.WorkFlow;
|
||||
|
||||
namespace WorkFlow
|
||||
namespace yavscModel.WorkFlow
|
||||
{
|
||||
public class WFOrder : IWFCommand
|
||||
public class WFOrder : IWFOrder
|
||||
{
|
||||
private Product p;
|
||||
private DateTime date;
|
||||
private string catref;
|
||||
private string id = null;
|
||||
public WFOrder(Product prod,string catalogReference){
|
||||
date = DateTime.Now;
|
||||
catref=catalogReference;
|
||||
p = prod;
|
||||
id = Guid.NewGuid ().ToString();
|
||||
}
|
||||
public override string ToString ()
|
||||
{
|
||||
return string.Format ("[Commande date={0} prodref={1}, cat={2}]",date,p.Reference,catref);
|
||||
}
|
||||
|
||||
#region IWFCommand implementation
|
||||
public event EventHandler<OrderStatusChangedEventArgs> StatusChanged;
|
||||
|
||||
public string CatalogReference {
|
||||
#region IWFCommand implementation
|
||||
/// <summary>
|
||||
/// Gets the catalog reference, a unique id for the catalog (not a product id).
|
||||
/// </summary>
|
||||
/// <value>The catalog reference.</value>
|
||||
public string UniqueID {
|
||||
get {
|
||||
return catref;
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue