* style.css:
* Web.csproj: * Web.config: * Catalog.xml: * Global.asax.cs: * TestBinding.cs: * IProvider.cs: * yavscModel.csproj: * WFManager.cs: * BasketController.cs: * WorkFlowController.cs: * ITCPNpgsqlProvider.cs: * IContentProvider.cs: * WorkFlowProvider.csproj: * NpgsqlContentProvider.cs: * Provider.cs: * ITContentProvider.csproj: * FrontOfficeApiController.cs: * ProviderCollection.cs: * WorkflowConfiguration.cs: * BlogProvidersConfigurationSection.cs: * IITContent.cs: Estimate creation
This commit is contained in:
@ -1,18 +1,73 @@
|
||||
using System;
|
||||
using yavscModel.WorkFlow;
|
||||
using System.Configuration;
|
||||
using WorkFlowProvider.Configuration;
|
||||
using System.Collections.Specialized;
|
||||
|
||||
namespace WorkFlowProvider
|
||||
{
|
||||
public static class WFManager
|
||||
{
|
||||
public static IContentProvider GetContentProviderFWC ()
|
||||
{
|
||||
string clsName = System.Configuration.ConfigurationManager.AppSettings ["WorkflowContentProviderClass"];
|
||||
if (clsName == null)
|
||||
throw new Exception ("No content provider specified in the configuration file (Application parameter \"WorkflowContentProviderClass\")");
|
||||
System.Reflection.ConstructorInfo ci = Type.GetType (clsName).GetConstructor (System.Type.EmptyTypes);
|
||||
return (IContentProvider) ci.Invoke (System.Type.EmptyTypes);
|
||||
static IContentProvider contentProvider;
|
||||
|
||||
public static IContentProvider ContentProvider {
|
||||
get {
|
||||
WorkflowConfiguration c = (WorkflowConfiguration) ConfigurationManager.GetSection ("system.web/workflow");
|
||||
if (c == null)
|
||||
throw new Exception ("No system.web/workflow configuration section found");
|
||||
WFProvider confprov = c.Providers.GetElement (c.DefaultProvider);
|
||||
if (confprov == null)
|
||||
throw new Exception ("Default workflow provider not found (system.web/workflow@defaultProvider)");
|
||||
string clsName = confprov.Type;
|
||||
if (clsName == null)
|
||||
throw new Exception ("Provider type not specified (system.web/workflow@type)");
|
||||
|
||||
if (contentProvider != null)
|
||||
{
|
||||
if (contentProvider.GetType ().Name != clsName)
|
||||
contentProvider = null;
|
||||
}
|
||||
|
||||
if (contentProvider == null)
|
||||
{
|
||||
Type cpt = Type.GetType (clsName);
|
||||
if (cpt == null)
|
||||
throw new Exception (string.Format("Type not found : {0} (wrong name, or missing assembly reference?)",clsName));
|
||||
System.Reflection.ConstructorInfo ci =cpt.GetConstructor (System.Type.EmptyTypes);
|
||||
contentProvider = (IContentProvider)ci.Invoke (System.Type.EmptyTypes);
|
||||
}
|
||||
|
||||
contentProvider.ApplicationName = confprov.ApplicationName;
|
||||
|
||||
NameValueCollection config = new NameValueCollection ();
|
||||
config.Add ("name", confprov.Name);
|
||||
config.Add ("connectionStringName", confprov.ConnectionStringName);
|
||||
config.Add ("applicationName", confprov.ApplicationName);
|
||||
contentProvider.Initialize (confprov.Name, config);
|
||||
|
||||
return contentProvider;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates the estimate.
|
||||
/// </summary>
|
||||
/// <returns>The estimate identifier.</returns>
|
||||
/// <param name="title">Title.</param>
|
||||
public static long CreateEstimate(string client, string title)
|
||||
{
|
||||
return ContentProvider.CreateEstimate (client, title);
|
||||
}
|
||||
|
||||
public static long Write(long estid, string desc, decimal ucost, int count, long productid)
|
||||
{
|
||||
return ContentProvider.Write(estid, desc, ucost, count, productid);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user