refactoring

main
Paul Schneider 11 years ago
parent 8cec6d44e2
commit 7fc21f1056
25 changed files with 179 additions and 335 deletions

@ -17,7 +17,7 @@ namespace Yavsc.ApiControllers
/// <summary> /// <summary>
/// Work flow controller. /// Work flow controller.
/// </summary> /// </summary>
public class WorkFlowApiController : ApiController public class WorkFlowController : ApiController
{ {
string adminRoleName="Admin"; string adminRoleName="Admin";
/// <summary> /// <summary>

@ -1,3 +1,16 @@
2015-06-12 Paul Schneider <paul@pschneider.fr>
* Web.csproj:
* Web.config:
* instdbws.sql:
* style.css:
* App.master:
* NoLogin.master:
* Login.aspx:
* Circles.aspx:
* AccountController.cs:
* WorkFlowController.cs:
2015-06-11 Paul Schneider <paul@pschneider.fr> 2015-06-11 Paul Schneider <paul@pschneider.fr>
* App.master: g+1 feels better at right ... * App.master: g+1 feels better at right ...

@ -11,6 +11,7 @@ using Yavsc;
using Yavsc.Model.RolesAndMembers; using Yavsc.Model.RolesAndMembers;
using Yavsc.Helpers; using Yavsc.Helpers;
using System.Web.Mvc; using System.Web.Mvc;
using Yavsc.Model.Circles;
namespace Yavsc.Controllers namespace Yavsc.Controllers
{ {
@ -290,7 +291,14 @@ namespace Yavsc.Controllers
} }
return View (model); return View (model);
} }
/// <summary>
/// Circles this instance.
/// </summary>
[Authorize]
public ActionResult Circles ()
{
return View (CircleManager.DefaultProvider.List (Membership.GetUser().UserName));
}
/// <summary> /// <summary>
/// Logout the specified returnUrl. /// Logout the specified returnUrl.
/// </summary> /// </summary>

@ -59,7 +59,6 @@ ViewState["orgtitle"] = T.GetString(Page.Title);
</aside> </aside>
<div style="float:right; height:5em; z-index:-1;"></div> <div style="float:right; height:5em; z-index:-1;"></div>
<footer> <footer>
<!-- Placez cette balise dans l'en-tête ou juste avant la balise de fermeture du corps de texte. -->
<script src="https://apis.google.com/js/platform.js" async defer> <script src="https://apis.google.com/js/platform.js" async defer>
{lang: 'fr'} {lang: 'fr'}
</script> </script>

@ -37,12 +37,15 @@ ViewState["orgtitle"] = T.GetString(Page.Title);
<asp:ContentPlaceHolder ID="MASContent" runat="server"> <asp:ContentPlaceHolder ID="MASContent" runat="server">
</asp:ContentPlaceHolder> </asp:ContentPlaceHolder>
<div style="float:right; height:5em; z-index:-1;"></div> <footer>
<footer> <script src="https://apis.google.com/js/platform.js" async defer>
{lang: 'fr'}
</script>
<%= Html.ActionLink("Contact","Contact","Home",null, new { @class="footerlink" }) %> <br/> <%= Html.ActionLink("Contact","Contact","Home",null, new { @class="footerlink" }) %> <br/>
<% foreach ( string link in Yavsc.ThanksHelper.Links()) { %> <% foreach ( string link in Yavsc.ThanksHelper.Links()) { %>
<%= link %> <%= link %>
<% } %> <% } %>
<div class="g-plusone" data-annotation="inline" data-width="230"></div>
</footer> </footer>
<script type="text/javascript"> <script type="text/javascript">
var apiBaseUrl = '<%=Url.Content(Yavsc.WebApiConfig.UrlPrefixRelative)%>'; var apiBaseUrl = '<%=Url.Content(Yavsc.WebApiConfig.UrlPrefixRelative)%>';

@ -41,24 +41,24 @@ footer {
bottom:0; bottom:0;
left:0; left:0;
right:0; right:0;
height:2.5em;
background-color:rgba(16,0,0,0.8); background-color:rgba(16,0,0,0.8);
display: flex; display: flex;
justify-content: space-around;
z-index:-1; z-index:-1;
font-size: small;
} }
footer a { footer a {
border: dashed #888 3px; max-height: 2em;
padding:.1em;
} }
footer img { footer img {
max-height: 1em; max-height: 2em;
max-width: 2.5em; padding:.1em;
} }
#logo { #logo {
float: left; float: left;
} }
.panel,.bshpanel,aside { .panel,.bshpanel,aside {
@ -217,7 +217,7 @@ a.actionlink:hover + .hidcom {
@media print { @media print {
body {background-color:white;color:black;} body {background-color:white;color:black;}
header,footer,.postcomment,.actionlink,.metablog{ display:none;} header,footer,.postcomment,.actionlink,.metablog,#login{ display:none;}
} }
@media all and (min-width: 641px) { @media all and (min-width: 641px) {
.bshpanel { display:block; } .bshpanel { display:block; }
@ -238,7 +238,7 @@ a.actionlink:hover + .hidcom {
max-width: 2.0em; max-width: 2.0em;
} }
footer { footer {
font-size: small; font-size: x-small;
} }
body { font-size: smaller; } body { font-size: smaller; }
@ -248,7 +248,7 @@ a.actionlink:hover + .hidcom {
footer img { footer img {
max-height: 0.6em; max-height: 0.6em;
max-width: 1.4em; } max-width: 1.4em; }
footer { font-size: x-small; } footer { font-size: xx-small; }
} }
} }

@ -0,0 +1,14 @@
<%@ Page Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage<Yavsc.Model.Circles.CircleInfoCollection>" %>
<asp:Content ID="initContent" ContentPlaceHolderID="init" runat="server">
</asp:Content>
<asp:Content ID="headContent" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="MainContentContent" ContentPlaceHolderID="MainContent" runat="server">
<% foreach (CircleInfo ci in model) { %>
<%= ci.Title %>
<%= ci.Id %>
<br/>
<% } %>
</asp:Content>
<asp:Content ID="MASContentContent" ContentPlaceHolderID="MASContent" runat="server">
</asp:Content>

@ -1,4 +1,4 @@
<%@ Page Title="Login" Language="C#" Inherits="System.Web.Mvc.ViewPage<LoginModel>" MasterPageFile="~/Models/App.master" %> <%@ Page Title="Login" Language="C#" Inherits="System.Web.Mvc.ViewPage<LoginModel>" MasterPageFile="~/Models/NoLogin.master" %>
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server"> <asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
<%= Html.ValidationSummary("Ouverture de session") %> <%= Html.ValidationSummary("Ouverture de session") %>
<% using(Html.BeginForm("Login", "Account")) %> <% using(Html.BeginForm("Login", "Account")) %>
@ -20,4 +20,10 @@
<% } %> <% } %>
<%= Html.ActionLink("S'enregistrer","Register",new {returnUrl=ViewData["returnUrl"]}, new { @class="actionlink" }) %> <%= Html.ActionLink("S'enregistrer","Register",new {returnUrl=ViewData["returnUrl"]}, new { @class="actionlink" }) %>
<a href="<%=Request.Url.Scheme + "://" + Request.Url.Authority + "/Google/Login"%>?returnUrl=<%=ViewData["returnUrl"]==null?Request.Url.PathAndQuery:(string)ViewData["returnUrl"]%>" class="actionlink">
Identification avec un compte Google
<img src="/images/sign-in-with-google.png" style="max-height:1.5em; max-width:6em;" alt="Google sign in">
</a>
</asp:Content> </asp:Content>

@ -22,10 +22,11 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx
<section name="paypal" type="PayPal.SDKConfigHandler, PayPal" /> <section name="paypal" type="PayPal.SDKConfigHandler, PayPal" />
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" /> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
<sectionGroup name="system.web"> <sectionGroup name="system.web">
<section name="blog" type="Yavsc.Model.Blogs.Configuration.BlogProvidersConfigurationSection, YavscModel" allowLocation="true" requirePermission="false" allowDefinition="Everywhere" /> <section name="blog" type="Yavsc.Model.DataProviderConfigurationSection, YavscModel" allowLocation="true" requirePermission="false" allowDefinition="Everywhere" />
<section name="thanks" type="Yavsc.ThanksConfigurationSection, Yavsc" allowLocation="true" requirePermission="false" allowDefinition="Everywhere" /> <section name="thanks" type="Yavsc.ThanksConfigurationSection, Yavsc" allowLocation="true" requirePermission="false" allowDefinition="Everywhere" />
<section name="catalog" type="Yavsc.Model.FrontOffice.Configuration.CatalogProvidersConfigurationSection, YavscModel" allowLocation="true" requirePermission="false" allowDefinition="Everywhere" /> <section name="catalog" type="Yavsc.Model.FrontOffice.Configuration.CatalogProvidersConfigurationSection, YavscModel" allowLocation="true" requirePermission="false" allowDefinition="Everywhere" />
<section name="workflow" type="Yavsc.Model.WorkFlow.Configuration.WorkflowConfiguration, YavscModel" allowLocation="true" requirePermission="false" allowDefinition="Everywhere" /> <section name="workflow" type="Yavsc.Model.DataProviderConfigurationSection, YavscModel" allowLocation="true" requirePermission="false" allowDefinition="Everywhere" />
<section name="circleProviders" type="Yavsc.Model.DataProviderConfigurationSection, YavscModel" />
</sectionGroup> </sectionGroup>
</configSections> </configSections>
<system.web> <system.web>
@ -150,6 +151,13 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx
<add name="Postgresql" url="http://www.postgresql.org" image="/images/pgsql.png" /> <add name="Postgresql" url="http://www.postgresql.org" image="/images/pgsql.png" />
</to> </to>
</thanks> </thanks>
<circleProviders defaultProvider="NpgsqlCircleProvider">
<providers>
<add name="NpgsqlCircleProvider" applicationName="/" type="WorkFlowProvider.NpgsqlCircleProvider, NpgsqlContentProvider" connectionStringName="yavsc" />
</providers>
</circleProviders>
<!-- <machineKey validationKey="13CA2E37A5A99AD8CE4A6B895BAF0ED3A022AA584B8D922256BA072189CEB085EEB4E573CA833D9B34FBF68687F6A6B3E008FB4EB67585A4D90551B9D36D42A1" decryptionKey="DA89CC83F6FB2EB12D5929DABC89299AC3928E0751705D33D02DB4162ED56536" validation="SHA1" decryption="AES" /> --> <!-- <machineKey validationKey="13CA2E37A5A99AD8CE4A6B895BAF0ED3A022AA584B8D922256BA072189CEB085EEB4E573CA833D9B34FBF68687F6A6B3E008FB4EB67585A4D90551B9D36D42A1" decryptionKey="DA89CC83F6FB2EB12D5929DABC89299AC3928E0751705D33D02DB4162ED56536" validation="SHA1" decryption="AES" /> -->
<!--- <sessionState cookieless="true" regenerateExpiredSessionId="true" timeout="120"/> --> <!--- <sessionState cookieless="true" regenerateExpiredSessionId="true" timeout="120"/> -->
<trust level="High" /> <trust level="High" />

@ -188,7 +188,7 @@
<Compile Include="ApiControllers\CircleApiController.cs" /> <Compile Include="ApiControllers\CircleApiController.cs" />
<Compile Include="ApiControllers\BasketApiController.cs" /> <Compile Include="ApiControllers\BasketApiController.cs" />
<Compile Include="ApiControllers\CalendarApiController.cs" /> <Compile Include="ApiControllers\CalendarApiController.cs" />
<Compile Include="ApiControllers\WorkFlowApiController.cs" /> <Compile Include="ApiControllers\WorkFlowController.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="Views\Web.config" /> <Content Include="Views\Web.config" />
@ -340,6 +340,7 @@
<Content Include="Theme\md\mdd_gripper.png" /> <Content Include="Theme\md\mdd_gripper.png" />
<Content Include="Theme\md\mdd_modal_background.png" /> <Content Include="Theme\md\mdd_modal_background.png" />
<Content Include="Theme\mdd_styles.css" /> <Content Include="Theme\mdd_styles.css" />
<Content Include="Views\Account\Circles.aspx" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" /> <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />

@ -658,6 +658,7 @@ CREATE TABLE circle
_id serial NOT NULL, -- Circle identifier _id serial NOT NULL, -- Circle identifier
owner character varying(255), -- creator of this circle owner character varying(255), -- creator of this circle
applicationname character varying(255), -- Application name applicationname character varying(255), -- Application name
title character varying(512),
CONSTRAINT circle_pkey PRIMARY KEY (_id), CONSTRAINT circle_pkey PRIMARY KEY (_id),
CONSTRAINT circle_owner_fkey FOREIGN KEY (owner, applicationname) CONSTRAINT circle_owner_fkey FOREIGN KEY (owner, applicationname)
REFERENCES users (username, applicationname) MATCH SIMPLE REFERENCES users (username, applicationname) MATCH SIMPLE
@ -666,11 +667,11 @@ CREATE TABLE circle
WITH ( WITH (
OIDS=FALSE OIDS=FALSE
); );
ALTER TABLE circle
OWNER TO yavscdev;
COMMENT ON COLUMN circle._id IS 'Circle identifier'; COMMENT ON COLUMN circle._id IS 'Circle identifier';
COMMENT ON COLUMN circle.owner IS 'creator of this circle'; COMMENT ON COLUMN circle.owner IS 'creator of this circle';
COMMENT ON COLUMN circle.applicationname IS 'Application name'; COMMENT ON COLUMN circle.applicationname IS 'Application name';
-- Table: circle_members -- Table: circle_members
-- DROP TABLE circle_members; -- DROP TABLE circle_members;

@ -2,7 +2,6 @@ using System;
using System.Configuration; using System.Configuration;
using System.Reflection; using System.Reflection;
using System.Collections.Specialized; using System.Collections.Specialized;
using Yavsc.Model.Blogs.Configuration;
namespace Yavsc.Model.Blogs namespace Yavsc.Model.Blogs
{ {
@ -17,22 +16,17 @@ namespace Yavsc.Model.Blogs
/// <returns>The provider.</returns> /// <returns>The provider.</returns>
public static BlogProvider GetProvider () public static BlogProvider GetProvider ()
{ {
BlogProvidersConfigurationSection config = ConfigurationManager.GetSection ("system.web/blog") as BlogProvidersConfigurationSection; DataProviderConfigurationSection config = ConfigurationManager.GetSection ("system.web/blog") as DataProviderConfigurationSection;
if (config == null) if (config == null)
throw new ConfigurationErrorsException("The configuration bloc for the blog provider was not found"); throw new ConfigurationErrorsException("The configuration bloc for the blog provider was not found");
BlogProviderConfigurationElement celt = ProviderSettings celt =
config.Providers.GetElement (config.DefaultProvider); config.Providers[config.DefaultProvider];
if (config == null) if (config == null)
throw new ConfigurationErrorsException("The default blog provider was not found"); throw new ConfigurationErrorsException("The default blog provider was not found");
ConstructorInfo ci = Type.GetType (celt.Type).GetConstructor (Type.EmptyTypes); ConstructorInfo ci = Type.GetType (celt.Type).GetConstructor (Type.EmptyTypes);
BlogProvider bp = ci.Invoke (Type.EmptyTypes) as BlogProvider; BlogProvider bp = ci.Invoke (Type.EmptyTypes) as BlogProvider;
NameValueCollection c = new NameValueCollection (); NameValueCollection c = new NameValueCollection ();
c.Add ("name", celt.Name); bp.Initialize (celt.Name, celt.Parameters);
c.Add ("type", celt.Type);
c.Add ("connectionStringName", celt.ConnectionStringName);
c.Add ("description", celt.Description);
c.Add ("applicationName", celt.ApplicationName);
bp.Initialize (celt.Name, c);
return bp; return bp;
} }

@ -1,62 +0,0 @@
using System;
using System.Configuration;
using System.ComponentModel;
namespace Yavsc.Model.Blogs.Configuration
{
/// <summary>
/// Blog provider configuration element.
/// </summary>
public class BlogProviderConfigurationElement : 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, IsKey=false)]
public string Type {
get { return (string)this ["type"]; }
set { this ["type"] = value; }
}
/// <summary>
/// Gets or sets the name of the connection string.
/// </summary>
/// <value>The name of the connection string.</value>
[ConfigurationProperty("connectionStringName")]
public string ConnectionStringName {
get { return (string)this ["connectionStringName"]; }
set { this ["connectionStringName"] = 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"]; }
set { this ["applicationName"] = value; }
}
}
}

@ -1,43 +0,0 @@
using System;
using System.Configuration;
using System.ComponentModel;
namespace Yavsc.Model.Blogs.Configuration
{
/// <summary>
/// Blog providers configuration collection.
/// </summary>
public class BlogProvidersConfigurationCollection : ConfigurationElementCollection
{
/// <summary>
/// Creates the new element.
/// </summary>
/// <returns>The new element.</returns>
protected override ConfigurationElement CreateNewElement ()
{
return new BlogProviderConfigurationElement();
}
/// <summary>
/// Gets the element key.
/// </summary>
/// <returns>The element key.</returns>
/// <param name="element">Element.</param>
protected override object GetElementKey (ConfigurationElement element)
{
return ((BlogProviderConfigurationElement) element).Name;
}
/// <summary>
/// Gets the element.
/// </summary>
/// <returns>The element.</returns>
/// <param name="name">Name.</param>
public BlogProviderConfigurationElement GetElement (string name)
{
return this.BaseGet(name) as BlogProviderConfigurationElement;
}
}
}

@ -1,37 +0,0 @@
using System;
using System.Configuration;
using System.ComponentModel;
namespace Yavsc.Model.Blogs.Configuration
{
/// <summary>
/// Blog providers configuration section.
/// </summary>
public class BlogProvidersConfigurationSection : ConfigurationSection
{
/// <summary>
/// Gets or sets the default provider.
/// </summary>
/// <value>The default provider.</value>
[ConfigurationProperty("defaultProvider")]
public string DefaultProvider {
get { return (string) this ["defaultProvider"]; }
set { this["defaultProvider"] = value; }
}
/// <summary>
/// Gets or sets the providers.
/// </summary>
/// <value>The providers.</value>
[ConfigurationProperty("providers")]
[ConfigurationCollection(typeof(BlogProvidersConfigurationCollection),
AddItemName = "add",
ClearItemsName = "clear",
RemoveItemName = "remove")]
public BlogProvidersConfigurationCollection Providers{
get { return (BlogProvidersConfigurationCollection) this["providers"]; }
set { this["providers"] = value; }
}
}
}

@ -1,3 +1,19 @@
2015-06-12 Paul Schneider <paul@pschneider.fr>
* YavscModel.csproj:
* BlogHelper.cs:
* CircleManager.cs:
* WorkFlowManager.cs:
* NewEstimateEvenArgs.cs:
* Provider.cs:
* DataProviderConfigurationSection.cs:
* ProviderCollection.cs:
* WorkflowConfiguration.cs:
* BlogProviderConfigurationElement.cs:
* BlogProvidersConfigurationSection.cs:
* BlogProvidersConfigurationCollection.cs:
* CatalogProvidersConfigurationSection.cs:
2015-06-10 Paul Schneider <paul@pschneider.fr> 2015-06-10 Paul Schneider <paul@pschneider.fr>
* Circle.cs: refactoring * Circle.cs: refactoring

@ -58,9 +58,11 @@ namespace Yavsc.Model.Circles
ConfigurationManager.OpenExeConfiguration( ConfigurationManager.OpenExeConfiguration(
ConfigurationUserLevel.None); ConfigurationUserLevel.None);
ProtectedConfigurationSection pSection = DataProviderConfigurationSection pSection =
config.GetSection("circleProviders") config.GetSection("system.web/circleProviders")
as ProtectedConfigurationSection; as DataProviderConfigurationSection;
if (pSection == null)
throw new ConfigurationErrorsException ("no circleProviders section defined");
ProviderSettingsCollection providerSettings = ProviderSettingsCollection providerSettings =

@ -0,0 +1,72 @@
//
// CircleConfigurationSection.cs
//
// Author:
// Paul Schneider <paul@pschneider.fr>
//
// Copyright (c) 2015 GNU GPL
//
// 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;
using System.Configuration;
namespace Yavsc.Model
{
/// <summary>
/// Data provider configuration section.
/// </summary>
public class DataProviderConfigurationSection: ConfigurationSection
{
/// <summary>
/// Initializes a new instance of the <see cref="Yavsc.Model.DataProviderConfigurationSection"/> class.
/// </summary>
public DataProviderConfigurationSection ()
{
}
/// <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(ProviderSettingsCollection),
AddItemName = "add",
ClearItemsName = "clear",
RemoveItemName = "remove")]
public ProviderSettingsCollection Providers {
get {
return (ProviderSettingsCollection)base ["providers"];
}
set {
base ["providers"] = value;
}
}
}
}

@ -7,7 +7,7 @@ namespace Yavsc.Model.FrontOffice.Configuration
/// <summary> /// <summary>
/// Catalog providers configuration section. /// Catalog providers configuration section.
/// </summary> /// </summary>
public class CatalogProvidersConfigurationSection : ConfigurationSection [Obsolete("Use DataProviderConfiguration instead")] public class CatalogProvidersConfigurationSection : ConfigurationSection
{ {
/// <summary> /// <summary>
/// Gets or sets the default provider. /// Gets or sets the default provider.

@ -1,60 +0,0 @@
using System;
using System.Configuration;
namespace Yavsc.Model.WorkFlow.Configuration
{
/// <summary>
/// WF provider.
/// </summary>
public class WFProvider:ConfigurationElement
{
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
[ConfigurationProperty("name", IsKey=true, IsRequired=true)]
public string Name {
get {
return (string) base ["name"];
}
set { base ["name"] = value; }
}
/// <summary>
/// Gets or sets the type.
/// </summary>
/// <value>The type.</value>
[ConfigurationProperty("type")]
public string Type {
get { return (string) this ["type"]; }
set {
this ["type"] = 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"];
}
set {
this ["applicationName"] = value;
}
}
/// <summary>
/// Gets or sets the name of the connection string.
/// </summary>
/// <value>The name of the connection string.</value>
[ConfigurationProperty("connectionStringName")]
public string ConnectionStringName {
get { return (string)this ["connectionStringName"]; }
set { this ["connectionStringName"] = value; }
}
}
}

@ -1,39 +0,0 @@
using System;
using System.Configuration;
namespace Yavsc.Model.WorkFlow.Configuration
{
/// <summary>
/// WF provider collection.
/// </summary>
public class WFProviderCollection : ConfigurationElementCollection
{
/// <summary>
/// Gets the element key.
/// </summary>
/// <returns>The element key.</returns>
/// <param name="element">Element.</param>
protected override object GetElementKey (ConfigurationElement element)
{
return ((WFProvider) element).Name;
}
/// <summary>
/// Creates the new element.
/// </summary>
/// <returns>The new element.</returns>
protected override ConfigurationElement CreateNewElement ()
{
return new WFProvider();
}
/// <summary>
/// Gets the element.
/// </summary>
/// <returns>The element.</returns>
/// <param name="name">Name.</param>
public WFProvider GetElement (string name)
{
return this.BaseGet (name) as WFProvider;
}
}
}

@ -1,41 +0,0 @@
using System;
using System.Configuration;
namespace Yavsc.Model.WorkFlow.Configuration
{
/// <summary>
/// Workflow configuration.
/// </summary>
public class WorkflowConfiguration : 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(WFProvider),
AddItemName = "add",
ClearItemsName = "clear",
RemoveItemName = "remove")]
public WFProviderCollection Providers {
get {
return this["providers"] as WFProviderCollection;
}
set {
this["providers"]=value;
}
}
}
}

@ -1,7 +1,6 @@
using System; using System;
using Yavsc.Model.WorkFlow; using Yavsc.Model.WorkFlow;
using System.Configuration; using System.Configuration;
using Yavsc.Model.WorkFlow.Configuration;
using System.Collections.Specialized; using System.Collections.Specialized;
namespace Yavsc.Model.WorkFlow namespace Yavsc.Model.WorkFlow

@ -1,9 +1,9 @@
using System; using System;
using Yavsc.Model.WorkFlow; using Yavsc.Model.WorkFlow;
using System.Configuration; using System.Configuration;
using Yavsc.Model.WorkFlow.Configuration;
using System.Collections.Specialized; using System.Collections.Specialized;
using Yavsc.Model.FrontOffice; using Yavsc.Model.FrontOffice;
using System.Configuration.Provider;
namespace Yavsc.Model.WorkFlow namespace Yavsc.Model.WorkFlow
{ {
@ -123,10 +123,10 @@ namespace Yavsc.Model.WorkFlow
/// <value>The content provider.</value> /// <value>The content provider.</value>
public IContentProvider ContentProvider { public IContentProvider ContentProvider {
get { get {
WorkflowConfiguration c = (WorkflowConfiguration) ConfigurationManager.GetSection ("system.web/workflow"); DataProviderConfigurationSection c = (DataProviderConfigurationSection) ConfigurationManager.GetSection ("system.web/workflow");
if (c == null) if (c == null)
throw new Exception ("No system.web/workflow configuration section found"); throw new Exception ("No system.web/workflow configuration section found");
WFProvider confprov = c.Providers.GetElement (c.DefaultProvider); ProviderSettings confprov = c.Providers[c.DefaultProvider] as ProviderSettings;
if (confprov == null) if (confprov == null)
throw new Exception ("Default workflow provider not found (system.web/workflow@defaultProvider)"); throw new Exception ("Default workflow provider not found (system.web/workflow@defaultProvider)");
string clsName = confprov.Type; string clsName = confprov.Type;
@ -147,12 +147,7 @@ namespace Yavsc.Model.WorkFlow
System.Reflection.ConstructorInfo ci =cpt.GetConstructor (System.Type.EmptyTypes); System.Reflection.ConstructorInfo ci =cpt.GetConstructor (System.Type.EmptyTypes);
contentProvider = (IContentProvider)ci.Invoke (System.Type.EmptyTypes); contentProvider = (IContentProvider)ci.Invoke (System.Type.EmptyTypes);
} }
contentProvider.Initialize (confprov.Name, confprov.Parameters);
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; return contentProvider;
} }

@ -67,13 +67,7 @@
<Compile Include="Blogs\BlogManager.cs" /> <Compile Include="Blogs\BlogManager.cs" />
<Compile Include="Blogs\BlogProvider.cs" /> <Compile Include="Blogs\BlogProvider.cs" />
<Compile Include="WorkFlow\WorkFlowManager.cs" /> <Compile Include="WorkFlow\WorkFlowManager.cs" />
<Compile Include="WorkFlow\Configuration\Provider.cs" />
<Compile Include="WorkFlow\Configuration\ProviderCollection.cs" />
<Compile Include="WorkFlow\Configuration\WorkflowConfiguration.cs" />
<Compile Include="Blogs\BlogHelper.cs" /> <Compile Include="Blogs\BlogHelper.cs" />
<Compile Include="Blogs\Configuration\BlogProviderConfigurationElement.cs" />
<Compile Include="Blogs\Configuration\BlogProvidersConfigurationCollection.cs" />
<Compile Include="Blogs\Configuration\BlogProvidersConfigurationSection.cs" />
<Compile Include="WorkFlow\NewEstimateEvenArgs.cs" /> <Compile Include="WorkFlow\NewEstimateEvenArgs.cs" />
<Compile Include="LocalizedText.fr.Designer.cs"> <Compile Include="LocalizedText.fr.Designer.cs">
<DependentUpon>LocalizedText.fr.resx</DependentUpon> <DependentUpon>LocalizedText.fr.resx</DependentUpon>
@ -163,6 +157,7 @@
<Compile Include="Circles\CircleInfoCollection.cs" /> <Compile Include="Circles\CircleInfoCollection.cs" />
<Compile Include="Circles\CircleManager.cs" /> <Compile Include="Circles\CircleManager.cs" />
<Compile Include="Circles\CircleProvider.cs" /> <Compile Include="Circles\CircleProvider.cs" />
<Compile Include="DataProviderConfigurationSection.cs" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup> <ItemGroup>

Loading…