* Estimate.aspx: from backoffice

* CatalogManager.cs: Uses GetDefaultProvider

* Catalog.cs: the Catalog object now should support a unique id in the
  system : UID, exposed as one of its properties.

* AccountController.cs: new static method te get an user profile by
  its name.

* AdminController.cs: Uses the Yavsc.Admin namespace (refactoring)

* Web.csproj:
* BlogManager.cs:
* BackOfficeController.cs: refactoring

* BlogsController.cs: Fixes the Blog title

* FrontOfficeController.cs: Changes on the go for the Command object

* AddRole.aspx: minor syntax change

* UserPosts.aspx: show the blog title

* style.css: black transparent for the background of posts

* Profile.cs: Method FromProfileBase became a constructor

* Commande.cs: nothing

* Estimate.aspx: moved to the frontoffice views

* CatalogHelper.cs: Writting GetDefaultProvider
This commit is contained in:
Paul Schneider
2014-10-10 11:54:18 +02:00
parent b5d19c5da6
commit c22be7f6b5
17 changed files with 104 additions and 46 deletions

View File

@ -12,13 +12,20 @@ namespace SalesCatalog
/// </summary>
public static class CatalogHelper
{
public static CatalogProvider GetProvider ()
{
CatalogProvidersConfigurationSection config = ConfigurationManager.GetSection ("system.web/catalog") as CatalogProvidersConfigurationSection;
if (config == null)
public static CatalogProvidersConfigurationSection Config {get; set; }
public static void Load () {
if (Config != null)
return ;
Config = ConfigurationManager.GetSection ("system.web/catalog") as CatalogProvidersConfigurationSection;
if (Config == null)
throw new ConfigurationErrorsException("The configuration bloc for the catalog provider was not found");
CatalogProviderConfigurationElement celt =
config.Providers.GetElement (config.DefaultProvider);
foreach (CatalogProviderConfigurationElement e in Config.Providers) {
CreateProvider (e);
}
}
private static CatalogProvider CreateProvider(CatalogProviderConfigurationElement celt) {
if (celt == null)
throw new ConfigurationErrorsException("The default catalog provider was not found");
Type catprtype = Type.GetType (celt.Type);
@ -28,7 +35,7 @@ namespace SalesCatalog
ConstructorInfo ci = catprtype.GetConstructor (Type.EmptyTypes);
if (ci==null)
throw new Exception (
string.Format("The catalog provider type ({0}) doesn't contain public constructor with empty parameter list",celt.Type));
string.Format("The catalog provider type ({0}) doesn't contain public constructor with empty parameter list",celt.Type));
CatalogProvider cp = ci.Invoke (Type.EmptyTypes) as CatalogProvider;
NameValueCollection c = new NameValueCollection ();
@ -40,6 +47,14 @@ namespace SalesCatalog
cp.Initialize (celt.Name, c);
return cp;
}
public static CatalogProvider GetDefaultProvider ()
{
CatalogProviderConfigurationElement celt =
Config.Providers.GetElement (Config.DefaultProvider);
return CreateProvider (celt);
}
}
}

View File

@ -11,7 +11,7 @@ namespace SalesCatalog
{
public static Catalog GetCatalog ()
{
CatalogProvider p = CatalogHelper.GetProvider ();
CatalogProvider p = CatalogHelper.GetDefaultProvider ();
return p.GetCatalog ();
}
}

View File

@ -7,6 +7,13 @@ namespace SalesCatalog.Model
/// Catalog.
/// </summary>
public class Catalog {
/// <summary>
/// Gets or sets the catalog unique identifier in the system.
/// </summary>
/// <value>The unique identifier.</value>
string UID { get; set; }
/// <summary>
/// Gets or sets the brands.
/// </summary>