* YavscModel.csproj:
* NewProjectModel.cs: * ITContentProvider.csproj: refactoring * WebApiConfig.cs: Web Api Config * IModule.cs: * RssFeeds.cs: * IRenderer.cs: * Blog.cs: * ITagHandler.cs: * ViewRenderer.cs: * Comment.cs: * IViewRenderer.cs: * People.cs: * SignIn.cs: * BlogEntry.cs: * AuthToken.cs: * BlogHelper.cs: * DataAccess.cs: * Estimate.cs: * BlogManager.cs: * Writting.cs: * AskForADate.cs: * RestoreQuery.cs: * Basket.cs: * BlogProvider.cs: * CalendarList.cs: * Commande.cs: * StatusChange.cs: * WebFileInfo.cs: * WorkFlowManager.cs: * Euro.cs: * Unit.cs: * Text.cs: * Profile.cs: * Note.cs: * Link.cs: * BlogEditEntryModel.cs: * FindBlogEntryFlags.cs: * NewProjectModel.cs: * CalendarListEntry.cs: * CalendarEntryList.cs: * IContentProvider.cs: * CommandStatus.cs: * Label.cs: * Price.cs: * BlogEntryCollection.cs: * Period.cs: * Scalar.cs: * BlogEditCommentModel.cs: * Option.cs: * NpgsqlContentProvider.cs: * Product.cs: * LoginModel.cs: * Service.cs: * Catalog.cs: * Currency.cs: * NewEstimateEvenArgs.cs: * CheckBox.cs: * SaleForm.cs: * FileSystemManager.cs: * FormInput.cs: * TextInput.cs: * NewRoleModel.cs: * FileInfoCollection.cs: * FilesInput.cs: * NewAdminModel.cs: * SelectItem.cs: * SelectInput.cs: * RadioButton.cs: * StockStatus.cs: * Provider.cs: * DirNotFoundException.cs: * FormElement.cs: * ProductImage.cs: * WebFileInfoCollection.cs: * CatalogHelper.cs: * CatalogManager.cs: * RegisterViewModel.cs: * InvalidDirNameException.cs: * PhysicalProduct.cs: * CatalogProvider.cs: * ProductCategory.cs: * OrderStatusChangedEventArgs.cs: * ProviderCollection.cs: * WorkflowConfiguration.cs: * BlogProviderConfigurationElement.cs: * BlogProvidersConfigurationSection.cs: * BlogProvidersConfigurationCollection.cs: * CatalogProviderConfigurationElement.cs: * CatalogProvidersConfigurationSection.cs: * CatalogProvidersConfigurationCollection.cs: xml doc * SalesCatalog.csproj: * XmlCatalogProvider.cs: Maps the catalog using System.Web * BasketController.cs: * FrontOfficeController.cs: a Basket controller * Global.asax.cs: Session in Web Api * App.master: WebApi bas url as Javascript var 'apiBaseUrl' * Index.aspx: !!not sure of this change. * Web.csproj: compiles now includes WebApiConfig.cs * style.css: link background color * FileSystemController.cs: a file system controller
This commit is contained in:
parent
017a6fde23
commit
b505ad90e7
100 changed files with 2520 additions and 212 deletions
|
|
@ -27,7 +27,7 @@ namespace Yavsc.Model.FrontOffice
|
|||
/// <summary>
|
||||
/// Basket.
|
||||
/// </summary>
|
||||
public class Basket: List<Commande>
|
||||
public class Basket: Dictionary<long,Commande>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.Basket"/> class.
|
||||
|
|
@ -35,7 +35,18 @@ namespace Yavsc.Model.FrontOffice
|
|||
public Basket ()
|
||||
{
|
||||
}
|
||||
|
||||
/// <Docs>The item to add to the current collection.</Docs>
|
||||
/// <para>Adds an item to the current collection.</para>
|
||||
/// <remarks>To be added.</remarks>
|
||||
/// <exception cref="System.NotSupportedException">The current collection is read-only.</exception>
|
||||
/// <summary>
|
||||
/// Add the specified cmd.
|
||||
/// </summary>
|
||||
/// <param name="cmd">Cmd.</param>
|
||||
public void Add(Commande cmd)
|
||||
{
|
||||
Add (cmd.Id, cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,12 +19,23 @@ namespace Yavsc.Model.FrontOffice
|
|||
/// </summary>
|
||||
/// <value>The brands.</value>
|
||||
public Brand[] Brands { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the brand.
|
||||
/// </summary>
|
||||
/// <returns>The brand.</returns>
|
||||
/// <param name="brandName">Brand name.</param>
|
||||
public Brand GetBrand(string brandName)
|
||||
{
|
||||
return Array.Find<Brand>(Brands, b => b.Name == brandName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds the brand.
|
||||
/// </summary>
|
||||
/// <returns>The brand.</returns>
|
||||
/// <param name="brandName">Brand name.</param>
|
||||
/// <param name="slogan">Slogan.</param>
|
||||
/// <param name="logo">Logo.</param>
|
||||
public Brand AddBrand(string brandName,string slogan=null, ProductImage logo=null)
|
||||
{
|
||||
Brand[] oldbrs = (Brand[]) Brands.Clone ();
|
||||
|
|
@ -39,6 +50,11 @@ namespace Yavsc.Model.FrontOffice
|
|||
return b;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the brand.
|
||||
/// </summary>
|
||||
/// <returns><c>true</c>, if brand was removed, <c>false</c> otherwise.</returns>
|
||||
/// <param name="brandName">Brand name.</param>
|
||||
public bool RemoveBrand(string brandName)
|
||||
{
|
||||
Brand b = this.GetBrand (brandName);
|
||||
|
|
@ -51,10 +67,23 @@ namespace Yavsc.Model.FrontOffice
|
|||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the start date.
|
||||
/// </summary>
|
||||
/// <value>The start date.</value>
|
||||
public DateTime StartDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the end date.
|
||||
/// </summary>
|
||||
/// <value>The end date.</value>
|
||||
public DateTime EndDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Finds the product.
|
||||
/// </summary>
|
||||
/// <returns>The product.</returns>
|
||||
/// <param name="reference">Reference.</param>
|
||||
public Product FindProduct (string reference)
|
||||
{
|
||||
Product p = null;
|
||||
|
|
|
|||
|
|
@ -12,9 +12,15 @@ namespace Yavsc.Model.FrontOffice
|
|||
/// </summary>
|
||||
public static class CatalogHelper
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the config.
|
||||
/// </summary>
|
||||
/// <value>The config.</value>
|
||||
public static CatalogProvidersConfigurationSection Config {get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Loads the config.
|
||||
/// </summary>
|
||||
public static void LoadConfig () {
|
||||
Config = ConfigurationManager.GetSection ("system.web/catalog") as CatalogProvidersConfigurationSection;
|
||||
if (Config == null)
|
||||
|
|
|
|||
|
|
@ -8,6 +8,12 @@ namespace Yavsc.Model.FrontOffice
|
|||
public static class CatalogManager
|
||||
{
|
||||
private static CatalogProvider defaultProvider = null;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the catalog.
|
||||
/// </summary>
|
||||
/// <returns>The catalog.</returns>
|
||||
/// <param name="catalogUri">Catalog URI.</param>
|
||||
public static Catalog GetCatalog (string catalogUri)
|
||||
{
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,10 @@ namespace Yavsc.Model.FrontOffice
|
|||
/// </summary>
|
||||
public abstract class CatalogProvider: ProviderBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the catalog.
|
||||
/// </summary>
|
||||
/// <returns>The catalog.</returns>
|
||||
public abstract Catalog GetCatalog ();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,23 +2,40 @@ using System;
|
|||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Check box.
|
||||
/// </summary>
|
||||
public class CheckBox : FormInput
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.CheckBox"/> class.
|
||||
/// </summary>
|
||||
public CheckBox ()
|
||||
{
|
||||
}
|
||||
|
||||
#region implemented abstract members of FormInput
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the type.
|
||||
/// </summary>
|
||||
/// <value>The type.</value>
|
||||
public override string Type {
|
||||
get {
|
||||
return "checkbox";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this <see cref="Yavsc.Model.FrontOffice.CheckBox"/> is value.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if value; otherwise, <c>false</c>.</value>
|
||||
public bool Value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Tos the html.
|
||||
/// </summary>
|
||||
/// <returns>The html.</returns>
|
||||
public override string ToHtml ()
|
||||
{
|
||||
return string.Format ("<input type=\"checkbox\" id=\"{0}\" name=\"{1}\" {2}/>", Id,Name,Value?"checked":"");
|
||||
|
|
|
|||
|
|
@ -3,33 +3,55 @@ using System.Configuration;
|
|||
|
||||
namespace Yavsc.Model.FrontOffice.Configuration
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Catalog provider configuration element.
|
||||
/// </summary>
|
||||
public class CatalogProviderConfigurationElement : ConfigurationElement
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
[ConfigurationProperty("name", IsRequired = true, IsKey=true)]
|
||||
public string Name {
|
||||
get { return (string)this ["name"]; }
|
||||
set { this ["name"] = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the type.
|
||||
/// </summary>
|
||||
/// <value>The type.</value>
|
||||
[ConfigurationProperty("type", IsRequired = true)]
|
||||
public string Type {
|
||||
get { return (string)this ["type"]; }
|
||||
set { this ["type"] = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the connection.
|
||||
/// </summary>
|
||||
/// <value>The connection.</value>
|
||||
[ConfigurationProperty("connection")]
|
||||
public string Connection {
|
||||
get { return (string)this ["connection"]; }
|
||||
set { this ["connection"] = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the description.
|
||||
/// </summary>
|
||||
/// <value>The description.</value>
|
||||
[ConfigurationProperty("description")]
|
||||
public string Description {
|
||||
get { return (string)this ["description"]; }
|
||||
set { this ["description"] = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the application.
|
||||
/// </summary>
|
||||
/// <value>The name of the application.</value>
|
||||
[ConfigurationProperty("applicationName")]
|
||||
public string ApplicationName {
|
||||
get { return (string)this ["applicationName"]; }
|
||||
|
|
|
|||
|
|
@ -4,18 +4,35 @@ using System.ComponentModel;
|
|||
|
||||
namespace Yavsc.Model.FrontOffice.Configuration
|
||||
{
|
||||
/// <summary>
|
||||
/// Catalog providers configuration collection.
|
||||
/// </summary>
|
||||
public class CatalogProvidersConfigurationCollection : ConfigurationElementCollection
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates the new element.
|
||||
/// </summary>
|
||||
/// <returns>The new element.</returns>
|
||||
protected override ConfigurationElement CreateNewElement ()
|
||||
{
|
||||
return new CatalogProviderConfigurationElement();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the element key.
|
||||
/// </summary>
|
||||
/// <returns>The element key.</returns>
|
||||
/// <param name="element">Element.</param>
|
||||
protected override object GetElementKey (ConfigurationElement element)
|
||||
{
|
||||
return ((CatalogProviderConfigurationElement) element).Name;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the element.
|
||||
/// </summary>
|
||||
/// <returns>The element.</returns>
|
||||
/// <param name="name">Name.</param>
|
||||
public CatalogProviderConfigurationElement GetElement (string name)
|
||||
{
|
||||
return this.BaseGet(name) as CatalogProviderConfigurationElement;
|
||||
|
|
|
|||
|
|
@ -4,14 +4,25 @@ using System.ComponentModel;
|
|||
|
||||
namespace Yavsc.Model.FrontOffice.Configuration
|
||||
{
|
||||
/// <summary>
|
||||
/// Catalog providers configuration section.
|
||||
/// </summary>
|
||||
public class CatalogProvidersConfigurationSection : ConfigurationSection
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the default provider.
|
||||
/// </summary>
|
||||
/// <value>The default provider.</value>
|
||||
[ConfigurationProperty("defaultProvider")]
|
||||
public string DefaultProvider {
|
||||
get { return (string)base ["defaultProvider"]; }
|
||||
set { base ["defaultProvider"] = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the providers.
|
||||
/// </summary>
|
||||
/// <value>The providers.</value>
|
||||
[ConfigurationProperty("providers")]
|
||||
[ConfigurationCollection(typeof(CatalogProvidersConfigurationCollection),
|
||||
AddItemName = "add",
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@ using System;
|
|||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Currency.
|
||||
/// </summary>
|
||||
public abstract class Currency: Unit
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,29 +2,54 @@ using System;
|
|||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Euro.
|
||||
/// </summary>
|
||||
public class Euro : Currency
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.Euro"/> class.
|
||||
/// </summary>
|
||||
public Euro ()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
public override string Name {
|
||||
get {
|
||||
return "Euro";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the description.
|
||||
/// </summary>
|
||||
/// <value>The description.</value>
|
||||
public override string Description {
|
||||
get {
|
||||
return "European currency";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Maies the convert to.
|
||||
/// </summary>
|
||||
/// <returns><c>true</c>, if convert to was mayed, <c>false</c> otherwise.</returns>
|
||||
/// <param name="other">Other.</param>
|
||||
public override bool MayConvertTo (Unit other)
|
||||
{
|
||||
return other.GetType().IsSubclassOf(typeof (Currency));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts to.
|
||||
/// </summary>
|
||||
/// <returns>The to.</returns>
|
||||
/// <param name="dest">Destination.</param>
|
||||
/// <param name="value">Value.</param>
|
||||
public override object ConvertTo (Unit dest, object value)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
|
|
|||
|
|
@ -2,9 +2,16 @@ using System;
|
|||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Files input.
|
||||
/// </summary>
|
||||
public class FilesInput : FormInput
|
||||
{
|
||||
#region implemented abstract members of FormInput
|
||||
/// <summary>
|
||||
/// Gets the type.
|
||||
/// </summary>
|
||||
/// <value>The type.</value>
|
||||
public override string Type {
|
||||
get {
|
||||
return "file";
|
||||
|
|
@ -12,10 +19,17 @@ namespace Yavsc.Model.FrontOffice
|
|||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.FilesInput"/> class.
|
||||
/// </summary>
|
||||
public FilesInput ()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tos the html.
|
||||
/// </summary>
|
||||
/// <returns>The html.</returns>
|
||||
public override string ToHtml ()
|
||||
{
|
||||
return string.Format ("<input type=\"file\" id=\"{0}\" name=\"{0}\"/>", Id);
|
||||
|
|
|
|||
|
|
@ -2,8 +2,15 @@ using System;
|
|||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Form element.
|
||||
/// </summary>
|
||||
public abstract class FormElement
|
||||
{
|
||||
/// <summary>
|
||||
/// Tos the html.
|
||||
/// </summary>
|
||||
/// <returns>The html.</returns>
|
||||
public abstract string ToHtml ();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@ using System.ComponentModel.DataAnnotations;
|
|||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Form input.
|
||||
/// </summary>
|
||||
public abstract class FormInput: FormElement
|
||||
{
|
||||
/// <summary>
|
||||
|
|
@ -15,10 +18,18 @@ namespace Yavsc.Model.FrontOffice
|
|||
[StringLength(256)]
|
||||
public string Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the type.
|
||||
/// </summary>
|
||||
/// <value>The type.</value>
|
||||
public abstract string Type { get; }
|
||||
|
||||
private string name=null;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
[StringLength(256)]
|
||||
public string Name { get { return name == null ? Id : name; } set { name = value; } }
|
||||
|
||||
|
|
|
|||
|
|
@ -2,13 +2,23 @@ using System;
|
|||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Label.
|
||||
/// </summary>
|
||||
public class Label:FormElement
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.Label"/> class.
|
||||
/// </summary>
|
||||
public Label ()
|
||||
{
|
||||
}
|
||||
string Text { get; set; }
|
||||
string For { get; set ; }
|
||||
/// <summary>
|
||||
/// Tos the html.
|
||||
/// </summary>
|
||||
/// <returns>The html.</returns>
|
||||
public override string ToHtml ()
|
||||
{
|
||||
return string.Format ("<label for=\"{0}\">{1}</label>", For, Text);
|
||||
|
|
|
|||
|
|
@ -3,11 +3,22 @@ using System.ComponentModel.DataAnnotations;
|
|||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Link.
|
||||
/// </summary>
|
||||
public class Link:Label
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.Link"/> class.
|
||||
/// </summary>
|
||||
public Link ()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the reference.
|
||||
/// </summary>
|
||||
/// <value>The reference.</value>
|
||||
[Required]
|
||||
public string Ref { get; set; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,8 +2,15 @@ using System;
|
|||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Note.
|
||||
/// </summary>
|
||||
public class Note:Text
|
||||
{
|
||||
/// <summary>
|
||||
/// Tos the html.
|
||||
/// </summary>
|
||||
/// <returns>The html.</returns>
|
||||
public override string ToHtml ()
|
||||
{
|
||||
return string.Format("<quote>{0}</quote>",Val);
|
||||
|
|
|
|||
|
|
@ -2,14 +2,31 @@ using System;
|
|||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Option.
|
||||
/// </summary>
|
||||
public class Option : FormElement
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.Option"/> class.
|
||||
/// </summary>
|
||||
public Option ()
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets or sets the value.
|
||||
/// </summary>
|
||||
/// <value>The value.</value>
|
||||
public string Value { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the text.
|
||||
/// </summary>
|
||||
/// <value>The text.</value>
|
||||
public string Text { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Tos the html.
|
||||
/// </summary>
|
||||
/// <returns>The html.</returns>
|
||||
public override string ToHtml ()
|
||||
{
|
||||
return string.Format ("<option value=\"{0}\">{1}</option>\n",Value,Text);
|
||||
|
|
|
|||
|
|
@ -2,12 +2,26 @@ using System;
|
|||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Period.
|
||||
/// </summary>
|
||||
public class Period
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.Period"/> class.
|
||||
/// </summary>
|
||||
public Period ()
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets or sets the start date.
|
||||
/// </summary>
|
||||
/// <value>The start date.</value>
|
||||
public DateTime StartDate { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the end date.
|
||||
/// </summary>
|
||||
/// <value>The end date.</value>
|
||||
public DateTime EndDate { get; set; }
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,13 +2,27 @@ using System;
|
|||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Physical product.
|
||||
/// </summary>
|
||||
public class PhysicalProduct : Product
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.PhysicalProduct"/> class.
|
||||
/// </summary>
|
||||
public PhysicalProduct ()
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets or sets the unitary price.
|
||||
/// </summary>
|
||||
/// <value>The unitary price.</value>
|
||||
public Price UnitaryPrice { get; set; }
|
||||
#region implemented abstract members of Product
|
||||
/// <summary>
|
||||
/// Gets the sales conditions.
|
||||
/// </summary>
|
||||
/// <returns>The sales conditions.</returns>
|
||||
public override string[] GetSalesConditions ()
|
||||
{
|
||||
return new string [] { string.Format(
|
||||
|
|
@ -17,7 +31,10 @@ namespace Yavsc.Model.FrontOffice
|
|||
UnitaryPrice.Unit.Name) };
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Returns a <see cref="System.String"/> that represents the current <see cref="Yavsc.Model.FrontOffice.PhysicalProduct"/>.
|
||||
/// </summary>
|
||||
/// <returns>A <see cref="System.String"/> that represents the current <see cref="Yavsc.Model.FrontOffice.PhysicalProduct"/>.</returns>
|
||||
public override string ToString ()
|
||||
{
|
||||
return string.Format ("[PhysicalProduct: Reference:{0} UnitaryPrice={1}]", Reference, UnitaryPrice);
|
||||
|
|
|
|||
|
|
@ -2,8 +2,14 @@ using System;
|
|||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Price.
|
||||
/// </summary>
|
||||
public class Price: Scalar
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.Price"/> class.
|
||||
/// </summary>
|
||||
public Price ()
|
||||
{
|
||||
}
|
||||
|
|
@ -11,6 +17,10 @@ namespace Yavsc.Model.FrontOffice
|
|||
decimal quantity;
|
||||
|
||||
#region implemented abstract members of SalesCatalog.Value
|
||||
/// <summary>
|
||||
/// Gets or sets the quantity.
|
||||
/// </summary>
|
||||
/// <value>The quantity.</value>
|
||||
public override object Quantity {
|
||||
get {
|
||||
return quantity;
|
||||
|
|
@ -21,6 +31,10 @@ namespace Yavsc.Model.FrontOffice
|
|||
}
|
||||
|
||||
Currency curr;
|
||||
/// <summary>
|
||||
/// Gets or sets the unit.
|
||||
/// </summary>
|
||||
/// <value>The unit.</value>
|
||||
public override Unit Unit {
|
||||
get {
|
||||
return curr;
|
||||
|
|
|
|||
|
|
@ -24,14 +24,38 @@ namespace Yavsc.Model.FrontOffice
|
|||
/// </summary>
|
||||
/// <value>The description.</value>
|
||||
public string Description { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the images.
|
||||
/// </summary>
|
||||
/// <value>The images.</value>
|
||||
public ProductImage[] Images { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the command form.
|
||||
/// </summary>
|
||||
/// <value>The command form.</value>
|
||||
public SaleForm CommandForm { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the reference.
|
||||
/// </summary>
|
||||
/// <value>The reference.</value>
|
||||
[Required]
|
||||
[StringLength(255)]
|
||||
public string Reference { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the command validity dates.
|
||||
/// </summary>
|
||||
/// <value>The command validity dates.</value>
|
||||
public Period CommandValidityDates { get; set; }
|
||||
/// <summary>
|
||||
/// Gets the sales conditions.
|
||||
/// </summary>
|
||||
/// <returns>The sales conditions.</returns>
|
||||
public abstract string[] GetSalesConditions();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the type.
|
||||
/// </summary>
|
||||
/// <value>The type.</value>
|
||||
public virtual string Type { get { return GetType().Name; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,18 +2,52 @@ using System;
|
|||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Product category.
|
||||
/// </summary>
|
||||
public class ProductCategory
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.ProductCategory"/> class.
|
||||
/// </summary>
|
||||
public ProductCategory ()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
public string Name { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the reference.
|
||||
/// </summary>
|
||||
/// <value>The reference.</value>
|
||||
public string Reference { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the products.
|
||||
/// </summary>
|
||||
/// <value>The products.</value>
|
||||
public Product[] Products { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the product by.
|
||||
/// </summary>
|
||||
/// <returns>The product by name.</returns>
|
||||
/// <param name="productName">Product name.</param>
|
||||
public Product GetProductByName (string productName)
|
||||
{
|
||||
return Array.Find<Product> (Products, p => p.Name == productName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the product.
|
||||
/// </summary>
|
||||
/// <returns>The product.</returns>
|
||||
/// <param name="reference">Reference.</param>
|
||||
public Product GetProduct (string reference)
|
||||
{
|
||||
return Array.Find<Product> (Products, p => p.Reference == reference);
|
||||
|
|
|
|||
|
|
@ -2,21 +2,39 @@ using System;
|
|||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Product image.
|
||||
/// </summary>
|
||||
public class ProductImage: FormElement
|
||||
{
|
||||
#region implemented abstract members of FormElement
|
||||
|
||||
/// <summary>
|
||||
/// Tos the html.
|
||||
/// </summary>
|
||||
/// <returns>The html.</returns>
|
||||
public override string ToHtml ()
|
||||
{
|
||||
return string.Format ("<img src=\"\" alt=\"\"/>", Src, Alt);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.ProductImage"/> class.
|
||||
/// </summary>
|
||||
public ProductImage ()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the source.
|
||||
/// </summary>
|
||||
/// <value>The source.</value>
|
||||
public string Src { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the alternate.
|
||||
/// </summary>
|
||||
/// <value>The alternate.</value>
|
||||
public string Alt { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,22 +2,40 @@ using System;
|
|||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Radio button.
|
||||
/// </summary>
|
||||
public class RadioButton:FormInput
|
||||
{
|
||||
#region implemented abstract members of FormInput
|
||||
|
||||
/// <summary>
|
||||
/// Gets the type.
|
||||
/// </summary>
|
||||
/// <value>The type.</value>
|
||||
public override string Type {
|
||||
get {
|
||||
return "radio";
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.RadioButton"/> class.
|
||||
/// </summary>
|
||||
public RadioButton ()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the choice.
|
||||
/// </summary>
|
||||
/// <value>The choice.</value>
|
||||
public string Choice { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Tos the html.
|
||||
/// </summary>
|
||||
/// <returns>The html.</returns>
|
||||
public override string ToHtml ()
|
||||
{
|
||||
return string.Format ("<input type=\"radio\" id=\"{0}\" name=\"{1}\" value=\"{2}\"/><label for=\"{0}\">{2}</label>", Id,Name,Choice);
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@ using System.Collections.Generic;
|
|||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Sale form.
|
||||
/// </summary>
|
||||
public class SaleForm
|
||||
{
|
||||
/// <summary>
|
||||
|
|
@ -14,6 +17,9 @@ namespace Yavsc.Model.FrontOffice
|
|||
/// <value>The catalog reference.</value>
|
||||
public string CatalogReference { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.SaleForm"/> class.
|
||||
/// </summary>
|
||||
public SaleForm ()
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,12 +2,26 @@ using System;
|
|||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Scalar.
|
||||
/// </summary>
|
||||
public abstract class Scalar
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.Scalar"/> class.
|
||||
/// </summary>
|
||||
public Scalar ()
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets or sets the quantity.
|
||||
/// </summary>
|
||||
/// <value>The quantity.</value>
|
||||
public abstract object Quantity { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the unit.
|
||||
/// </summary>
|
||||
/// <value>The unit.</value>
|
||||
public abstract Unit Unit{ get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,10 +4,16 @@ using System.Web.Mvc;
|
|||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Select input.
|
||||
/// </summary>
|
||||
public class SelectInput: FormInput
|
||||
{
|
||||
#region implemented abstract members of FormInput
|
||||
|
||||
/// <summary>
|
||||
/// Gets the type.
|
||||
/// </summary>
|
||||
/// <value>The type.</value>
|
||||
public override string Type {
|
||||
get {
|
||||
return "select";
|
||||
|
|
@ -15,9 +21,20 @@ namespace Yavsc.Model.FrontOffice
|
|||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// The items.
|
||||
/// </summary>
|
||||
public Option[] Items;
|
||||
|
||||
/// <summary>
|
||||
/// The index of the selected.
|
||||
/// </summary>
|
||||
public int SelectedIndex;
|
||||
|
||||
/// <summary>
|
||||
/// Tos the html.
|
||||
/// </summary>
|
||||
/// <returns>The html.</returns>
|
||||
public override string ToHtml ()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder ();
|
||||
|
|
|
|||
|
|
@ -2,17 +2,33 @@ using System;
|
|||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Select item.
|
||||
/// </summary>
|
||||
public class SelectItem
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.SelectItem"/> class.
|
||||
/// </summary>
|
||||
/// <param name="t">T.</param>
|
||||
public SelectItem(string t)
|
||||
{
|
||||
Value = t;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value.
|
||||
/// </summary>
|
||||
/// <value>The value.</value>
|
||||
public string Value { get; set; }
|
||||
|
||||
/// <param name="t">a SelectItem.</param>
|
||||
public static implicit operator string(SelectItem t)
|
||||
{
|
||||
return t.Value;
|
||||
}
|
||||
|
||||
/// <param name="t">a string.</param>
|
||||
public static implicit operator SelectItem(string t)
|
||||
{
|
||||
return new SelectItem(t);
|
||||
|
|
|
|||
|
|
@ -2,15 +2,29 @@ using System;
|
|||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Service.
|
||||
/// </summary>
|
||||
public class Service : Product
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.Service"/> class.
|
||||
/// </summary>
|
||||
public Service ()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the hour price.
|
||||
/// </summary>
|
||||
/// <value>The hour price.</value>
|
||||
public Price HourPrice { get; set; }
|
||||
|
||||
#region implemented abstract members of Product
|
||||
/// <summary>
|
||||
/// Gets the sales conditions.
|
||||
/// </summary>
|
||||
/// <returns>The sales conditions.</returns>
|
||||
public override string [] GetSalesConditions ()
|
||||
{
|
||||
return new string [] { string.Format(
|
||||
|
|
@ -19,6 +33,11 @@ namespace Yavsc.Model.FrontOffice
|
|||
HourPrice.Unit.Name) } ;
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Returns a <see cref="System.String"/> that represents the current <see cref="Yavsc.Model.FrontOffice.Service"/>.
|
||||
/// </summary>
|
||||
/// <returns>A <see cref="System.String"/> that represents the current <see cref="Yavsc.Model.FrontOffice.Service"/>.</returns>
|
||||
public override string ToString ()
|
||||
{
|
||||
return string.Format ("[Service: HourPrice={0}]", HourPrice);
|
||||
|
|
|
|||
|
|
@ -2,10 +2,38 @@ using System;
|
|||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
public enum StockStatus
|
||||
/// <summary>
|
||||
/// Stock status.
|
||||
/// </summary>
|
||||
public enum StockStatus:int
|
||||
{
|
||||
NoStock,
|
||||
InStock
|
||||
/// <summary>
|
||||
/// not in the catalog.
|
||||
/// </summary>
|
||||
NonExistent, //
|
||||
/// <summary>
|
||||
/// Service resources are not immediatly available.
|
||||
/// </summary>
|
||||
NotAvailable, //
|
||||
/// <summary>
|
||||
/// for a service, the resources are available,
|
||||
/// but a human review of the order has to de made by
|
||||
/// the FrontOffice, before the process could start.
|
||||
/// For a product, it is in the catalog but do not (yet)
|
||||
/// leads to any payment, and so, can not be sold.
|
||||
/// </summary>
|
||||
EstimateRequired,
|
||||
/// <summary>
|
||||
/// Service is up. For a phisical product,
|
||||
/// it is in stock.
|
||||
/// For a service, the resources are available
|
||||
/// and it can be rendered right now
|
||||
/// </summary>
|
||||
Available,
|
||||
/// <summary>
|
||||
/// This service is closed, or this product is no more available in stock.
|
||||
/// </summary>
|
||||
Spent
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,13 +2,24 @@ using System;
|
|||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Text.
|
||||
/// </summary>
|
||||
public class Text: FormElement
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the value.
|
||||
/// </summary>
|
||||
/// <value>The value.</value>
|
||||
public string Val {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tos the html.
|
||||
/// </summary>
|
||||
/// <returns>The html.</returns>
|
||||
public override string ToHtml ()
|
||||
{
|
||||
return Val;
|
||||
|
|
|
|||
|
|
@ -2,29 +2,45 @@ using System;
|
|||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Text input.
|
||||
/// </summary>
|
||||
public class TextInput:FormInput
|
||||
{
|
||||
|
||||
#region implemented abstract members of FormInput
|
||||
private string tpe = null;
|
||||
/// <summary>
|
||||
/// Gets the type.
|
||||
/// </summary>
|
||||
/// <value>The type.</value>
|
||||
public override string Type {
|
||||
get {
|
||||
return tpe;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.TextInput"/> class.
|
||||
/// </summary>
|
||||
public TextInput ()
|
||||
{
|
||||
tpe = "text";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.TextInput"/> class.
|
||||
/// </summary>
|
||||
/// <param name="txt">Text.</param>
|
||||
public TextInput (string txt)
|
||||
{
|
||||
tpe = "text";
|
||||
text = txt;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.TextInput"/> class.
|
||||
/// </summary>
|
||||
/// <param name="type">Type.</param>
|
||||
/// <param name="txt">Text.</param>
|
||||
public TextInput (string type, string txt)
|
||||
{
|
||||
tpe = type;
|
||||
|
|
@ -33,17 +49,20 @@ namespace Yavsc.Model.FrontOffice
|
|||
|
||||
string text = null;
|
||||
|
||||
|
||||
/// <param name="t">T.</param>
|
||||
public static implicit operator string(TextInput t)
|
||||
{
|
||||
return t.text;
|
||||
}
|
||||
|
||||
/// <param name="t">T.</param>
|
||||
public static implicit operator TextInput(string t)
|
||||
{
|
||||
return new TextInput(t);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the default value.
|
||||
/// </summary>
|
||||
/// <value>The default value.</value>
|
||||
public string DefaultValue {
|
||||
get {
|
||||
return text;
|
||||
|
|
@ -54,8 +73,17 @@ namespace Yavsc.Model.FrontOffice
|
|||
}
|
||||
|
||||
private bool multiline = false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this <see cref="Yavsc.Model.FrontOffice.TextInput"/> multi line.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if multi line; otherwise, <c>false</c>.</value>
|
||||
public bool MultiLine { get { return multiline; } set { multiline = value; } }
|
||||
|
||||
/// <summary>
|
||||
/// Tos the html.
|
||||
/// </summary>
|
||||
/// <returns>The html.</returns>
|
||||
public override string ToHtml ()
|
||||
{
|
||||
|
||||
|
|
|
|||
|
|
@ -2,11 +2,33 @@ using System;
|
|||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Unit.
|
||||
/// </summary>
|
||||
public abstract class Unit
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
public abstract string Name { get; }
|
||||
/// <summary>
|
||||
/// Gets the description.
|
||||
/// </summary>
|
||||
/// <value>The description.</value>
|
||||
public abstract string Description { get; }
|
||||
/// <summary>
|
||||
/// Converts to.
|
||||
/// </summary>
|
||||
/// <returns>The to.</returns>
|
||||
/// <param name="dest">Destination.</param>
|
||||
/// <param name="value">Value.</param>
|
||||
public abstract object ConvertTo (Unit dest, object value);
|
||||
/// <summary>
|
||||
/// Maies the convert to.
|
||||
/// </summary>
|
||||
/// <returns><c>true</c>, if convert to was mayed, <c>false</c> otherwise.</returns>
|
||||
/// <param name="other">Other.</param>
|
||||
public abstract bool MayConvertTo (Unit other);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
35
yavscModel/FrontOffice/CommandStatus.cs
Normal file
35
yavscModel/FrontOffice/CommandStatus.cs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
//
|
||||
// CommandStatus.cs
|
||||
//
|
||||
// Author:
|
||||
// Paul Schneider <paulschneider@free.fr>
|
||||
//
|
||||
// Copyright (c) 2015 Paul Schneider
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
using System;
|
||||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
public enum CommandStatus:int
|
||||
{
|
||||
Inserted,
|
||||
UserValidated,
|
||||
UserCanceled,
|
||||
ExecutionPending,
|
||||
Satisfied,
|
||||
Refunded
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2,7 +2,8 @@ using System;
|
|||
using Yavsc;
|
||||
using System.Collections.Specialized;
|
||||
using Yavsc.Model.WorkFlow;
|
||||
using Newtonsoft.Json;
|
||||
using Yavsc.Model.FileSystem;
|
||||
using System.Web;
|
||||
|
||||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
|
|
@ -23,37 +24,47 @@ namespace Yavsc.Model.FrontOffice
|
|||
/// <value>The identifier.</value>
|
||||
public long Id { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the prod reference.
|
||||
/// Gets or sets the product reference.
|
||||
/// </summary>
|
||||
/// <value>The prod reference.</value>
|
||||
public string ProdRef { get; set; }
|
||||
public CommandStatus Status { get; set; }
|
||||
public string ProductRef { get; set; }
|
||||
/// <summary>
|
||||
/// The parameters.
|
||||
/// </summary>
|
||||
public StringDictionary Parameters = new StringDictionary();
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.Commande"/> class.
|
||||
/// </summary>
|
||||
public Commande() {
|
||||
|
||||
FileInfoCollection Files {
|
||||
get {
|
||||
return GetFSM().GetFiles (Id.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create the specified collection.
|
||||
/// Create a command using the specified collection
|
||||
/// as command parameters, handles the request files.
|
||||
/// </summary>
|
||||
/// <param name="collection">Collection.</param>
|
||||
public static Commande Create(NameValueCollection collection)
|
||||
/// <param name="files">Files.</param>
|
||||
public Commande (NameValueCollection collection, NameObjectCollectionBase files)
|
||||
{
|
||||
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;
|
||||
|
||||
ProductRef=collection["ref"]; // Required product reference
|
||||
CreationDate = DateTime.Now;
|
||||
Status = CommandStatus.Inserted;
|
||||
// stores the parameters:
|
||||
foreach (string key in collection.AllKeys) {
|
||||
cmd.Parameters.Add (key, collection [key]);
|
||||
if (key!="ref")
|
||||
Parameters.Add (key, collection [key]);
|
||||
}
|
||||
WorkFlowManager wm = new WorkFlowManager ();
|
||||
wm.RegisterCommand (cmd); // sets cmd.Id
|
||||
return cmd;
|
||||
WorkFlowManager wfm = new WorkFlowManager ();
|
||||
wfm.RegisterCommand (this); // sets this.Id
|
||||
string strcmdid = Id.ToString ();
|
||||
GetFSM().Put (strcmdid, files);
|
||||
}
|
||||
|
||||
private FileSystemManager GetFSM() {
|
||||
return new FileSystemManager ("~/commands");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
24
yavscModel/FrontOffice/WebFileInfoCollection.cs
Normal file
24
yavscModel/FrontOffice/WebFileInfoCollection.cs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
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
|
||||
{
|
||||
public class WebFileInfoCollection: List<WebFileInfo>
|
||||
{
|
||||
public WebFileInfoCollection (
|
||||
HttpContextBase context, string prefix)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue