* Web.csproj:
* YavscModel.csproj: * Basket.cs: * Basket.aspx: * Commande.cs: * BasketController.cs: * CommandSet.cs: * NpgsqlWorkflow.csproj: * FileSystemController.cs: * FrontOfficeController.cs: * NpgsqlContentProvider.cs: implementing a basket * ProjectInfo.cs: * ITCPNpgsqlProvider.cs: * CommandStatus.cs: * NpgsqlBlogProvider.cs: xml doc * CalendarApi.cs: document formatting * FileSystemManager.cs: refactoring * WorkFlowManager.cs: * IContentProvider.cs: provides a basket * WebFileInfoCollection.cs: not used
This commit is contained in:
parent
b505ad90e7
commit
75fe032822
19 changed files with 388 additions and 127 deletions
|
|
@ -8,6 +8,7 @@ using System.Configuration.Provider;
|
|||
using System.Collections.Generic;
|
||||
using Yavsc.Model.FrontOffice;
|
||||
using Newtonsoft.Json;
|
||||
using System.Web.Security;
|
||||
|
||||
namespace WorkFlowProvider
|
||||
{
|
||||
|
|
@ -16,22 +17,12 @@ namespace WorkFlowProvider
|
|||
/// </summary>
|
||||
public class NpgsqlContentProvider: ProviderBase, IContentProvider
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the stock status.
|
||||
/// </summary>
|
||||
/// <returns>The stock status.</returns>
|
||||
/// <param name="productReference">Product reference.</param>
|
||||
public virtual StockStatus GetStockStatus (string productReference)
|
||||
{
|
||||
return StockStatus.NonExistent;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers the command.
|
||||
/// </summary>
|
||||
/// <returns>The command id in db.</returns>
|
||||
/// <param name="com">COM.</param>
|
||||
public long RegisterCommand (Commande com)
|
||||
public long RegisterCommand (Command com)
|
||||
{
|
||||
long id;
|
||||
using (NpgsqlConnection cnx = CreateConnection ()) {
|
||||
|
|
@ -47,6 +38,56 @@ namespace WorkFlowProvider
|
|||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the commands.
|
||||
/// </summary>
|
||||
/// <returns>The commands.</returns>
|
||||
/// <param name="username">Username.</param>
|
||||
public CommandSet GetCommands (string username )
|
||||
{
|
||||
// Check the user's authorisations
|
||||
MembershipUser user = Membership.GetUser ();
|
||||
if (user.UserName != username)
|
||||
if (!Roles.IsUserInRole ("Admin"))
|
||||
if (!Roles.IsUserInRole ("FrontOffice"))
|
||||
throw new Exception ("Not allowed");
|
||||
CommandSet cmds = new CommandSet ();
|
||||
|
||||
using (NpgsqlConnection cnx = CreateConnection ()) {
|
||||
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
|
||||
cmd.CommandText =
|
||||
"select id,prdref,creation,params from commandes where @user = clientname and applicationname = @app";
|
||||
cmd.Parameters.Add ("@user", username);
|
||||
cmd.Parameters.Add ("@app", this.ApplicationName);
|
||||
cnx.Open ();
|
||||
using (NpgsqlDataReader rdr = cmd.ExecuteReader ()) {
|
||||
while (rdr.Read ()) {
|
||||
Command ycmd = new Command();
|
||||
ycmd.Id = rdr.GetInt64(0);
|
||||
ycmd.CreationDate = rdr.GetDateTime(1);
|
||||
ycmd.ProductRef = rdr.GetString(2);
|
||||
ycmd.Parameters = JsonConvert.DeserializeObject(rdr.GetString(3)) as StringDictionary;
|
||||
cmds.Add (ycmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
cnx.Close ();
|
||||
}
|
||||
return cmds;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the stock status.
|
||||
/// </summary>
|
||||
/// <returns>The stock status.</returns>
|
||||
/// <param name="productReference">Product reference.</param>
|
||||
public virtual StockStatus GetStockStatus (string productReference)
|
||||
{
|
||||
return StockStatus.NonExistent;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the writting status changes.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -40,6 +40,8 @@
|
|||
<HintPath>..\..\..\..\..\usr\lib\mono\4.5\System.Net.Http.Formatting.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue