diff --git a/ITContentProvider/ITContentProvider.csproj b/ITContentProvider/ITContentProvider.csproj index 67706942..8bdb3ff1 100644 --- a/ITContentProvider/ITContentProvider.csproj +++ b/ITContentProvider/ITContentProvider.csproj @@ -35,11 +35,13 @@ + + @@ -52,4 +54,7 @@ NpgsqlWorkflow + + + \ No newline at end of file diff --git a/yavscModel/WorkFlow/NewProjectModel.cs b/ITContentProvider/Model/NewProjectModel.cs similarity index 50% rename from yavscModel/WorkFlow/NewProjectModel.cs rename to ITContentProvider/Model/NewProjectModel.cs index fa74ccf5..a777d3f9 100644 --- a/yavscModel/WorkFlow/NewProjectModel.cs +++ b/ITContentProvider/Model/NewProjectModel.cs @@ -2,19 +2,33 @@ using System; using System.ComponentModel.DataAnnotations; using System.ComponentModel; -namespace Yavsc.Model.WorkFlow +namespace ITContentProvider.Model { - [Obsolete("This should be define in an IT specific module")] + /// + /// New project model. + /// public class NewProjectModel { + /// + /// Gets or sets the name. + /// + /// The name. [DisplayName("Nom du projet")] [Required()] public string Name { get; set; } + /// + /// Gets or sets the manager. + /// + /// The manager. [DisplayName("Manager du projet")] [Required] public string Manager { get; set; } + /// + /// Gets or sets the description. + /// + /// The description. [DisplayName("Description du projet")] [Required] public string Description { get; set; } diff --git a/SalesCatalog/SalesCatalog.csproj b/SalesCatalog/SalesCatalog.csproj index 9f56e70e..09ed11c4 100644 --- a/SalesCatalog/SalesCatalog.csproj +++ b/SalesCatalog/SalesCatalog.csproj @@ -35,6 +35,7 @@ + diff --git a/SalesCatalog/XmlImplementation/XmlCatalogProvider.cs b/SalesCatalog/XmlImplementation/XmlCatalogProvider.cs index f65c435b..989a7c58 100644 --- a/SalesCatalog/XmlImplementation/XmlCatalogProvider.cs +++ b/SalesCatalog/XmlImplementation/XmlCatalogProvider.cs @@ -4,6 +4,7 @@ using System.Configuration; using System.IO; using System.Xml; using Yavsc.Model.FrontOffice; +using System.Web; namespace SalesCatalog.XmlImplementation { @@ -48,6 +49,9 @@ namespace SalesCatalog.XmlImplementation /// /// Initialize the catalog /// using the specified name and config. + /// The config object contains under the key + /// connection the path to the Xml Catalog file + /// at server side. /// /// Name. /// Config. @@ -56,9 +60,12 @@ namespace SalesCatalog.XmlImplementation if (config ["connection"] == null) throw new Exception ("the 'connection' parameter is null " + "(it should be the absolute path to the xml catalog)"); - string basedir = AppDomain.CurrentDomain.BaseDirectory; // config ["connection"] starts with "~/" - fileName = Path.Combine(basedir, config ["connection"].Substring (2)); + fileName = (string) config ["connection"]; + if (fileName.StartsWith ("~/")) { + fileName = HttpContext.Current.Server.MapPath( + config ["connection"]); + } LoadCatalog (); } diff --git a/WorkFlowProvider/NpgsqlContentProvider.cs b/WorkFlowProvider/NpgsqlContentProvider.cs index c2fb3f0f..cb1e1e55 100644 --- a/WorkFlowProvider/NpgsqlContentProvider.cs +++ b/WorkFlowProvider/NpgsqlContentProvider.cs @@ -11,8 +11,26 @@ using Newtonsoft.Json; namespace WorkFlowProvider { + /// + /// Npgsql content provider. + /// 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) { long id; @@ -20,7 +38,7 @@ namespace WorkFlowProvider using (NpgsqlCommand cmd = cnx.CreateCommand ()) { cmd.CommandText = "insert into commandes (prdref,creation,params) values (@pref,@creat,@prs) returning id"; - cmd.Parameters.Add ("@pref", com.ProdRef); + cmd.Parameters.Add ("@pref", com.ProductRef); cmd.Parameters.Add ("@creat", com.CreationDate); cmd.Parameters.Add ("@prs", JsonConvert.SerializeObject(com.Parameters)); cnx.Open (); @@ -29,47 +47,110 @@ namespace WorkFlowProvider } return id; } - + /// + /// Gets the writting status changes. + /// + /// The writting statuses. + /// Wrid. public StatusChange[] GetWrittingStatuses (long wrid) { throw new NotImplementedException (); } + /// + /// Gets the estimate status changes. + /// + /// The estimate statuses. + /// Estid. public StatusChange[] GetEstimateStatuses (long estid) { throw new NotImplementedException (); } + /// + /// Tags the writting. + /// + /// Wrid. + /// Tag. public void TagWritting (long wrid, string tag) { throw new NotImplementedException (); } - public void DropTagWritting (long wrid, string tag) + + /// + /// Drops the writting tag . + /// + /// Wrid. + /// Tag. + public void DropWrittingTag (long wrid, string tag) { throw new NotImplementedException (); } + /// + /// Sets the writting status. + /// + /// Wrtid. + /// Status. + /// Username. public void SetWrittingStatus (long wrtid, int status, string username) { throw new NotImplementedException (); } + /// + /// Sets the estimate status. + /// + /// Estid. + /// Status. + /// Username. public void SetEstimateStatus (long estid, int status, string username) { throw new NotImplementedException (); } + /// + /// Releases all resource used by the object. + /// + /// Call when you are finished using the . + /// The method leaves the in an unusable + /// state. After calling , you must release all references to the + /// so the garbage collector can reclaim the memory that the + /// was occupying. public void Dispose () { throw new NotImplementedException (); } + /// + /// Install the model in database using the specified cnx. + /// + /// Cnx. public void Install (System.Data.IDbConnection cnx) { throw new NotImplementedException (); } + + /// + /// Uninstall the module data and data model from + /// database, using the specified connection. + /// + /// Cnx. + /// If set to true remove config. public void Uninstall (System.Data.IDbConnection cnx, bool removeConfig) { throw new NotImplementedException (); } + + /// + /// Defaults the config. + /// + /// The config. + /// App name. + /// Cnx string. public ConfigurationSection DefaultConfig (string appName, string cnxStr) { throw new NotImplementedException (); } + + /// + /// Gets or sets a value indicating whether this is active. + /// + /// true if active; otherwise, false. public bool Active { get { throw new NotImplementedException (); @@ -79,16 +160,33 @@ namespace WorkFlowProvider } } + /// + /// Gets the different status labels. + /// 0 is the starting status. Each status is an integer and the 0-based index + /// of a string in this array. + /// + /// The status labels. public string[] Statuses { get { return new string[] { "Created", "Validated", "Success", "Error" }; } } + + /// + /// Gets the final statuses. + /// + /// The final statuses. public bool[] FinalStatuses { get { return new bool[] { false, false, true, true }; } } + + /// + /// Gets the estimates created for a specified client. + /// + /// The estimates. + /// Client. public Estimate[] GetEstimates (string client) { using (NpgsqlConnection cnx = CreateConnection ()) { @@ -108,6 +206,10 @@ namespace WorkFlowProvider } } + /// + /// Drops the writting. + /// + /// Wrid. public void DropWritting (long wrid) { @@ -123,6 +225,10 @@ namespace WorkFlowProvider } } + /// + /// Drops the estimate. + /// + /// Estid. public void DropEstimate (long estid) { using (NpgsqlConnection cnx = CreateConnection ()) { @@ -137,6 +243,11 @@ namespace WorkFlowProvider } } + /// + /// Gets the estimate by identifier. + /// + /// The estimate. + /// Estimid. public Estimate GetEstimate (long estimid) { using (NpgsqlConnection cnx = CreateConnection ()) { @@ -198,7 +309,10 @@ namespace WorkFlowProvider } } - + /// + /// Updates the writting. + /// + /// Wr. public void UpdateWritting (Writting wr) { using (NpgsqlConnection cnx = CreateConnection ()) { @@ -222,6 +336,10 @@ namespace WorkFlowProvider } } + /// + /// Saves the given Estimate object in database. + /// + /// the Estimate object. public void UpdateEstimate (Estimate estim) { using (NpgsqlConnection cnx = CreateConnection ()) { @@ -241,6 +359,15 @@ namespace WorkFlowProvider } } + /// + /// Add a line to the specified estimate by id, + /// using the specified desc, ucost, count and productid. + /// + /// Estimate identifier. + /// Textual description for this line. + /// Unitary cost. + /// Cost multiplier. + /// Product identifier. public long Write (long estid, string desc, decimal ucost, int count, string productid) { using (NpgsqlConnection cnx = CreateConnection ()) { @@ -262,6 +389,11 @@ namespace WorkFlowProvider } } + /// + /// Sets the desc. + /// + /// Writid. + /// New desc. public void SetDesc (long writid, string newDesc) { using (NpgsqlConnection cnx = CreateConnection ()) { @@ -277,7 +409,14 @@ namespace WorkFlowProvider } } - + /// + /// Creates the estimate. + /// + /// The estimate. + /// Client. + /// Title. + /// Responsible. + /// Description. public Estimate CreateEstimate (string responsible, string client, string title, string description) { using (NpgsqlConnection cnx = CreateConnection ()) { @@ -304,7 +443,10 @@ namespace WorkFlowProvider } string applicationName=null; - + /// + /// Gets or sets the name of the application. + /// + /// The name of the application. public string ApplicationName { get { return applicationName; @@ -315,7 +457,11 @@ namespace WorkFlowProvider } string cnxstr = null; - + /// + /// Initialize this object using the specified name and config. + /// + /// Name. + /// Config. public override void Initialize (string name, NameValueCollection config) { if ( string.IsNullOrWhiteSpace(config ["connectionStringName"])) @@ -328,6 +474,10 @@ namespace WorkFlowProvider } + /// + /// Creates the connection. + /// + /// The connection. protected NpgsqlConnection CreateConnection () { return new NpgsqlConnection (cnxstr); diff --git a/web/Controllers/BasketController.cs b/web/Controllers/BasketController.cs index 0dff26a7..325d51e5 100644 --- a/web/Controllers/BasketController.cs +++ b/web/Controllers/BasketController.cs @@ -7,6 +7,7 @@ using System.Web.Http; using Yavsc.Model.WorkFlow; using System.Collections.Specialized; using Yavsc.Model.FrontOffice; +using System.Web.SessionState; namespace Yavsc.ApiControllers { @@ -32,23 +33,40 @@ namespace Yavsc.ApiControllers wfmgr = new WorkFlowManager (); } + /// + /// Gets the current basket, creates a new one, if it doesn't exist. + /// + /// The current basket. + protected Basket CurrentBasket { + get { + HttpSessionState session = HttpContext.Current.Session; + Basket b = (Basket) session ["Basket"]; + if (b == null) + session ["Basket"] = b = new Basket (); + return b; + } + } + /// /// Create the specified basket item using specified command parameters. /// /// Command parameters. - [AcceptVerbs("CREATE")] + [Authorize] public long Create(NameValueCollection cmdParams) { - throw new NotImplementedException (); + // HttpContext.Current.Request.Files + Commande cmd = new Commande(cmdParams, HttpContext.Current.Request.Files); + CurrentBasket.Add (cmd); + return cmd.Id; } /// /// Read the specified basket item. /// /// Itemid. - [AcceptVerbs("READ")] + [Authorize] Commande Read(long itemid){ - throw new NotImplementedException (); + return CurrentBasket[itemid]; } /// @@ -57,29 +75,21 @@ namespace Yavsc.ApiControllers /// Item identifier. /// Parameter name. /// Value. - [AcceptVerbs("UPDATE")] - public void Update(long itemid, string param, string value) + [Authorize] + public void UpdateParam(long itemid, string param, string value) { - throw new NotImplementedException (); + CurrentBasket [itemid].Parameters [param] = value; } /// /// Delete the specified item. /// /// Item identifier. + [Authorize] public void Delete(long itemid) { - throw new NotImplementedException (); + CurrentBasket.Remove (itemid); } - /// - /// Post a file, as attached document to the specified - /// Item - /// - [AcceptVerbs("POST")] - public void Post(long itemId) - { - throw new NotImplementedException (); - } } } \ No newline at end of file diff --git a/web/Controllers/FileSystemController.cs b/web/Controllers/FileSystemController.cs index 5318db27..434de7b4 100644 --- a/web/Controllers/FileSystemController.cs +++ b/web/Controllers/FileSystemController.cs @@ -6,6 +6,7 @@ using System.Web.Mvc; using System.IO; using System.Web.Security; using System.Text.RegularExpressions; +using Yavsc.Model.FileSystem; namespace Yavsc.Controllers { @@ -14,34 +15,37 @@ namespace Yavsc.Controllers /// public class FileSystemController : Controller { - private static string usersDir = "~/users"; + private string usersDir = "~/users"; /// - /// Gets the users dir. + /// Gets the users base directory. /// /// The users dir. - public static string UsersDir { + public string UsersDir { get { return usersDir; } } + FileSystemManager mgr = null ; + + /// + /// Initialize the specified requestContext. + /// + /// Request context. + protected override void Initialize (System.Web.Routing.RequestContext requestContext) + { + base.Initialize (requestContext); + mgr = new FileSystemManager (UsersDir); + } + /// /// Index this instance. /// [Authorize] - public ActionResult Index () + public ActionResult Index (string id) { - string user = Membership.GetUser ().UserName; - ViewData ["UserName"] = user; - - DirectoryInfo di = new DirectoryInfo ( - Path.Combine ( - Server.MapPath (UsersDir), - user)); - if (!di.Exists) - di.Create (); - return View (new FileInfoCollection (di.GetFiles ())); + return View (mgr.GetFiles (Membership.GetUser().UserName+"/"+id)); } /// @@ -59,7 +63,7 @@ namespace Yavsc.Controllers return RedirectToAction ("Index"); } } - string fpath = Path.Combine (BaseDir, id); + string fpath = Path.Combine (UserBaseDir, id); ViewData ["Content"] = Url.Content (fpath); FileInfo fi = new FileInfo (fpath); @@ -67,54 +71,23 @@ namespace Yavsc.Controllers } /// - /// Create this instance. - /// - public ActionResult Create () - { - return View (); - } - - /// - /// Create the specified collection. + /// Create the specified id. /// - /// Collection. + /// Identifier. [HttpPost] [Authorize] - public ActionResult Create (FormCollection collection) + public ActionResult Create (string id) { - try { - string fnre = "[A-Za-z0-9~\\-.]+"; - HttpFileCollectionBase hfc = Request.Files; - - for (int i = 0; i < hfc.Count; i++) { - if (!Regex.Match (hfc [i].FileName, fnre).Success) { - ViewData ["Message"] += string.Format ("

File name '{0}' refused

", hfc [i].FileName); - ModelState.AddModelError ( - "AFile", - string.Format ( - "The file name {0} dosn't match an acceptable file name {1}", - hfc [i].FileName, fnre)); - return View (); - } - } - for (int i = 0; i < hfc.Count; i++) { - // TODO Limit with hfc[h].ContentLength - string filename = Path.Combine (Server.MapPath (BaseDir), hfc [i].FileName); - hfc [i].SaveAs (filename); - ViewData ["Message"] += string.Format ("

File name '{0}' saved

", hfc [i].FileName); - } - return RedirectToAction ("Index", "FileSystem"); - } catch (Exception e) { - ViewData ["Message"] = "Exception:" + e.Message; - return View (); - } + string path=Membership.GetUser().UserName+"/"+id; + mgr.Put ( path, Request.Files); + return View ("Index",mgr.GetFiles(path)); } /// - /// Gets the base dir. + /// Gets the user's base dir. /// /// The base dir. - public static string BaseDir { get { return Path.Combine (UsersDir, Membership.GetUser ().UserName); } } + public string UserBaseDir { get { return Path.Combine (UsersDir, Membership.GetUser ().UserName); } } /// /// Edit the specified id. @@ -122,7 +95,7 @@ namespace Yavsc.Controllers /// Identifier. public ActionResult Edit (int id) { - return View (); + throw new NotImplementedException (); } /// @@ -133,11 +106,7 @@ namespace Yavsc.Controllers [HttpPost] public ActionResult Edit (int id, FormCollection collection) { - try { - return RedirectToAction ("Index"); - } catch { - return View (); - } + throw new NotImplementedException (); } /// @@ -146,7 +115,7 @@ namespace Yavsc.Controllers /// Identifier. public ActionResult Delete (int id) { - return View (); + throw new NotImplementedException (); } /// @@ -157,11 +126,7 @@ namespace Yavsc.Controllers [HttpPost] public ActionResult Delete (int id, FormCollection collection) { - try { - return RedirectToAction ("Index"); - } catch { - return View (); - } + throw new NotImplementedException (); } } } \ No newline at end of file diff --git a/web/Controllers/FrontOfficeController.cs b/web/Controllers/FrontOfficeController.cs index 5755b7bb..8cc9d33d 100644 --- a/web/Controllers/FrontOfficeController.cs +++ b/web/Controllers/FrontOfficeController.cs @@ -12,6 +12,7 @@ using WorkFlowProvider; using System.Web.Security; using System.Threading; using Yavsc.Model.FrontOffice; +using Yavsc.Model.FileSystem; namespace Yavsc.Controllers { @@ -218,12 +219,14 @@ namespace Yavsc.Controllers 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 (FileSystemController.BaseDir, hfc [h].FileName)); + hfc [h].SaveAs (Path.Combine (usersdir, hfc [h].FileName)); } // Add specified product command to the basket, - GetBasket().Add (Commande.Create (collection)); + GetBasket().Add (new Commande(collection,HttpContext.Request.Files)); ViewData ["Message"] = LocalizedText.Item_added_to_basket; return View (collection); } catch (Exception e) { diff --git a/web/Global.asax.cs b/web/Global.asax.cs index 8fd9f0f1..eed3c48b 100644 --- a/web/Global.asax.cs +++ b/web/Global.asax.cs @@ -9,9 +9,11 @@ using System.Web.Routing; using Yavsc.Formatters; using Yavsc.Model.FrontOffice; using System.Web.Http; +using System.Web.SessionState; namespace Yavsc { + /// /// Mvc application. /// @@ -28,6 +30,9 @@ namespace Yavsc routes.IgnoreRoute ("Scripts/{*pathInfo}"); routes.IgnoreRoute ("Theme/{*pathInfo}"); routes.IgnoreRoute ("images/{*pathInfo}"); + routes.IgnoreRoute ("users/{*pathInfo}"); + routes.IgnoreRoute ("files/{*pathInfo}"); + routes.IgnoreRoute ("avatars/{*pathInfo}"); routes.IgnoreRoute ("xmldoc/{*pathInfo}"); // xml doc routes.IgnoreRoute ("htmldoc/{*pathInfo}"); // html doc routes.IgnoreRoute ("favicon.ico"); @@ -56,13 +61,25 @@ namespace Yavsc protected void Application_Start () { AreaRegistration.RegisterAllAreas (); - GlobalConfiguration.Configuration.Routes.MapHttpRoute( - name: "DefaultApi", - routeTemplate: "api/{controller}/{action}/{*id}", - defaults: new { controller = "WorkFlow", action="Index", id=0 } - ); - + WebApiConfig.Register (GlobalConfiguration.Configuration); RegisterRoutes (RouteTable.Routes); } + + /// + /// Applications the post authorize request. + /// + protected void Application_PostAuthorizeRequest() + { + if (IsWebApiRequest()) + { + HttpContext.Current.SetSessionStateBehavior(SessionStateBehavior.Required); + } + } + + private bool IsWebApiRequest() + { + return HttpContext.Current.Request.AppRelativeCurrentExecutionFilePath.StartsWith(WebApiConfig.UrlPrefixRelative); + } + } } diff --git a/web/Models/App.master b/web/Models/App.master index 7c5db7f0..71e73312 100644 --- a/web/Models/App.master +++ b/web/Models/App.master @@ -73,6 +73,9 @@ <%= link %> <% } %> + diff --git a/web/Theme/style.css b/web/Theme/style.css index c2cf0d63..4dfc0af9 100644 --- a/web/Theme/style.css +++ b/web/Theme/style.css @@ -57,7 +57,7 @@ footer img { max-height: 2em; } a { text-decoration: none; color: #B0B080; - background-color:rgba(0,30,0,0.5); + background-color:rgba(20,0,20,0.5); } a:hover { diff --git a/web/Views/FileSystem/Index.aspx b/web/Views/FileSystem/Index.aspx index 5c77d6fe..249186ea 100644 --- a/web/Views/FileSystem/Index.aspx +++ b/web/Views/FileSystem/Index.aspx @@ -1,6 +1,6 @@ <%@ Page Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage" %> -

Index of <%=ViewData["UserName"] %>'s files (<%= Html.Encode(Model.Count) %>)

+

Index of <%= Model.Owner %>'s files (<%= Html.Encode(Model.Count) %>)

    <% foreach (System.IO.FileInfo fi in Model) { %>
  • <%= Html.ActionLink(fi.Name,"Details",new {id = fi.Name}) %>
  • diff --git a/web/Web.csproj b/web/Web.csproj index 790a1408..be23aa0e 100644 --- a/web/Web.csproj +++ b/web/Web.csproj @@ -191,6 +191,7 @@ + diff --git a/web/WebApiConfig.cs b/web/WebApiConfig.cs new file mode 100644 index 00000000..0cef4818 --- /dev/null +++ b/web/WebApiConfig.cs @@ -0,0 +1,66 @@ +// +// WebApiConfig.cs +// +// Author: +// Paul Schneider +// +// Copyright (c) 2015 Paul Schneider +// +// 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 . + + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Mvc; +using System.Web.Routing; +using Yavsc.Formatters; +using Yavsc.Model.FrontOffice; +using System.Web.Http; + +namespace Yavsc +{ + /// + /// Web API config. + /// + public static class WebApiConfig + { + /// + /// Gets the URL prefix. + /// + /// The URL prefix. + public static string UrlPrefix { get { return "api"; } } + + /// + /// Gets the URL prefix relative. + /// + /// The URL prefix relative. + public static string UrlPrefixRelative { get { return "~/api"; } } + + /// + /// Register the specified config. + /// + /// Config. + public static void Register(HttpConfiguration config) + { + config.Routes.MapHttpRoute( + name: "DefaultApi", + routeTemplate: WebApiConfig.UrlPrefix + "/{controller}/{id}", + defaults: new { id = RouteParameter.Optional } + ); + } + } + +} diff --git a/yavscModel/Admin/DataAccess.cs b/yavscModel/Admin/DataAccess.cs index 5e00e961..7239c875 100644 --- a/yavscModel/Admin/DataAccess.cs +++ b/yavscModel/Admin/DataAccess.cs @@ -6,9 +6,16 @@ using System.ComponentModel.DataAnnotations; namespace Yavsc.Model.Admin { + /// + /// Data access. + /// public class DataAccess { private string host = "localhost"; + /// + /// Gets or sets the host. + /// + /// The host. [StringLength(2056)] public string Host { get { @@ -21,6 +28,10 @@ namespace Yavsc.Model.Admin private int port = 5432; + /// + /// Gets or sets the port. + /// + /// The port. public int Port { get { return port; @@ -32,6 +43,10 @@ namespace Yavsc.Model.Admin private string dbname = "yavsc"; + /// + /// Gets or sets the dbname. + /// + /// The dbname. public string Dbname { get { return dbname; @@ -43,6 +58,10 @@ namespace Yavsc.Model.Admin private string dbuser = "postgres"; + /// + /// Gets or sets the dbuser. + /// + /// The dbuser. public string Dbuser { get { return dbuser; @@ -54,7 +73,11 @@ namespace Yavsc.Model.Admin private string dbpassword ; private string backupPrefix= "~/backup/global.backup"; - + + /// + /// Gets or sets the backup prefix. + /// + /// The backup prefix. public string BackupPrefix { get { return backupPrefix; @@ -64,12 +87,19 @@ namespace Yavsc.Model.Admin } } + /// + /// Gets or sets the password. + /// + /// The password. [Required(ErrorMessage ="Please, specify a password")] public string Password { get { return dbpassword; } set { dbpassword = value; } } - + /// + /// Connections the string. + /// + /// The string. public string ConnectionString() { return string.Format ("Server={0};Port={1};Database={2};User Id={3};Password={4};Encoding=Unicode;", Host,Port,Dbuser,Password); diff --git a/yavscModel/Admin/RestoreQuery.cs b/yavscModel/Admin/RestoreQuery.cs index 5f000bf2..cdae1673 100644 --- a/yavscModel/Admin/RestoreQuery.cs +++ b/yavscModel/Admin/RestoreQuery.cs @@ -3,12 +3,22 @@ using System.ComponentModel.DataAnnotations; namespace Yavsc.Model.Admin { + /// + /// Restore query. + /// public class RestoreQuery: DataAccess { + /// + /// Gets or sets the name of the file. + /// + /// The name of the file. [Required] [StringLength(2056)] public string FileName { get; set ; } + /// + /// Initializes a new instance of the class. + /// public RestoreQuery () { } diff --git a/yavscModel/Blogs/Blog.cs b/yavscModel/Blogs/Blog.cs index 4701672e..0a542178 100644 --- a/yavscModel/Blogs/Blog.cs +++ b/yavscModel/Blogs/Blog.cs @@ -5,10 +5,17 @@ using System.ComponentModel; namespace Yavsc.Model.Blogs { + /// + /// Blog. + /// public class Blog { string title; - + + /// + /// Gets or sets the title. + /// + /// The title. [StringLength(512)] [Required] [DisplayName("Titre")] diff --git a/yavscModel/Blogs/BlogEditCommentModel.cs b/yavscModel/Blogs/BlogEditCommentModel.cs index 7c80e736..b956464b 100644 --- a/yavscModel/Blogs/BlogEditCommentModel.cs +++ b/yavscModel/Blogs/BlogEditCommentModel.cs @@ -4,22 +4,19 @@ using System.ComponentModel.DataAnnotations; namespace Yavsc.Model.Blogs { + /// + /// Blog edit comment model. + /// public class BlogEditCommentModel:Comment { + /// + /// Gets or sets a value indicating whether this is preview. + /// + /// true if preview; otherwise, false. [DisplayName("Prévisualiser")] [Required] public bool Preview { get; set; } - /* TODO Clean - public BlogEditCommentModel(Comment be) { - this.Preview = true; - this.Content = be.Content; - this.Posted = be.Posted; - this.Modified = be.Modified; - this.Visible = be.Visible; - this.From = be.From; - this.PostId = be.PostId; - this.Id = be.Id; - } */ + } } diff --git a/yavscModel/Blogs/BlogEditEntryModel.cs b/yavscModel/Blogs/BlogEditEntryModel.cs index 0b98c65e..6969aea1 100644 --- a/yavscModel/Blogs/BlogEditEntryModel.cs +++ b/yavscModel/Blogs/BlogEditEntryModel.cs @@ -4,15 +4,30 @@ using System.ComponentModel.DataAnnotations; namespace Yavsc.Model.Blogs { + /// + /// Blog edit entry model. + /// public class BlogEditEntryModel:BlogEntry { + /// + /// Gets or sets a value indicating whether this is preview. + /// + /// true if preview; otherwise, false. [DisplayName("Prévisualiser")] [Required] public bool Preview { get; set; } + + /// + /// Initializes a new instance of the class. + /// public BlogEditEntryModel () { } + /// + /// Initializes a new instance of the class. + /// + /// Be. public BlogEditEntryModel(BlogEntry be) { this.Preview = true; this.Content = be.Content; diff --git a/yavscModel/Blogs/BlogEntry.cs b/yavscModel/Blogs/BlogEntry.cs index 697e6393..b244b295 100644 --- a/yavscModel/Blogs/BlogEntry.cs +++ b/yavscModel/Blogs/BlogEntry.cs @@ -5,8 +5,17 @@ using System.ComponentModel.DataAnnotations; namespace Yavsc.Model.Blogs { + /// + /// Blog entry. + /// public class BlogEntry { long id; + + + /// + /// Gets or sets the identifier. + /// + /// The identifier. [DisplayName("Identifiant numérique de billet")] public long Id { get { @@ -19,6 +28,10 @@ namespace Yavsc.Model.Blogs string title; + /// + /// Gets or sets the title. + /// + /// The title. [DisplayName("Titre du billet")] [StringLength(512)] [RegularExpression("^[^:%&?]*$",ErrorMessage = "Les caratères suivants sont invalides pour un titre: :%&?")] @@ -34,6 +47,10 @@ namespace Yavsc.Model.Blogs string content; + /// + /// Gets or sets the content. + /// + /// The content. [DisplayName("Corps du billet")] [Required(ErrorMessage = "S'il vous plait, saisissez un texte.")] public string Content { @@ -47,6 +64,10 @@ namespace Yavsc.Model.Blogs string userName; + /// + /// Gets or sets the name of the user. + /// + /// The name of the user. [StringLength(255)] [DisplayName("Nom de l'auteur")] public string UserName { @@ -57,9 +78,15 @@ namespace Yavsc.Model.Blogs userName = value; } } - + /// + /// The posted. + /// public DateTime posted; + /// + /// Gets or sets the posted. + /// + /// The posted. [DisplayName("Date de creation")] public DateTime Posted { get { @@ -69,9 +96,15 @@ namespace Yavsc.Model.Blogs posted = value; } } - + /// + /// The modified. + /// public DateTime modified; + /// + /// Gets or sets the modified. + /// + /// The modified. [DisplayName("Date de modification")] public DateTime Modified { get { @@ -81,7 +114,17 @@ namespace Yavsc.Model.Blogs modified = value; } } + + /// + /// Gets or sets a value indicating whether this is visible. + /// + /// true if visible; otherwise, false. public bool Visible { get; set ; } + + /// + /// Gets or sets the tags. + /// + /// The tags. public string [] Tags { get; set ; } } diff --git a/yavscModel/Blogs/BlogEntryCollection.cs b/yavscModel/Blogs/BlogEntryCollection.cs index 23de2571..54eb7b42 100644 --- a/yavscModel/Blogs/BlogEntryCollection.cs +++ b/yavscModel/Blogs/BlogEntryCollection.cs @@ -5,6 +5,9 @@ using Yavsc.Model.Blogs; namespace Yavsc.Model.Blogs { + /// + /// Blog entry collection. + /// public class BlogEntryCollection : List { } diff --git a/yavscModel/Blogs/BlogHelper.cs b/yavscModel/Blogs/BlogHelper.cs index ae65cd59..82ee715e 100644 --- a/yavscModel/Blogs/BlogHelper.cs +++ b/yavscModel/Blogs/BlogHelper.cs @@ -6,8 +6,15 @@ using Yavsc.Model.Blogs.Configuration; namespace Yavsc.Model.Blogs { + /// + /// Blog helper. + /// public static class BlogHelper { + /// + /// Gets the provider. + /// + /// The provider. public static BlogProvider GetProvider () { BlogProvidersConfigurationSection config = ConfigurationManager.GetSection ("system.web/blog") as BlogProvidersConfigurationSection; diff --git a/yavscModel/Blogs/BlogManager.cs b/yavscModel/Blogs/BlogManager.cs index 052d76ea..d58ca8b4 100644 --- a/yavscModel/Blogs/BlogManager.cs +++ b/yavscModel/Blogs/BlogManager.cs @@ -7,13 +7,27 @@ using System.Web.Security; namespace Yavsc.Model.Blogs { + /// + /// Blog manager. + /// public static class BlogManager { + /// + /// Removes the comment. + /// + /// The comment. + /// Cmtid. public static long RemoveComment(long cmtid) { return Provider.RemoveComment (cmtid); } - + /// + /// Comment the specified from, postid, content and visible. + /// + /// From. + /// Postid. + /// Content. + /// If set to true visible. public static void Comment (string from, long postid, string content, bool visible) { provider.Comment (from, postid, content); @@ -21,6 +35,10 @@ namespace Yavsc.Model.Blogs static BlogProvider provider; + /// + /// Gets the provider. + /// + /// The provider. public static BlogProvider Provider { get { if (provider == null) @@ -28,26 +46,70 @@ namespace Yavsc.Model.Blogs return provider; } } + + /// + /// Gets the post. + /// + /// The post. + /// Username. + /// Title. public static BlogEntry GetPost (string username, string title) { return Provider.GetPost (username, title ); } + + /// + /// Gets the post. + /// + /// The post. + /// Postid. public static BlogEntry GetPost(long postid) { return Provider.GetPost (postid); } + + /// + /// Post the specified username, title, content and visible. + /// + /// Username. + /// Title. + /// Content. + /// If set to true visible. public static void Post(string username, string title, string content, bool visible) { Provider.Post(username, title, content, visible ); } + + /// + /// Updates the post. + /// + /// Postid. + /// Title. + /// Content. + /// If set to true visible. public static void UpdatePost(long postid, string title, string content, bool visible) { Provider.UpdatePost(postid, title, content, visible); } + + /// + /// Finds the post. + /// + /// The post. + /// Pattern. + /// Searchflags. + /// Page index. + /// Page size. + /// Total records. public static BlogEntryCollection FindPost (string pattern, FindBlogEntryFlags searchflags, int pageIndex, int pageSize, out int totalRecords) { return Provider.FindPost (pattern, searchflags, pageIndex, pageSize, out totalRecords); } + /// + /// Removes the post. + /// + /// Username. + /// Title. public static void RemovePost (string username, string title) { if (!Roles.IsUserInRole ("Admin")) { @@ -61,10 +123,25 @@ namespace Yavsc.Model.Blogs } Provider.RemovePost (username, title); } + + /// + /// Lasts the posts. + /// + /// The posts. + /// Page index. + /// Page size. + /// Total records. public static BlogEntryCollection LastPosts (int pageIndex, int pageSize, out int totalRecords) { return Provider.LastPosts (pageIndex, pageSize, out totalRecords); } + + /// + /// Gets the comments. + /// + /// The comments. + /// Postid. + /// If set to true get hidden. public static Comment[] GetComments(long postid, bool getHidden=true) { return Provider.GetComments (postid,getHidden); @@ -73,6 +150,7 @@ namespace Yavsc.Model.Blogs /// Tag the specified post by postid. ///
/// Postid. + /// Tag. /// The tag identifier public static long Tag(long postid, string tag) { return Provider.Tag (postid, tag); diff --git a/yavscModel/Blogs/BlogProvider.cs b/yavscModel/Blogs/BlogProvider.cs index d0ebac7c..6b485b6e 100644 --- a/yavscModel/Blogs/BlogProvider.cs +++ b/yavscModel/Blogs/BlogProvider.cs @@ -5,27 +5,147 @@ using System.Collections.Generic; namespace Yavsc.Model.Blogs { + /// + /// Blog provider. + /// public abstract class BlogProvider: ProviderBase { + /// + /// Gets the post. + /// + /// The post. + /// Postid. public abstract BlogEntry GetPost (long postid); + + /// + /// Gets the post. + /// + /// The post. + /// Username. + /// Title. public abstract BlogEntry GetPost (string username, string title); + + /// + /// Gets the post identifier. + /// + /// The post identifier. + /// Username. + /// Title. public abstract long GetPostId (string username, string title); + /// + /// Post the specified username, title, content and visible. + /// + /// Username. + /// Title. + /// Content. + /// If set to true visible. public abstract long Post (string username, string title, string content, bool visible); + + /// + /// Updates the post. + /// + /// Postid. + /// Title. + /// Content. + /// If set to true visible. public abstract void UpdatePost (long postid, string title, string content, bool visible); + + /// + /// Finds the post. + /// + /// The post. + /// Pattern. + /// Searchflags. + /// Page index. + /// Page size. + /// Total records. public abstract BlogEntryCollection FindPost (string pattern, FindBlogEntryFlags searchflags, int pageIndex, int pageSize, out int totalRecords); + + /// + /// Removes the post. + /// + /// Username. + /// Title. public abstract void RemovePost (string username, string title); + + /// + /// Removes the post. + /// + /// Postid. public abstract void RemovePost (long postid); + + /// + /// Removes the comment. + /// + /// The comment. + /// Cmtid. public abstract long RemoveComment (long cmtid); + + /// + /// Lasts the posts. + /// + /// The posts. + /// Page index. + /// Page size. + /// Total records. public abstract BlogEntryCollection LastPosts(int pageIndex, int pageSize, out int totalRecords); + + /// + /// Blogs the title. + /// + /// The title. + /// Username. public abstract string BlogTitle (string username); + + /// + /// Comment the specified from, postid and content. + /// + /// From. + /// Postid. + /// Content. public abstract long Comment (string from, long postid, string content); + + /// + /// Gets the comments. + /// + /// The comments. + /// Postid. + /// If set to true get hidden. public abstract Comment[] GetComments (long postid, bool getHidden) ; + + /// + /// Gets or sets a value indicating whether this auto validate comment. + /// + /// true if auto validate comment; otherwise, false. public abstract bool AutoValidateComment { get; set; } + + /// + /// Validates the comment. + /// + /// Cmtid. public abstract void ValidateComment (long cmtid); + + /// + /// Updates the comment. + /// + /// Cmtid. + /// Content. + /// If set to true visible. public abstract void UpdateComment (long cmtid, string content, bool visible); + + /// + /// Tag the specified postid and tag. + /// + /// Postid. + /// Tag. public abstract long Tag (long postid,string tag); + + /// + /// Removes the tag. + /// + /// Tagid. public abstract void RemoveTag (long tagid); } diff --git a/yavscModel/Blogs/Comment.cs b/yavscModel/Blogs/Comment.cs index 7468e77c..97ae6a5f 100644 --- a/yavscModel/Blogs/Comment.cs +++ b/yavscModel/Blogs/Comment.cs @@ -5,9 +5,17 @@ using System.ComponentModel.DataAnnotations; namespace Yavsc.Model.Blogs { + /// + /// Comment. + /// public class Comment { long id; + + /// + /// Gets or sets the identifier. + /// + /// The identifier. [DisplayName("Identifiant numérique de commentaire")] public long Id { get { @@ -18,6 +26,11 @@ namespace Yavsc.Model.Blogs } } long postid; + + /// + /// Gets or sets the post identifier. + /// + /// The post identifier. [DisplayName("Identifiant numérique du billet commenté")] public long PostId { get { @@ -27,13 +40,19 @@ namespace Yavsc.Model.Blogs postid = value; } } + /// /// Gets or sets the author of this comment. /// /// From. public string From { get; set; } - + string content; + + /// + /// Gets or sets the comment text. + /// + /// The comment text. [DisplayName("Contenu")] [Required(ErrorMessage = "S'il vous plait, saisissez un contenu")] public string CommentText { @@ -45,8 +64,12 @@ namespace Yavsc.Model.Blogs } } - public DateTime posted; + private DateTime posted; + /// + /// Gets or sets the posted. + /// + /// The posted. [DisplayName("Date de creation")] public DateTime Posted { get { @@ -57,8 +80,12 @@ namespace Yavsc.Model.Blogs } } - public DateTime modified; - + private DateTime modified; + + /// + /// Gets or sets the modified. + /// + /// The modified. [DisplayName("Date de modification")] public DateTime Modified { get { @@ -69,6 +96,10 @@ namespace Yavsc.Model.Blogs } } + /// + /// Gets or sets a value indicating whether this is visible. + /// + /// true if visible; otherwise, false. public bool Visible { get; set ; } } diff --git a/yavscModel/Blogs/Configuration/BlogProviderConfigurationElement.cs b/yavscModel/Blogs/Configuration/BlogProviderConfigurationElement.cs index aff5d147..1cd572e7 100644 --- a/yavscModel/Blogs/Configuration/BlogProviderConfigurationElement.cs +++ b/yavscModel/Blogs/Configuration/BlogProviderConfigurationElement.cs @@ -4,33 +4,55 @@ using System.ComponentModel; namespace Yavsc.Model.Blogs.Configuration { - + /// + /// Blog provider configuration element. + /// public class BlogProviderConfigurationElement : ConfigurationElement { + /// + /// Gets or sets the name. + /// + /// The name. [ConfigurationProperty("name", IsRequired = true, IsKey=true)] public string Name { get { return (string)this ["name"]; } set { this ["name"] = value; } } + /// + /// Gets or sets the type. + /// + /// The type. [ConfigurationProperty("type", IsRequired = true, IsKey=false)] public string Type { get { return (string)this ["type"]; } set { this ["type"] = value; } } + /// + /// Gets or sets the name of the connection string. + /// + /// The name of the connection string. [ConfigurationProperty("connectionStringName")] public string ConnectionStringName { get { return (string)this ["connectionStringName"]; } set { this ["connectionStringName"] = value; } } + /// + /// Gets or sets the description. + /// + /// The description. [ConfigurationProperty("description")] public string Description { get { return (string)this ["description"]; } set { this ["description"] = value; } } + /// + /// Gets or sets the name of the application. + /// + /// The name of the application. [ConfigurationProperty("applicationName")] public string ApplicationName { get { return (string)this ["applicationName"]; } diff --git a/yavscModel/Blogs/Configuration/BlogProvidersConfigurationCollection.cs b/yavscModel/Blogs/Configuration/BlogProvidersConfigurationCollection.cs index ba89d675..16e76d8e 100644 --- a/yavscModel/Blogs/Configuration/BlogProvidersConfigurationCollection.cs +++ b/yavscModel/Blogs/Configuration/BlogProvidersConfigurationCollection.cs @@ -4,18 +4,35 @@ using System.ComponentModel; namespace Yavsc.Model.Blogs.Configuration { + /// + /// Blog providers configuration collection. + /// public class BlogProvidersConfigurationCollection : ConfigurationElementCollection { + /// + /// Creates the new element. + /// + /// The new element. protected override ConfigurationElement CreateNewElement () { return new BlogProviderConfigurationElement(); } + /// + /// Gets the element key. + /// + /// The element key. + /// Element. protected override object GetElementKey (ConfigurationElement element) { return ((BlogProviderConfigurationElement) element).Name; } + /// + /// Gets the element. + /// + /// The element. + /// Name. public BlogProviderConfigurationElement GetElement (string name) { return this.BaseGet(name) as BlogProviderConfigurationElement; diff --git a/yavscModel/Blogs/Configuration/BlogProvidersConfigurationSection.cs b/yavscModel/Blogs/Configuration/BlogProvidersConfigurationSection.cs index cc4a0c7a..631afb0b 100644 --- a/yavscModel/Blogs/Configuration/BlogProvidersConfigurationSection.cs +++ b/yavscModel/Blogs/Configuration/BlogProvidersConfigurationSection.cs @@ -4,6 +4,9 @@ using System.ComponentModel; namespace Yavsc.Model.Blogs.Configuration { + /// + /// Blog providers configuration section. + /// public class BlogProvidersConfigurationSection : ConfigurationSection { /// @@ -16,16 +19,15 @@ namespace Yavsc.Model.Blogs.Configuration set { this["defaultProvider"] = value; } } + /// + /// Gets or sets the providers. + /// + /// The providers. [ConfigurationProperty("providers")] [ConfigurationCollection(typeof(BlogProvidersConfigurationCollection), AddItemName = "add", ClearItemsName = "clear", RemoveItemName = "remove")] - - /// - /// Gets or sets the providers. - /// - /// The providers. public BlogProvidersConfigurationCollection Providers{ get { return (BlogProvidersConfigurationCollection) this["providers"]; } set { this["providers"] = value; } diff --git a/yavscModel/Blogs/FindBlogEntryFlags.cs b/yavscModel/Blogs/FindBlogEntryFlags.cs index fe146c47..9c0f2ee7 100644 --- a/yavscModel/Blogs/FindBlogEntryFlags.cs +++ b/yavscModel/Blogs/FindBlogEntryFlags.cs @@ -4,11 +4,25 @@ using System.Collections.Generic; namespace Yavsc.Model.Blogs { - + /// + /// Find blog entry flags. + /// public enum FindBlogEntryFlags : byte { + /// + /// The match title. + /// MatchTitle = 1, + /// + /// The content of the match. + /// MatchContent = 2, + /// + /// The name of the match user. + /// MatchUserName = 4, + /// + /// The match invisible. + /// MatchInvisible = 8 } diff --git a/yavscModel/FileSystem/DirNotFoundException.cs b/yavscModel/FileSystem/DirNotFoundException.cs new file mode 100644 index 00000000..f3979286 --- /dev/null +++ b/yavscModel/FileSystem/DirNotFoundException.cs @@ -0,0 +1,46 @@ +// +// DirNotFoundException.cs +// +// Author: +// Paul Schneider +// +// Copyright (c) 2015 Paul Schneider +// +// 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 . + +using System; +using System.IO; +using System.Web; +using System.Text.RegularExpressions; +using System.Text; +using System.Web.Security; + +namespace Yavsc.Model.FileSystem +{ + + /// + /// Dir not found exception. + /// + public class DirNotFoundException : Exception { + /// + /// Initializes a new instance of the class. + /// + /// Dir. + public DirNotFoundException(string dir) + : base(string.Format( "Directory not found : {0}", dir)) + { + } + } + +} diff --git a/yavscModel/FileSystem/FileInfoCollection.cs b/yavscModel/FileSystem/FileInfoCollection.cs index 6c1b1c91..f29be3ab 100644 --- a/yavscModel/FileSystem/FileInfoCollection.cs +++ b/yavscModel/FileSystem/FileInfoCollection.cs @@ -4,9 +4,24 @@ using System.Collections.Generic; namespace Yavsc.Model.FileSystem { + /// + /// File info collection. + /// public class FileInfoCollection: List { - + /// + /// Gets or sets the owner. + /// + /// The owner. + public string Owner { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// Files. + public FileInfoCollection (FileInfo [] files) + { + AddRange (files); + } } } diff --git a/yavscModel/FileSystem/FileSystemManager.cs b/yavscModel/FileSystem/FileSystemManager.cs new file mode 100644 index 00000000..0ef32043 --- /dev/null +++ b/yavscModel/FileSystem/FileSystemManager.cs @@ -0,0 +1,157 @@ +// +// FileSystemManager.cs +// +// Author: +// Paul Schneider +// +// Copyright (c) 2015 Paul Schneider +// +// 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 . +using System; +using System.IO; +using System.Web; +using System.Text.RegularExpressions; +using System.Text; +using System.Web.Security; +using System.Linq; +using System.Collections.Generic; +using System.Collections.Specialized; + +namespace Yavsc.Model.FileSystem +{ + + /// + /// File system manager. + /// It performs the FileSystem controllers logic. + /// It will not be a true file system, + /// It just provides simple method for a small set of + /// files, in a small tree of sub-folders . + /// + public class FileSystemManager + { + /// + /// Gets or sets the size of the max file. + /// + /// The size of the max file. + public long MaxFileSize { get; set; } + + /// + /// Gets or sets the max user storage. + /// + /// The max user storage. + public long MaxUserStorage { get; set; } + + + /// + /// Initializes a new instance of the class. + /// + public FileSystemManager (string usersDirectory="~/files", char dirSep = '/') + { + prefix = usersDirectory; + DirectorySeparator = dirSep; + + } + + string regexFileName = "^[A-Za-z0-9#^!+ _~\\-.]+$"; + + /// + /// Put the specified files in destDir, as sub dir of the current user's home dir. + /// + /// Destination dir, use "." to point to the user's home dir. + /// Files. + public void Put (string destDir, NameObjectCollectionBase files) + { + // sanity check on file names + foreach (object obj in files) { + HttpPostedFileBase file = obj as HttpPostedFileBase; + if (!Regex.Match (file.FileName, regexFileName).Success) { + throw new InvalidOperationException (string.Format ( + "The file name {0} dosn't match an acceptable file name ({1})", + file.FileName, regexFileName)); + } + } + // do the job + + checkSubDir (destDir); + DirectoryInfo di = new DirectoryInfo ( + Path.Combine (Prefix, destDir)); + if (!di.Exists) + di.Create (); + + foreach (object obj in files) { + HttpPostedFileBase file = obj as HttpPostedFileBase; + // TODO Limit with hfc[h].ContentLength + string filename = Path.Combine (di.FullName, file.FileName); + file.SaveAs (filename); + } + } + + private string prefix = null; + + /// + /// Gets the users dir. + /// + /// The users dir. + public string Prefix { + get { + return prefix; + } + set { + prefix = value; + if (value.StartsWith ("~/")) { + prefix = HttpContext.Current.Server.MapPath(value); + } + } + } + + /// + /// Gets or sets the directory name separator. + /// + /// The separator. + public char DirectorySeparator { get; set; } + + /// + /// Checks the sub dir name. + /// + /// Subdir. + private void checkSubDir (string subdir) + { + foreach (string dirname in subdir.Split(DirectorySeparator)) + if (!Regex.Match (dirname, regexFileName).Success) + throw new InvalidDirNameException (dirname); + foreach (char x in Path.GetInvalidPathChars()) + if (subdir.Contains (x)) + throw new InvalidDirNameException (subdir); + } + /// + /// Gets the files. + /// The web user must be authenticated, + /// The given username must be registered. + /// + /// The files. + /// Subdir. + public FileInfoCollection GetFiles (string subdir) + { + string path = Prefix; + if (subdir != null) { + checkSubDir (subdir); + path = Path.Combine (Prefix, subdir); + } + DirectoryInfo di = new DirectoryInfo (path); + FileInfoCollection res = new FileInfoCollection (di.GetFiles ()); + return res; + } + } +} + diff --git a/yavscModel/FileSystem/InvalidDirNameException.cs b/yavscModel/FileSystem/InvalidDirNameException.cs new file mode 100644 index 00000000..208fd56a --- /dev/null +++ b/yavscModel/FileSystem/InvalidDirNameException.cs @@ -0,0 +1,60 @@ +// +// InvalidDirNameException.cs +// +// Author: +// Paul Schneider +// +// Copyright (c) 2015 Paul Schneider +// +// 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 . + +using System; +using System.IO; +using System.Web; +using System.Text.RegularExpressions; +using System.Text; +using System.Web.Security; + +namespace Yavsc.Model.FileSystem +{ + + /// + /// Invalid dir name exception. + /// + public class InvalidDirNameException : Exception { + + /// + /// Initializes a new instance of the class. + /// + /// Dir. + public InvalidDirNameException(string dir) + : base(string.Format( "Invalid directory name : {0}", dir)) + { + } + } + /// + /// Invalid file name exception. + /// + public class InvalidFileNameException : Exception { + + /// + /// Initializes a new instance of the class. + /// + /// Dir. + public InvalidFileNameException(string fileName) + : base(string.Format( "Invalid file name : {0}", fileName)) + { + } + } +} diff --git a/yavscModel/FileSystem/WebFileInfo.cs b/yavscModel/FileSystem/WebFileInfo.cs new file mode 100644 index 00000000..ff4f0ddd --- /dev/null +++ b/yavscModel/FileSystem/WebFileInfo.cs @@ -0,0 +1,105 @@ +// +// ShortFileName.cs +// +// Author: +// Paul Schneider +// +// Copyright (c) 2015 Paul Schneider +// +// 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 . +using System; +using System.ComponentModel.DataAnnotations; + +using System.Web.Mvc; +using System.IO; +using System.Web; + +namespace Yavsc.Model.FileSystem +{ + /// + /// Files in the name. + /// + public class WebFileInfo + { + /// + /// Initializes a new instance of the class. + /// + /// Context. + /// Identifier. + public WebFileInfo(HttpContextBase context, string id) { + DirectoryInfo di=new DirectoryInfo( + HttpContext.Current.Server.MapPath(id)); + + if (!di.Exists) + throw new Exception (string.Format( + "Inexistent:{0}", id)); + path = id; + permaLink = UrlHelper.GenerateContentUrl(id,context); + } + private string path = null; + string permaLink = null; + /// + /// Gets the perma link. + /// + /// The perma link. + public string PermaLink { + get { + return permaLink; + } + } + + /// + /// Gets the Path. + /// + /// The web dir. + public string Path { + get { + return path; + } + } + + /* + /// + /// Creates the name of the file. + /// + /// The file name. + /// Intent value. + /// Destdir. + public static FileInfo BuildUniqueFileName(string intentValue, string destdir) { + + int nbTries = 0; + FileInfo res = new FileInfo (Path.Combine(destdir,intentValue)); + + foreach(var property in res.GetType().GetProperties()) + { + if(property.Name == "Name") + { + object [] atts = property.GetCustomAttributes(typeof(RegularExpressionAttribute), true); + // we only keep the last one + // ASSERT(atts.Length>0) + if (!((RegularExpressionAttribute)(atts [atts.Length - 1])).IsValid (res)) + throw new InvalidFileNameException (intentValue); + } + } + + while (new FileInfo (Path.Combine (di.FullName, res.ShortName)).Exists) + { + res.ShortName = intentValue + "-" + nbTries++; + } + return res; + }*/ + + } +} + diff --git a/yavscModel/FrontOffice/Basket.cs b/yavscModel/FrontOffice/Basket.cs index 1d8be19b..5af677da 100644 --- a/yavscModel/FrontOffice/Basket.cs +++ b/yavscModel/FrontOffice/Basket.cs @@ -27,7 +27,7 @@ namespace Yavsc.Model.FrontOffice /// /// Basket. /// - public class Basket: List + public class Basket: Dictionary { /// /// Initializes a new instance of the class. @@ -35,7 +35,18 @@ namespace Yavsc.Model.FrontOffice public Basket () { } - + /// The item to add to the current collection. + /// Adds an item to the current collection. + /// To be added. + /// The current collection is read-only. + /// + /// Add the specified cmd. + /// + /// Cmd. + public void Add(Commande cmd) + { + Add (cmd.Id, cmd); + } } } diff --git a/yavscModel/FrontOffice/Catalog/Catalog.cs b/yavscModel/FrontOffice/Catalog/Catalog.cs index e5508754..59a3cfab 100644 --- a/yavscModel/FrontOffice/Catalog/Catalog.cs +++ b/yavscModel/FrontOffice/Catalog/Catalog.cs @@ -19,12 +19,23 @@ namespace Yavsc.Model.FrontOffice /// /// The brands. public Brand[] Brands { get; set; } - + /// + /// Gets the brand. + /// + /// The brand. + /// Brand name. public Brand GetBrand(string brandName) { return Array.Find(Brands, b => b.Name == brandName); } + /// + /// Adds the brand. + /// + /// The brand. + /// Brand name. + /// Slogan. + /// Logo. public Brand AddBrand(string brandName,string slogan=null, ProductImage logo=null) { Brand[] oldbrs = (Brand[]) Brands.Clone (); @@ -39,6 +50,11 @@ namespace Yavsc.Model.FrontOffice return b; } + /// + /// Removes the brand. + /// + /// true, if brand was removed, false otherwise. + /// Brand name. public bool RemoveBrand(string brandName) { Brand b = this.GetBrand (brandName); @@ -51,10 +67,23 @@ namespace Yavsc.Model.FrontOffice return true; } + /// + /// Gets or sets the start date. + /// + /// The start date. public DateTime StartDate { get; set; } + /// + /// Gets or sets the end date. + /// + /// The end date. public DateTime EndDate { get; set; } + /// + /// Finds the product. + /// + /// The product. + /// Reference. public Product FindProduct (string reference) { Product p = null; diff --git a/yavscModel/FrontOffice/Catalog/CatalogHelper.cs b/yavscModel/FrontOffice/Catalog/CatalogHelper.cs index 33ac9949..205c7162 100644 --- a/yavscModel/FrontOffice/Catalog/CatalogHelper.cs +++ b/yavscModel/FrontOffice/Catalog/CatalogHelper.cs @@ -12,9 +12,15 @@ namespace Yavsc.Model.FrontOffice /// public static class CatalogHelper { - + /// + /// Gets or sets the config. + /// + /// The config. public static CatalogProvidersConfigurationSection Config {get; set; } + /// + /// Loads the config. + /// public static void LoadConfig () { Config = ConfigurationManager.GetSection ("system.web/catalog") as CatalogProvidersConfigurationSection; if (Config == null) diff --git a/yavscModel/FrontOffice/Catalog/CatalogManager.cs b/yavscModel/FrontOffice/Catalog/CatalogManager.cs index 2d1628fa..3023e127 100644 --- a/yavscModel/FrontOffice/Catalog/CatalogManager.cs +++ b/yavscModel/FrontOffice/Catalog/CatalogManager.cs @@ -8,6 +8,12 @@ namespace Yavsc.Model.FrontOffice public static class CatalogManager { private static CatalogProvider defaultProvider = null; + + /// + /// Gets the catalog. + /// + /// The catalog. + /// Catalog URI. public static Catalog GetCatalog (string catalogUri) { diff --git a/yavscModel/FrontOffice/Catalog/CatalogProvider.cs b/yavscModel/FrontOffice/Catalog/CatalogProvider.cs index c922008e..d479aaa2 100644 --- a/yavscModel/FrontOffice/Catalog/CatalogProvider.cs +++ b/yavscModel/FrontOffice/Catalog/CatalogProvider.cs @@ -9,6 +9,10 @@ namespace Yavsc.Model.FrontOffice ///
public abstract class CatalogProvider: ProviderBase { + /// + /// Gets the catalog. + /// + /// The catalog. public abstract Catalog GetCatalog (); } } diff --git a/yavscModel/FrontOffice/Catalog/CheckBox.cs b/yavscModel/FrontOffice/Catalog/CheckBox.cs index 41ac08ef..73261d39 100644 --- a/yavscModel/FrontOffice/Catalog/CheckBox.cs +++ b/yavscModel/FrontOffice/Catalog/CheckBox.cs @@ -2,23 +2,40 @@ using System; namespace Yavsc.Model.FrontOffice { + /// + /// Check box. + /// public class CheckBox : FormInput { + /// + /// Initializes a new instance of the class. + /// public CheckBox () { } #region implemented abstract members of FormInput - + /// + /// Gets the type. + /// + /// The type. public override string Type { get { return "checkbox"; } } + /// + /// Gets or sets a value indicating whether this is value. + /// + /// true if value; otherwise, false. public bool Value { get; set; } + /// + /// Tos the html. + /// + /// The html. public override string ToHtml () { return string.Format ("", Id,Name,Value?"checked":""); diff --git a/yavscModel/FrontOffice/Catalog/Configuration/CatalogProviderConfigurationElement.cs b/yavscModel/FrontOffice/Catalog/Configuration/CatalogProviderConfigurationElement.cs index 9538635f..11f35018 100644 --- a/yavscModel/FrontOffice/Catalog/Configuration/CatalogProviderConfigurationElement.cs +++ b/yavscModel/FrontOffice/Catalog/Configuration/CatalogProviderConfigurationElement.cs @@ -3,33 +3,55 @@ using System.Configuration; namespace Yavsc.Model.FrontOffice.Configuration { - + /// + /// Catalog provider configuration element. + /// public class CatalogProviderConfigurationElement : ConfigurationElement { + /// + /// Gets or sets the name. + /// + /// The name. [ConfigurationProperty("name", IsRequired = true, IsKey=true)] public string Name { get { return (string)this ["name"]; } set { this ["name"] = value; } } + /// + /// Gets or sets the type. + /// + /// The type. [ConfigurationProperty("type", IsRequired = true)] public string Type { get { return (string)this ["type"]; } set { this ["type"] = value; } } + /// + /// Gets or sets the connection. + /// + /// The connection. [ConfigurationProperty("connection")] public string Connection { get { return (string)this ["connection"]; } set { this ["connection"] = value; } } + /// + /// Gets or sets the description. + /// + /// The description. [ConfigurationProperty("description")] public string Description { get { return (string)this ["description"]; } set { this ["description"] = value; } } + /// + /// Gets or sets the name of the application. + /// + /// The name of the application. [ConfigurationProperty("applicationName")] public string ApplicationName { get { return (string)this ["applicationName"]; } diff --git a/yavscModel/FrontOffice/Catalog/Configuration/CatalogProvidersConfigurationCollection.cs b/yavscModel/FrontOffice/Catalog/Configuration/CatalogProvidersConfigurationCollection.cs index 0f1e181f..0b18ac24 100644 --- a/yavscModel/FrontOffice/Catalog/Configuration/CatalogProvidersConfigurationCollection.cs +++ b/yavscModel/FrontOffice/Catalog/Configuration/CatalogProvidersConfigurationCollection.cs @@ -4,18 +4,35 @@ using System.ComponentModel; namespace Yavsc.Model.FrontOffice.Configuration { + /// + /// Catalog providers configuration collection. + /// public class CatalogProvidersConfigurationCollection : ConfigurationElementCollection { + /// + /// Creates the new element. + /// + /// The new element. protected override ConfigurationElement CreateNewElement () { return new CatalogProviderConfigurationElement(); } + /// + /// Gets the element key. + /// + /// The element key. + /// Element. protected override object GetElementKey (ConfigurationElement element) { return ((CatalogProviderConfigurationElement) element).Name; } + /// + /// Gets the element. + /// + /// The element. + /// Name. public CatalogProviderConfigurationElement GetElement (string name) { return this.BaseGet(name) as CatalogProviderConfigurationElement; diff --git a/yavscModel/FrontOffice/Catalog/Configuration/CatalogProvidersConfigurationSection.cs b/yavscModel/FrontOffice/Catalog/Configuration/CatalogProvidersConfigurationSection.cs index b404992d..2bedeb43 100644 --- a/yavscModel/FrontOffice/Catalog/Configuration/CatalogProvidersConfigurationSection.cs +++ b/yavscModel/FrontOffice/Catalog/Configuration/CatalogProvidersConfigurationSection.cs @@ -4,14 +4,25 @@ using System.ComponentModel; namespace Yavsc.Model.FrontOffice.Configuration { + /// + /// Catalog providers configuration section. + /// public class CatalogProvidersConfigurationSection : ConfigurationSection { + /// + /// Gets or sets the default provider. + /// + /// The default provider. [ConfigurationProperty("defaultProvider")] public string DefaultProvider { get { return (string)base ["defaultProvider"]; } set { base ["defaultProvider"] = value; } } + /// + /// Gets or sets the providers. + /// + /// The providers. [ConfigurationProperty("providers")] [ConfigurationCollection(typeof(CatalogProvidersConfigurationCollection), AddItemName = "add", diff --git a/yavscModel/FrontOffice/Catalog/Currency.cs b/yavscModel/FrontOffice/Catalog/Currency.cs index b2dd1696..5b2333c5 100644 --- a/yavscModel/FrontOffice/Catalog/Currency.cs +++ b/yavscModel/FrontOffice/Catalog/Currency.cs @@ -2,6 +2,9 @@ using System; namespace Yavsc.Model.FrontOffice { + /// + /// Currency. + /// public abstract class Currency: Unit { } diff --git a/yavscModel/FrontOffice/Catalog/Euro.cs b/yavscModel/FrontOffice/Catalog/Euro.cs index 2eee2f44..ada9cbc9 100644 --- a/yavscModel/FrontOffice/Catalog/Euro.cs +++ b/yavscModel/FrontOffice/Catalog/Euro.cs @@ -2,29 +2,54 @@ using System; namespace Yavsc.Model.FrontOffice { + /// + /// Euro. + /// public class Euro : Currency { + /// + /// Initializes a new instance of the class. + /// public Euro () { } + /// + /// Gets the name. + /// + /// The name. public override string Name { get { return "Euro"; } } + /// + /// Gets the description. + /// + /// The description. public override string Description { get { return "European currency"; } } + /// + /// Maies the convert to. + /// + /// true, if convert to was mayed, false otherwise. + /// Other. public override bool MayConvertTo (Unit other) { return other.GetType().IsSubclassOf(typeof (Currency)); } + /// + /// Converts to. + /// + /// The to. + /// Destination. + /// Value. public override object ConvertTo (Unit dest, object value) { throw new NotImplementedException(); diff --git a/yavscModel/FrontOffice/Catalog/FilesInput.cs b/yavscModel/FrontOffice/Catalog/FilesInput.cs index b6a76eaf..92f032c3 100644 --- a/yavscModel/FrontOffice/Catalog/FilesInput.cs +++ b/yavscModel/FrontOffice/Catalog/FilesInput.cs @@ -2,9 +2,16 @@ using System; namespace Yavsc.Model.FrontOffice { + /// + /// Files input. + /// public class FilesInput : FormInput { #region implemented abstract members of FormInput + /// + /// Gets the type. + /// + /// The type. public override string Type { get { return "file"; @@ -12,10 +19,17 @@ namespace Yavsc.Model.FrontOffice } #endregion + /// + /// Initializes a new instance of the class. + /// public FilesInput () { } + /// + /// Tos the html. + /// + /// The html. public override string ToHtml () { return string.Format ("", Id); diff --git a/yavscModel/FrontOffice/Catalog/FormElement.cs b/yavscModel/FrontOffice/Catalog/FormElement.cs index c2367b95..a4bbc039 100644 --- a/yavscModel/FrontOffice/Catalog/FormElement.cs +++ b/yavscModel/FrontOffice/Catalog/FormElement.cs @@ -2,8 +2,15 @@ using System; namespace Yavsc.Model.FrontOffice { + /// + /// Form element. + /// public abstract class FormElement { + /// + /// Tos the html. + /// + /// The html. public abstract string ToHtml (); } } diff --git a/yavscModel/FrontOffice/Catalog/FormInput.cs b/yavscModel/FrontOffice/Catalog/FormInput.cs index f8b22d54..a3f09ce6 100644 --- a/yavscModel/FrontOffice/Catalog/FormInput.cs +++ b/yavscModel/FrontOffice/Catalog/FormInput.cs @@ -3,6 +3,9 @@ using System.ComponentModel.DataAnnotations; namespace Yavsc.Model.FrontOffice { + /// + /// Form input. + /// public abstract class FormInput: FormElement { /// @@ -15,10 +18,18 @@ namespace Yavsc.Model.FrontOffice [StringLength(256)] public string Id { get; set; } + /// + /// Gets the type. + /// + /// The type. public abstract string Type { get; } private string name=null; - + + /// + /// Gets or sets the name. + /// + /// The name. [StringLength(256)] public string Name { get { return name == null ? Id : name; } set { name = value; } } diff --git a/yavscModel/FrontOffice/Catalog/Label.cs b/yavscModel/FrontOffice/Catalog/Label.cs index 635ff4a0..5c8cc0c9 100644 --- a/yavscModel/FrontOffice/Catalog/Label.cs +++ b/yavscModel/FrontOffice/Catalog/Label.cs @@ -2,13 +2,23 @@ using System; namespace Yavsc.Model.FrontOffice { + /// + /// Label. + /// public class Label:FormElement { + /// + /// Initializes a new instance of the class. + /// public Label () { } string Text { get; set; } string For { get; set ; } + /// + /// Tos the html. + /// + /// The html. public override string ToHtml () { return string.Format ("", For, Text); diff --git a/yavscModel/FrontOffice/Catalog/Link.cs b/yavscModel/FrontOffice/Catalog/Link.cs index 41d7d32f..2dc7e242 100644 --- a/yavscModel/FrontOffice/Catalog/Link.cs +++ b/yavscModel/FrontOffice/Catalog/Link.cs @@ -3,11 +3,22 @@ using System.ComponentModel.DataAnnotations; namespace Yavsc.Model.FrontOffice { + /// + /// Link. + /// public class Link:Label { + /// + /// Initializes a new instance of the class. + /// public Link () { } + + /// + /// Gets or sets the reference. + /// + /// The reference. [Required] public string Ref { get; set; } } diff --git a/yavscModel/FrontOffice/Catalog/Note.cs b/yavscModel/FrontOffice/Catalog/Note.cs index 5c3ec6b1..e9f4c499 100644 --- a/yavscModel/FrontOffice/Catalog/Note.cs +++ b/yavscModel/FrontOffice/Catalog/Note.cs @@ -2,8 +2,15 @@ using System; namespace Yavsc.Model.FrontOffice { + /// + /// Note. + /// public class Note:Text { + /// + /// Tos the html. + /// + /// The html. public override string ToHtml () { return string.Format("{0}",Val); diff --git a/yavscModel/FrontOffice/Catalog/Option.cs b/yavscModel/FrontOffice/Catalog/Option.cs index 3c03c798..11d41d1e 100644 --- a/yavscModel/FrontOffice/Catalog/Option.cs +++ b/yavscModel/FrontOffice/Catalog/Option.cs @@ -2,14 +2,31 @@ using System; namespace Yavsc.Model.FrontOffice { + /// + /// Option. + /// public class Option : FormElement { + /// + /// Initializes a new instance of the class. + /// public Option () { } + /// + /// Gets or sets the value. + /// + /// The value. public string Value { get; set; } + /// + /// Gets or sets the text. + /// + /// The text. public string Text { get; set; } - + /// + /// Tos the html. + /// + /// The html. public override string ToHtml () { return string.Format ("\n",Value,Text); diff --git a/yavscModel/FrontOffice/Catalog/Period.cs b/yavscModel/FrontOffice/Catalog/Period.cs index 6e063d2c..3f3a3785 100644 --- a/yavscModel/FrontOffice/Catalog/Period.cs +++ b/yavscModel/FrontOffice/Catalog/Period.cs @@ -2,12 +2,26 @@ using System; namespace Yavsc.Model.FrontOffice { + /// + /// Period. + /// public class Period { + /// + /// Initializes a new instance of the class. + /// public Period () { } + /// + /// Gets or sets the start date. + /// + /// The start date. public DateTime StartDate { get; set; } + /// + /// Gets or sets the end date. + /// + /// The end date. public DateTime EndDate { get; set; } } diff --git a/yavscModel/FrontOffice/Catalog/PhysicalProduct.cs b/yavscModel/FrontOffice/Catalog/PhysicalProduct.cs index bf0bccec..4825ffbe 100644 --- a/yavscModel/FrontOffice/Catalog/PhysicalProduct.cs +++ b/yavscModel/FrontOffice/Catalog/PhysicalProduct.cs @@ -2,13 +2,27 @@ using System; namespace Yavsc.Model.FrontOffice { + /// + /// Physical product. + /// public class PhysicalProduct : Product { + /// + /// Initializes a new instance of the class. + /// public PhysicalProduct () { } + /// + /// Gets or sets the unitary price. + /// + /// The unitary price. public Price UnitaryPrice { get; set; } #region implemented abstract members of Product + /// + /// Gets the sales conditions. + /// + /// The sales conditions. public override string[] GetSalesConditions () { return new string [] { string.Format( @@ -17,7 +31,10 @@ namespace Yavsc.Model.FrontOffice UnitaryPrice.Unit.Name) }; } #endregion - + /// + /// Returns a that represents the current . + /// + /// A that represents the current . public override string ToString () { return string.Format ("[PhysicalProduct: Reference:{0} UnitaryPrice={1}]", Reference, UnitaryPrice); diff --git a/yavscModel/FrontOffice/Catalog/Price.cs b/yavscModel/FrontOffice/Catalog/Price.cs index b468b56c..4d9c7df2 100644 --- a/yavscModel/FrontOffice/Catalog/Price.cs +++ b/yavscModel/FrontOffice/Catalog/Price.cs @@ -2,8 +2,14 @@ using System; namespace Yavsc.Model.FrontOffice { + /// + /// Price. + /// public class Price: Scalar { + /// + /// Initializes a new instance of the class. + /// public Price () { } @@ -11,6 +17,10 @@ namespace Yavsc.Model.FrontOffice decimal quantity; #region implemented abstract members of SalesCatalog.Value + /// + /// Gets or sets the quantity. + /// + /// The quantity. public override object Quantity { get { return quantity; @@ -21,6 +31,10 @@ namespace Yavsc.Model.FrontOffice } Currency curr; + /// + /// Gets or sets the unit. + /// + /// The unit. public override Unit Unit { get { return curr; diff --git a/yavscModel/FrontOffice/Catalog/Product.cs b/yavscModel/FrontOffice/Catalog/Product.cs index f4478180..c4c5d6ce 100644 --- a/yavscModel/FrontOffice/Catalog/Product.cs +++ b/yavscModel/FrontOffice/Catalog/Product.cs @@ -24,14 +24,38 @@ namespace Yavsc.Model.FrontOffice /// /// The description. public string Description { get; set; } + /// + /// Gets or sets the images. + /// + /// The images. public ProductImage[] Images { get; set; } + /// + /// Gets or sets the command form. + /// + /// The command form. public SaleForm CommandForm { get; set; } + + /// + /// Gets or sets the reference. + /// + /// The reference. [Required] [StringLength(255)] public string Reference { get; set; } + /// + /// Gets or sets the command validity dates. + /// + /// The command validity dates. public Period CommandValidityDates { get; set; } + /// + /// Gets the sales conditions. + /// + /// The sales conditions. public abstract string[] GetSalesConditions(); - + /// + /// Gets the type. + /// + /// The type. public virtual string Type { get { return GetType().Name; } } } diff --git a/yavscModel/FrontOffice/Catalog/ProductCategory.cs b/yavscModel/FrontOffice/Catalog/ProductCategory.cs index 5a72bac3..6ff33efd 100644 --- a/yavscModel/FrontOffice/Catalog/ProductCategory.cs +++ b/yavscModel/FrontOffice/Catalog/ProductCategory.cs @@ -2,18 +2,52 @@ using System; namespace Yavsc.Model.FrontOffice { + /// + /// Product category. + /// public class ProductCategory { + /// + /// Initializes a new instance of the class. + /// public ProductCategory () { } + + /// + /// Gets or sets the name. + /// + /// The name. public string Name { get; set; } + + + /// + /// Gets or sets the reference. + /// + /// The reference. public string Reference { get; set; } + + /// + /// Gets or sets the products. + /// + /// The products. public Product[] Products { get; set; } + + /// + /// Gets the name of the product by. + /// + /// The product by name. + /// Product name. public Product GetProductByName (string productName) { return Array.Find (Products, p => p.Name == productName); } + + /// + /// Gets the product. + /// + /// The product. + /// Reference. public Product GetProduct (string reference) { return Array.Find (Products, p => p.Reference == reference); diff --git a/yavscModel/FrontOffice/Catalog/ProductImage.cs b/yavscModel/FrontOffice/Catalog/ProductImage.cs index f4d96860..5de578db 100644 --- a/yavscModel/FrontOffice/Catalog/ProductImage.cs +++ b/yavscModel/FrontOffice/Catalog/ProductImage.cs @@ -2,21 +2,39 @@ using System; namespace Yavsc.Model.FrontOffice { + /// + /// Product image. + /// public class ProductImage: FormElement { #region implemented abstract members of FormElement - + /// + /// Tos the html. + /// + /// The html. public override string ToHtml () { return string.Format ("\"\"/", Src, Alt); } #endregion - + /// + /// Initializes a new instance of the class. + /// public ProductImage () { } + + /// + /// Gets or sets the source. + /// + /// The source. public string Src { get; set; } + + /// + /// Gets or sets the alternate. + /// + /// The alternate. public string Alt { get; set; } } } diff --git a/yavscModel/FrontOffice/Catalog/RadioButton.cs b/yavscModel/FrontOffice/Catalog/RadioButton.cs index 8fcdd971..416b7364 100644 --- a/yavscModel/FrontOffice/Catalog/RadioButton.cs +++ b/yavscModel/FrontOffice/Catalog/RadioButton.cs @@ -2,22 +2,40 @@ using System; namespace Yavsc.Model.FrontOffice { + /// + /// Radio button. + /// public class RadioButton:FormInput { #region implemented abstract members of FormInput - + /// + /// Gets the type. + /// + /// The type. public override string Type { get { return "radio"; } } - #endregion + /// + /// Initializes a new instance of the class. + /// public RadioButton () { } + + /// + /// Gets or sets the choice. + /// + /// The choice. public string Choice { get; set; } + + /// + /// Tos the html. + /// + /// The html. public override string ToHtml () { return string.Format ("", Id,Name,Choice); diff --git a/yavscModel/FrontOffice/Catalog/SaleForm.cs b/yavscModel/FrontOffice/Catalog/SaleForm.cs index 950c2773..288f2302 100644 --- a/yavscModel/FrontOffice/Catalog/SaleForm.cs +++ b/yavscModel/FrontOffice/Catalog/SaleForm.cs @@ -3,6 +3,9 @@ using System.Collections.Generic; namespace Yavsc.Model.FrontOffice { + /// + /// Sale form. + /// public class SaleForm { /// @@ -14,6 +17,9 @@ namespace Yavsc.Model.FrontOffice /// The catalog reference. public string CatalogReference { get; set; } + /// + /// Initializes a new instance of the class. + /// public SaleForm () { } diff --git a/yavscModel/FrontOffice/Catalog/Scalar.cs b/yavscModel/FrontOffice/Catalog/Scalar.cs index e543789b..f8801f23 100644 --- a/yavscModel/FrontOffice/Catalog/Scalar.cs +++ b/yavscModel/FrontOffice/Catalog/Scalar.cs @@ -2,12 +2,26 @@ using System; namespace Yavsc.Model.FrontOffice { + /// + /// Scalar. + /// public abstract class Scalar { + /// + /// Initializes a new instance of the class. + /// public Scalar () { } + /// + /// Gets or sets the quantity. + /// + /// The quantity. public abstract object Quantity { get; set; } + /// + /// Gets or sets the unit. + /// + /// The unit. public abstract Unit Unit{ get; set; } } } diff --git a/yavscModel/FrontOffice/Catalog/SelectInput.cs b/yavscModel/FrontOffice/Catalog/SelectInput.cs index f96af152..1da29294 100644 --- a/yavscModel/FrontOffice/Catalog/SelectInput.cs +++ b/yavscModel/FrontOffice/Catalog/SelectInput.cs @@ -4,10 +4,16 @@ using System.Web.Mvc; namespace Yavsc.Model.FrontOffice { + /// + /// Select input. + /// public class SelectInput: FormInput { #region implemented abstract members of FormInput - + /// + /// Gets the type. + /// + /// The type. public override string Type { get { return "select"; @@ -15,9 +21,20 @@ namespace Yavsc.Model.FrontOffice } #endregion - + /// + /// The items. + /// public Option[] Items; + + /// + /// The index of the selected. + /// public int SelectedIndex; + + /// + /// Tos the html. + /// + /// The html. public override string ToHtml () { StringBuilder sb = new StringBuilder (); diff --git a/yavscModel/FrontOffice/Catalog/SelectItem.cs b/yavscModel/FrontOffice/Catalog/SelectItem.cs index 1c56cdfc..9c849fd1 100644 --- a/yavscModel/FrontOffice/Catalog/SelectItem.cs +++ b/yavscModel/FrontOffice/Catalog/SelectItem.cs @@ -2,17 +2,33 @@ using System; namespace Yavsc.Model.FrontOffice { + /// + /// Select item. + /// public class SelectItem { + /// + /// Initializes a new instance of the class. + /// + /// T. public SelectItem(string t) { Value = t; } + + /// + /// Gets or sets the value. + /// + /// The value. public string Value { get; set; } + + /// a SelectItem. public static implicit operator string(SelectItem t) { return t.Value; } + + /// a string. public static implicit operator SelectItem(string t) { return new SelectItem(t); diff --git a/yavscModel/FrontOffice/Catalog/Service.cs b/yavscModel/FrontOffice/Catalog/Service.cs index c467245a..c0134090 100644 --- a/yavscModel/FrontOffice/Catalog/Service.cs +++ b/yavscModel/FrontOffice/Catalog/Service.cs @@ -2,15 +2,29 @@ using System; namespace Yavsc.Model.FrontOffice { + /// + /// Service. + /// public class Service : Product { + /// + /// Initializes a new instance of the class. + /// public Service () { } + /// + /// Gets or sets the hour price. + /// + /// The hour price. public Price HourPrice { get; set; } #region implemented abstract members of Product + /// + /// Gets the sales conditions. + /// + /// The sales conditions. public override string [] GetSalesConditions () { return new string [] { string.Format( @@ -19,6 +33,11 @@ namespace Yavsc.Model.FrontOffice HourPrice.Unit.Name) } ; } #endregion + + /// + /// Returns a that represents the current . + /// + /// A that represents the current . public override string ToString () { return string.Format ("[Service: HourPrice={0}]", HourPrice); diff --git a/yavscModel/FrontOffice/Catalog/StockStatus.cs b/yavscModel/FrontOffice/Catalog/StockStatus.cs index 9dfa24f0..ff346a57 100644 --- a/yavscModel/FrontOffice/Catalog/StockStatus.cs +++ b/yavscModel/FrontOffice/Catalog/StockStatus.cs @@ -2,10 +2,38 @@ using System; namespace Yavsc.Model.FrontOffice { - public enum StockStatus + /// + /// Stock status. + /// + public enum StockStatus:int { - NoStock, - InStock + /// + /// not in the catalog. + /// + NonExistent, // + /// + /// Service resources are not immediatly available. + /// + NotAvailable, // + /// + /// for a service, the resources are available, + /// but a human review of the order has to de made by + /// the FrontOffice, before the process could start. + /// For a product, it is in the catalog but do not (yet) + /// leads to any payment, and so, can not be sold. + /// + EstimateRequired, + /// + /// Service is up. For a phisical product, + /// it is in stock. + /// For a service, the resources are available + /// and it can be rendered right now + /// + Available, + /// + /// This service is closed, or this product is no more available in stock. + /// + Spent } } diff --git a/yavscModel/FrontOffice/Catalog/Text.cs b/yavscModel/FrontOffice/Catalog/Text.cs index d2c38237..2981ee67 100644 --- a/yavscModel/FrontOffice/Catalog/Text.cs +++ b/yavscModel/FrontOffice/Catalog/Text.cs @@ -2,13 +2,24 @@ using System; namespace Yavsc.Model.FrontOffice { + /// + /// Text. + /// public class Text: FormElement { + /// + /// Gets or sets the value. + /// + /// The value. public string Val { get; set; } + /// + /// Tos the html. + /// + /// The html. public override string ToHtml () { return Val; diff --git a/yavscModel/FrontOffice/Catalog/TextInput.cs b/yavscModel/FrontOffice/Catalog/TextInput.cs index 4f7e4f43..82740490 100644 --- a/yavscModel/FrontOffice/Catalog/TextInput.cs +++ b/yavscModel/FrontOffice/Catalog/TextInput.cs @@ -2,29 +2,45 @@ using System; namespace Yavsc.Model.FrontOffice { + /// + /// Text input. + /// public class TextInput:FormInput { #region implemented abstract members of FormInput private string tpe = null; + /// + /// Gets the type. + /// + /// The type. public override string Type { get { return tpe; } } #endregion - + /// + /// Initializes a new instance of the class. + /// public TextInput () { tpe = "text"; } - + /// + /// Initializes a new instance of the class. + /// + /// Text. public TextInput (string txt) { tpe = "text"; text = txt; } - + /// + /// Initializes a new instance of the class. + /// + /// Type. + /// Text. public TextInput (string type, string txt) { tpe = type; @@ -33,17 +49,20 @@ namespace Yavsc.Model.FrontOffice string text = null; - + /// T. public static implicit operator string(TextInput t) { return t.text; } - + /// T. public static implicit operator TextInput(string t) { return new TextInput(t); } - + /// + /// Gets or sets the default value. + /// + /// The default value. public string DefaultValue { get { return text; @@ -54,8 +73,17 @@ namespace Yavsc.Model.FrontOffice } private bool multiline = false; + + /// + /// Gets or sets a value indicating whether this multi line. + /// + /// true if multi line; otherwise, false. public bool MultiLine { get { return multiline; } set { multiline = value; } } + /// + /// Tos the html. + /// + /// The html. public override string ToHtml () { diff --git a/yavscModel/FrontOffice/Catalog/Unit.cs b/yavscModel/FrontOffice/Catalog/Unit.cs index bafd9e1d..a760458a 100644 --- a/yavscModel/FrontOffice/Catalog/Unit.cs +++ b/yavscModel/FrontOffice/Catalog/Unit.cs @@ -2,11 +2,33 @@ using System; namespace Yavsc.Model.FrontOffice { + /// + /// Unit. + /// public abstract class Unit { + /// + /// Gets the name. + /// + /// The name. public abstract string Name { get; } + /// + /// Gets the description. + /// + /// The description. public abstract string Description { get; } + /// + /// Converts to. + /// + /// The to. + /// Destination. + /// Value. public abstract object ConvertTo (Unit dest, object value); + /// + /// Maies the convert to. + /// + /// true, if convert to was mayed, false otherwise. + /// Other. public abstract bool MayConvertTo (Unit other); } } diff --git a/yavscModel/FrontOffice/CommandStatus.cs b/yavscModel/FrontOffice/CommandStatus.cs new file mode 100644 index 00000000..a44633fe --- /dev/null +++ b/yavscModel/FrontOffice/CommandStatus.cs @@ -0,0 +1,35 @@ +// +// CommandStatus.cs +// +// Author: +// Paul Schneider +// +// Copyright (c) 2015 Paul Schneider +// +// 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 . +using System; + +namespace Yavsc.Model.FrontOffice +{ + public enum CommandStatus:int + { + Inserted, + UserValidated, + UserCanceled, + ExecutionPending, + Satisfied, + Refunded + } +} + diff --git a/yavscModel/FrontOffice/Commande.cs b/yavscModel/FrontOffice/Commande.cs index a08bb116..808969ea 100644 --- a/yavscModel/FrontOffice/Commande.cs +++ b/yavscModel/FrontOffice/Commande.cs @@ -2,7 +2,8 @@ using System; using Yavsc; using System.Collections.Specialized; using Yavsc.Model.WorkFlow; -using Newtonsoft.Json; +using Yavsc.Model.FileSystem; +using System.Web; namespace Yavsc.Model.FrontOffice @@ -23,37 +24,47 @@ namespace Yavsc.Model.FrontOffice /// The identifier. public long Id { get; set; } /// - /// Gets or sets the prod reference. + /// Gets or sets the product reference. /// /// The prod reference. - public string ProdRef { get; set; } + public CommandStatus Status { get; set; } + public string ProductRef { get; set; } /// /// The parameters. /// public StringDictionary Parameters = new StringDictionary(); - /// - /// Initializes a new instance of the class. - /// - public Commande() { + + FileInfoCollection Files { + get { + return GetFSM().GetFiles (Id.ToString()); + } } + /// - /// Create the specified collection. + /// Create a command using the specified collection + /// as command parameters, handles the request files. /// /// Collection. - public static Commande Create(NameValueCollection collection) + /// Files. + public Commande (NameValueCollection collection, NameObjectCollectionBase files) { - Commande cmd = new Commande (); // string catref=collection["catref"]; // Catalog Url from which formdata has been built - cmd.ProdRef=collection["ref"]; // Required product reference - cmd.CreationDate = DateTime.Now; - + ProductRef=collection["ref"]; // Required product reference + CreationDate = DateTime.Now; + Status = CommandStatus.Inserted; // stores the parameters: foreach (string key in collection.AllKeys) { - cmd.Parameters.Add (key, collection [key]); + if (key!="ref") + Parameters.Add (key, collection [key]); } - WorkFlowManager wm = new WorkFlowManager (); - wm.RegisterCommand (cmd); // sets cmd.Id - return cmd; + WorkFlowManager wfm = new WorkFlowManager (); + wfm.RegisterCommand (this); // sets this.Id + string strcmdid = Id.ToString (); + GetFSM().Put (strcmdid, files); + } + + private FileSystemManager GetFSM() { + return new FileSystemManager ("~/commands"); } } } diff --git a/yavscModel/FrontOffice/WebFileInfoCollection.cs b/yavscModel/FrontOffice/WebFileInfoCollection.cs new file mode 100644 index 00000000..e713cfa1 --- /dev/null +++ b/yavscModel/FrontOffice/WebFileInfoCollection.cs @@ -0,0 +1,24 @@ +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/Google/AskForADate.cs b/yavscModel/Google/AskForADate.cs index 649cc04d..8332711e 100644 --- a/yavscModel/Google/AskForADate.cs +++ b/yavscModel/Google/AskForADate.cs @@ -24,34 +24,64 @@ using System.ComponentModel.DataAnnotations; namespace Yavsc.Model.Google { + /// + /// Ask for A date. + /// public class AskForADate { + /// + /// Initializes a new instance of the class. + /// public AskForADate () { MinDate = MaxDate = DateTime.Now.AddMinutes (5); } + /// + /// Gets or sets the minimum date. + /// + /// The minimum date. [Display(Name="MinDate",ResourceType=typeof(LocalizedText))] [DataType(DataType.Date)] [DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}", ApplyFormatInEditMode = true)] [Required(ErrorMessage = "S'il vous plait, saisissez une date minimale au format jj/mm/aaaa")] public DateTime MinDate { get; set; } + /// + /// Gets or sets the max date. + /// + /// The max date. [Display(Name="MaxDate",ResourceType=typeof(LocalizedText))] [DataType(DataType.Date)] [DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}", ApplyFormatInEditMode = true)] public DateTime MaxDate { get; set; } + /// + /// Gets or sets the minimum time. + /// + /// The minimum time. [Required(ErrorMessage = "S'il vous plait, saisissez une heure minimale au format hh:mm sur 24 heures")] [RegularExpression("\\d\\d:\\d\\d")] public string MinTime { get; set; } + /// + /// Gets or sets the max time. + /// + /// The max time. [RegularExpression("\\d\\d:\\d\\d")] public string MaxTime { get; set; } + /// + /// Gets or sets the duration. + /// + /// The duration. [RegularExpression("\\d\\d:\\d\\d")] public string Duration { get; set; } + /// + /// Gets or sets the name of the user. + /// + /// The name of the user. [Required(ErrorMessage="S'il vous plait, saisisser le pseudo de votre interlocuteur")] [Display(Name="Consultant",ResourceType=typeof(LocalizedText))] public string UserName { get; set; } diff --git a/yavscModel/Google/AuthToken.cs b/yavscModel/Google/AuthToken.cs index fd1943bc..2d1d14ee 100644 --- a/yavscModel/Google/AuthToken.cs +++ b/yavscModel/Google/AuthToken.cs @@ -34,12 +34,34 @@ using Yavsc.Model; namespace Yavsc.Model.Google { - + /// + /// Auth token. + /// public class AuthToken { + /// + /// Gets or sets the access token. + /// + /// The access token. public string access_token { get; set; } + /// + /// Gets or sets the identifier token. + /// + /// The identifier token. public string id_token { get; set; } + /// + /// Gets or sets the expires in. + /// + /// The expires in. public int expires_in { get; set; } + /// + /// Gets or sets the type of the token. + /// + /// The type of the token. public string token_type { get; set ; } + /// + /// Gets or sets the refresh token. + /// + /// The refresh token. public string refresh_token { get; set; } } diff --git a/yavscModel/Google/CalendarEntryList.cs b/yavscModel/Google/CalendarEntryList.cs index ddc0035e..b69c397f 100644 --- a/yavscModel/Google/CalendarEntryList.cs +++ b/yavscModel/Google/CalendarEntryList.cs @@ -1,4 +1,4 @@ -// +// // CalendarEntry.cs // // Author: @@ -22,6 +22,9 @@ using System; namespace Yavsc.Model.Google { + /// + /// Calendar entry list. + /// public class CalendarEntryList { diff --git a/yavscModel/Google/CalendarList.cs b/yavscModel/Google/CalendarList.cs index 4e9b8e3c..2fbb779a 100644 --- a/yavscModel/Google/CalendarList.cs +++ b/yavscModel/Google/CalendarList.cs @@ -34,10 +34,29 @@ using Yavsc.Model; namespace Yavsc.Model.Google { + /// + /// Calendar list. + /// public class CalendarList { + /// + /// Gets or sets the kind. + /// + /// The kind. public string kind { get; set;} + /// + /// Gets or sets the etag. + /// + /// The etag. public string etag { get; set; } + /// + /// Gets or sets the next sync token. + /// + /// The next sync token. public string nextSyncToken { get; set; } + /// + /// Gets or sets the items. + /// + /// The items. public CalendarListEntry[] items { get; set; } } diff --git a/yavscModel/Google/CalendarListEntry.cs b/yavscModel/Google/CalendarListEntry.cs index 81017b8d..0896f6a0 100644 --- a/yavscModel/Google/CalendarListEntry.cs +++ b/yavscModel/Google/CalendarListEntry.cs @@ -34,24 +34,89 @@ using Yavsc.Model; namespace Yavsc.Model.Google { - + /// + /// Calendar list entry. + /// public class CalendarListEntry { + /// + /// Gets or sets the kind. + /// + /// The kind. public string kind { get; set;} + /// + /// Gets or sets the etag. + /// + /// The etag. public string etag { get; set; } + /// + /// Gets or sets the identifier. + /// + /// The identifier. public string id { get; set; } + /// + /// Gets or sets the summary. + /// + /// The summary. public string summary { get; set; } + /// + /// Gets or sets the description. + /// + /// The description. public string description { get; set; } + /// + /// Gets or sets the time zone. + /// + /// The time zone. public string timeZone { get; set; } + /// + /// Gets or sets the color identifier. + /// + /// The color identifier. public string colorId { get; set; } + /// + /// Gets or sets the color of the background. + /// + /// The color of the background. public string backgroundColor { get; set; } + /// + /// Gets or sets the color of the foreground. + /// + /// The color of the foreground. public string foregroundColor { get; set; } + /// + /// Gets or sets a value indicating whether this is selected. + /// + /// true if selected; otherwise, false. public bool selected { get; set; } + /// + /// Gets or sets a value indicating whether this is primary. + /// + /// true if primary; otherwise, false. public bool primary { get; set; } + /// + /// Gets or sets the access role. + /// + /// The access role. public string accessRole { get; set; } + /// + /// Reminder. + /// public class Reminder { + /// + /// Gets or sets the method. + /// + /// The method. public string method { get; set; } + /// + /// Gets or sets the minutes. + /// + /// The minutes. public int minutes { get; set; } } + /// + /// Gets or sets the default reminders. + /// + /// The default reminders. public Reminder[] defaultReminders { get; set; } /* "notificationSettings": { "notifications": [ { "type": "eventCreation", "method": "email" }, diff --git a/yavscModel/Google/People.cs b/yavscModel/Google/People.cs index 74846c46..85429fb2 100644 --- a/yavscModel/Google/People.cs +++ b/yavscModel/Google/People.cs @@ -34,38 +34,144 @@ using Yavsc.Model; namespace Yavsc.Model.Google { - + /// + /// People. + /// public class People { + /// + /// Gets or sets the kind. + /// + /// The kind. public string kind { get; set; } + /// + /// Gets or sets the etag. + /// + /// The etag. public string etag { get; set; } + /// + /// Gets or sets the gender. + /// + /// The gender. public string gender { get; set; } + /// + /// E mail. + /// public class EMail{ + /// + /// Gets or sets the value. + /// + /// The value. public string value { get; set; } + /// + /// Gets or sets the type. + /// + /// The type. public string type { get; set; } } + /// + /// Gets or sets the emails. + /// + /// The emails. public EMail[] emails { get; set; } + /// + /// Gets or sets the type of the object. + /// + /// The type of the object. public string objectType { get; set; } + /// + /// Gets or sets the identifier. + /// + /// The identifier. public string id { get; set; } + /// + /// Gets or sets the display name. + /// + /// The display name. public string displayName { get; set; } + /// + /// Name. + /// public class Name { + /// + /// Gets or sets the name of the family. + /// + /// The name of the family. public string familyName { get; set; } + /// + /// Gets or sets the name of the given. + /// + /// The name of the given. public string givenName { get; set; } } + /// + /// Gets or sets the name. + /// + /// The name. public Name name { get; set;} + /// + /// Gets or sets the URL. + /// + /// The URL. public string url { get; set; } + /// + /// Image. + /// public class Image { + /// + /// Gets or sets the URL. + /// + /// The URL. public string url { get; set; } + /// + /// Gets or sets a value indicating whether this is default. + /// + /// true if is default; otherwise, false. public bool isDefault { get; set; } } + /// + /// Gets or sets the image. + /// + /// The image. public Image image { get; set; } + /// + /// Place. + /// public class Place { + /// + /// Gets or sets the value. + /// + /// The value. public string value { get; set; } + /// + /// Gets or sets a value indicating whether this is primary. + /// + /// true if primary; otherwise, false. public bool primary { get; set; } } + /// + /// Gets or sets the places lived. + /// + /// The places lived. public Place[] placesLived { get; set; } + /// + /// Gets or sets a value indicating whether this is plus user. + /// + /// true if is plus user; otherwise, false. public bool isPlusUser { get; set; } + /// + /// Gets or sets the language. + /// + /// The language. public string language { get; set; } + /// + /// Gets or sets the circled by count. + /// + /// The circled by count. public int circledByCount { get; set; } + /// + /// Gets or sets a value indicating whether this is verified. + /// + /// true if verified; otherwise, false. public bool verified { get; set; } } } diff --git a/yavscModel/Google/SignIn.cs b/yavscModel/Google/SignIn.cs index e16f417f..8e63382d 100644 --- a/yavscModel/Google/SignIn.cs +++ b/yavscModel/Google/SignIn.cs @@ -22,11 +22,24 @@ using System; namespace Yavsc.Model.Google { + /// + /// Sign in. + /// public class SignIn { + /// + /// Gets or sets the name of the user. + /// + /// The name of the user. public string UserName { get; set; } + /// + /// Gets or sets the email. + /// + /// The email. public string Email { get; set; } - + /// + /// Initializes a new instance of the class. + /// public SignIn () { } diff --git a/yavscModel/IModule.cs b/yavscModel/IModule.cs index 63eb140d..65b1e9d6 100644 --- a/yavscModel/IModule.cs +++ b/yavscModel/IModule.cs @@ -6,6 +6,9 @@ using System.Web.Mvc; namespace Yavsc.Model { + /// + /// I module. + /// public interface IModule { /// @@ -15,11 +18,16 @@ namespace Yavsc.Model void Install(IDbConnection cnx); /// /// Uninstall the module data and data model from - /// database, using the specified cnx. + /// database, using the specified connection. /// /// Cnx. /// If set to true remove config. - void Uninstall(IDbConnection cnx,bool removeConfig); + void Uninstall(IDbConnection cnx, bool removeConfig); + /// + /// Initialize this object using the specified name and config. + /// + /// Name. + /// Config. void Initialize (string name, NameValueCollection config); } } diff --git a/yavscModel/IRenderer.cs b/yavscModel/IRenderer.cs index ce5237e8..c1990e0d 100644 --- a/yavscModel/IRenderer.cs +++ b/yavscModel/IRenderer.cs @@ -27,10 +27,21 @@ using System.Web.Mvc; namespace Yavsc.Model { + /// + /// I renderer. + /// public interface IRenderer { // Should set ViewData["Message|Author|Body"] // and return an ActionResult + /// + /// Get the specified c. + /// + /// C. object Get(Controller c); + /// + /// Gets or sets the name. + /// + /// The name. string Name { get; set; } } diff --git a/yavscModel/ITagHandler.cs b/yavscModel/ITagHandler.cs index df39329b..0e19c46a 100644 --- a/yavscModel/ITagHandler.cs +++ b/yavscModel/ITagHandler.cs @@ -27,14 +27,31 @@ using System.Web.Mvc; namespace Yavsc.Model { - + /// + /// I tag handler. + /// public interface ITagHandler { - // Should set ViewData["Tags"] with - // an array of rendered tags - + /// + /// Backup this instance. + /// Should set ViewData["Tags"] with + /// an array of rendered tags + /// void Backup(); + + /// + /// Restore this instance. + /// void Restore(); + + /// + /// Invoke this instance. + /// void Invoke(); + + /// + /// Gets or sets the name. + /// + /// The name. string Name { get; set; } } diff --git a/yavscModel/IViewRenderer.cs b/yavscModel/IViewRenderer.cs index d164c814..a5bae042 100644 --- a/yavscModel/IViewRenderer.cs +++ b/yavscModel/IViewRenderer.cs @@ -27,13 +27,12 @@ using System.Web.Mvc; namespace Yavsc.Model { - + /// + /// I view renderer. + /// public interface IViewRenderer : IRenderer { - - // IRenderer.Get() Should set ViewData["Message|Author|Body"] - // and return an ActionResult /// - /// Gets the template route part + /// Gets the template route part. /// /// The template. string Template { get; } diff --git a/yavscModel/RolesAndMemebers/LoginModel.cs b/yavscModel/RolesAndMemebers/LoginModel.cs index 3d8e0b0e..795bffcb 100644 --- a/yavscModel/RolesAndMemebers/LoginModel.cs +++ b/yavscModel/RolesAndMemebers/LoginModel.cs @@ -4,18 +4,33 @@ using System.ComponentModel; namespace Yavsc.Model.RolesAndMembers { + /// + /// Login model. + /// public class LoginModel { - [DisplayName("Nom d'utilisateur")] - [Required(ErrorMessage = "S'il vous plait, entrez un nom d'utilisateur ([a-z]|[A-Z]|[-_.~])+")] - [RegularExpression("([a-z]|[A-Z]|[-_.~])+")] + /// + /// Gets or sets the name of the user. + /// + /// The name of the user. + [DisplayName("Nom d'utilisateur"), + Required(ErrorMessage = "S'il vous plait, entrez un nom d'utilisateur ([a-z]|[A-Z]|[-_.~])+"), + RegularExpression("([a-z]|[A-Z]|[-_.~])+")] public string UserName { get; set; } - [DisplayName("Mot de passe")] - [Required(ErrorMessage = "S'il vous plait, entez un mot de passe")] - [RegularExpression("([a-z]|[A-Z]|[-_.~#{}`'\\^])+")] + /// + /// Gets or sets the password. + /// + /// The password. + [DisplayName("Mot de passe"), + Required(ErrorMessage = "S'il vous plait, entez un mot de passe"), + RegularExpression("([a-z]|[A-Z]|[-_.~#{}`'\\^])+")] public string Password { get; set; } + /// + /// Gets or sets a value indicating whether this remember me. + /// + /// true if remember me; otherwise, false. [Display(Name = "Remember_me",ResourceType=typeof(LocalizedText))] public bool RememberMe { get; set; } } diff --git a/yavscModel/RolesAndMemebers/NewAdminModel.cs b/yavscModel/RolesAndMemebers/NewAdminModel.cs index 52828116..8a895db9 100644 --- a/yavscModel/RolesAndMemebers/NewAdminModel.cs +++ b/yavscModel/RolesAndMemebers/NewAdminModel.cs @@ -3,10 +3,17 @@ using System.ComponentModel.DataAnnotations; namespace Yavsc.Model.RolesAndMembers { + /// + /// New admin model. + /// public class NewAdminModel { - [Required(ErrorMessage = "S'il vous plait, entrez un nom d'utilisateur")] - [Display(Name = "Nom du nouvel administrateur", Description="Nom de l'utilisateur à enregistrer comme administrateur")] + /// + /// Gets or sets the name of the user about to become Admin. + /// + /// The name of the user. + [Required(ErrorMessage = "S'il vous plait, entrez un nom d'utilisateur"), + Display(Name = "Nom du nouvel administrateur", Description="Nom de l'utilisateur à enregistrer comme administrateur")] public string UserName { get; set ; } } } diff --git a/yavscModel/RolesAndMemebers/NewRoleModel.cs b/yavscModel/RolesAndMemebers/NewRoleModel.cs index b82e6c4f..36494baf 100644 --- a/yavscModel/RolesAndMemebers/NewRoleModel.cs +++ b/yavscModel/RolesAndMemebers/NewRoleModel.cs @@ -4,8 +4,15 @@ using System.ComponentModel; namespace Yavsc.Model.RolesAndMembers { + /// + /// New role model. + /// public class NewRoleModel { + /// + /// Gets or sets the name of the role. + /// + /// The name of the role. [Required] [StringLength(255)] [DisplayName("Nom du rôle")] diff --git a/yavscModel/RolesAndMemebers/Profile.cs b/yavscModel/RolesAndMemebers/Profile.cs index 729641e5..a5256e95 100644 --- a/yavscModel/RolesAndMemebers/Profile.cs +++ b/yavscModel/RolesAndMemebers/Profile.cs @@ -7,82 +7,167 @@ using System.Web; namespace Yavsc.Model.RolesAndMembers { + /// + /// Profile. + /// public class Profile { + + /// + /// Gets or sets the name. + /// + /// The name. [DisplayName ("Nom complet")] [StringLength (1024)] public string Name { get; set; } + /// + /// Gets or sets the avatar. + /// + /// The avatar. [DisplayName("Avatar")] public string avatar { get; set; } + /// + /// Gets or sets the address. + /// + /// The address. [DisplayName ("Adresse")] [StringLength (2047)] public string Address { get; set; } + /// + /// Gets or sets the state of the city and. + /// + /// The state of the city and. [DisplayName ("Ville")] [StringLength (255)] public string CityAndState { get; set; } + /// + /// Gets or sets the zip code. + /// + /// The zip code. [DisplayName ("Code Postal")] [StringLength (9)] public string ZipCode { get; set; } + /// + /// Gets or sets the country. + /// + /// The country. [DisplayName ("Pays")] [StringLength (99)] public string Country { get; set; } + /// + /// Gets or sets the web site. + /// + /// The web site. [DisplayName ("Site Web")] [StringLength (255)] public string WebSite { get; set; } + /// + /// Gets or sets a value indicating whether this blog visible. + /// + /// true if blog visible; otherwise, false. [DisplayName ("Blog visible")] public bool BlogVisible { get; set; } private string blogTitle; + + /// + /// Gets or sets the blog title. + /// + /// The blog title. [DisplayName ("Titre du blog")] [StringLength (255)] public string BlogTitle { get { return blogTitle==null? Name+"'s blog":blogTitle; } set { blogTitle = value; } } + /// + /// Gets or sets the phone number. + /// + /// The phone. [DisplayName ("Téléphone fixe")] [StringLength (15)] public string Phone { get; set; } + /// + /// Gets or sets the mobile. + /// + /// The mobile. [DisplayName ("Portable")] [StringLength (15)] public string Mobile { get; set; } + /// + /// Gets or sets the email. + /// + /// The email. [DisplayName ("E-mail")] [StringLength (1024)] public string Email { get; set; } + /// + /// Gets or sets the BI. + /// + /// The BI. [DisplayName ("Code BIC")] [StringLength (15)] public string BIC { get; set; } + /// + /// Gets or sets the IBA. + /// + /// The IBA. [DisplayName ("Code IBAN")] [StringLength (33)] public string IBAN { get; set; } + /// + /// Gets or sets the bank code. + /// + /// The bank code. [DisplayName ("Code Banque")] [StringLength (5)] public string BankCode { get; set; } + /// + /// Gets or sets the wicket code. + /// + /// The wicket code. [DisplayName ("Code Guichet")] [StringLength (5)] public string WicketCode { get; set; } + /// + /// Gets or sets the account number. + /// + /// The account number. [DisplayName ("Numéro de compte")] [StringLength (15)] public string AccountNumber { get; set; } + /// + /// Gets or sets the banked key. + /// + /// The banked key. [DisplayName ("Clé RIB")] public int BankedKey { get; set; } + /// + /// Gets or sets the google calendar. + /// + /// The google calendar. [Display(Name="Google_calendar",ResourceType=typeof(LocalizedText))] public string GoogleCalendar { get; set; } + /// + /// Gets a value indicating whether this instance has bank account. + /// + /// true if this instance has bank account; otherwise, false. public bool HasBankAccount { get { return IsBillable && !string.IsNullOrWhiteSpace (BankCode) @@ -92,6 +177,10 @@ namespace Yavsc.Model.RolesAndMembers && !string.IsNullOrWhiteSpace (AccountNumber) && BankedKey != 0; } } + /// + /// Gets a value indicating whether this instance is billable. + /// + /// true if this instance is billable; otherwise, false. public bool IsBillable { get { return !string.IsNullOrWhiteSpace (Name) @@ -108,8 +197,16 @@ namespace Yavsc.Model.RolesAndMembers { } + /// + /// Gets or sets a value indicating whether this remember me. + /// + /// true if remember me; otherwise, false. public bool RememberMe { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// Profile. public Profile (ProfileBase profile) { object b = profile.GetPropertyValue ("BlogVisible"); diff --git a/yavscModel/RolesAndMemebers/RegisterViewModel.cs b/yavscModel/RolesAndMemebers/RegisterViewModel.cs index 004d1030..db5002c4 100644 --- a/yavscModel/RolesAndMemebers/RegisterViewModel.cs +++ b/yavscModel/RolesAndMemebers/RegisterViewModel.cs @@ -4,19 +4,38 @@ using System.ComponentModel.DataAnnotations; namespace Yavsc.Model.RolesAndMembers { + /// + /// Register view model. + /// public class RegisterViewModel { + /// + /// Gets or sets the name of the user. + /// + /// The name of the user. [Localizable(true)] [Required(ErrorMessage = "S'il vous plait, entrez un nom d'utilisateur")] public string UserName { get; set; } + /// + /// Gets or sets the password. + /// + /// The password. [DisplayName("Mot de passe")] [Required(ErrorMessage = "S'il vous plait, entez un mot de passe")] public string Password { get; set; } + /// + /// Gets or sets the confirm password. + /// + /// The confirm password. [DisplayName("Confirmation du mot de passe")] public string ConfirmPassword { get; set; } + /// + /// Gets or sets the email. + /// + /// The email. [DisplayName("Adresse e-mail")] [Required(ErrorMessage = "S'il vous plait, entrez un e-mail valide")] public string Email { get; set; } diff --git a/yavscModel/RssFeeds.cs b/yavscModel/RssFeeds.cs index 73ba90a7..4b64eb6d 100644 --- a/yavscModel/RssFeeds.cs +++ b/yavscModel/RssFeeds.cs @@ -22,19 +22,59 @@ using System; namespace Yavsc.Model { + /// + /// Rss feeds entry. + /// public class RssFeedsEntry { - + /// + /// Gets or sets the title. + /// + /// The title. public string Title { get ; set; } + /// + /// Gets or sets the description. + /// + /// The description. public string Description { get ; set; } + /// + /// Gets or sets the pub date. + /// + /// The pub date. public DateTime PubDate { get ; set; } + /// + /// Gets or sets the link. + /// + /// The link. public string Link { get ; set; } } + /// + /// Rss feeds channel. + /// public class RssFeedsChannel { + /// + /// Gets or sets the title. + /// + /// The title. public string Title { get ; set; } + /// + /// Gets or sets the description. + /// + /// The description. public string Description { get ; set; } + /// + /// Gets or sets the last build date. + /// + /// The last build date. public DateTime LastBuildDate { get ; set; } + /// + /// Gets or sets the link. + /// + /// The link. public string Link { get ; set; } + /// + /// The entries. + /// public RssFeedsEntry[] Entries; } diff --git a/yavscModel/ViewRenderer.cs b/yavscModel/ViewRenderer.cs index cd47712c..a9cdeece 100644 --- a/yavscModel/ViewRenderer.cs +++ b/yavscModel/ViewRenderer.cs @@ -27,18 +27,34 @@ using System.Web.Mvc; namespace Yavsc.Model { - + /// + /// View renderer. + /// public abstract class ViewRenderer : IViewRenderer { #region IRenderer implementation + /// + /// Get the specified c. + /// + /// C. public object Get (Controller c) { return Name; } + + /// + /// Gets the template route part. + /// + /// The template. public string Template { get { return "Tag.aspx"; } } + + /// + /// Gets or sets the name. + /// + /// The name. public string Name { get { throw new NotImplementedException (); diff --git a/yavscModel/WorkFlow/Configuration/Provider.cs b/yavscModel/WorkFlow/Configuration/Provider.cs index fbe3b650..807c8c5f 100644 --- a/yavscModel/WorkFlow/Configuration/Provider.cs +++ b/yavscModel/WorkFlow/Configuration/Provider.cs @@ -3,8 +3,15 @@ using System.Configuration; namespace Yavsc.Model.WorkFlow.Configuration { + /// + /// WF provider. + /// public class WFProvider:ConfigurationElement { + /// + /// Gets or sets the name. + /// + /// The name. [ConfigurationProperty("name", IsKey=true, IsRequired=true)] public string Name { get { @@ -13,6 +20,10 @@ namespace Yavsc.Model.WorkFlow.Configuration set { base ["name"] = value; } } + /// + /// Gets or sets the type. + /// + /// The type. [ConfigurationProperty("type")] public string Type { get { return (string) this ["type"]; } @@ -20,6 +31,11 @@ namespace Yavsc.Model.WorkFlow.Configuration this ["type"] = value; } } + + /// + /// Gets or sets the name of the application. + /// + /// The name of the application. [ConfigurationProperty("applicationName")] public string ApplicationName { get { @@ -30,6 +46,10 @@ namespace Yavsc.Model.WorkFlow.Configuration } } + /// + /// Gets or sets the name of the connection string. + /// + /// The name of the connection string. [ConfigurationProperty("connectionStringName")] public string ConnectionStringName { get { return (string)this ["connectionStringName"]; } diff --git a/yavscModel/WorkFlow/Configuration/ProviderCollection.cs b/yavscModel/WorkFlow/Configuration/ProviderCollection.cs index 3d32c87e..94a53ddd 100644 --- a/yavscModel/WorkFlow/Configuration/ProviderCollection.cs +++ b/yavscModel/WorkFlow/Configuration/ProviderCollection.cs @@ -3,16 +3,33 @@ using System.Configuration; namespace Yavsc.Model.WorkFlow.Configuration { + /// + /// WF provider collection. + /// public class WFProviderCollection : ConfigurationElementCollection { + /// + /// Gets the element key. + /// + /// The element key. + /// Element. protected override object GetElementKey (ConfigurationElement element) { return ((WFProvider) element).Name; } + /// + /// Creates the new element. + /// + /// The new element. protected override ConfigurationElement CreateNewElement () { return new WFProvider(); } + /// + /// Gets the element. + /// + /// The element. + /// Name. public WFProvider GetElement (string name) { return this.BaseGet (name) as WFProvider; diff --git a/yavscModel/WorkFlow/Configuration/WorkflowConfiguration.cs b/yavscModel/WorkFlow/Configuration/WorkflowConfiguration.cs index 4c73f026..f6132da6 100644 --- a/yavscModel/WorkFlow/Configuration/WorkflowConfiguration.cs +++ b/yavscModel/WorkFlow/Configuration/WorkflowConfiguration.cs @@ -3,6 +3,9 @@ using System.Configuration; namespace Yavsc.Model.WorkFlow.Configuration { + /// + /// Workflow configuration. + /// public class WorkflowConfiguration : ConfigurationSection { /// diff --git a/yavscModel/WorkFlow/Estimate.cs b/yavscModel/WorkFlow/Estimate.cs index 67988987..b4fb0762 100644 --- a/yavscModel/WorkFlow/Estimate.cs +++ b/yavscModel/WorkFlow/Estimate.cs @@ -4,26 +4,62 @@ using System.ComponentModel; namespace Yavsc.Model.WorkFlow { + /// + /// Estimate. + /// [Serializable] public class Estimate { + /// + /// Initializes a new instance of the class. + /// public Estimate () { } + + /// + /// Gets or sets the title. + /// + /// The title. [Required] [Display(ResourceType = typeof(LocalizedText),Name="Title")] public string Title { get; set; } + + /// + /// Gets or sets the description. + /// + /// The description. [Required] [DisplayName("Description")] public string Description { get; set; } + + /// + /// Gets or sets the responsible. + /// + /// The responsible. [Required] [DisplayName("Responsable")] public string Responsible { get; set; } + + /// + /// Gets or sets the client. + /// + /// The client. [Required] [DisplayName("Client")] public string Client { get; set; } + /// + /// Gets or sets the identifier. + /// + /// The identifier. public long Id { get; set; } + + + /// + /// Gets the ciffer. + /// + /// The ciffer. [Display(ResourceType = typeof(LocalizedText),Name="Ciffer")] public decimal Ciffer { get { @@ -36,6 +72,10 @@ namespace Yavsc.Model.WorkFlow } } + /// + /// Gets or sets the lines. + /// + /// The lines. public Writting[] Lines { get; set; } } } diff --git a/yavscModel/WorkFlow/IContentProvider.cs b/yavscModel/WorkFlow/IContentProvider.cs index 74737c65..939f40be 100644 --- a/yavscModel/WorkFlow/IContentProvider.cs +++ b/yavscModel/WorkFlow/IContentProvider.cs @@ -41,8 +41,10 @@ namespace Yavsc.Model.WorkFlow /// Creates the estimate. /// /// The estimate. + /// Responsible. /// Client. /// Title. + /// Description. Estimate CreateEstimate (string responsible, string client, string title, string description); /// /// Add a line to the specified estimate by id, @@ -87,17 +89,16 @@ namespace Yavsc.Model.WorkFlow /// /// Wrid. /// Tag. - void DropTagWritting (long wrid,string tag); + void DropWrittingTag (long wrid,string tag); /// /// Updates the writting. /// /// Wr. void UpdateWritting (Writting wr); /// - /// Sets the title for a specified estimate by id. + /// Updates the estimate. /// - /// Estid. - /// New title. + /// Estim. void UpdateEstimate (Estimate estim); /// /// Sets the writting status. @@ -119,6 +120,13 @@ namespace Yavsc.Model.WorkFlow /// The command id in db. /// COM. long RegisterCommand (Commande com); + + /// + /// Gets the stock status. + /// + /// The stock status. + /// Product reference. + StockStatus GetStockStatus (string productReference); } } diff --git a/yavscModel/WorkFlow/NewEstimateEvenArgs.cs b/yavscModel/WorkFlow/NewEstimateEvenArgs.cs index 0ca45ba2..4077f42c 100644 --- a/yavscModel/WorkFlow/NewEstimateEvenArgs.cs +++ b/yavscModel/WorkFlow/NewEstimateEvenArgs.cs @@ -6,10 +6,23 @@ using System.Collections.Specialized; namespace Yavsc.Model.WorkFlow { + /// + /// New estimate even arguments. + /// public class NewEstimateEvenArgs: EventArgs { private Estimate data=null; + + /// + /// Gets the data. + /// + /// The data. public Estimate Data{ get { return data; } } + + /// + /// Initializes a new instance of the class. + /// + /// Created. public NewEstimateEvenArgs(Estimate created) { data = created; diff --git a/yavscModel/WorkFlow/OrderStatusChangedEventArgs.cs b/yavscModel/WorkFlow/OrderStatusChangedEventArgs.cs index 51e2d2d9..5403e24b 100644 --- a/yavscModel/WorkFlow/OrderStatusChangedEventArgs.cs +++ b/yavscModel/WorkFlow/OrderStatusChangedEventArgs.cs @@ -2,15 +2,32 @@ using System; namespace Yavsc.Model.WorkFlow { + /// + /// Order status changed event arguments. + /// public class OrderStatusChangedEventArgs: EventArgs { + /// + /// Initializes a new instance of the class. + /// + /// Oldstatus. + /// Newstatus. + /// Reason. public OrderStatusChangedEventArgs (int oldstatus, int newstatus, string reason) { oldstat = oldstatus; newstat = newstatus; } private int oldstat, newstat; + /// + /// Gets the old status. + /// + /// The old status. public int OldStatus { get { return oldstat; } } + /// + /// Gets the new status. + /// + /// The new status. public int NewStatus { get { return newstat; } } } } diff --git a/yavscModel/WorkFlow/StatusChange.cs b/yavscModel/WorkFlow/StatusChange.cs index 24ad5496..ed63db78 100644 --- a/yavscModel/WorkFlow/StatusChange.cs +++ b/yavscModel/WorkFlow/StatusChange.cs @@ -4,8 +4,19 @@ using System.Web.Mvc; namespace Yavsc.Model.WorkFlow { + /// + /// Status change. + /// public class StatusChange { + /// + /// Gets or sets the status. + /// + /// The status. public int Status { get; set;} + /// + /// Gets or sets the date. + /// + /// The date. public DateTime date { get; set;} } } diff --git a/yavscModel/WorkFlow/WorkFlowManager.cs b/yavscModel/WorkFlow/WorkFlowManager.cs index b9215b0b..92a2411c 100644 --- a/yavscModel/WorkFlow/WorkFlowManager.cs +++ b/yavscModel/WorkFlow/WorkFlowManager.cs @@ -14,13 +14,26 @@ namespace Yavsc.Model.WorkFlow /// public class WorkFlowManager { + /// + /// Gets or sets the catalog. + /// + /// The catalog. public static Catalog Catalog { get; set; } + /// + /// Registers the command. + /// + /// The command. + /// COM. public long RegisterCommand(Commande com) { return ContentProvider.RegisterCommand (com); } + /// + /// Updates the estimate. + /// + /// Estim. public void UpdateEstimate (Estimate estim) { ContentProvider.UpdateEstimate (estim); @@ -34,27 +47,56 @@ namespace Yavsc.Model.WorkFlow { return ContentProvider.GetEstimate (estid); } - + /// + /// Gets the estimates. + /// + /// The estimates. + /// Client. public Estimate [] GetEstimates (string client) { return ContentProvider.GetEstimates (client); } + /// + /// Gets the stock for a given product reference. + /// + /// The stock status. + /// Product reference. + public StockStatus GetStock(string productReference) + { + return ContentProvider.GetStockStatus (productReference); + } + + /// + /// Updates the writting. + /// + /// Wr. public void UpdateWritting (Writting wr) { ContentProvider.UpdateWritting (wr); } + /// + /// Drops the writting. + /// + /// Wrid. public void DropWritting (long wrid) { ContentProvider.DropWritting (wrid); } + /// + /// Drops the estimate. + /// + /// Estid. public void DropEstimate (long estid) { ContentProvider.DropEstimate(estid); } IContentProvider contentProvider; - + /// + /// Gets the content provider. + /// + /// The content provider. public IContentProvider ContentProvider { get { WorkflowConfiguration c = (WorkflowConfiguration) ConfigurationManager.GetSection ("system.web/workflow"); @@ -97,15 +139,25 @@ namespace Yavsc.Model.WorkFlow /// /// Creates the estimate. /// - /// The estimate identifier. + /// The estimate. + /// Responsible. + /// Client. /// Title. - + /// Description. public Estimate CreateEstimate(string responsible, string client, string title, string description) { Estimate created = ContentProvider.CreateEstimate (responsible, client, title, description); return created; } + /// + /// Write the specified estid, desc, ucost, count and productid. + /// + /// Estid. + /// Desc. + /// Ucost. + /// Count. + /// Productid. public long Write(long estid, string desc, decimal ucost, int count, string productid) { if (!string.IsNullOrWhiteSpace(productid)) { @@ -121,6 +173,12 @@ namespace Yavsc.Model.WorkFlow return ContentProvider.Write(estid, desc, ucost, count, productid); } + /// + /// Sets the estimate status. + /// + /// Estid. + /// Status. + /// Username. public void SetEstimateStatus(long estid, int status, string username) { ContentProvider.SetEstimateStatus (estid, status, username); diff --git a/yavscModel/WorkFlow/Writting.cs b/yavscModel/WorkFlow/Writting.cs index a24fd72a..15fe1b21 100644 --- a/yavscModel/WorkFlow/Writting.cs +++ b/yavscModel/WorkFlow/Writting.cs @@ -47,7 +47,10 @@ namespace Yavsc.Model.WorkFlow [StringLength (2048)] [Display(ResourceType = typeof(LocalizedText),Name="Description")] public string Description { get; set; } - + /// + /// Returns a that represents the current . + /// + /// A that represents the current . public override string ToString () { return string.Format ("[Writting: Id={0}, UnitaryCost={1}, Count={2}, ProductReference={3}, Description={4}]", Id, UnitaryCost, Count, ProductReference, Description); diff --git a/yavscModel/YavscModel.csproj b/yavscModel/YavscModel.csproj index 447b9b76..c33d8a7b 100644 --- a/yavscModel/YavscModel.csproj +++ b/yavscModel/YavscModel.csproj @@ -49,7 +49,6 @@ - @@ -90,7 +89,6 @@ - @@ -133,6 +131,13 @@ + + + + + + +