diff --git a/ITContentProvider/ITCPNpgsqlProvider.cs b/ITContentProvider/ITCPNpgsqlProvider.cs
index 5f221fe6..b17a8f0c 100644
--- a/ITContentProvider/ITCPNpgsqlProvider.cs
+++ b/ITContentProvider/ITCPNpgsqlProvider.cs
@@ -4,6 +4,9 @@ using Npgsql;
namespace ITContentProvider
{
+ ///
+ /// ITCP npgsql provider.
+ ///
public class ITCPNpgsqlProvider : NpgsqlContentProvider
{
/* TODO
@@ -19,42 +22,79 @@ namespace ITContentProvider
void SetTaskDesc(int taskId, string desc);
void NewRelease(int projectId, string Version);
*/
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
public ITCPNpgsqlProvider ()
{
}
-
+ ///
+ /// Gets the project info.
+ ///
+ /// The project info.
+ /// Projectid.
public ProjectInfo GetProjectInfo(int projectid)
{
throw new NotImplementedException ();
}
+ ///
+ /// Searchs the project.
+ ///
+ /// The project.
+ /// Pi.
public ProjectInfo[] SearchProject(ProjectInfo pi)
{
throw new NotImplementedException ();
}
+ ///
+ /// News the task.
+ ///
+ /// The task.
+ /// Project identifier.
+ /// Name.
+ /// Desc.
public int NewTask (int projectId, string name, string desc)
{
throw new System.NotImplementedException ();
}
-
+ ///
+ /// Sets the name of the task.
+ ///
+ /// Task identifier.
+ /// Name.
public void SetTaskName (int taskId, string name)
{
throw new System.NotImplementedException ();
}
+ ///
+ /// Sets the start date.
+ ///
+ /// Task identifier.
+ /// D.
public void SetStartDate (int taskId, DateTime d)
{
throw new System.NotImplementedException ();
}
+ ///
+ /// Sets the end date.
+ ///
+ /// Task identifier.
+ /// D.
public void SetEndDate (int taskId, DateTime d)
{
throw new System.NotImplementedException ();
}
-
+ ///
+ /// Removes the project.
+ ///
+ /// Prj identifier.
public void RemoveProject (int prjId)
{
using (var cnx = CreateConnection()) {
@@ -68,7 +108,13 @@ namespace ITContentProvider
}
}
-
+ ///
+ /// News the project.
+ ///
+ /// The project.
+ /// Name.
+ /// Desc.
+ /// Owner identifier.
public int NewProject (string name, string desc, string ownerId)
{
int id = 0;
diff --git a/ITContentProvider/ProjectInfo.cs b/ITContentProvider/ProjectInfo.cs
index 8ec33452..63a3c23c 100644
--- a/ITContentProvider/ProjectInfo.cs
+++ b/ITContentProvider/ProjectInfo.cs
@@ -3,15 +3,50 @@ using WorkFlowProvider;
namespace ITContentProvider
{
+ ///
+ /// Project info.
+ ///
public class ProjectInfo
{
+ ///
+ /// Gets or sets the name.
+ ///
+ /// The name.
string Name { get; set; }
+ ///
+ /// Gets or sets the licence.
+ ///
+ /// The licence.
string Licence { get; set; }
+ ///
+ /// Gets or sets the BB description.
+ ///
+ /// The BB description.
string BBDescription { get; set; }
+ ///
+ /// Gets or sets the start date.
+ ///
+ /// The start date.
DateTime StartDate { get; set; }
+ ///
+ /// Gets or sets the prod version.
+ ///
+ /// The prod version.
string ProdVersion { get; set; }
+ ///
+ /// Gets or sets the stable version.
+ ///
+ /// The stable version.
string StableVersion { get; set; }
+ ///
+ /// Gets or sets the testing version.
+ ///
+ /// The testing version.
string TestingVersion { get; set; }
+ ///
+ /// Gets or sets the web site.
+ ///
+ /// The web site.
string WebSite { get; set; }
}
}
diff --git a/NpgsqlBlogProvider/NpgsqlBlogProvider.cs b/NpgsqlBlogProvider/NpgsqlBlogProvider.cs
index 330f624c..3db8a530 100644
--- a/NpgsqlBlogProvider/NpgsqlBlogProvider.cs
+++ b/NpgsqlBlogProvider/NpgsqlBlogProvider.cs
@@ -7,13 +7,20 @@ using Yavsc.Model.Blogs;
namespace Npgsql.Web.Blog
{
+ ///
+ /// Npgsql blog provider.
+ ///
public class NpgsqlBlogProvider : BlogProvider
{
string applicationName;
string connectionString;
#region implemented abstract members of BlogProvider
-
+ ///
+ /// Tag the specified postid and tag.
+ ///
+ /// Postid.
+ /// Tag.
public override long Tag (long postid, string tag)
{
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
@@ -24,7 +31,10 @@ namespace Npgsql.Web.Blog
return (long) cmd.ExecuteScalar ();
}
}
-
+ ///
+ /// Removes the tag.
+ ///
+ /// Tagid.
public override void RemoveTag (long tagid)
{
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
@@ -34,10 +44,22 @@ namespace Npgsql.Web.Blog
cmd.ExecuteNonQuery ();
}
}
+ ///
+ /// Gets the post identifier.
+ ///
+ /// The post identifier.
+ /// Username.
+ /// Title.
public override long GetPostId (string username, string title)
{
throw new NotImplementedException ();
}
+ ///
+ /// Gets the comments.
+ ///
+ /// The comments.
+ /// Postid.
+ /// If set to true get hidden.
public override Comment[] GetComments (long postid, bool getHidden)
{
List cmts = new List ();
@@ -68,6 +90,13 @@ namespace Npgsql.Web.Blog
}
return cmts.ToArray();
}
+ ///
+ /// Updates the post.
+ ///
+ /// Postid.
+ /// Title.
+ /// Content.
+ /// If set to true visible.
public override void UpdatePost (long postid, string title, string content, bool visible)
{
using (NpgsqlConnection cnx = new NpgsqlConnection(connectionString))
@@ -89,12 +118,20 @@ namespace Npgsql.Web.Blog
cnx.Close();
}
}
-
+ ///
+ /// Removes the post.
+ ///
+ /// Postid.
public override void RemovePost (long postid)
{
throw new NotImplementedException ();
}
-
+ ///
+ /// Comment the specified from, postid and content.
+ ///
+ /// From.
+ /// Postid.
+ /// Content.
public override long Comment (string from, long postid, string content)
{
if (from == null)
@@ -121,12 +158,20 @@ namespace Npgsql.Web.Blog
return (long) cmd.ExecuteScalar();
}
}
-
+ ///
+ /// Validates the comment.
+ ///
+ /// Cmtid.
public override void ValidateComment (long cmtid)
{
throw new NotImplementedException ();
}
-
+ ///
+ /// Updates the comment.
+ ///
+ /// Cmtid.
+ /// Content.
+ /// If set to true visible.
public override void UpdateComment
(long cmtid, string content, bool visible)
{
@@ -134,7 +179,10 @@ namespace Npgsql.Web.Blog
}
private bool autoValidateComment = true;
-
+ ///
+ /// Gets or sets a value indicating whether this auto validate comment.
+ ///
+ /// true if auto validate comment; otherwise, false.
public override bool AutoValidateComment {
get {
return autoValidateComment;
@@ -144,7 +192,11 @@ namespace Npgsql.Web.Blog
}
}
-
+ ///
+ /// Blogs the title.
+ ///
+ /// The title.
+ /// Username.
public override string BlogTitle
(string username)
{
@@ -152,7 +204,11 @@ namespace Npgsql.Web.Blog
}
#endregion
-
+ ///
+ /// Initialize the specified name and config.
+ ///
+ /// Name.
+ /// Config.
public override void Initialize
(string name, System.Collections.Specialized.NameValueCollection config)
{
@@ -165,6 +221,11 @@ namespace Npgsql.Web.Blog
base.Initialize (name, config);
}
#region implemented abstract members of BlogProvider
+ ///
+ /// Gets the post.
+ ///
+ /// The post.
+ /// Postid.
public override BlogEntry GetPost (long postid)
{
BlogEntry be = null;
@@ -190,6 +251,11 @@ namespace Npgsql.Web.Blog
}
return be;
}
+ ///
+ /// Removes the comment.
+ ///
+ /// The comment.
+ /// Cmtid.
public override long RemoveComment (long cmtid)
{
long postid = 0;
@@ -202,6 +268,12 @@ namespace Npgsql.Web.Blog
}
return postid;
}
+ ///
+ /// Gets the post.
+ ///
+ /// The post.
+ /// Username.
+ /// Title.
public override BlogEntry GetPost (string username, string title)
{
BlogEntry be = null;
@@ -239,7 +311,13 @@ namespace Npgsql.Web.Blog
}
return be;
}
-
+ ///
+ /// Post the specified username, title, content and visible.
+ ///
+ /// Username.
+ /// Title.
+ /// Content.
+ /// If set to true visible.
public override long Post (string username, string title, string content, bool visible)
{
if (username == null)
@@ -264,7 +342,15 @@ namespace Npgsql.Web.Blog
return (long) cmd.ExecuteScalar();
}
}
-
+ ///
+ /// Finds the post.
+ ///
+ /// The post.
+ /// Pattern.
+ /// Searchflags.
+ /// Page index.
+ /// Page size.
+ /// Total records.
public override BlogEntryCollection FindPost (string pattern, FindBlogEntryFlags searchflags, int pageIndex, int pageSize, out int totalRecords)
{
BlogEntryCollection c = new BlogEntryCollection ();
@@ -313,7 +399,11 @@ namespace Npgsql.Web.Blog
}
return c;
}
-
+ ///
+ /// Removes the post.
+ ///
+ /// Username.
+ /// Title.
public override void RemovePost (string username, string title)
{
using (NpgsqlConnection cnx=new NpgsqlConnection(connectionString))
@@ -330,7 +420,13 @@ namespace Npgsql.Web.Blog
int defaultPageSize = 10;
-
+ ///
+ /// Lasts the posts.
+ ///
+ /// The posts.
+ /// Page index.
+ /// Page size.
+ /// Total records.
public override BlogEntryCollection LastPosts(int pageIndex, int pageSize, out int totalRecords)
{
BlogEntryCollection c = new BlogEntryCollection ();
diff --git a/WorkFlowProvider/NpgsqlContentProvider.cs b/WorkFlowProvider/NpgsqlContentProvider.cs
index cb1e1e55..92e4f6c5 100644
--- a/WorkFlowProvider/NpgsqlContentProvider.cs
+++ b/WorkFlowProvider/NpgsqlContentProvider.cs
@@ -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
///
public class NpgsqlContentProvider: ProviderBase, IContentProvider
{
- ///
- /// Gets the stock status.
- ///
- /// The stock status.
- /// Product reference.
- public virtual StockStatus GetStockStatus (string productReference)
- {
- return StockStatus.NonExistent;
- }
-
///
/// Registers the command.
///
/// The command id in db.
/// COM.
- public long RegisterCommand (Commande com)
+ public long RegisterCommand (Command com)
{
long id;
using (NpgsqlConnection cnx = CreateConnection ()) {
@@ -47,6 +38,56 @@ namespace WorkFlowProvider
}
return id;
}
+
+ ///
+ /// Gets the commands.
+ ///
+ /// The commands.
+ /// Username.
+ 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;
+ }
+
+ ///
+ /// Gets the stock status.
+ ///
+ /// The stock status.
+ /// Product reference.
+ public virtual StockStatus GetStockStatus (string productReference)
+ {
+ return StockStatus.NonExistent;
+ }
+
+
///
/// Gets the writting status changes.
///
diff --git a/WorkFlowProvider/NpgsqlWorkflow.csproj b/WorkFlowProvider/NpgsqlWorkflow.csproj
index e6f2c27e..4cf2301a 100644
--- a/WorkFlowProvider/NpgsqlWorkflow.csproj
+++ b/WorkFlowProvider/NpgsqlWorkflow.csproj
@@ -40,6 +40,8 @@
..\..\..\..\..\usr\lib\mono\4.5\System.Net.Http.Formatting.dll
False
+
+
diff --git a/web/Controllers/BasketController.cs b/web/Controllers/BasketController.cs
index 325d51e5..b31cc91d 100644
--- a/web/Controllers/BasketController.cs
+++ b/web/Controllers/BasketController.cs
@@ -7,7 +7,6 @@ using System.Web.Http;
using Yavsc.Model.WorkFlow;
using System.Collections.Specialized;
using Yavsc.Model.FrontOffice;
-using System.Web.SessionState;
namespace Yavsc.ApiControllers
{
@@ -37,12 +36,10 @@ namespace Yavsc.ApiControllers
/// Gets the current basket, creates a new one, if it doesn't exist.
///
/// The current basket.
- protected Basket CurrentBasket {
+ protected CommandSet CurrentBasket {
get {
- HttpSessionState session = HttpContext.Current.Session;
- Basket b = (Basket) session ["Basket"];
- if (b == null)
- session ["Basket"] = b = new Basket ();
+ CommandSet b = wfmgr.GetCommands (Membership.GetUser ().UserName);
+ if (b == null) b = new CommandSet ();
return b;
}
}
@@ -55,7 +52,7 @@ namespace Yavsc.ApiControllers
public long Create(NameValueCollection cmdParams)
{
// HttpContext.Current.Request.Files
- Commande cmd = new Commande(cmdParams, HttpContext.Current.Request.Files);
+ Command cmd = new Command(cmdParams, HttpContext.Current.Request.Files);
CurrentBasket.Add (cmd);
return cmd.Id;
}
@@ -65,7 +62,7 @@ namespace Yavsc.ApiControllers
///
/// Itemid.
[Authorize]
- Commande Read(long itemid){
+ Command Read(long itemid){
return CurrentBasket[itemid];
}
diff --git a/web/Controllers/FileSystemController.cs b/web/Controllers/FileSystemController.cs
index 434de7b4..476872fc 100644
--- a/web/Controllers/FileSystemController.cs
+++ b/web/Controllers/FileSystemController.cs
@@ -15,15 +15,13 @@ namespace Yavsc.Controllers
///
public class FileSystemController : Controller
{
- private string usersDir = "~/users";
-
///
/// Gets the users base directory.
///
/// The users dir.
- public string UsersDir {
+ public string RootDir {
get {
- return usersDir;
+ return mgr.Prefix;
}
}
@@ -36,7 +34,8 @@ namespace Yavsc.Controllers
protected override void Initialize (System.Web.Routing.RequestContext requestContext)
{
base.Initialize (requestContext);
- mgr = new FileSystemManager (UsersDir);
+ mgr = new FileSystemManager (
+ string.Format("~/users/{0}",Membership.GetUser().UserName));
}
///
@@ -45,7 +44,7 @@ namespace Yavsc.Controllers
[Authorize]
public ActionResult Index (string id)
{
- return View (mgr.GetFiles (Membership.GetUser().UserName+"/"+id));
+ return View (mgr.GetFiles (id));
}
///
@@ -63,9 +62,9 @@ namespace Yavsc.Controllers
return RedirectToAction ("Index");
}
}
- string fpath = Path.Combine (UserBaseDir, id);
- ViewData ["Content"] = Url.Content (fpath);
- FileInfo fi = new FileInfo (fpath);
+ FileInfo fi = mgr.FileInfo (id);
+
+ ViewData ["Content"] = Url.Content (fi.FullName);
return View (fi);
}
@@ -78,16 +77,15 @@ namespace Yavsc.Controllers
[Authorize]
public ActionResult Create (string id)
{
- string path=Membership.GetUser().UserName+"/"+id;
- mgr.Put ( path, Request.Files);
- return View ("Index",mgr.GetFiles(path));
+ mgr.Put ( id, Request.Files);
+ return View ("Index",mgr.GetFiles(id));
}
///
/// Gets the user's base dir.
///
/// The base dir.
- public string UserBaseDir { get { return Path.Combine (UsersDir, Membership.GetUser ().UserName); } }
+ public string UserBaseDir { get { return Path.Combine (RootDir, Membership.GetUser ().UserName); } }
///
/// Edit the specified id.
diff --git a/web/Controllers/FrontOfficeController.cs b/web/Controllers/FrontOfficeController.cs
index 8cc9d33d..1e04bf22 100644
--- a/web/Controllers/FrontOfficeController.cs
+++ b/web/Controllers/FrontOfficeController.cs
@@ -181,19 +181,14 @@ namespace Yavsc.Controllers
}
///
- /// Command this instance.
+ /// Basket this instance.
///
- public ActionResult Command ()
+ [Authorize]
+ public ActionResult Basket ()
{
- return View ();
+ return View (wfmgr.GetCommands(Membership.GetUser().UserName));
}
- private Basket GetBasket ()
- {
- if (Session ["Basket"] == null)
- Session ["Basket"] = new Basket();
- return Session ["Basket"] as Basket;
- }
///
/// Command the specified collection.
@@ -204,29 +199,9 @@ namespace Yavsc.Controllers
public ActionResult Command (FormCollection collection)
{
try {
- // get files from the request
- string fnre = "[A-Za-z0-9~\\-.]+";
- HttpFileCollectionBase hfc = Request.Files;
- // TODO mime-magic on content, and file name filter
- foreach (String h in hfc.AllKeys) {
- if (!Regex.Match (hfc [h].FileName, fnre).Success) {
- ViewData ["Message"] = "File name refused";
- ModelState.AddModelError (
- h,
- string.Format (
- "The file name {0} dosn't match an acceptable file name {1}",
- hfc [h].FileName, fnre));
- return View (collection);
- }
- }
- string usersdir = Server.MapPath("~/users");
- FileSystemManager fsmgr = new FileSystemManager(usersdir);
- foreach (String h in hfc.AllKeys) {
- // TODO Limit with hfc[h].ContentLength
- hfc [h].SaveAs (Path.Combine (usersdir, hfc [h].FileName));
- }
// Add specified product command to the basket,
- GetBasket().Add (new Commande(collection,HttpContext.Request.Files));
+ // saves it in db
+ new Command(collection,HttpContext.Request.Files);
ViewData ["Message"] = LocalizedText.Item_added_to_basket;
return View (collection);
} catch (Exception e) {
diff --git a/web/Helpers/Google/CalendarApi.cs b/web/Helpers/Google/CalendarApi.cs
index 2f21630f..b0fea70e 100644
--- a/web/Helpers/Google/CalendarApi.cs
+++ b/web/Helpers/Google/CalendarApi.cs
@@ -103,13 +103,13 @@ namespace Yavsc.Helpers.Google
try {
using (WebResponse resp = webreq.GetResponse ()) {
using (Stream respstream = resp.GetResponseStream ()) {
- try {
+ try {
res = (CalendarEntryList) new DataContractJsonSerializer(typeof(CalendarEntryList)).ReadObject (respstream);
- } catch (Exception ex) {
- respstream.Close ();
- resp.Close ();
+ } catch (Exception ex) {
+ respstream.Close ();
+ resp.Close ();
webreq.Abort ();
- throw new GoogleErrorException(ex);
+ throw ex;
}
}
resp.Close ();
diff --git a/web/Views/FrontOffice/Basket.aspx b/web/Views/FrontOffice/Basket.aspx
new file mode 100644
index 00000000..ff7dd704
--- /dev/null
+++ b/web/Views/FrontOffice/Basket.aspx
@@ -0,0 +1,26 @@
+<%@ Page Title="Basket" Language="C#" Inherits="System.Web.Mvc.ViewPage" MasterPageFile="~/Models/App.master" %>
+
+
+<% Title = Title +" "+ Model.Count+" article(s)"; %>
+
+
+
+
+
+
+<% foreach (Commande cmd in Model.Values) { %>
+ -
+ <%= cmd.Id %>
+ <%= cmd.CreationDate %>
+
+ <%= cmd.Status %>
+ <%= cmd.ProductRef %>
+
+ <% foreach (string key in cmd.Parameters.Keys) { %>
+ - <%=key%>: <%=cmd.Parameters[key]%>
+ <% } %>
+
+
+<% } %>
+
+
diff --git a/web/Web.csproj b/web/Web.csproj
index be23aa0e..4cea4304 100644
--- a/web/Web.csproj
+++ b/web/Web.csproj
@@ -673,6 +673,7 @@
+
diff --git a/yavscModel/FileSystem/FileSystemManager.cs b/yavscModel/FileSystem/FileSystemManager.cs
index 0ef32043..4eb9fe19 100644
--- a/yavscModel/FileSystem/FileSystemManager.cs
+++ b/yavscModel/FileSystem/FileSystemManager.cs
@@ -56,9 +56,9 @@ namespace Yavsc.Model.FileSystem
///
/// Initializes a new instance of the class.
///
- public FileSystemManager (string usersDirectory="~/files", char dirSep = '/')
+ public FileSystemManager (string rootDirectory="~/files", char dirSep = '/')
{
- prefix = usersDirectory;
+ prefix = rootDirectory;
DirectorySeparator = dirSep;
}
@@ -150,8 +150,19 @@ namespace Yavsc.Model.FileSystem
}
DirectoryInfo di = new DirectoryInfo (path);
FileInfoCollection res = new FileInfoCollection (di.GetFiles ());
+ // TODO define an Owner
return res;
}
+ ///
+ /// Files the info.
+ ///
+ /// The info.
+ /// Identifier.
+ public FileInfo FileInfo(string id)
+ {
+ checkSubDir (id);
+ return new FileInfo(Path.Combine (Prefix, id));
+ }
}
}
diff --git a/yavscModel/FrontOffice/Basket.cs b/yavscModel/FrontOffice/CommandSet.cs
similarity index 91%
rename from yavscModel/FrontOffice/Basket.cs
rename to yavscModel/FrontOffice/CommandSet.cs
index 5af677da..5dd0bbbf 100644
--- a/yavscModel/FrontOffice/Basket.cs
+++ b/yavscModel/FrontOffice/CommandSet.cs
@@ -27,12 +27,12 @@ namespace Yavsc.Model.FrontOffice
///
/// Basket.
///
- public class Basket: Dictionary
+ public class CommandSet: Dictionary
{
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
- public Basket ()
+ public CommandSet ()
{
}
/// The item to add to the current collection.
@@ -43,7 +43,7 @@ namespace Yavsc.Model.FrontOffice
/// Add the specified cmd.
///
/// Cmd.
- public void Add(Commande cmd)
+ public void Add(Command cmd)
{
Add (cmd.Id, cmd);
}
diff --git a/yavscModel/FrontOffice/CommandStatus.cs b/yavscModel/FrontOffice/CommandStatus.cs
index a44633fe..9959c43c 100644
--- a/yavscModel/FrontOffice/CommandStatus.cs
+++ b/yavscModel/FrontOffice/CommandStatus.cs
@@ -22,13 +22,34 @@ using System;
namespace Yavsc.Model.FrontOffice
{
+ ///
+ /// Command status.
+ ///
public enum CommandStatus:int
{
+ ///
+ /// The inserted.
+ ///
Inserted,
+ ///
+ /// The user validated.
+ ///
UserValidated,
+ ///
+ /// The user canceled.
+ ///
UserCanceled,
+ ///
+ /// The execution pending.
+ ///
ExecutionPending,
+ ///
+ /// The satisfied.
+ ///
Satisfied,
+ ///
+ /// The refunded.
+ ///
Refunded
}
}
diff --git a/yavscModel/FrontOffice/Commande.cs b/yavscModel/FrontOffice/Commande.cs
index 808969ea..15eebc42 100644
--- a/yavscModel/FrontOffice/Commande.cs
+++ b/yavscModel/FrontOffice/Commande.cs
@@ -11,24 +11,32 @@ namespace Yavsc.Model.FrontOffice
///
/// Commande.
///
- public class Commande
+ public class Command
{
///
/// Gets or sets the creation date.
///
/// The creation date.
public DateTime CreationDate { get; set; }
+
///
/// Gets or sets the identifier.
///
/// The identifier.
public long Id { get; set; }
+
///
/// Gets or sets the product reference.
///
/// The prod reference.
public CommandStatus Status { get; set; }
+
+ ///
+ /// Gets or sets the product reference.
+ ///
+ /// The product reference.
public string ProductRef { get; set; }
+
///
/// The parameters.
///
@@ -39,30 +47,46 @@ namespace Yavsc.Model.FrontOffice
return GetFSM().GetFiles (Id.ToString());
}
}
-
///
- /// Create a command using the specified collection
- /// as command parameters, handles the request files.
+ /// Initializes a new instance of the class.
+ ///
+ public Command()
+ {
+ }
+ ///
+ /// Froms the post.
///
/// Collection.
/// Files.
- public Commande (NameValueCollection collection, NameObjectCollectionBase files)
+ public void FromPost(NameValueCollection collection, NameObjectCollectionBase files)
{
// string catref=collection["catref"]; // Catalog Url from which formdata has been built
ProductRef=collection["ref"]; // Required product reference
CreationDate = DateTime.Now;
Status = CommandStatus.Inserted;
// stores the parameters:
+ Parameters.Clear ();
foreach (string key in collection.AllKeys) {
if (key!="ref")
Parameters.Add (key, collection [key]);
}
WorkFlowManager wfm = new WorkFlowManager ();
- wfm.RegisterCommand (this); // sets this.Id
+ wfm.RegisterCommand (this); // overrides this.Id
string strcmdid = Id.ToString ();
GetFSM().Put (strcmdid, files);
}
+ ///
+ /// Creates a command using the specified collection
+ /// as command parameters, handles the files upload.
+ ///
+ /// Collection.
+ /// Files.
+ public Command (NameValueCollection collection, NameObjectCollectionBase files)
+ {
+ FromPost (collection, files);
+ }
+
private FileSystemManager GetFSM() {
return new FileSystemManager ("~/commands");
}
diff --git a/yavscModel/FrontOffice/WebFileInfoCollection.cs b/yavscModel/FrontOffice/WebFileInfoCollection.cs
deleted file mode 100644
index e713cfa1..00000000
--- a/yavscModel/FrontOffice/WebFileInfoCollection.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-using System;
-using Yavsc;
-using System.Collections.Specialized;
-using Yavsc.Model.WorkFlow;
-using Yavsc.Model.FileSystem;
-using System.Web;
-using System.Collections.Generic;
-
-
-namespace Yavsc.Model.FrontOffice
-{
- public class WebFileInfoCollection: List
- {
- public WebFileInfoCollection (
- HttpContextBase context, string prefix)
- {
-
- }
-
-
- }
-
-}
-
diff --git a/yavscModel/WorkFlow/IContentProvider.cs b/yavscModel/WorkFlow/IContentProvider.cs
index 939f40be..2da74941 100644
--- a/yavscModel/WorkFlow/IContentProvider.cs
+++ b/yavscModel/WorkFlow/IContentProvider.cs
@@ -119,8 +119,13 @@ namespace Yavsc.Model.WorkFlow
///
/// The command id in db.
/// COM.
- long RegisterCommand (Commande com);
-
+ long RegisterCommand (Command com);
+ ///
+ /// Gets the commands.
+ ///
+ /// The commands.
+ /// Username.
+ CommandSet GetCommands (string username);
///
/// Gets the stock status.
///
diff --git a/yavscModel/WorkFlow/WorkFlowManager.cs b/yavscModel/WorkFlow/WorkFlowManager.cs
index 92a2411c..db6daeb5 100644
--- a/yavscModel/WorkFlow/WorkFlowManager.cs
+++ b/yavscModel/WorkFlow/WorkFlowManager.cs
@@ -25,7 +25,7 @@ namespace Yavsc.Model.WorkFlow
///
/// The command.
/// COM.
- public long RegisterCommand(Commande com)
+ public long RegisterCommand(Command com)
{
return ContentProvider.RegisterCommand (com);
}
@@ -183,7 +183,15 @@ namespace Yavsc.Model.WorkFlow
{
ContentProvider.SetEstimateStatus (estid, status, username);
}
-
+ ///
+ /// Gets the commands.
+ ///
+ /// The commands.
+ /// Username.
+ public CommandSet GetCommands(string username)
+ {
+ return ContentProvider.GetCommands (username);
+ }
}
}
diff --git a/yavscModel/YavscModel.csproj b/yavscModel/YavscModel.csproj
index c33d8a7b..b451a251 100644
--- a/yavscModel/YavscModel.csproj
+++ b/yavscModel/YavscModel.csproj
@@ -96,7 +96,6 @@
-
@@ -136,8 +135,8 @@
-
+