Initial import
This commit is contained in:
148
WorkFlowProvider/NpgsqlContentProvider.cs
Normal file
148
WorkFlowProvider/NpgsqlContentProvider.cs
Normal file
@ -0,0 +1,148 @@
|
||||
using System;
|
||||
using Npgsql;
|
||||
using NpgsqlTypes;
|
||||
using System.Configuration;
|
||||
using System.Collections.Specialized;
|
||||
using yavscModel.WorkFlow;
|
||||
|
||||
namespace WorkFlowProvider
|
||||
{
|
||||
public class NpgsqlContentProvider: IContentProvider
|
||||
{
|
||||
public string Order (IWFCommand c)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
public IContent Get (string orderId)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
public void AddDevRessource (int prjId, string userName)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
public void AddPrjRessource(int prjId, string owner)
|
||||
{
|
||||
}
|
||||
|
||||
public void NewRelease (int projectId, string Version)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
string applicationName=null;
|
||||
string cnxstr = null;
|
||||
|
||||
public NpgsqlContentProvider ()
|
||||
{
|
||||
Initialize("NpgsqlYavscContentProvider",ConfigurationManager.AppSettings);
|
||||
}
|
||||
|
||||
public void Initialize (string name, NameValueCollection config)
|
||||
{
|
||||
cnxstr = ConfigurationManager.ConnectionStrings [config ["connectionStringName"]].ConnectionString;
|
||||
applicationName = config["applicationName"] ?? "/";
|
||||
}
|
||||
|
||||
NpgsqlConnection CreateConnection ()
|
||||
{
|
||||
return new NpgsqlConnection (cnxstr);
|
||||
}
|
||||
|
||||
#region IDisposable implementation
|
||||
public void Dispose ()
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IContentProvider implementation
|
||||
|
||||
public int NewTask (int projectId, string name, string desc)
|
||||
{
|
||||
throw new System.NotImplementedException ();
|
||||
}
|
||||
|
||||
public void SetProjectName (int projectId, string name)
|
||||
{
|
||||
throw new System.NotImplementedException ();
|
||||
}
|
||||
|
||||
public void SetProjectDesc (int projectId, string desc)
|
||||
{
|
||||
throw new System.NotImplementedException ();
|
||||
}
|
||||
|
||||
public void SetTaskName (int taskId, string name)
|
||||
{
|
||||
throw new System.NotImplementedException ();
|
||||
}
|
||||
|
||||
public void SetStartDate (int taskId, DateTime d)
|
||||
{
|
||||
throw new System.NotImplementedException ();
|
||||
}
|
||||
|
||||
public void SetEndDate (int taskId, DateTime d)
|
||||
{
|
||||
throw new System.NotImplementedException ();
|
||||
}
|
||||
|
||||
public void SetTaskDesc (int taskId, string desc)
|
||||
{
|
||||
throw new System.NotImplementedException ();
|
||||
}
|
||||
|
||||
public void RemoveProject (int prjId)
|
||||
{
|
||||
using (var cnx = CreateConnection()) {
|
||||
cnx.Open ();
|
||||
using (NpgsqlCommand cmd = cnx.CreateCommand()) {
|
||||
cmd.CommandText = "delete from projets where id = @id";
|
||||
cmd.Parameters.Add ("@id", prjId);
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
cnx.Close ();
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveTask (int taskId)
|
||||
{
|
||||
throw new System.NotImplementedException ();
|
||||
}
|
||||
|
||||
public void SetManager (int projectId, string user)
|
||||
{
|
||||
throw new System.NotImplementedException ();
|
||||
}
|
||||
|
||||
public void RemoveUser (string user)
|
||||
{
|
||||
throw new System.NotImplementedException ();
|
||||
}
|
||||
|
||||
public int NewProject (string name, string desc, string ownerId)
|
||||
{
|
||||
int id = 0;
|
||||
using (var cnx = CreateConnection()) {
|
||||
cnx.Open ();
|
||||
using (NpgsqlCommand cmd = cnx.CreateCommand()) {
|
||||
cmd.CommandText = "insert into projets (name,managerid,ApplicatonName,prdesc) values (@name,@mid,@appname,@pdesc)";
|
||||
cmd.Parameters.Add ("@name", name);
|
||||
cmd.Parameters.Add ("@mid", ownerId);
|
||||
cmd.Parameters.Add ("@appname", applicationName);
|
||||
cmd.Parameters.Add ("@desc", desc);
|
||||
id = (int)cmd.ExecuteScalar ();
|
||||
}
|
||||
cnx.Close ();
|
||||
}
|
||||
return id;
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
22
WorkFlowProvider/Properties/AssemblyInfo.cs
Normal file
22
WorkFlowProvider/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
// Information about this assembly is defined by the following attributes.
|
||||
// Change them to the values specific to your project.
|
||||
[assembly: AssemblyTitle ("WorkFlowProvider")]
|
||||
[assembly: AssemblyDescription ("")]
|
||||
[assembly: AssemblyConfiguration ("")]
|
||||
[assembly: AssemblyCompany ("")]
|
||||
[assembly: AssemblyProduct ("")]
|
||||
[assembly: AssemblyCopyright ("Paul Schneider")]
|
||||
[assembly: AssemblyTrademark ("")]
|
||||
[assembly: AssemblyCulture ("")]
|
||||
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
|
||||
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
|
||||
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
|
||||
[assembly: AssemblyVersion ("1.0.*")]
|
||||
// The following attributes are used to specify the signing key for the assembly,
|
||||
// if desired. See the Mono documentation for more information about signing.
|
||||
//[assembly: AssemblyDelaySign(false)]
|
||||
//[assembly: AssemblyKeyFile("")]
|
||||
|
18
WorkFlowProvider/WFManager.cs
Normal file
18
WorkFlowProvider/WFManager.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using yavscModel.WorkFlow;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
49
WorkFlowProvider/WorkFlowProvider.csproj
Normal file
49
WorkFlowProvider/WorkFlowProvider.csproj
Normal file
@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>10.0.0</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{821FF72D-9F4B-4A2C-B95C-7B965291F119}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>WorkFlowProvider</RootNamespace>
|
||||
<AssemblyName>WorkFlowProvider</AssemblyName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="Npgsql" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Data" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="NpgsqlContentProvider.cs" />
|
||||
<Compile Include="WFManager.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\yavscModel\yavscModel.csproj">
|
||||
<Project>{68F5B80A-616E-4C3C-91A0-828AA40000BD}</Project>
|
||||
<Name>yavscModel</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
</Project>
|
Reference in New Issue
Block a user