* Makefile:
* CatalogManager.cs: Let the catalog manager ensure all command form are instancied * PhysicalProduct.cs: A better ToString method * SaleForm.cs: doc * NpgsqlContentProvider.cs: registers a command * FrontOfficeApiController.cs: Set the catalog referer uri in each command form found in the catalog * FrontOfficeController.cs: creates the catalog with referer uri * instdbws.sql: the command has got a client, as registered user * Commande.cs: The command has an id and a product reference * IContentProvider.cs: new RegisterCommand method * WorkFlowManager.cs: yavscModel/WorkFlow/IContentProvider.cs
This commit is contained in:
parent
85346d0e00
commit
b835053e5f
11 changed files with 122 additions and 19 deletions
|
|
@ -10,15 +10,29 @@ namespace SalesCatalog
|
|||
public static class CatalogManager
|
||||
{
|
||||
private static CatalogProvider defaultProvider = null;
|
||||
public static Catalog GetCatalog ()
|
||||
public static Catalog GetCatalog (string catalogUri)
|
||||
{
|
||||
|
||||
if (defaultProvider == null) {
|
||||
if (CatalogHelper.Config == null)
|
||||
CatalogHelper.LoadConfig ();
|
||||
defaultProvider = CatalogHelper.GetDefaultProvider ();
|
||||
|
||||
}
|
||||
return defaultProvider.GetCatalog ();
|
||||
Catalog res = defaultProvider.GetCatalog ();
|
||||
|
||||
// Assert res.Brands.All( x => x.DefaultForm != null );
|
||||
// Sanity fixes
|
||||
foreach (Brand b in res.Brands) {
|
||||
if (b.DefaultForm.CatalogReference==null)
|
||||
b.DefaultForm.CatalogReference = catalogUri;
|
||||
foreach (ProductCategory pc in b.Categories) {
|
||||
foreach (Product p in pc.Products) {
|
||||
if (p.CommandForm == null)
|
||||
p.CommandForm = b.DefaultForm;
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ namespace SalesCatalog.Model
|
|||
|
||||
public override string ToString ()
|
||||
{
|
||||
return string.Format ("[PhysicalProduct: UnitaryPrice={0}]", UnitaryPrice);
|
||||
return string.Format ("[PhysicalProduct: Reference:{0} UnitaryPrice={1}]", Reference, UnitaryPrice);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,15 +5,35 @@ namespace SalesCatalog.Model
|
|||
{
|
||||
public class SaleForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the catalog reference.
|
||||
/// It must be non null,
|
||||
/// it is an Uri, returning the Xml
|
||||
/// Catalog at Http GET request
|
||||
/// </summary>
|
||||
/// <value>The catalog reference.</value>
|
||||
public string CatalogReference { get; set; }
|
||||
|
||||
public SaleForm ()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the action, that is,
|
||||
/// the Method of the FrontOffice controller
|
||||
/// called to post this Command form.
|
||||
/// It defaults to "Command"
|
||||
/// </summary>
|
||||
/// <value>The action.</value>
|
||||
public string Action {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the input values of this command form.
|
||||
/// </summary>
|
||||
/// <value>The items.</value>
|
||||
public FormElement[] Items { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue