* YavscModel.csproj:
* NewProjectModel.cs: * ITContentProvider.csproj: refactoring * WebApiConfig.cs: Web Api Config * IModule.cs: * RssFeeds.cs: * IRenderer.cs: * Blog.cs: * ITagHandler.cs: * ViewRenderer.cs: * Comment.cs: * IViewRenderer.cs: * People.cs: * SignIn.cs: * BlogEntry.cs: * AuthToken.cs: * BlogHelper.cs: * DataAccess.cs: * Estimate.cs: * BlogManager.cs: * Writting.cs: * AskForADate.cs: * RestoreQuery.cs: * Basket.cs: * BlogProvider.cs: * CalendarList.cs: * Commande.cs: * StatusChange.cs: * WebFileInfo.cs: * WorkFlowManager.cs: * Euro.cs: * Unit.cs: * Text.cs: * Profile.cs: * Note.cs: * Link.cs: * BlogEditEntryModel.cs: * FindBlogEntryFlags.cs: * NewProjectModel.cs: * CalendarListEntry.cs: * CalendarEntryList.cs: * IContentProvider.cs: * CommandStatus.cs: * Label.cs: * Price.cs: * BlogEntryCollection.cs: * Period.cs: * Scalar.cs: * BlogEditCommentModel.cs: * Option.cs: * NpgsqlContentProvider.cs: * Product.cs: * LoginModel.cs: * Service.cs: * Catalog.cs: * Currency.cs: * NewEstimateEvenArgs.cs: * CheckBox.cs: * SaleForm.cs: * FileSystemManager.cs: * FormInput.cs: * TextInput.cs: * NewRoleModel.cs: * FileInfoCollection.cs: * FilesInput.cs: * NewAdminModel.cs: * SelectItem.cs: * SelectInput.cs: * RadioButton.cs: * StockStatus.cs: * Provider.cs: * DirNotFoundException.cs: * FormElement.cs: * ProductImage.cs: * WebFileInfoCollection.cs: * CatalogHelper.cs: * CatalogManager.cs: * RegisterViewModel.cs: * InvalidDirNameException.cs: * PhysicalProduct.cs: * CatalogProvider.cs: * ProductCategory.cs: * OrderStatusChangedEventArgs.cs: * ProviderCollection.cs: * WorkflowConfiguration.cs: * BlogProviderConfigurationElement.cs: * BlogProvidersConfigurationSection.cs: * BlogProvidersConfigurationCollection.cs: * CatalogProviderConfigurationElement.cs: * CatalogProvidersConfigurationSection.cs: * CatalogProvidersConfigurationCollection.cs: xml doc * SalesCatalog.csproj: * XmlCatalogProvider.cs: Maps the catalog using System.Web * BasketController.cs: * FrontOfficeController.cs: a Basket controller * Global.asax.cs: Session in Web Api * App.master: WebApi bas url as Javascript var 'apiBaseUrl' * Index.aspx: !!not sure of this change. * Web.csproj: compiles now includes WebApiConfig.cs * style.css: link background color * FileSystemController.cs: a file system controller
This commit is contained in:
@ -35,11 +35,13 @@
|
||||
<Reference Include="Npgsql" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="ProjectInfo.cs" />
|
||||
<Compile Include="ITCPNpgsqlProvider.cs" />
|
||||
<Compile Include="Model\NewProjectModel.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
@ -52,4 +54,7 @@
|
||||
<Name>NpgsqlWorkflow</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Model\" />
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -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")]
|
||||
/// <summary>
|
||||
/// New project model.
|
||||
/// </summary>
|
||||
public class NewProjectModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
[DisplayName("Nom du projet")]
|
||||
[Required()]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the manager.
|
||||
/// </summary>
|
||||
/// <value>The manager.</value>
|
||||
[DisplayName("Manager du projet")]
|
||||
[Required]
|
||||
public string Manager { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the description.
|
||||
/// </summary>
|
||||
/// <value>The description.</value>
|
||||
[DisplayName("Description du projet")]
|
||||
[Required]
|
||||
public string Description { get; set; }
|
@ -35,6 +35,7 @@
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Web" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AssemblyInfo.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
|
||||
/// <summary>
|
||||
/// Initialize the catalog
|
||||
/// using the specified name and config.
|
||||
/// The config object contains under the key
|
||||
/// <c>connection</c> the path to the Xml Catalog file
|
||||
/// at server side.
|
||||
/// </summary>
|
||||
/// <param name="name">Name.</param>
|
||||
/// <param name="config">Config.</param>
|
||||
@ -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 ();
|
||||
}
|
||||
|
||||
|
@ -11,8 +11,26 @@ using Newtonsoft.Json;
|
||||
|
||||
namespace WorkFlowProvider
|
||||
{
|
||||
/// <summary>
|
||||
/// Npgsql content provider.
|
||||
/// </summary>
|
||||
public class NpgsqlContentProvider: ProviderBase, IContentProvider
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the stock status.
|
||||
/// </summary>
|
||||
/// <returns>The stock status.</returns>
|
||||
/// <param name="productReference">Product reference.</param>
|
||||
public virtual StockStatus GetStockStatus (string productReference)
|
||||
{
|
||||
return StockStatus.NonExistent;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers the command.
|
||||
/// </summary>
|
||||
/// <returns>The command id in db.</returns>
|
||||
/// <param name="com">COM.</param>
|
||||
public long RegisterCommand (Commande com)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the writting status changes.
|
||||
/// </summary>
|
||||
/// <returns>The writting statuses.</returns>
|
||||
/// <param name="wrid">Wrid.</param>
|
||||
public StatusChange[] GetWrittingStatuses (long wrid)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the estimate status changes.
|
||||
/// </summary>
|
||||
/// <returns>The estimate statuses.</returns>
|
||||
/// <param name="estid">Estid.</param>
|
||||
public StatusChange[] GetEstimateStatuses (long estid)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
/// <summary>
|
||||
/// Tags the writting.
|
||||
/// </summary>
|
||||
/// <param name="wrid">Wrid.</param>
|
||||
/// <param name="tag">Tag.</param>
|
||||
public void TagWritting (long wrid, string tag)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
public void DropTagWritting (long wrid, string tag)
|
||||
|
||||
/// <summary>
|
||||
/// Drops the writting tag .
|
||||
/// </summary>
|
||||
/// <param name="wrid">Wrid.</param>
|
||||
/// <param name="tag">Tag.</param>
|
||||
public void DropWrittingTag (long wrid, string tag)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
/// <summary>
|
||||
/// Sets the writting status.
|
||||
/// </summary>
|
||||
/// <param name="wrtid">Wrtid.</param>
|
||||
/// <param name="status">Status.</param>
|
||||
/// <param name="username">Username.</param>
|
||||
public void SetWrittingStatus (long wrtid, int status, string username)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
/// <summary>
|
||||
/// Sets the estimate status.
|
||||
/// </summary>
|
||||
/// <param name="estid">Estid.</param>
|
||||
/// <param name="status">Status.</param>
|
||||
/// <param name="username">Username.</param>
|
||||
public void SetEstimateStatus (long estid, int status, string username)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
/// <summary>
|
||||
/// Releases all resource used by the <see cref="WorkFlowProvider.NpgsqlContentProvider"/> object.
|
||||
/// </summary>
|
||||
/// <remarks>Call <see cref="Dispose"/> when you are finished using the <see cref="WorkFlowProvider.NpgsqlContentProvider"/>.
|
||||
/// The <see cref="Dispose"/> method leaves the <see cref="WorkFlowProvider.NpgsqlContentProvider"/> in an unusable
|
||||
/// state. After calling <see cref="Dispose"/>, you must release all references to the
|
||||
/// <see cref="WorkFlowProvider.NpgsqlContentProvider"/> so the garbage collector can reclaim the memory that the
|
||||
/// <see cref="WorkFlowProvider.NpgsqlContentProvider"/> was occupying.</remarks>
|
||||
public void Dispose ()
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
/// <summary>
|
||||
/// Install the model in database using the specified cnx.
|
||||
/// </summary>
|
||||
/// <param name="cnx">Cnx.</param>
|
||||
public void Install (System.Data.IDbConnection cnx)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Uninstall the module data and data model from
|
||||
/// database, using the specified connection.
|
||||
/// </summary>
|
||||
/// <param name="cnx">Cnx.</param>
|
||||
/// <param name="removeConfig">If set to <c>true</c> remove config.</param>
|
||||
public void Uninstall (System.Data.IDbConnection cnx, bool removeConfig)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defaults the config.
|
||||
/// </summary>
|
||||
/// <returns>The config.</returns>
|
||||
/// <param name="appName">App name.</param>
|
||||
/// <param name="cnxStr">Cnx string.</param>
|
||||
public ConfigurationSection DefaultConfig (string appName, string cnxStr)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this <see cref="WorkFlowProvider.NpgsqlContentProvider"/> is active.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if active; otherwise, <c>false</c>.</value>
|
||||
public bool Active {
|
||||
get {
|
||||
throw new NotImplementedException ();
|
||||
@ -79,16 +160,33 @@ namespace WorkFlowProvider
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
/// <value>The status labels.</value>
|
||||
public string[] Statuses {
|
||||
get {
|
||||
return new string[] { "Created", "Validated", "Success", "Error" };
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the final statuses.
|
||||
/// </summary>
|
||||
/// <value>The final statuses.</value>
|
||||
public bool[] FinalStatuses {
|
||||
get {
|
||||
return new bool[] { false, false, true, true };
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the estimates created for a specified client.
|
||||
/// </summary>
|
||||
/// <returns>The estimates.</returns>
|
||||
/// <param name="client">Client.</param>
|
||||
public Estimate[] GetEstimates (string client)
|
||||
{
|
||||
using (NpgsqlConnection cnx = CreateConnection ()) {
|
||||
@ -108,6 +206,10 @@ namespace WorkFlowProvider
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Drops the writting.
|
||||
/// </summary>
|
||||
/// <param name="wrid">Wrid.</param>
|
||||
public void DropWritting (long wrid)
|
||||
{
|
||||
|
||||
@ -123,6 +225,10 @@ namespace WorkFlowProvider
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Drops the estimate.
|
||||
/// </summary>
|
||||
/// <param name="estid">Estid.</param>
|
||||
public void DropEstimate (long estid)
|
||||
{
|
||||
using (NpgsqlConnection cnx = CreateConnection ()) {
|
||||
@ -137,6 +243,11 @@ namespace WorkFlowProvider
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the estimate by identifier.
|
||||
/// </summary>
|
||||
/// <returns>The estimate.</returns>
|
||||
/// <param name="estimid">Estimid.</param>
|
||||
public Estimate GetEstimate (long estimid)
|
||||
{
|
||||
using (NpgsqlConnection cnx = CreateConnection ()) {
|
||||
@ -198,7 +309,10 @@ namespace WorkFlowProvider
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Updates the writting.
|
||||
/// </summary>
|
||||
/// <param name="wr">Wr.</param>
|
||||
public void UpdateWritting (Writting wr)
|
||||
{
|
||||
using (NpgsqlConnection cnx = CreateConnection ()) {
|
||||
@ -222,6 +336,10 @@ namespace WorkFlowProvider
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves the given Estimate object in database.
|
||||
/// </summary>
|
||||
/// <param name="estim">the Estimate object.</param>
|
||||
public void UpdateEstimate (Estimate estim)
|
||||
{
|
||||
using (NpgsqlConnection cnx = CreateConnection ()) {
|
||||
@ -241,6 +359,15 @@ namespace WorkFlowProvider
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a line to the specified estimate by id,
|
||||
/// using the specified desc, ucost, count and productid.
|
||||
/// </summary>
|
||||
/// <param name="estid">Estimate identifier.</param>
|
||||
/// <param name="desc">Textual description for this line.</param>
|
||||
/// <param name="ucost">Unitary cost.</param>
|
||||
/// <param name="count">Cost multiplier.</param>
|
||||
/// <param name="productid">Product identifier.</param>
|
||||
public long Write (long estid, string desc, decimal ucost, int count, string productid)
|
||||
{
|
||||
using (NpgsqlConnection cnx = CreateConnection ()) {
|
||||
@ -262,6 +389,11 @@ namespace WorkFlowProvider
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the desc.
|
||||
/// </summary>
|
||||
/// <param name="writid">Writid.</param>
|
||||
/// <param name="newDesc">New desc.</param>
|
||||
public void SetDesc (long writid, string newDesc)
|
||||
{
|
||||
using (NpgsqlConnection cnx = CreateConnection ()) {
|
||||
@ -277,7 +409,14 @@ namespace WorkFlowProvider
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Creates the estimate.
|
||||
/// </summary>
|
||||
/// <returns>The estimate.</returns>
|
||||
/// <param name="client">Client.</param>
|
||||
/// <param name="title">Title.</param>
|
||||
/// <param name="responsible">Responsible.</param>
|
||||
/// <param name="description">Description.</param>
|
||||
public Estimate CreateEstimate (string responsible, string client, string title, string description)
|
||||
{
|
||||
using (NpgsqlConnection cnx = CreateConnection ()) {
|
||||
@ -304,7 +443,10 @@ namespace WorkFlowProvider
|
||||
}
|
||||
|
||||
string applicationName=null;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the application.
|
||||
/// </summary>
|
||||
/// <value>The name of the application.</value>
|
||||
public string ApplicationName {
|
||||
get {
|
||||
return applicationName;
|
||||
@ -315,7 +457,11 @@ namespace WorkFlowProvider
|
||||
}
|
||||
|
||||
string cnxstr = null;
|
||||
|
||||
/// <summary>
|
||||
/// Initialize this object using the specified name and config.
|
||||
/// </summary>
|
||||
/// <param name="name">Name.</param>
|
||||
/// <param name="config">Config.</param>
|
||||
public override void Initialize (string name, NameValueCollection config)
|
||||
{
|
||||
if ( string.IsNullOrWhiteSpace(config ["connectionStringName"]))
|
||||
@ -328,6 +474,10 @@ namespace WorkFlowProvider
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates the connection.
|
||||
/// </summary>
|
||||
/// <returns>The connection.</returns>
|
||||
protected NpgsqlConnection CreateConnection ()
|
||||
{
|
||||
return new NpgsqlConnection (cnxstr);
|
||||
|
@ -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 ();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current basket, creates a new one, if it doesn't exist.
|
||||
/// </summary>
|
||||
/// <value>The current basket.</value>
|
||||
protected Basket CurrentBasket {
|
||||
get {
|
||||
HttpSessionState session = HttpContext.Current.Session;
|
||||
Basket b = (Basket) session ["Basket"];
|
||||
if (b == null)
|
||||
session ["Basket"] = b = new Basket ();
|
||||
return b;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create the specified basket item using specified command parameters.
|
||||
/// </summary>
|
||||
/// <param name="cmdParams">Command parameters.</param>
|
||||
[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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read the specified basket item.
|
||||
/// </summary>
|
||||
/// <param name="itemid">Itemid.</param>
|
||||
[AcceptVerbs("READ")]
|
||||
[Authorize]
|
||||
Commande Read(long itemid){
|
||||
throw new NotImplementedException ();
|
||||
return CurrentBasket[itemid];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -57,29 +75,21 @@ namespace Yavsc.ApiControllers
|
||||
/// <param name="itemid">Item identifier.</param>
|
||||
/// <param name="param">Parameter name.</param>
|
||||
/// <param name="value">Value.</param>
|
||||
[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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete the specified item.
|
||||
/// </summary>
|
||||
/// <param name="itemid">Item identifier.</param>
|
||||
[Authorize]
|
||||
public void Delete(long itemid)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
CurrentBasket.Remove (itemid);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Post a file, as attached document to the specified
|
||||
/// Item
|
||||
/// </summary>
|
||||
[AcceptVerbs("POST")]
|
||||
public void Post(long itemId)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
}
|
||||
}
|
@ -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
|
||||
/// </summary>
|
||||
public class FileSystemController : Controller
|
||||
{
|
||||
private static string usersDir = "~/users";
|
||||
private string usersDir = "~/users";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the users dir.
|
||||
/// Gets the users base directory.
|
||||
/// </summary>
|
||||
/// <value>The users dir.</value>
|
||||
public static string UsersDir {
|
||||
public string UsersDir {
|
||||
get {
|
||||
return usersDir;
|
||||
}
|
||||
}
|
||||
|
||||
FileSystemManager mgr = null ;
|
||||
|
||||
/// <summary>
|
||||
/// Initialize the specified requestContext.
|
||||
/// </summary>
|
||||
/// <param name="requestContext">Request context.</param>
|
||||
protected override void Initialize (System.Web.Routing.RequestContext requestContext)
|
||||
{
|
||||
base.Initialize (requestContext);
|
||||
mgr = new FileSystemManager (UsersDir);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Index this instance.
|
||||
/// </summary>
|
||||
[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));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -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
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create this instance.
|
||||
/// Create the specified id.
|
||||
/// </summary>
|
||||
public ActionResult Create ()
|
||||
{
|
||||
return View ();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create the specified collection.
|
||||
/// </summary>
|
||||
/// <param name="collection">Collection.</param>
|
||||
/// <param name="id">Identifier.</param>
|
||||
[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 ("<p>File name '{0}' refused</p>", 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 ("<p>File name '{0}' saved</p>", 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));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the base dir.
|
||||
/// Gets the user's base dir.
|
||||
/// </summary>
|
||||
/// <value>The base dir.</value>
|
||||
public static string BaseDir { get { return Path.Combine (UsersDir, Membership.GetUser ().UserName); } }
|
||||
public string UserBaseDir { get { return Path.Combine (UsersDir, Membership.GetUser ().UserName); } }
|
||||
|
||||
/// <summary>
|
||||
/// Edit the specified id.
|
||||
@ -122,7 +95,7 @@ namespace Yavsc.Controllers
|
||||
/// <param name="id">Identifier.</param>
|
||||
public ActionResult Edit (int id)
|
||||
{
|
||||
return View ();
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -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 ();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -146,7 +115,7 @@ namespace Yavsc.Controllers
|
||||
/// <param name="id">Identifier.</param>
|
||||
public ActionResult Delete (int id)
|
||||
{
|
||||
return View ();
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -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 ();
|
||||
}
|
||||
}
|
||||
}
|
@ -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) {
|
||||
|
@ -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
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Mvc application.
|
||||
/// </summary>
|
||||
@ -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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Applications the post authorize request.
|
||||
/// </summary>
|
||||
protected void Application_PostAuthorizeRequest()
|
||||
{
|
||||
if (IsWebApiRequest())
|
||||
{
|
||||
HttpContext.Current.SetSessionStateBehavior(SessionStateBehavior.Required);
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsWebApiRequest()
|
||||
{
|
||||
return HttpContext.Current.Request.AppRelativeCurrentExecutionFilePath.StartsWith(WebApiConfig.UrlPrefixRelative);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -73,6 +73,9 @@
|
||||
<%= link %>
|
||||
<% } %>
|
||||
</footer>
|
||||
<script type="text/javascript">
|
||||
var apiBaseUrl = '@Url.Content(ProjectNameSpace.WebApiConfig.UrlPrefixRelative)';
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -1,6 +1,6 @@
|
||||
<%@ Page Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage<Yavsc.FileInfoCollection>" %>
|
||||
<asp:Content ID="MainContentContent" ContentPlaceHolderID="MainContent" runat="server">
|
||||
<h1> Index of <%=ViewData["UserName"] %>'s files (<%= Html.Encode(Model.Count) %>) </h1>
|
||||
<h1> Index of <%= Model.Owner %>'s files (<%= Html.Encode(Model.Count) %>) </h1>
|
||||
<ul>
|
||||
<% foreach (System.IO.FileInfo fi in Model) { %>
|
||||
<li> <%= Html.ActionLink(fi.Name,"Details",new {id = fi.Name}) %> </li>
|
||||
|
@ -191,6 +191,7 @@
|
||||
<Compile Include="Formatters\RssFeedsFormatter.cs" />
|
||||
<Compile Include="Controllers\PaypalApiController.cs" />
|
||||
<Compile Include="Formatters\TexToPdfFormatter.cs" />
|
||||
<Compile Include="WebApiConfig.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\Web.config" />
|
||||
|
66
web/WebApiConfig.cs
Normal file
66
web/WebApiConfig.cs
Normal file
@ -0,0 +1,66 @@
|
||||
//
|
||||
// WebApiConfig.cs
|
||||
//
|
||||
// Author:
|
||||
// Paul Schneider <paulschneider@free.fr>
|
||||
//
|
||||
// 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// Web API config.
|
||||
/// </summary>
|
||||
public static class WebApiConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the URL prefix.
|
||||
/// </summary>
|
||||
/// <value>The URL prefix.</value>
|
||||
public static string UrlPrefix { get { return "api"; } }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the URL prefix relative.
|
||||
/// </summary>
|
||||
/// <value>The URL prefix relative.</value>
|
||||
public static string UrlPrefixRelative { get { return "~/api"; } }
|
||||
|
||||
/// <summary>
|
||||
/// Register the specified config.
|
||||
/// </summary>
|
||||
/// <param name="config">Config.</param>
|
||||
public static void Register(HttpConfiguration config)
|
||||
{
|
||||
config.Routes.MapHttpRoute(
|
||||
name: "DefaultApi",
|
||||
routeTemplate: WebApiConfig.UrlPrefix + "/{controller}/{id}",
|
||||
defaults: new { id = RouteParameter.Optional }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -6,9 +6,16 @@ using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Yavsc.Model.Admin
|
||||
{
|
||||
/// <summary>
|
||||
/// Data access.
|
||||
/// </summary>
|
||||
public class DataAccess {
|
||||
private string host = "localhost";
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the host.
|
||||
/// </summary>
|
||||
/// <value>The host.</value>
|
||||
[StringLength(2056)]
|
||||
public string Host {
|
||||
get {
|
||||
@ -21,6 +28,10 @@ namespace Yavsc.Model.Admin
|
||||
|
||||
private int port = 5432;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the port.
|
||||
/// </summary>
|
||||
/// <value>The port.</value>
|
||||
public int Port {
|
||||
get {
|
||||
return port;
|
||||
@ -32,6 +43,10 @@ namespace Yavsc.Model.Admin
|
||||
|
||||
private string dbname = "yavsc";
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the dbname.
|
||||
/// </summary>
|
||||
/// <value>The dbname.</value>
|
||||
public string Dbname {
|
||||
get {
|
||||
return dbname;
|
||||
@ -43,6 +58,10 @@ namespace Yavsc.Model.Admin
|
||||
|
||||
private string dbuser = "postgres";
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the dbuser.
|
||||
/// </summary>
|
||||
/// <value>The dbuser.</value>
|
||||
public string Dbuser {
|
||||
get {
|
||||
return dbuser;
|
||||
@ -55,6 +74,10 @@ namespace Yavsc.Model.Admin
|
||||
private string dbpassword ;
|
||||
private string backupPrefix= "~/backup/global.backup";
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the backup prefix.
|
||||
/// </summary>
|
||||
/// <value>The backup prefix.</value>
|
||||
public string BackupPrefix {
|
||||
get {
|
||||
return backupPrefix;
|
||||
@ -64,12 +87,19 @@ namespace Yavsc.Model.Admin
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the password.
|
||||
/// </summary>
|
||||
/// <value>The password.</value>
|
||||
[Required(ErrorMessage ="Please, specify a password")]
|
||||
public string Password {
|
||||
get { return dbpassword; }
|
||||
set { dbpassword = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Connections the string.
|
||||
/// </summary>
|
||||
/// <returns>The string.</returns>
|
||||
public string ConnectionString() {
|
||||
return string.Format ("Server={0};Port={1};Database={2};User Id={3};Password={4};Encoding=Unicode;",
|
||||
Host,Port,Dbuser,Password);
|
||||
|
@ -3,12 +3,22 @@ using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Yavsc.Model.Admin
|
||||
{
|
||||
/// <summary>
|
||||
/// Restore query.
|
||||
/// </summary>
|
||||
public class RestoreQuery: DataAccess
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the file.
|
||||
/// </summary>
|
||||
/// <value>The name of the file.</value>
|
||||
[Required]
|
||||
[StringLength(2056)]
|
||||
public string FileName { get; set ; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.Admin.RestoreQuery"/> class.
|
||||
/// </summary>
|
||||
public RestoreQuery ()
|
||||
{
|
||||
}
|
||||
|
@ -5,10 +5,17 @@ using System.ComponentModel;
|
||||
|
||||
namespace Yavsc.Model.Blogs
|
||||
{
|
||||
/// <summary>
|
||||
/// Blog.
|
||||
/// </summary>
|
||||
public class Blog
|
||||
{
|
||||
string title;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the title.
|
||||
/// </summary>
|
||||
/// <value>The title.</value>
|
||||
[StringLength(512)]
|
||||
[Required]
|
||||
[DisplayName("Titre")]
|
||||
|
@ -4,22 +4,19 @@ using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Yavsc.Model.Blogs
|
||||
{
|
||||
/// <summary>
|
||||
/// Blog edit comment model.
|
||||
/// </summary>
|
||||
public class BlogEditCommentModel:Comment
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this <see cref="Yavsc.Model.Blogs.BlogEditCommentModel"/> is preview.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if preview; otherwise, <c>false</c>.</value>
|
||||
[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;
|
||||
} */
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,15 +4,30 @@ using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Yavsc.Model.Blogs
|
||||
{
|
||||
/// <summary>
|
||||
/// Blog edit entry model.
|
||||
/// </summary>
|
||||
public class BlogEditEntryModel:BlogEntry
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this <see cref="Yavsc.Model.Blogs.BlogEditEntryModel"/> is preview.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if preview; otherwise, <c>false</c>.</value>
|
||||
[DisplayName("Prévisualiser")]
|
||||
[Required]
|
||||
public bool Preview { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.Blogs.BlogEditEntryModel"/> class.
|
||||
/// </summary>
|
||||
public BlogEditEntryModel ()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.Blogs.BlogEditEntryModel"/> class.
|
||||
/// </summary>
|
||||
/// <param name="be">Be.</param>
|
||||
public BlogEditEntryModel(BlogEntry be) {
|
||||
this.Preview = true;
|
||||
this.Content = be.Content;
|
||||
|
@ -5,8 +5,17 @@ using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Yavsc.Model.Blogs
|
||||
{
|
||||
/// <summary>
|
||||
/// Blog entry.
|
||||
/// </summary>
|
||||
public class BlogEntry {
|
||||
long id;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the identifier.
|
||||
/// </summary>
|
||||
/// <value>The identifier.</value>
|
||||
[DisplayName("Identifiant numérique de billet")]
|
||||
public long Id {
|
||||
get {
|
||||
@ -19,6 +28,10 @@ namespace Yavsc.Model.Blogs
|
||||
|
||||
string title;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the title.
|
||||
/// </summary>
|
||||
/// <value>The title.</value>
|
||||
[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;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the content.
|
||||
/// </summary>
|
||||
/// <value>The content.</value>
|
||||
[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;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the user.
|
||||
/// </summary>
|
||||
/// <value>The name of the user.</value>
|
||||
[StringLength(255)]
|
||||
[DisplayName("Nom de l'auteur")]
|
||||
public string UserName {
|
||||
@ -57,9 +78,15 @@ namespace Yavsc.Model.Blogs
|
||||
userName = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The posted.
|
||||
/// </summary>
|
||||
public DateTime posted;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the posted.
|
||||
/// </summary>
|
||||
/// <value>The posted.</value>
|
||||
[DisplayName("Date de creation")]
|
||||
public DateTime Posted {
|
||||
get {
|
||||
@ -69,9 +96,15 @@ namespace Yavsc.Model.Blogs
|
||||
posted = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The modified.
|
||||
/// </summary>
|
||||
public DateTime modified;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the modified.
|
||||
/// </summary>
|
||||
/// <value>The modified.</value>
|
||||
[DisplayName("Date de modification")]
|
||||
public DateTime Modified {
|
||||
get {
|
||||
@ -81,7 +114,17 @@ namespace Yavsc.Model.Blogs
|
||||
modified = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this <see cref="Yavsc.Model.Blogs.BlogEntry"/> is visible.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if visible; otherwise, <c>false</c>.</value>
|
||||
public bool Visible { get; set ; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the tags.
|
||||
/// </summary>
|
||||
/// <value>The tags.</value>
|
||||
public string [] Tags { get; set ; }
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,9 @@ using Yavsc.Model.Blogs;
|
||||
|
||||
namespace Yavsc.Model.Blogs
|
||||
{
|
||||
/// <summary>
|
||||
/// Blog entry collection.
|
||||
/// </summary>
|
||||
public class BlogEntryCollection : List<BlogEntry>
|
||||
{
|
||||
}
|
||||
|
@ -6,8 +6,15 @@ using Yavsc.Model.Blogs.Configuration;
|
||||
|
||||
namespace Yavsc.Model.Blogs
|
||||
{
|
||||
/// <summary>
|
||||
/// Blog helper.
|
||||
/// </summary>
|
||||
public static class BlogHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the provider.
|
||||
/// </summary>
|
||||
/// <returns>The provider.</returns>
|
||||
public static BlogProvider GetProvider ()
|
||||
{
|
||||
BlogProvidersConfigurationSection config = ConfigurationManager.GetSection ("system.web/blog") as BlogProvidersConfigurationSection;
|
||||
|
@ -7,13 +7,27 @@ using System.Web.Security;
|
||||
|
||||
namespace Yavsc.Model.Blogs
|
||||
{
|
||||
/// <summary>
|
||||
/// Blog manager.
|
||||
/// </summary>
|
||||
public static class BlogManager
|
||||
{
|
||||
/// <summary>
|
||||
/// Removes the comment.
|
||||
/// </summary>
|
||||
/// <returns>The comment.</returns>
|
||||
/// <param name="cmtid">Cmtid.</param>
|
||||
public static long RemoveComment(long cmtid)
|
||||
{
|
||||
return Provider.RemoveComment (cmtid);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Comment the specified from, postid, content and visible.
|
||||
/// </summary>
|
||||
/// <param name="from">From.</param>
|
||||
/// <param name="postid">Postid.</param>
|
||||
/// <param name="content">Content.</param>
|
||||
/// <param name="visible">If set to <c>true</c> visible.</param>
|
||||
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;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the provider.
|
||||
/// </summary>
|
||||
/// <value>The provider.</value>
|
||||
public static BlogProvider Provider {
|
||||
get {
|
||||
if (provider == null)
|
||||
@ -28,26 +46,70 @@ namespace Yavsc.Model.Blogs
|
||||
return provider;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the post.
|
||||
/// </summary>
|
||||
/// <returns>The post.</returns>
|
||||
/// <param name="username">Username.</param>
|
||||
/// <param name="title">Title.</param>
|
||||
public static BlogEntry GetPost (string username, string title)
|
||||
{
|
||||
return Provider.GetPost (username, title );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the post.
|
||||
/// </summary>
|
||||
/// <returns>The post.</returns>
|
||||
/// <param name="postid">Postid.</param>
|
||||
public static BlogEntry GetPost(long postid)
|
||||
{
|
||||
return Provider.GetPost (postid);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Post the specified username, title, content and visible.
|
||||
/// </summary>
|
||||
/// <param name="username">Username.</param>
|
||||
/// <param name="title">Title.</param>
|
||||
/// <param name="content">Content.</param>
|
||||
/// <param name="visible">If set to <c>true</c> visible.</param>
|
||||
public static void Post(string username, string title, string content, bool visible)
|
||||
{
|
||||
Provider.Post(username, title, content, visible );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the post.
|
||||
/// </summary>
|
||||
/// <param name="postid">Postid.</param>
|
||||
/// <param name="title">Title.</param>
|
||||
/// <param name="content">Content.</param>
|
||||
/// <param name="visible">If set to <c>true</c> visible.</param>
|
||||
public static void UpdatePost(long postid, string title, string content, bool visible)
|
||||
{
|
||||
Provider.UpdatePost(postid, title, content, visible);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finds the post.
|
||||
/// </summary>
|
||||
/// <returns>The post.</returns>
|
||||
/// <param name="pattern">Pattern.</param>
|
||||
/// <param name="searchflags">Searchflags.</param>
|
||||
/// <param name="pageIndex">Page index.</param>
|
||||
/// <param name="pageSize">Page size.</param>
|
||||
/// <param name="totalRecords">Total records.</param>
|
||||
public static BlogEntryCollection FindPost (string pattern, FindBlogEntryFlags searchflags, int pageIndex, int pageSize, out int totalRecords)
|
||||
{
|
||||
return Provider.FindPost (pattern, searchflags, pageIndex, pageSize, out totalRecords);
|
||||
}
|
||||
/// <summary>
|
||||
/// Removes the post.
|
||||
/// </summary>
|
||||
/// <param name="username">Username.</param>
|
||||
/// <param name="title">Title.</param>
|
||||
public static void RemovePost (string username, string title)
|
||||
{
|
||||
if (!Roles.IsUserInRole ("Admin")) {
|
||||
@ -61,10 +123,25 @@ namespace Yavsc.Model.Blogs
|
||||
}
|
||||
Provider.RemovePost (username, title);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Lasts the posts.
|
||||
/// </summary>
|
||||
/// <returns>The posts.</returns>
|
||||
/// <param name="pageIndex">Page index.</param>
|
||||
/// <param name="pageSize">Page size.</param>
|
||||
/// <param name="totalRecords">Total records.</param>
|
||||
public static BlogEntryCollection LastPosts (int pageIndex, int pageSize, out int totalRecords)
|
||||
{
|
||||
return Provider.LastPosts (pageIndex, pageSize, out totalRecords);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the comments.
|
||||
/// </summary>
|
||||
/// <returns>The comments.</returns>
|
||||
/// <param name="postid">Postid.</param>
|
||||
/// <param name="getHidden">If set to <c>true</c> get hidden.</param>
|
||||
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.
|
||||
/// </summary>
|
||||
/// <param name="postid">Postid.</param>
|
||||
/// <param name="tag">Tag.</param>
|
||||
/// <returns>The tag identifier</returns>
|
||||
public static long Tag(long postid, string tag) {
|
||||
return Provider.Tag (postid, tag);
|
||||
|
@ -5,27 +5,147 @@ using System.Collections.Generic;
|
||||
|
||||
namespace Yavsc.Model.Blogs
|
||||
{
|
||||
/// <summary>
|
||||
/// Blog provider.
|
||||
/// </summary>
|
||||
public abstract class BlogProvider: ProviderBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the post.
|
||||
/// </summary>
|
||||
/// <returns>The post.</returns>
|
||||
/// <param name="postid">Postid.</param>
|
||||
public abstract BlogEntry GetPost (long postid);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the post.
|
||||
/// </summary>
|
||||
/// <returns>The post.</returns>
|
||||
/// <param name="username">Username.</param>
|
||||
/// <param name="title">Title.</param>
|
||||
public abstract BlogEntry GetPost (string username, string title);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the post identifier.
|
||||
/// </summary>
|
||||
/// <returns>The post identifier.</returns>
|
||||
/// <param name="username">Username.</param>
|
||||
/// <param name="title">Title.</param>
|
||||
public abstract long GetPostId (string username, string title);
|
||||
|
||||
/// <summary>
|
||||
/// Post the specified username, title, content and visible.
|
||||
/// </summary>
|
||||
/// <param name="username">Username.</param>
|
||||
/// <param name="title">Title.</param>
|
||||
/// <param name="content">Content.</param>
|
||||
/// <param name="visible">If set to <c>true</c> visible.</param>
|
||||
public abstract long Post (string username, string title, string content, bool visible);
|
||||
|
||||
/// <summary>
|
||||
/// Updates the post.
|
||||
/// </summary>
|
||||
/// <param name="postid">Postid.</param>
|
||||
/// <param name="title">Title.</param>
|
||||
/// <param name="content">Content.</param>
|
||||
/// <param name="visible">If set to <c>true</c> visible.</param>
|
||||
public abstract void UpdatePost (long postid, string title, string content, bool visible);
|
||||
|
||||
/// <summary>
|
||||
/// Finds the post.
|
||||
/// </summary>
|
||||
/// <returns>The post.</returns>
|
||||
/// <param name="pattern">Pattern.</param>
|
||||
/// <param name="searchflags">Searchflags.</param>
|
||||
/// <param name="pageIndex">Page index.</param>
|
||||
/// <param name="pageSize">Page size.</param>
|
||||
/// <param name="totalRecords">Total records.</param>
|
||||
public abstract BlogEntryCollection FindPost (string pattern, FindBlogEntryFlags searchflags,
|
||||
int pageIndex, int pageSize, out int totalRecords);
|
||||
|
||||
/// <summary>
|
||||
/// Removes the post.
|
||||
/// </summary>
|
||||
/// <param name="username">Username.</param>
|
||||
/// <param name="title">Title.</param>
|
||||
public abstract void RemovePost (string username, string title);
|
||||
|
||||
/// <summary>
|
||||
/// Removes the post.
|
||||
/// </summary>
|
||||
/// <param name="postid">Postid.</param>
|
||||
public abstract void RemovePost (long postid);
|
||||
|
||||
/// <summary>
|
||||
/// Removes the comment.
|
||||
/// </summary>
|
||||
/// <returns>The comment.</returns>
|
||||
/// <param name="cmtid">Cmtid.</param>
|
||||
public abstract long RemoveComment (long cmtid);
|
||||
|
||||
/// <summary>
|
||||
/// Lasts the posts.
|
||||
/// </summary>
|
||||
/// <returns>The posts.</returns>
|
||||
/// <param name="pageIndex">Page index.</param>
|
||||
/// <param name="pageSize">Page size.</param>
|
||||
/// <param name="totalRecords">Total records.</param>
|
||||
public abstract BlogEntryCollection LastPosts(int pageIndex, int pageSize, out int totalRecords);
|
||||
|
||||
/// <summary>
|
||||
/// Blogs the title.
|
||||
/// </summary>
|
||||
/// <returns>The title.</returns>
|
||||
/// <param name="username">Username.</param>
|
||||
public abstract string BlogTitle (string username);
|
||||
|
||||
/// <summary>
|
||||
/// Comment the specified from, postid and content.
|
||||
/// </summary>
|
||||
/// <param name="from">From.</param>
|
||||
/// <param name="postid">Postid.</param>
|
||||
/// <param name="content">Content.</param>
|
||||
public abstract long Comment (string from, long postid, string content);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the comments.
|
||||
/// </summary>
|
||||
/// <returns>The comments.</returns>
|
||||
/// <param name="postid">Postid.</param>
|
||||
/// <param name="getHidden">If set to <c>true</c> get hidden.</param>
|
||||
public abstract Comment[] GetComments (long postid, bool getHidden) ;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this <see cref="Yavsc.Model.Blogs.BlogProvider"/> auto validate comment.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if auto validate comment; otherwise, <c>false</c>.</value>
|
||||
public abstract bool AutoValidateComment { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Validates the comment.
|
||||
/// </summary>
|
||||
/// <param name="cmtid">Cmtid.</param>
|
||||
public abstract void ValidateComment (long cmtid);
|
||||
|
||||
/// <summary>
|
||||
/// Updates the comment.
|
||||
/// </summary>
|
||||
/// <param name="cmtid">Cmtid.</param>
|
||||
/// <param name="content">Content.</param>
|
||||
/// <param name="visible">If set to <c>true</c> visible.</param>
|
||||
public abstract void UpdateComment (long cmtid, string content, bool visible);
|
||||
|
||||
/// <summary>
|
||||
/// Tag the specified postid and tag.
|
||||
/// </summary>
|
||||
/// <param name="postid">Postid.</param>
|
||||
/// <param name="tag">Tag.</param>
|
||||
public abstract long Tag (long postid,string tag);
|
||||
|
||||
/// <summary>
|
||||
/// Removes the tag.
|
||||
/// </summary>
|
||||
/// <param name="tagid">Tagid.</param>
|
||||
public abstract void RemoveTag (long tagid);
|
||||
}
|
||||
|
||||
|
@ -5,9 +5,17 @@ using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Yavsc.Model.Blogs
|
||||
{
|
||||
/// <summary>
|
||||
/// Comment.
|
||||
/// </summary>
|
||||
public class Comment
|
||||
{
|
||||
long id;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the identifier.
|
||||
/// </summary>
|
||||
/// <value>The identifier.</value>
|
||||
[DisplayName("Identifiant numérique de commentaire")]
|
||||
public long Id {
|
||||
get {
|
||||
@ -18,6 +26,11 @@ namespace Yavsc.Model.Blogs
|
||||
}
|
||||
}
|
||||
long postid;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the post identifier.
|
||||
/// </summary>
|
||||
/// <value>The post identifier.</value>
|
||||
[DisplayName("Identifiant numérique du billet commenté")]
|
||||
public long PostId {
|
||||
get {
|
||||
@ -27,6 +40,7 @@ namespace Yavsc.Model.Blogs
|
||||
postid = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the author of this comment.
|
||||
/// </summary>
|
||||
@ -34,6 +48,11 @@ namespace Yavsc.Model.Blogs
|
||||
public string From { get; set; }
|
||||
|
||||
string content;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the comment text.
|
||||
/// </summary>
|
||||
/// <value>The comment text.</value>
|
||||
[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;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the posted.
|
||||
/// </summary>
|
||||
/// <value>The posted.</value>
|
||||
[DisplayName("Date de creation")]
|
||||
public DateTime Posted {
|
||||
get {
|
||||
@ -57,8 +80,12 @@ namespace Yavsc.Model.Blogs
|
||||
}
|
||||
}
|
||||
|
||||
public DateTime modified;
|
||||
private DateTime modified;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the modified.
|
||||
/// </summary>
|
||||
/// <value>The modified.</value>
|
||||
[DisplayName("Date de modification")]
|
||||
public DateTime Modified {
|
||||
get {
|
||||
@ -69,6 +96,10 @@ namespace Yavsc.Model.Blogs
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this <see cref="Yavsc.Model.Blogs.Comment"/> is visible.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if visible; otherwise, <c>false</c>.</value>
|
||||
public bool Visible { get; set ; }
|
||||
|
||||
}
|
||||
|
@ -4,33 +4,55 @@ using System.ComponentModel;
|
||||
|
||||
namespace Yavsc.Model.Blogs.Configuration
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Blog provider configuration element.
|
||||
/// </summary>
|
||||
public class BlogProviderConfigurationElement : ConfigurationElement
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
[ConfigurationProperty("name", IsRequired = true, IsKey=true)]
|
||||
public string Name {
|
||||
get { return (string)this ["name"]; }
|
||||
set { this ["name"] = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the type.
|
||||
/// </summary>
|
||||
/// <value>The type.</value>
|
||||
[ConfigurationProperty("type", IsRequired = true, IsKey=false)]
|
||||
public string Type {
|
||||
get { return (string)this ["type"]; }
|
||||
set { this ["type"] = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the connection string.
|
||||
/// </summary>
|
||||
/// <value>The name of the connection string.</value>
|
||||
[ConfigurationProperty("connectionStringName")]
|
||||
public string ConnectionStringName {
|
||||
get { return (string)this ["connectionStringName"]; }
|
||||
set { this ["connectionStringName"] = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the description.
|
||||
/// </summary>
|
||||
/// <value>The description.</value>
|
||||
[ConfigurationProperty("description")]
|
||||
public string Description {
|
||||
get { return (string)this ["description"]; }
|
||||
set { this ["description"] = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the application.
|
||||
/// </summary>
|
||||
/// <value>The name of the application.</value>
|
||||
[ConfigurationProperty("applicationName")]
|
||||
public string ApplicationName {
|
||||
get { return (string)this ["applicationName"]; }
|
||||
|
@ -4,18 +4,35 @@ using System.ComponentModel;
|
||||
|
||||
namespace Yavsc.Model.Blogs.Configuration
|
||||
{
|
||||
/// <summary>
|
||||
/// Blog providers configuration collection.
|
||||
/// </summary>
|
||||
public class BlogProvidersConfigurationCollection : ConfigurationElementCollection
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates the new element.
|
||||
/// </summary>
|
||||
/// <returns>The new element.</returns>
|
||||
protected override ConfigurationElement CreateNewElement ()
|
||||
{
|
||||
return new BlogProviderConfigurationElement();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the element key.
|
||||
/// </summary>
|
||||
/// <returns>The element key.</returns>
|
||||
/// <param name="element">Element.</param>
|
||||
protected override object GetElementKey (ConfigurationElement element)
|
||||
{
|
||||
return ((BlogProviderConfigurationElement) element).Name;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the element.
|
||||
/// </summary>
|
||||
/// <returns>The element.</returns>
|
||||
/// <param name="name">Name.</param>
|
||||
public BlogProviderConfigurationElement GetElement (string name)
|
||||
{
|
||||
return this.BaseGet(name) as BlogProviderConfigurationElement;
|
||||
|
@ -4,6 +4,9 @@ using System.ComponentModel;
|
||||
|
||||
namespace Yavsc.Model.Blogs.Configuration
|
||||
{
|
||||
/// <summary>
|
||||
/// Blog providers configuration section.
|
||||
/// </summary>
|
||||
public class BlogProvidersConfigurationSection : ConfigurationSection
|
||||
{
|
||||
/// <summary>
|
||||
@ -16,16 +19,15 @@ namespace Yavsc.Model.Blogs.Configuration
|
||||
set { this["defaultProvider"] = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the providers.
|
||||
/// </summary>
|
||||
/// <value>The providers.</value>
|
||||
[ConfigurationProperty("providers")]
|
||||
[ConfigurationCollection(typeof(BlogProvidersConfigurationCollection),
|
||||
AddItemName = "add",
|
||||
ClearItemsName = "clear",
|
||||
RemoveItemName = "remove")]
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the providers.
|
||||
/// </summary>
|
||||
/// <value>The providers.</value>
|
||||
public BlogProvidersConfigurationCollection Providers{
|
||||
get { return (BlogProvidersConfigurationCollection) this["providers"]; }
|
||||
set { this["providers"] = value; }
|
||||
|
@ -4,11 +4,25 @@ using System.Collections.Generic;
|
||||
|
||||
namespace Yavsc.Model.Blogs
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Find blog entry flags.
|
||||
/// </summary>
|
||||
public enum FindBlogEntryFlags : byte {
|
||||
/// <summary>
|
||||
/// The match title.
|
||||
/// </summary>
|
||||
MatchTitle = 1,
|
||||
/// <summary>
|
||||
/// The content of the match.
|
||||
/// </summary>
|
||||
MatchContent = 2,
|
||||
/// <summary>
|
||||
/// The name of the match user.
|
||||
/// </summary>
|
||||
MatchUserName = 4,
|
||||
/// <summary>
|
||||
/// The match invisible.
|
||||
/// </summary>
|
||||
MatchInvisible = 8
|
||||
}
|
||||
|
||||
|
46
yavscModel/FileSystem/DirNotFoundException.cs
Normal file
46
yavscModel/FileSystem/DirNotFoundException.cs
Normal file
@ -0,0 +1,46 @@
|
||||
//
|
||||
// DirNotFoundException.cs
|
||||
//
|
||||
// Author:
|
||||
// Paul Schneider <paulschneider@free.fr>
|
||||
//
|
||||
// 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Web;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Text;
|
||||
using System.Web.Security;
|
||||
|
||||
namespace Yavsc.Model.FileSystem
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Dir not found exception.
|
||||
/// </summary>
|
||||
public class DirNotFoundException : Exception {
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FileSystem.DirNotFoundException"/> class.
|
||||
/// </summary>
|
||||
/// <param name="dir">Dir.</param>
|
||||
public DirNotFoundException(string dir)
|
||||
: base(string.Format( "Directory not found : {0}", dir))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -4,9 +4,24 @@ using System.Collections.Generic;
|
||||
|
||||
namespace Yavsc.Model.FileSystem
|
||||
{
|
||||
/// <summary>
|
||||
/// File info collection.
|
||||
/// </summary>
|
||||
public class FileInfoCollection: List<FileInfo>
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the owner.
|
||||
/// </summary>
|
||||
/// <value>The owner.</value>
|
||||
public string Owner { get; set; }
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FileSystem.FileInfoCollection"/> class.
|
||||
/// </summary>
|
||||
/// <param name="files">Files.</param>
|
||||
public FileInfoCollection (FileInfo [] files)
|
||||
{
|
||||
AddRange (files);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
157
yavscModel/FileSystem/FileSystemManager.cs
Normal file
157
yavscModel/FileSystem/FileSystemManager.cs
Normal file
@ -0,0 +1,157 @@
|
||||
//
|
||||
// FileSystemManager.cs
|
||||
//
|
||||
// Author:
|
||||
// Paul Schneider <paulschneider@free.fr>
|
||||
//
|
||||
// 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 <http://www.gnu.org/licenses/>.
|
||||
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
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 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 .
|
||||
/// </summary>
|
||||
public class FileSystemManager
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the size of the max file.
|
||||
/// </summary>
|
||||
/// <value>The size of the max file.</value>
|
||||
public long MaxFileSize { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the max user storage.
|
||||
/// </summary>
|
||||
/// <value>The max user storage.</value>
|
||||
public long MaxUserStorage { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FileSystem.FileSystemManager"/> class.
|
||||
/// </summary>
|
||||
public FileSystemManager (string usersDirectory="~/files", char dirSep = '/')
|
||||
{
|
||||
prefix = usersDirectory;
|
||||
DirectorySeparator = dirSep;
|
||||
|
||||
}
|
||||
|
||||
string regexFileName = "^[A-Za-z0-9#^!+ _~\\-.]+$";
|
||||
|
||||
/// <summary>
|
||||
/// Put the specified files in destDir, as sub dir of the current user's home dir.
|
||||
/// </summary>
|
||||
/// <param name="destDir">Destination dir, use "." to point to the user's home dir.</param>
|
||||
/// <param name="files">Files.</param>
|
||||
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;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the users dir.
|
||||
/// </summary>
|
||||
/// <value>The users dir.</value>
|
||||
public string Prefix {
|
||||
get {
|
||||
return prefix;
|
||||
}
|
||||
set {
|
||||
prefix = value;
|
||||
if (value.StartsWith ("~/")) {
|
||||
prefix = HttpContext.Current.Server.MapPath(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the directory name separator.
|
||||
/// </summary>
|
||||
/// <value>The separator.</value>
|
||||
public char DirectorySeparator { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Checks the sub dir name.
|
||||
/// </summary>
|
||||
/// <param name="subdir">Subdir.</param>
|
||||
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);
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the files.
|
||||
/// The web user must be authenticated,
|
||||
/// The given username must be registered.
|
||||
/// </summary>
|
||||
/// <returns>The files.</returns>
|
||||
/// <param name="subdir">Subdir.</param>
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
60
yavscModel/FileSystem/InvalidDirNameException.cs
Normal file
60
yavscModel/FileSystem/InvalidDirNameException.cs
Normal file
@ -0,0 +1,60 @@
|
||||
//
|
||||
// InvalidDirNameException.cs
|
||||
//
|
||||
// Author:
|
||||
// Paul Schneider <paulschneider@free.fr>
|
||||
//
|
||||
// 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Web;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Text;
|
||||
using System.Web.Security;
|
||||
|
||||
namespace Yavsc.Model.FileSystem
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Invalid dir name exception.
|
||||
/// </summary>
|
||||
public class InvalidDirNameException : Exception {
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FileSystem.InvalidDirNameException"/> class.
|
||||
/// </summary>
|
||||
/// <param name="dir">Dir.</param>
|
||||
public InvalidDirNameException(string dir)
|
||||
: base(string.Format( "Invalid directory name : {0}", dir))
|
||||
{
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Invalid file name exception.
|
||||
/// </summary>
|
||||
public class InvalidFileNameException : Exception {
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FileSystem.InvalidDirNameException"/> class.
|
||||
/// </summary>
|
||||
/// <param name="fileName">Dir.</param>
|
||||
public InvalidFileNameException(string fileName)
|
||||
: base(string.Format( "Invalid file name : {0}", fileName))
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
105
yavscModel/FileSystem/WebFileInfo.cs
Normal file
105
yavscModel/FileSystem/WebFileInfo.cs
Normal file
@ -0,0 +1,105 @@
|
||||
//
|
||||
// ShortFileName.cs
|
||||
//
|
||||
// Author:
|
||||
// Paul Schneider <paulschneider@free.fr>
|
||||
//
|
||||
// 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 <http://www.gnu.org/licenses/>.
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
using System.Web.Mvc;
|
||||
using System.IO;
|
||||
using System.Web;
|
||||
|
||||
namespace Yavsc.Model.FileSystem
|
||||
{
|
||||
/// <summary>
|
||||
/// Files in the name.
|
||||
/// </summary>
|
||||
public class WebFileInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FileSystem.WebFileInfo"/> class.
|
||||
/// </summary>
|
||||
/// <param name="context">Context.</param>
|
||||
/// <param name="id">Identifier.</param>
|
||||
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;
|
||||
/// <summary>
|
||||
/// Gets the perma link.
|
||||
/// </summary>
|
||||
/// <value>The perma link.</value>
|
||||
public string PermaLink {
|
||||
get {
|
||||
return permaLink;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Path.
|
||||
/// </summary>
|
||||
/// <value>The web dir.</value>
|
||||
public string Path {
|
||||
get {
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/// <summary>
|
||||
/// Creates the name of the file.
|
||||
/// </summary>
|
||||
/// <returns>The file name.</returns>
|
||||
/// <param name="intentValue">Intent value.</param>
|
||||
/// <param name="destdir">Destdir.</param>
|
||||
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;
|
||||
}*/
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ namespace Yavsc.Model.FrontOffice
|
||||
/// <summary>
|
||||
/// Basket.
|
||||
/// </summary>
|
||||
public class Basket: List<Commande>
|
||||
public class Basket: Dictionary<long,Commande>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.Basket"/> class.
|
||||
@ -35,7 +35,18 @@ namespace Yavsc.Model.FrontOffice
|
||||
public Basket ()
|
||||
{
|
||||
}
|
||||
|
||||
/// <Docs>The item to add to the current collection.</Docs>
|
||||
/// <para>Adds an item to the current collection.</para>
|
||||
/// <remarks>To be added.</remarks>
|
||||
/// <exception cref="System.NotSupportedException">The current collection is read-only.</exception>
|
||||
/// <summary>
|
||||
/// Add the specified cmd.
|
||||
/// </summary>
|
||||
/// <param name="cmd">Cmd.</param>
|
||||
public void Add(Commande cmd)
|
||||
{
|
||||
Add (cmd.Id, cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,12 +19,23 @@ namespace Yavsc.Model.FrontOffice
|
||||
/// </summary>
|
||||
/// <value>The brands.</value>
|
||||
public Brand[] Brands { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the brand.
|
||||
/// </summary>
|
||||
/// <returns>The brand.</returns>
|
||||
/// <param name="brandName">Brand name.</param>
|
||||
public Brand GetBrand(string brandName)
|
||||
{
|
||||
return Array.Find<Brand>(Brands, b => b.Name == brandName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds the brand.
|
||||
/// </summary>
|
||||
/// <returns>The brand.</returns>
|
||||
/// <param name="brandName">Brand name.</param>
|
||||
/// <param name="slogan">Slogan.</param>
|
||||
/// <param name="logo">Logo.</param>
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the brand.
|
||||
/// </summary>
|
||||
/// <returns><c>true</c>, if brand was removed, <c>false</c> otherwise.</returns>
|
||||
/// <param name="brandName">Brand name.</param>
|
||||
public bool RemoveBrand(string brandName)
|
||||
{
|
||||
Brand b = this.GetBrand (brandName);
|
||||
@ -51,10 +67,23 @@ namespace Yavsc.Model.FrontOffice
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the start date.
|
||||
/// </summary>
|
||||
/// <value>The start date.</value>
|
||||
public DateTime StartDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the end date.
|
||||
/// </summary>
|
||||
/// <value>The end date.</value>
|
||||
public DateTime EndDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Finds the product.
|
||||
/// </summary>
|
||||
/// <returns>The product.</returns>
|
||||
/// <param name="reference">Reference.</param>
|
||||
public Product FindProduct (string reference)
|
||||
{
|
||||
Product p = null;
|
||||
|
@ -12,9 +12,15 @@ namespace Yavsc.Model.FrontOffice
|
||||
/// </summary>
|
||||
public static class CatalogHelper
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the config.
|
||||
/// </summary>
|
||||
/// <value>The config.</value>
|
||||
public static CatalogProvidersConfigurationSection Config {get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Loads the config.
|
||||
/// </summary>
|
||||
public static void LoadConfig () {
|
||||
Config = ConfigurationManager.GetSection ("system.web/catalog") as CatalogProvidersConfigurationSection;
|
||||
if (Config == null)
|
||||
|
@ -8,6 +8,12 @@ namespace Yavsc.Model.FrontOffice
|
||||
public static class CatalogManager
|
||||
{
|
||||
private static CatalogProvider defaultProvider = null;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the catalog.
|
||||
/// </summary>
|
||||
/// <returns>The catalog.</returns>
|
||||
/// <param name="catalogUri">Catalog URI.</param>
|
||||
public static Catalog GetCatalog (string catalogUri)
|
||||
{
|
||||
|
||||
|
@ -9,6 +9,10 @@ namespace Yavsc.Model.FrontOffice
|
||||
/// </summary>
|
||||
public abstract class CatalogProvider: ProviderBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the catalog.
|
||||
/// </summary>
|
||||
/// <returns>The catalog.</returns>
|
||||
public abstract Catalog GetCatalog ();
|
||||
}
|
||||
}
|
||||
|
@ -2,23 +2,40 @@ using System;
|
||||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Check box.
|
||||
/// </summary>
|
||||
public class CheckBox : FormInput
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.CheckBox"/> class.
|
||||
/// </summary>
|
||||
public CheckBox ()
|
||||
{
|
||||
}
|
||||
|
||||
#region implemented abstract members of FormInput
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the type.
|
||||
/// </summary>
|
||||
/// <value>The type.</value>
|
||||
public override string Type {
|
||||
get {
|
||||
return "checkbox";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this <see cref="Yavsc.Model.FrontOffice.CheckBox"/> is value.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if value; otherwise, <c>false</c>.</value>
|
||||
public bool Value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Tos the html.
|
||||
/// </summary>
|
||||
/// <returns>The html.</returns>
|
||||
public override string ToHtml ()
|
||||
{
|
||||
return string.Format ("<input type=\"checkbox\" id=\"{0}\" name=\"{1}\" {2}/>", Id,Name,Value?"checked":"");
|
||||
|
@ -3,33 +3,55 @@ using System.Configuration;
|
||||
|
||||
namespace Yavsc.Model.FrontOffice.Configuration
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Catalog provider configuration element.
|
||||
/// </summary>
|
||||
public class CatalogProviderConfigurationElement : ConfigurationElement
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
[ConfigurationProperty("name", IsRequired = true, IsKey=true)]
|
||||
public string Name {
|
||||
get { return (string)this ["name"]; }
|
||||
set { this ["name"] = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the type.
|
||||
/// </summary>
|
||||
/// <value>The type.</value>
|
||||
[ConfigurationProperty("type", IsRequired = true)]
|
||||
public string Type {
|
||||
get { return (string)this ["type"]; }
|
||||
set { this ["type"] = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the connection.
|
||||
/// </summary>
|
||||
/// <value>The connection.</value>
|
||||
[ConfigurationProperty("connection")]
|
||||
public string Connection {
|
||||
get { return (string)this ["connection"]; }
|
||||
set { this ["connection"] = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the description.
|
||||
/// </summary>
|
||||
/// <value>The description.</value>
|
||||
[ConfigurationProperty("description")]
|
||||
public string Description {
|
||||
get { return (string)this ["description"]; }
|
||||
set { this ["description"] = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the application.
|
||||
/// </summary>
|
||||
/// <value>The name of the application.</value>
|
||||
[ConfigurationProperty("applicationName")]
|
||||
public string ApplicationName {
|
||||
get { return (string)this ["applicationName"]; }
|
||||
|
@ -4,18 +4,35 @@ using System.ComponentModel;
|
||||
|
||||
namespace Yavsc.Model.FrontOffice.Configuration
|
||||
{
|
||||
/// <summary>
|
||||
/// Catalog providers configuration collection.
|
||||
/// </summary>
|
||||
public class CatalogProvidersConfigurationCollection : ConfigurationElementCollection
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates the new element.
|
||||
/// </summary>
|
||||
/// <returns>The new element.</returns>
|
||||
protected override ConfigurationElement CreateNewElement ()
|
||||
{
|
||||
return new CatalogProviderConfigurationElement();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the element key.
|
||||
/// </summary>
|
||||
/// <returns>The element key.</returns>
|
||||
/// <param name="element">Element.</param>
|
||||
protected override object GetElementKey (ConfigurationElement element)
|
||||
{
|
||||
return ((CatalogProviderConfigurationElement) element).Name;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the element.
|
||||
/// </summary>
|
||||
/// <returns>The element.</returns>
|
||||
/// <param name="name">Name.</param>
|
||||
public CatalogProviderConfigurationElement GetElement (string name)
|
||||
{
|
||||
return this.BaseGet(name) as CatalogProviderConfigurationElement;
|
||||
|
@ -4,14 +4,25 @@ using System.ComponentModel;
|
||||
|
||||
namespace Yavsc.Model.FrontOffice.Configuration
|
||||
{
|
||||
/// <summary>
|
||||
/// Catalog providers configuration section.
|
||||
/// </summary>
|
||||
public class CatalogProvidersConfigurationSection : ConfigurationSection
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the default provider.
|
||||
/// </summary>
|
||||
/// <value>The default provider.</value>
|
||||
[ConfigurationProperty("defaultProvider")]
|
||||
public string DefaultProvider {
|
||||
get { return (string)base ["defaultProvider"]; }
|
||||
set { base ["defaultProvider"] = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the providers.
|
||||
/// </summary>
|
||||
/// <value>The providers.</value>
|
||||
[ConfigurationProperty("providers")]
|
||||
[ConfigurationCollection(typeof(CatalogProvidersConfigurationCollection),
|
||||
AddItemName = "add",
|
||||
|
@ -2,6 +2,9 @@ using System;
|
||||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Currency.
|
||||
/// </summary>
|
||||
public abstract class Currency: Unit
|
||||
{
|
||||
}
|
||||
|
@ -2,29 +2,54 @@ using System;
|
||||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Euro.
|
||||
/// </summary>
|
||||
public class Euro : Currency
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.Euro"/> class.
|
||||
/// </summary>
|
||||
public Euro ()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
public override string Name {
|
||||
get {
|
||||
return "Euro";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the description.
|
||||
/// </summary>
|
||||
/// <value>The description.</value>
|
||||
public override string Description {
|
||||
get {
|
||||
return "European currency";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Maies the convert to.
|
||||
/// </summary>
|
||||
/// <returns><c>true</c>, if convert to was mayed, <c>false</c> otherwise.</returns>
|
||||
/// <param name="other">Other.</param>
|
||||
public override bool MayConvertTo (Unit other)
|
||||
{
|
||||
return other.GetType().IsSubclassOf(typeof (Currency));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts to.
|
||||
/// </summary>
|
||||
/// <returns>The to.</returns>
|
||||
/// <param name="dest">Destination.</param>
|
||||
/// <param name="value">Value.</param>
|
||||
public override object ConvertTo (Unit dest, object value)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
@ -2,9 +2,16 @@ using System;
|
||||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Files input.
|
||||
/// </summary>
|
||||
public class FilesInput : FormInput
|
||||
{
|
||||
#region implemented abstract members of FormInput
|
||||
/// <summary>
|
||||
/// Gets the type.
|
||||
/// </summary>
|
||||
/// <value>The type.</value>
|
||||
public override string Type {
|
||||
get {
|
||||
return "file";
|
||||
@ -12,10 +19,17 @@ namespace Yavsc.Model.FrontOffice
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.FilesInput"/> class.
|
||||
/// </summary>
|
||||
public FilesInput ()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tos the html.
|
||||
/// </summary>
|
||||
/// <returns>The html.</returns>
|
||||
public override string ToHtml ()
|
||||
{
|
||||
return string.Format ("<input type=\"file\" id=\"{0}\" name=\"{0}\"/>", Id);
|
||||
|
@ -2,8 +2,15 @@ using System;
|
||||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Form element.
|
||||
/// </summary>
|
||||
public abstract class FormElement
|
||||
{
|
||||
/// <summary>
|
||||
/// Tos the html.
|
||||
/// </summary>
|
||||
/// <returns>The html.</returns>
|
||||
public abstract string ToHtml ();
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,9 @@ using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Form input.
|
||||
/// </summary>
|
||||
public abstract class FormInput: FormElement
|
||||
{
|
||||
/// <summary>
|
||||
@ -15,10 +18,18 @@ namespace Yavsc.Model.FrontOffice
|
||||
[StringLength(256)]
|
||||
public string Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the type.
|
||||
/// </summary>
|
||||
/// <value>The type.</value>
|
||||
public abstract string Type { get; }
|
||||
|
||||
private string name=null;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
[StringLength(256)]
|
||||
public string Name { get { return name == null ? Id : name; } set { name = value; } }
|
||||
|
||||
|
@ -2,13 +2,23 @@ using System;
|
||||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Label.
|
||||
/// </summary>
|
||||
public class Label:FormElement
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.Label"/> class.
|
||||
/// </summary>
|
||||
public Label ()
|
||||
{
|
||||
}
|
||||
string Text { get; set; }
|
||||
string For { get; set ; }
|
||||
/// <summary>
|
||||
/// Tos the html.
|
||||
/// </summary>
|
||||
/// <returns>The html.</returns>
|
||||
public override string ToHtml ()
|
||||
{
|
||||
return string.Format ("<label for=\"{0}\">{1}</label>", For, Text);
|
||||
|
@ -3,11 +3,22 @@ using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Link.
|
||||
/// </summary>
|
||||
public class Link:Label
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.Link"/> class.
|
||||
/// </summary>
|
||||
public Link ()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the reference.
|
||||
/// </summary>
|
||||
/// <value>The reference.</value>
|
||||
[Required]
|
||||
public string Ref { get; set; }
|
||||
}
|
||||
|
@ -2,8 +2,15 @@ using System;
|
||||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Note.
|
||||
/// </summary>
|
||||
public class Note:Text
|
||||
{
|
||||
/// <summary>
|
||||
/// Tos the html.
|
||||
/// </summary>
|
||||
/// <returns>The html.</returns>
|
||||
public override string ToHtml ()
|
||||
{
|
||||
return string.Format("<quote>{0}</quote>",Val);
|
||||
|
@ -2,14 +2,31 @@ using System;
|
||||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Option.
|
||||
/// </summary>
|
||||
public class Option : FormElement
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.Option"/> class.
|
||||
/// </summary>
|
||||
public Option ()
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets or sets the value.
|
||||
/// </summary>
|
||||
/// <value>The value.</value>
|
||||
public string Value { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the text.
|
||||
/// </summary>
|
||||
/// <value>The text.</value>
|
||||
public string Text { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Tos the html.
|
||||
/// </summary>
|
||||
/// <returns>The html.</returns>
|
||||
public override string ToHtml ()
|
||||
{
|
||||
return string.Format ("<option value=\"{0}\">{1}</option>\n",Value,Text);
|
||||
|
@ -2,12 +2,26 @@ using System;
|
||||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Period.
|
||||
/// </summary>
|
||||
public class Period
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.Period"/> class.
|
||||
/// </summary>
|
||||
public Period ()
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets or sets the start date.
|
||||
/// </summary>
|
||||
/// <value>The start date.</value>
|
||||
public DateTime StartDate { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the end date.
|
||||
/// </summary>
|
||||
/// <value>The end date.</value>
|
||||
public DateTime EndDate { get; set; }
|
||||
|
||||
}
|
||||
|
@ -2,13 +2,27 @@ using System;
|
||||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Physical product.
|
||||
/// </summary>
|
||||
public class PhysicalProduct : Product
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.PhysicalProduct"/> class.
|
||||
/// </summary>
|
||||
public PhysicalProduct ()
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets or sets the unitary price.
|
||||
/// </summary>
|
||||
/// <value>The unitary price.</value>
|
||||
public Price UnitaryPrice { get; set; }
|
||||
#region implemented abstract members of Product
|
||||
/// <summary>
|
||||
/// Gets the sales conditions.
|
||||
/// </summary>
|
||||
/// <returns>The sales conditions.</returns>
|
||||
public override string[] GetSalesConditions ()
|
||||
{
|
||||
return new string [] { string.Format(
|
||||
@ -17,7 +31,10 @@ namespace Yavsc.Model.FrontOffice
|
||||
UnitaryPrice.Unit.Name) };
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Returns a <see cref="System.String"/> that represents the current <see cref="Yavsc.Model.FrontOffice.PhysicalProduct"/>.
|
||||
/// </summary>
|
||||
/// <returns>A <see cref="System.String"/> that represents the current <see cref="Yavsc.Model.FrontOffice.PhysicalProduct"/>.</returns>
|
||||
public override string ToString ()
|
||||
{
|
||||
return string.Format ("[PhysicalProduct: Reference:{0} UnitaryPrice={1}]", Reference, UnitaryPrice);
|
||||
|
@ -2,8 +2,14 @@ using System;
|
||||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Price.
|
||||
/// </summary>
|
||||
public class Price: Scalar
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.Price"/> class.
|
||||
/// </summary>
|
||||
public Price ()
|
||||
{
|
||||
}
|
||||
@ -11,6 +17,10 @@ namespace Yavsc.Model.FrontOffice
|
||||
decimal quantity;
|
||||
|
||||
#region implemented abstract members of SalesCatalog.Value
|
||||
/// <summary>
|
||||
/// Gets or sets the quantity.
|
||||
/// </summary>
|
||||
/// <value>The quantity.</value>
|
||||
public override object Quantity {
|
||||
get {
|
||||
return quantity;
|
||||
@ -21,6 +31,10 @@ namespace Yavsc.Model.FrontOffice
|
||||
}
|
||||
|
||||
Currency curr;
|
||||
/// <summary>
|
||||
/// Gets or sets the unit.
|
||||
/// </summary>
|
||||
/// <value>The unit.</value>
|
||||
public override Unit Unit {
|
||||
get {
|
||||
return curr;
|
||||
|
@ -24,14 +24,38 @@ namespace Yavsc.Model.FrontOffice
|
||||
/// </summary>
|
||||
/// <value>The description.</value>
|
||||
public string Description { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the images.
|
||||
/// </summary>
|
||||
/// <value>The images.</value>
|
||||
public ProductImage[] Images { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the command form.
|
||||
/// </summary>
|
||||
/// <value>The command form.</value>
|
||||
public SaleForm CommandForm { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the reference.
|
||||
/// </summary>
|
||||
/// <value>The reference.</value>
|
||||
[Required]
|
||||
[StringLength(255)]
|
||||
public string Reference { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the command validity dates.
|
||||
/// </summary>
|
||||
/// <value>The command validity dates.</value>
|
||||
public Period CommandValidityDates { get; set; }
|
||||
/// <summary>
|
||||
/// Gets the sales conditions.
|
||||
/// </summary>
|
||||
/// <returns>The sales conditions.</returns>
|
||||
public abstract string[] GetSalesConditions();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the type.
|
||||
/// </summary>
|
||||
/// <value>The type.</value>
|
||||
public virtual string Type { get { return GetType().Name; }
|
||||
}
|
||||
}
|
||||
|
@ -2,18 +2,52 @@ using System;
|
||||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Product category.
|
||||
/// </summary>
|
||||
public class ProductCategory
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.ProductCategory"/> class.
|
||||
/// </summary>
|
||||
public ProductCategory ()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
public string Name { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the reference.
|
||||
/// </summary>
|
||||
/// <value>The reference.</value>
|
||||
public string Reference { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the products.
|
||||
/// </summary>
|
||||
/// <value>The products.</value>
|
||||
public Product[] Products { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the product by.
|
||||
/// </summary>
|
||||
/// <returns>The product by name.</returns>
|
||||
/// <param name="productName">Product name.</param>
|
||||
public Product GetProductByName (string productName)
|
||||
{
|
||||
return Array.Find<Product> (Products, p => p.Name == productName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the product.
|
||||
/// </summary>
|
||||
/// <returns>The product.</returns>
|
||||
/// <param name="reference">Reference.</param>
|
||||
public Product GetProduct (string reference)
|
||||
{
|
||||
return Array.Find<Product> (Products, p => p.Reference == reference);
|
||||
|
@ -2,21 +2,39 @@ using System;
|
||||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Product image.
|
||||
/// </summary>
|
||||
public class ProductImage: FormElement
|
||||
{
|
||||
#region implemented abstract members of FormElement
|
||||
|
||||
/// <summary>
|
||||
/// Tos the html.
|
||||
/// </summary>
|
||||
/// <returns>The html.</returns>
|
||||
public override string ToHtml ()
|
||||
{
|
||||
return string.Format ("<img src=\"\" alt=\"\"/>", Src, Alt);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.ProductImage"/> class.
|
||||
/// </summary>
|
||||
public ProductImage ()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the source.
|
||||
/// </summary>
|
||||
/// <value>The source.</value>
|
||||
public string Src { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the alternate.
|
||||
/// </summary>
|
||||
/// <value>The alternate.</value>
|
||||
public string Alt { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -2,22 +2,40 @@ using System;
|
||||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Radio button.
|
||||
/// </summary>
|
||||
public class RadioButton:FormInput
|
||||
{
|
||||
#region implemented abstract members of FormInput
|
||||
|
||||
/// <summary>
|
||||
/// Gets the type.
|
||||
/// </summary>
|
||||
/// <value>The type.</value>
|
||||
public override string Type {
|
||||
get {
|
||||
return "radio";
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.RadioButton"/> class.
|
||||
/// </summary>
|
||||
public RadioButton ()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the choice.
|
||||
/// </summary>
|
||||
/// <value>The choice.</value>
|
||||
public string Choice { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Tos the html.
|
||||
/// </summary>
|
||||
/// <returns>The html.</returns>
|
||||
public override string ToHtml ()
|
||||
{
|
||||
return string.Format ("<input type=\"radio\" id=\"{0}\" name=\"{1}\" value=\"{2}\"/><label for=\"{0}\">{2}</label>", Id,Name,Choice);
|
||||
|
@ -3,6 +3,9 @@ using System.Collections.Generic;
|
||||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Sale form.
|
||||
/// </summary>
|
||||
public class SaleForm
|
||||
{
|
||||
/// <summary>
|
||||
@ -14,6 +17,9 @@ namespace Yavsc.Model.FrontOffice
|
||||
/// <value>The catalog reference.</value>
|
||||
public string CatalogReference { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.SaleForm"/> class.
|
||||
/// </summary>
|
||||
public SaleForm ()
|
||||
{
|
||||
}
|
||||
|
@ -2,12 +2,26 @@ using System;
|
||||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Scalar.
|
||||
/// </summary>
|
||||
public abstract class Scalar
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.Scalar"/> class.
|
||||
/// </summary>
|
||||
public Scalar ()
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets or sets the quantity.
|
||||
/// </summary>
|
||||
/// <value>The quantity.</value>
|
||||
public abstract object Quantity { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the unit.
|
||||
/// </summary>
|
||||
/// <value>The unit.</value>
|
||||
public abstract Unit Unit{ get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -4,10 +4,16 @@ using System.Web.Mvc;
|
||||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Select input.
|
||||
/// </summary>
|
||||
public class SelectInput: FormInput
|
||||
{
|
||||
#region implemented abstract members of FormInput
|
||||
|
||||
/// <summary>
|
||||
/// Gets the type.
|
||||
/// </summary>
|
||||
/// <value>The type.</value>
|
||||
public override string Type {
|
||||
get {
|
||||
return "select";
|
||||
@ -15,9 +21,20 @@ namespace Yavsc.Model.FrontOffice
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// The items.
|
||||
/// </summary>
|
||||
public Option[] Items;
|
||||
|
||||
/// <summary>
|
||||
/// The index of the selected.
|
||||
/// </summary>
|
||||
public int SelectedIndex;
|
||||
|
||||
/// <summary>
|
||||
/// Tos the html.
|
||||
/// </summary>
|
||||
/// <returns>The html.</returns>
|
||||
public override string ToHtml ()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder ();
|
||||
|
@ -2,17 +2,33 @@ using System;
|
||||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Select item.
|
||||
/// </summary>
|
||||
public class SelectItem
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.SelectItem"/> class.
|
||||
/// </summary>
|
||||
/// <param name="t">T.</param>
|
||||
public SelectItem(string t)
|
||||
{
|
||||
Value = t;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value.
|
||||
/// </summary>
|
||||
/// <value>The value.</value>
|
||||
public string Value { get; set; }
|
||||
|
||||
/// <param name="t">a SelectItem.</param>
|
||||
public static implicit operator string(SelectItem t)
|
||||
{
|
||||
return t.Value;
|
||||
}
|
||||
|
||||
/// <param name="t">a string.</param>
|
||||
public static implicit operator SelectItem(string t)
|
||||
{
|
||||
return new SelectItem(t);
|
||||
|
@ -2,15 +2,29 @@ using System;
|
||||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Service.
|
||||
/// </summary>
|
||||
public class Service : Product
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.Service"/> class.
|
||||
/// </summary>
|
||||
public Service ()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the hour price.
|
||||
/// </summary>
|
||||
/// <value>The hour price.</value>
|
||||
public Price HourPrice { get; set; }
|
||||
|
||||
#region implemented abstract members of Product
|
||||
/// <summary>
|
||||
/// Gets the sales conditions.
|
||||
/// </summary>
|
||||
/// <returns>The sales conditions.</returns>
|
||||
public override string [] GetSalesConditions ()
|
||||
{
|
||||
return new string [] { string.Format(
|
||||
@ -19,6 +33,11 @@ namespace Yavsc.Model.FrontOffice
|
||||
HourPrice.Unit.Name) } ;
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Returns a <see cref="System.String"/> that represents the current <see cref="Yavsc.Model.FrontOffice.Service"/>.
|
||||
/// </summary>
|
||||
/// <returns>A <see cref="System.String"/> that represents the current <see cref="Yavsc.Model.FrontOffice.Service"/>.</returns>
|
||||
public override string ToString ()
|
||||
{
|
||||
return string.Format ("[Service: HourPrice={0}]", HourPrice);
|
||||
|
@ -2,10 +2,38 @@ using System;
|
||||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
public enum StockStatus
|
||||
/// <summary>
|
||||
/// Stock status.
|
||||
/// </summary>
|
||||
public enum StockStatus:int
|
||||
{
|
||||
NoStock,
|
||||
InStock
|
||||
/// <summary>
|
||||
/// not in the catalog.
|
||||
/// </summary>
|
||||
NonExistent, //
|
||||
/// <summary>
|
||||
/// Service resources are not immediatly available.
|
||||
/// </summary>
|
||||
NotAvailable, //
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
EstimateRequired,
|
||||
/// <summary>
|
||||
/// 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
|
||||
/// </summary>
|
||||
Available,
|
||||
/// <summary>
|
||||
/// This service is closed, or this product is no more available in stock.
|
||||
/// </summary>
|
||||
Spent
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,13 +2,24 @@ using System;
|
||||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Text.
|
||||
/// </summary>
|
||||
public class Text: FormElement
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the value.
|
||||
/// </summary>
|
||||
/// <value>The value.</value>
|
||||
public string Val {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tos the html.
|
||||
/// </summary>
|
||||
/// <returns>The html.</returns>
|
||||
public override string ToHtml ()
|
||||
{
|
||||
return Val;
|
||||
|
@ -2,29 +2,45 @@ using System;
|
||||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Text input.
|
||||
/// </summary>
|
||||
public class TextInput:FormInput
|
||||
{
|
||||
|
||||
#region implemented abstract members of FormInput
|
||||
private string tpe = null;
|
||||
/// <summary>
|
||||
/// Gets the type.
|
||||
/// </summary>
|
||||
/// <value>The type.</value>
|
||||
public override string Type {
|
||||
get {
|
||||
return tpe;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.TextInput"/> class.
|
||||
/// </summary>
|
||||
public TextInput ()
|
||||
{
|
||||
tpe = "text";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.TextInput"/> class.
|
||||
/// </summary>
|
||||
/// <param name="txt">Text.</param>
|
||||
public TextInput (string txt)
|
||||
{
|
||||
tpe = "text";
|
||||
text = txt;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.TextInput"/> class.
|
||||
/// </summary>
|
||||
/// <param name="type">Type.</param>
|
||||
/// <param name="txt">Text.</param>
|
||||
public TextInput (string type, string txt)
|
||||
{
|
||||
tpe = type;
|
||||
@ -33,17 +49,20 @@ namespace Yavsc.Model.FrontOffice
|
||||
|
||||
string text = null;
|
||||
|
||||
|
||||
/// <param name="t">T.</param>
|
||||
public static implicit operator string(TextInput t)
|
||||
{
|
||||
return t.text;
|
||||
}
|
||||
|
||||
/// <param name="t">T.</param>
|
||||
public static implicit operator TextInput(string t)
|
||||
{
|
||||
return new TextInput(t);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the default value.
|
||||
/// </summary>
|
||||
/// <value>The default value.</value>
|
||||
public string DefaultValue {
|
||||
get {
|
||||
return text;
|
||||
@ -54,8 +73,17 @@ namespace Yavsc.Model.FrontOffice
|
||||
}
|
||||
|
||||
private bool multiline = false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this <see cref="Yavsc.Model.FrontOffice.TextInput"/> multi line.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if multi line; otherwise, <c>false</c>.</value>
|
||||
public bool MultiLine { get { return multiline; } set { multiline = value; } }
|
||||
|
||||
/// <summary>
|
||||
/// Tos the html.
|
||||
/// </summary>
|
||||
/// <returns>The html.</returns>
|
||||
public override string ToHtml ()
|
||||
{
|
||||
|
||||
|
@ -2,11 +2,33 @@ using System;
|
||||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
/// <summary>
|
||||
/// Unit.
|
||||
/// </summary>
|
||||
public abstract class Unit
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
public abstract string Name { get; }
|
||||
/// <summary>
|
||||
/// Gets the description.
|
||||
/// </summary>
|
||||
/// <value>The description.</value>
|
||||
public abstract string Description { get; }
|
||||
/// <summary>
|
||||
/// Converts to.
|
||||
/// </summary>
|
||||
/// <returns>The to.</returns>
|
||||
/// <param name="dest">Destination.</param>
|
||||
/// <param name="value">Value.</param>
|
||||
public abstract object ConvertTo (Unit dest, object value);
|
||||
/// <summary>
|
||||
/// Maies the convert to.
|
||||
/// </summary>
|
||||
/// <returns><c>true</c>, if convert to was mayed, <c>false</c> otherwise.</returns>
|
||||
/// <param name="other">Other.</param>
|
||||
public abstract bool MayConvertTo (Unit other);
|
||||
}
|
||||
}
|
||||
|
35
yavscModel/FrontOffice/CommandStatus.cs
Normal file
35
yavscModel/FrontOffice/CommandStatus.cs
Normal file
@ -0,0 +1,35 @@
|
||||
//
|
||||
// CommandStatus.cs
|
||||
//
|
||||
// Author:
|
||||
// Paul Schneider <paulschneider@free.fr>
|
||||
//
|
||||
// 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 <http://www.gnu.org/licenses/>.
|
||||
using System;
|
||||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
public enum CommandStatus:int
|
||||
{
|
||||
Inserted,
|
||||
UserValidated,
|
||||
UserCanceled,
|
||||
ExecutionPending,
|
||||
Satisfied,
|
||||
Refunded
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
/// <value>The identifier.</value>
|
||||
public long Id { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the prod reference.
|
||||
/// Gets or sets the product reference.
|
||||
/// </summary>
|
||||
/// <value>The prod reference.</value>
|
||||
public string ProdRef { get; set; }
|
||||
public CommandStatus Status { get; set; }
|
||||
public string ProductRef { get; set; }
|
||||
/// <summary>
|
||||
/// The parameters.
|
||||
/// </summary>
|
||||
public StringDictionary Parameters = new StringDictionary();
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.Commande"/> class.
|
||||
/// </summary>
|
||||
public Commande() {
|
||||
|
||||
FileInfoCollection Files {
|
||||
get {
|
||||
return GetFSM().GetFiles (Id.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create the specified collection.
|
||||
/// Create a command using the specified collection
|
||||
/// as command parameters, handles the request files.
|
||||
/// </summary>
|
||||
/// <param name="collection">Collection.</param>
|
||||
public static Commande Create(NameValueCollection collection)
|
||||
/// <param name="files">Files.</param>
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
24
yavscModel/FrontOffice/WebFileInfoCollection.cs
Normal file
24
yavscModel/FrontOffice/WebFileInfoCollection.cs
Normal file
@ -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<WebFileInfo>
|
||||
{
|
||||
public WebFileInfoCollection (
|
||||
HttpContextBase context, string prefix)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -24,34 +24,64 @@ using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Yavsc.Model.Google
|
||||
{
|
||||
/// <summary>
|
||||
/// Ask for A date.
|
||||
/// </summary>
|
||||
public class AskForADate
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.Google.AskForADate"/> class.
|
||||
/// </summary>
|
||||
public AskForADate ()
|
||||
{
|
||||
MinDate = MaxDate = DateTime.Now.AddMinutes (5);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the minimum date.
|
||||
/// </summary>
|
||||
/// <value>The minimum date.</value>
|
||||
[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; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the max date.
|
||||
/// </summary>
|
||||
/// <value>The max date.</value>
|
||||
[Display(Name="MaxDate",ResourceType=typeof(LocalizedText))]
|
||||
[DataType(DataType.Date)]
|
||||
[DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}", ApplyFormatInEditMode = true)]
|
||||
public DateTime MaxDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the minimum time.
|
||||
/// </summary>
|
||||
/// <value>The minimum time.</value>
|
||||
[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; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the max time.
|
||||
/// </summary>
|
||||
/// <value>The max time.</value>
|
||||
[RegularExpression("\\d\\d:\\d\\d")]
|
||||
public string MaxTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the duration.
|
||||
/// </summary>
|
||||
/// <value>The duration.</value>
|
||||
[RegularExpression("\\d\\d:\\d\\d")]
|
||||
public string Duration { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the user.
|
||||
/// </summary>
|
||||
/// <value>The name of the user.</value>
|
||||
[Required(ErrorMessage="S'il vous plait, saisisser le pseudo de votre interlocuteur")]
|
||||
[Display(Name="Consultant",ResourceType=typeof(LocalizedText))]
|
||||
public string UserName { get; set; }
|
||||
|
@ -34,12 +34,34 @@ using Yavsc.Model;
|
||||
|
||||
namespace Yavsc.Model.Google
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Auth token.
|
||||
/// </summary>
|
||||
public class AuthToken {
|
||||
/// <summary>
|
||||
/// Gets or sets the access token.
|
||||
/// </summary>
|
||||
/// <value>The access token.</value>
|
||||
public string access_token { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the identifier token.
|
||||
/// </summary>
|
||||
/// <value>The identifier token.</value>
|
||||
public string id_token { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the expires in.
|
||||
/// </summary>
|
||||
/// <value>The expires in.</value>
|
||||
public int expires_in { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the type of the token.
|
||||
/// </summary>
|
||||
/// <value>The type of the token.</value>
|
||||
public string token_type { get; set ; }
|
||||
/// <summary>
|
||||
/// Gets or sets the refresh token.
|
||||
/// </summary>
|
||||
/// <value>The refresh token.</value>
|
||||
public string refresh_token { get; set; }
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// CalendarEntry.cs
|
||||
//
|
||||
// Author:
|
||||
@ -22,6 +22,9 @@ using System;
|
||||
|
||||
namespace Yavsc.Model.Google
|
||||
{
|
||||
/// <summary>
|
||||
/// Calendar entry list.
|
||||
/// </summary>
|
||||
public class CalendarEntryList
|
||||
{
|
||||
|
||||
|
@ -34,10 +34,29 @@ using Yavsc.Model;
|
||||
|
||||
namespace Yavsc.Model.Google
|
||||
{
|
||||
/// <summary>
|
||||
/// Calendar list.
|
||||
/// </summary>
|
||||
public class CalendarList {
|
||||
/// <summary>
|
||||
/// Gets or sets the kind.
|
||||
/// </summary>
|
||||
/// <value>The kind.</value>
|
||||
public string kind { get; set;}
|
||||
/// <summary>
|
||||
/// Gets or sets the etag.
|
||||
/// </summary>
|
||||
/// <value>The etag.</value>
|
||||
public string etag { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the next sync token.
|
||||
/// </summary>
|
||||
/// <value>The next sync token.</value>
|
||||
public string nextSyncToken { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the items.
|
||||
/// </summary>
|
||||
/// <value>The items.</value>
|
||||
public CalendarListEntry[] items { get; set; }
|
||||
}
|
||||
|
||||
|
@ -34,24 +34,89 @@ using Yavsc.Model;
|
||||
|
||||
namespace Yavsc.Model.Google
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Calendar list entry.
|
||||
/// </summary>
|
||||
public class CalendarListEntry {
|
||||
/// <summary>
|
||||
/// Gets or sets the kind.
|
||||
/// </summary>
|
||||
/// <value>The kind.</value>
|
||||
public string kind { get; set;}
|
||||
/// <summary>
|
||||
/// Gets or sets the etag.
|
||||
/// </summary>
|
||||
/// <value>The etag.</value>
|
||||
public string etag { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the identifier.
|
||||
/// </summary>
|
||||
/// <value>The identifier.</value>
|
||||
public string id { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the summary.
|
||||
/// </summary>
|
||||
/// <value>The summary.</value>
|
||||
public string summary { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the description.
|
||||
/// </summary>
|
||||
/// <value>The description.</value>
|
||||
public string description { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the time zone.
|
||||
/// </summary>
|
||||
/// <value>The time zone.</value>
|
||||
public string timeZone { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the color identifier.
|
||||
/// </summary>
|
||||
/// <value>The color identifier.</value>
|
||||
public string colorId { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the color of the background.
|
||||
/// </summary>
|
||||
/// <value>The color of the background.</value>
|
||||
public string backgroundColor { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the color of the foreground.
|
||||
/// </summary>
|
||||
/// <value>The color of the foreground.</value>
|
||||
public string foregroundColor { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this <see cref="Yavsc.Model.Google.CalendarListEntry"/> is selected.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if selected; otherwise, <c>false</c>.</value>
|
||||
public bool selected { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this <see cref="Yavsc.Model.Google.CalendarListEntry"/> is primary.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if primary; otherwise, <c>false</c>.</value>
|
||||
public bool primary { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the access role.
|
||||
/// </summary>
|
||||
/// <value>The access role.</value>
|
||||
public string accessRole { get; set; }
|
||||
/// <summary>
|
||||
/// Reminder.
|
||||
/// </summary>
|
||||
public class Reminder {
|
||||
/// <summary>
|
||||
/// Gets or sets the method.
|
||||
/// </summary>
|
||||
/// <value>The method.</value>
|
||||
public string method { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the minutes.
|
||||
/// </summary>
|
||||
/// <value>The minutes.</value>
|
||||
public int minutes { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets or sets the default reminders.
|
||||
/// </summary>
|
||||
/// <value>The default reminders.</value>
|
||||
public Reminder[] defaultReminders { get; set; }
|
||||
/* "notificationSettings": { "notifications":
|
||||
[ { "type": "eventCreation", "method": "email" },
|
||||
|
@ -34,38 +34,144 @@ using Yavsc.Model;
|
||||
|
||||
namespace Yavsc.Model.Google
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// People.
|
||||
/// </summary>
|
||||
public class People {
|
||||
/// <summary>
|
||||
/// Gets or sets the kind.
|
||||
/// </summary>
|
||||
/// <value>The kind.</value>
|
||||
public string kind { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the etag.
|
||||
/// </summary>
|
||||
/// <value>The etag.</value>
|
||||
public string etag { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the gender.
|
||||
/// </summary>
|
||||
/// <value>The gender.</value>
|
||||
public string gender { get; set; }
|
||||
/// <summary>
|
||||
/// E mail.
|
||||
/// </summary>
|
||||
public class EMail{
|
||||
/// <summary>
|
||||
/// Gets or sets the value.
|
||||
/// </summary>
|
||||
/// <value>The value.</value>
|
||||
public string value { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the type.
|
||||
/// </summary>
|
||||
/// <value>The type.</value>
|
||||
public string type { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets or sets the emails.
|
||||
/// </summary>
|
||||
/// <value>The emails.</value>
|
||||
public EMail[] emails { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the type of the object.
|
||||
/// </summary>
|
||||
/// <value>The type of the object.</value>
|
||||
public string objectType { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the identifier.
|
||||
/// </summary>
|
||||
/// <value>The identifier.</value>
|
||||
public string id { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the display name.
|
||||
/// </summary>
|
||||
/// <value>The display name.</value>
|
||||
public string displayName { get; set; }
|
||||
/// <summary>
|
||||
/// Name.
|
||||
/// </summary>
|
||||
public class Name {
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the family.
|
||||
/// </summary>
|
||||
/// <value>The name of the family.</value>
|
||||
public string familyName { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the given.
|
||||
/// </summary>
|
||||
/// <value>The name of the given.</value>
|
||||
public string givenName { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
public Name name { get; set;}
|
||||
/// <summary>
|
||||
/// Gets or sets the URL.
|
||||
/// </summary>
|
||||
/// <value>The URL.</value>
|
||||
public string url { get; set; }
|
||||
/// <summary>
|
||||
/// Image.
|
||||
/// </summary>
|
||||
public class Image {
|
||||
/// <summary>
|
||||
/// Gets or sets the URL.
|
||||
/// </summary>
|
||||
/// <value>The URL.</value>
|
||||
public string url { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this <see cref="Yavsc.Model.Google.People.Image"/> is default.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if is default; otherwise, <c>false</c>.</value>
|
||||
public bool isDefault { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets or sets the image.
|
||||
/// </summary>
|
||||
/// <value>The image.</value>
|
||||
public Image image { get; set; }
|
||||
/// <summary>
|
||||
/// Place.
|
||||
/// </summary>
|
||||
public class Place {
|
||||
/// <summary>
|
||||
/// Gets or sets the value.
|
||||
/// </summary>
|
||||
/// <value>The value.</value>
|
||||
public string value { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this <see cref="Yavsc.Model.Google.People.Place"/> is primary.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if primary; otherwise, <c>false</c>.</value>
|
||||
public bool primary { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets or sets the places lived.
|
||||
/// </summary>
|
||||
/// <value>The places lived.</value>
|
||||
public Place[] placesLived { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this <see cref="Yavsc.Model.Google.People"/> is plus user.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if is plus user; otherwise, <c>false</c>.</value>
|
||||
public bool isPlusUser { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the language.
|
||||
/// </summary>
|
||||
/// <value>The language.</value>
|
||||
public string language { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the circled by count.
|
||||
/// </summary>
|
||||
/// <value>The circled by count.</value>
|
||||
public int circledByCount { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this <see cref="Yavsc.Model.Google.People"/> is verified.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if verified; otherwise, <c>false</c>.</value>
|
||||
public bool verified { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -22,11 +22,24 @@ using System;
|
||||
|
||||
namespace Yavsc.Model.Google
|
||||
{
|
||||
/// <summary>
|
||||
/// Sign in.
|
||||
/// </summary>
|
||||
public class SignIn
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the user.
|
||||
/// </summary>
|
||||
/// <value>The name of the user.</value>
|
||||
public string UserName { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the email.
|
||||
/// </summary>
|
||||
/// <value>The email.</value>
|
||||
public string Email { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.Google.SignIn"/> class.
|
||||
/// </summary>
|
||||
public SignIn ()
|
||||
{
|
||||
}
|
||||
|
@ -6,6 +6,9 @@ using System.Web.Mvc;
|
||||
|
||||
namespace Yavsc.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// I module.
|
||||
/// </summary>
|
||||
public interface IModule
|
||||
{
|
||||
/// <summary>
|
||||
@ -15,11 +18,16 @@ namespace Yavsc.Model
|
||||
void Install(IDbConnection cnx);
|
||||
/// <summary>
|
||||
/// Uninstall the module data and data model from
|
||||
/// database, using the specified cnx.
|
||||
/// database, using the specified connection.
|
||||
/// </summary>
|
||||
/// <param name="cnx">Cnx.</param>
|
||||
/// <param name="removeConfig">If set to <c>true</c> remove config.</param>
|
||||
void Uninstall(IDbConnection cnx, bool removeConfig);
|
||||
/// <summary>
|
||||
/// Initialize this object using the specified name and config.
|
||||
/// </summary>
|
||||
/// <param name="name">Name.</param>
|
||||
/// <param name="config">Config.</param>
|
||||
void Initialize (string name, NameValueCollection config);
|
||||
}
|
||||
}
|
||||
|
@ -27,10 +27,21 @@ using System.Web.Mvc;
|
||||
|
||||
namespace Yavsc.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// I renderer.
|
||||
/// </summary>
|
||||
public interface IRenderer {
|
||||
// Should set ViewData["Message|Author|Body"]
|
||||
// and return an ActionResult
|
||||
/// <summary>
|
||||
/// Get the specified c.
|
||||
/// </summary>
|
||||
/// <param name="c">C.</param>
|
||||
object Get(Controller c);
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
string Name { get; set; }
|
||||
}
|
||||
|
||||
|
@ -27,14 +27,31 @@ using System.Web.Mvc;
|
||||
|
||||
namespace Yavsc.Model
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// I tag handler.
|
||||
/// </summary>
|
||||
public interface ITagHandler {
|
||||
// Should set ViewData["Tags"] with
|
||||
// an array of rendered tags
|
||||
|
||||
/// <summary>
|
||||
/// Backup this instance.
|
||||
/// Should set ViewData["Tags"] with
|
||||
/// an array of rendered tags
|
||||
/// </summary>
|
||||
void Backup();
|
||||
|
||||
/// <summary>
|
||||
/// Restore this instance.
|
||||
/// </summary>
|
||||
void Restore();
|
||||
|
||||
/// <summary>
|
||||
/// Invoke this instance.
|
||||
/// </summary>
|
||||
void Invoke();
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
string Name { get; set; }
|
||||
|
||||
}
|
||||
|
@ -27,13 +27,12 @@ using System.Web.Mvc;
|
||||
|
||||
namespace Yavsc.Model
|
||||
{
|
||||
|
||||
public interface IViewRenderer : IRenderer {
|
||||
|
||||
// IRenderer.Get() Should set ViewData["Message|Author|Body"]
|
||||
// and return an ActionResult
|
||||
/// <summary>
|
||||
/// Gets the template route part
|
||||
/// I view renderer.
|
||||
/// </summary>
|
||||
public interface IViewRenderer : IRenderer {
|
||||
/// <summary>
|
||||
/// Gets the template route part.
|
||||
/// </summary>
|
||||
/// <value>The template.</value>
|
||||
string Template { get; }
|
||||
|
@ -4,18 +4,33 @@ using System.ComponentModel;
|
||||
|
||||
namespace Yavsc.Model.RolesAndMembers
|
||||
{
|
||||
/// <summary>
|
||||
/// Login model.
|
||||
/// </summary>
|
||||
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]|[-_.~])+")]
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the user.
|
||||
/// </summary>
|
||||
/// <value>The name of the user.</value>
|
||||
[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]|[-_.~#{}`'\\^])+")]
|
||||
/// <summary>
|
||||
/// Gets or sets the password.
|
||||
/// </summary>
|
||||
/// <value>The password.</value>
|
||||
[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; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this <see cref="Yavsc.Model.RolesAndMembers.LoginModel"/> remember me.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if remember me; otherwise, <c>false</c>.</value>
|
||||
[Display(Name = "Remember_me",ResourceType=typeof(LocalizedText))]
|
||||
public bool RememberMe { get; set; }
|
||||
}
|
||||
|
@ -3,10 +3,17 @@ using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Yavsc.Model.RolesAndMembers
|
||||
{
|
||||
/// <summary>
|
||||
/// New admin model.
|
||||
/// </summary>
|
||||
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")]
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the user about to become Admin.
|
||||
/// </summary>
|
||||
/// <value>The name of the user.</value>
|
||||
[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 ; }
|
||||
}
|
||||
}
|
||||
|
@ -4,8 +4,15 @@ using System.ComponentModel;
|
||||
|
||||
namespace Yavsc.Model.RolesAndMembers
|
||||
{
|
||||
/// <summary>
|
||||
/// New role model.
|
||||
/// </summary>
|
||||
public class NewRoleModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the role.
|
||||
/// </summary>
|
||||
/// <value>The name of the role.</value>
|
||||
[Required]
|
||||
[StringLength(255)]
|
||||
[DisplayName("Nom du rôle")]
|
||||
|
@ -7,82 +7,167 @@ using System.Web;
|
||||
|
||||
namespace Yavsc.Model.RolesAndMembers
|
||||
{
|
||||
/// <summary>
|
||||
/// Profile.
|
||||
/// </summary>
|
||||
public class Profile
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
[DisplayName ("Nom complet")]
|
||||
[StringLength (1024)]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the avatar.
|
||||
/// </summary>
|
||||
/// <value>The avatar.</value>
|
||||
[DisplayName("Avatar")]
|
||||
public string avatar { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the address.
|
||||
/// </summary>
|
||||
/// <value>The address.</value>
|
||||
[DisplayName ("Adresse")]
|
||||
[StringLength (2047)]
|
||||
public string Address { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the state of the city and.
|
||||
/// </summary>
|
||||
/// <value>The state of the city and.</value>
|
||||
[DisplayName ("Ville")]
|
||||
[StringLength (255)]
|
||||
public string CityAndState { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the zip code.
|
||||
/// </summary>
|
||||
/// <value>The zip code.</value>
|
||||
[DisplayName ("Code Postal")]
|
||||
[StringLength (9)]
|
||||
public string ZipCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the country.
|
||||
/// </summary>
|
||||
/// <value>The country.</value>
|
||||
[DisplayName ("Pays")]
|
||||
[StringLength (99)]
|
||||
public string Country { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the web site.
|
||||
/// </summary>
|
||||
/// <value>The web site.</value>
|
||||
[DisplayName ("Site Web")]
|
||||
[StringLength (255)]
|
||||
public string WebSite { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this <see cref="Yavsc.Model.RolesAndMembers.Profile"/> blog visible.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if blog visible; otherwise, <c>false</c>.</value>
|
||||
[DisplayName ("Blog visible")]
|
||||
public bool BlogVisible { get; set; }
|
||||
|
||||
private string blogTitle;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the blog title.
|
||||
/// </summary>
|
||||
/// <value>The blog title.</value>
|
||||
[DisplayName ("Titre du blog")]
|
||||
[StringLength (255)]
|
||||
public string BlogTitle { get { return blogTitle==null? Name+"'s blog":blogTitle; } set { blogTitle = value; } }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the phone number.
|
||||
/// </summary>
|
||||
/// <value>The phone.</value>
|
||||
[DisplayName ("Téléphone fixe")]
|
||||
[StringLength (15)]
|
||||
public string Phone { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the mobile.
|
||||
/// </summary>
|
||||
/// <value>The mobile.</value>
|
||||
[DisplayName ("Portable")]
|
||||
[StringLength (15)]
|
||||
public string Mobile { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the email.
|
||||
/// </summary>
|
||||
/// <value>The email.</value>
|
||||
[DisplayName ("E-mail")]
|
||||
[StringLength (1024)]
|
||||
public string Email { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the BI.
|
||||
/// </summary>
|
||||
/// <value>The BI.</value>
|
||||
[DisplayName ("Code BIC")]
|
||||
[StringLength (15)]
|
||||
public string BIC { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the IBA.
|
||||
/// </summary>
|
||||
/// <value>The IBA.</value>
|
||||
[DisplayName ("Code IBAN")]
|
||||
[StringLength (33)]
|
||||
public string IBAN { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the bank code.
|
||||
/// </summary>
|
||||
/// <value>The bank code.</value>
|
||||
[DisplayName ("Code Banque")]
|
||||
[StringLength (5)]
|
||||
public string BankCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the wicket code.
|
||||
/// </summary>
|
||||
/// <value>The wicket code.</value>
|
||||
[DisplayName ("Code Guichet")]
|
||||
[StringLength (5)]
|
||||
public string WicketCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the account number.
|
||||
/// </summary>
|
||||
/// <value>The account number.</value>
|
||||
[DisplayName ("Numéro de compte")]
|
||||
[StringLength (15)]
|
||||
public string AccountNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the banked key.
|
||||
/// </summary>
|
||||
/// <value>The banked key.</value>
|
||||
[DisplayName ("Clé RIB")]
|
||||
public int BankedKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the google calendar.
|
||||
/// </summary>
|
||||
/// <value>The google calendar.</value>
|
||||
[Display(Name="Google_calendar",ResourceType=typeof(LocalizedText))]
|
||||
public string GoogleCalendar { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this instance has bank account.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance has bank account; otherwise, <c>false</c>.</value>
|
||||
public bool HasBankAccount { get {
|
||||
return IsBillable
|
||||
&& !string.IsNullOrWhiteSpace (BankCode)
|
||||
@ -92,6 +177,10 @@ namespace Yavsc.Model.RolesAndMembers
|
||||
&& !string.IsNullOrWhiteSpace (AccountNumber)
|
||||
&& BankedKey != 0; } }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this instance is billable.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance is billable; otherwise, <c>false</c>.</value>
|
||||
public bool IsBillable {
|
||||
get {
|
||||
return !string.IsNullOrWhiteSpace (Name)
|
||||
@ -108,8 +197,16 @@ namespace Yavsc.Model.RolesAndMembers
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this <see cref="Yavsc.Model.RolesAndMembers.Profile"/> remember me.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if remember me; otherwise, <c>false</c>.</value>
|
||||
public bool RememberMe { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.RolesAndMembers.Profile"/> class.
|
||||
/// </summary>
|
||||
/// <param name="profile">Profile.</param>
|
||||
public Profile (ProfileBase profile)
|
||||
{
|
||||
object b = profile.GetPropertyValue ("BlogVisible");
|
||||
|
@ -4,19 +4,38 @@ using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Yavsc.Model.RolesAndMembers
|
||||
{
|
||||
/// <summary>
|
||||
/// Register view model.
|
||||
/// </summary>
|
||||
public class RegisterViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the user.
|
||||
/// </summary>
|
||||
/// <value>The name of the user.</value>
|
||||
[Localizable(true)]
|
||||
[Required(ErrorMessage = "S'il vous plait, entrez un nom d'utilisateur")]
|
||||
public string UserName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the password.
|
||||
/// </summary>
|
||||
/// <value>The password.</value>
|
||||
[DisplayName("Mot de passe")]
|
||||
[Required(ErrorMessage = "S'il vous plait, entez un mot de passe")]
|
||||
public string Password { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the confirm password.
|
||||
/// </summary>
|
||||
/// <value>The confirm password.</value>
|
||||
[DisplayName("Confirmation du mot de passe")]
|
||||
public string ConfirmPassword { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the email.
|
||||
/// </summary>
|
||||
/// <value>The email.</value>
|
||||
[DisplayName("Adresse e-mail")]
|
||||
[Required(ErrorMessage = "S'il vous plait, entrez un e-mail valide")]
|
||||
public string Email { get; set; }
|
||||
|
@ -22,19 +22,59 @@ using System;
|
||||
|
||||
namespace Yavsc.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// Rss feeds entry.
|
||||
/// </summary>
|
||||
public class RssFeedsEntry {
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the title.
|
||||
/// </summary>
|
||||
/// <value>The title.</value>
|
||||
public string Title { get ; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the description.
|
||||
/// </summary>
|
||||
/// <value>The description.</value>
|
||||
public string Description { get ; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the pub date.
|
||||
/// </summary>
|
||||
/// <value>The pub date.</value>
|
||||
public DateTime PubDate { get ; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the link.
|
||||
/// </summary>
|
||||
/// <value>The link.</value>
|
||||
public string Link { get ; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Rss feeds channel.
|
||||
/// </summary>
|
||||
public class RssFeedsChannel {
|
||||
/// <summary>
|
||||
/// Gets or sets the title.
|
||||
/// </summary>
|
||||
/// <value>The title.</value>
|
||||
public string Title { get ; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the description.
|
||||
/// </summary>
|
||||
/// <value>The description.</value>
|
||||
public string Description { get ; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the last build date.
|
||||
/// </summary>
|
||||
/// <value>The last build date.</value>
|
||||
public DateTime LastBuildDate { get ; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the link.
|
||||
/// </summary>
|
||||
/// <value>The link.</value>
|
||||
public string Link { get ; set; }
|
||||
/// <summary>
|
||||
/// The entries.
|
||||
/// </summary>
|
||||
public RssFeedsEntry[] Entries;
|
||||
}
|
||||
|
||||
|
@ -27,18 +27,34 @@ using System.Web.Mvc;
|
||||
|
||||
namespace Yavsc.Model
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// View renderer.
|
||||
/// </summary>
|
||||
public abstract class ViewRenderer<T> : IViewRenderer {
|
||||
#region IRenderer implementation
|
||||
/// <summary>
|
||||
/// Get the specified c.
|
||||
/// </summary>
|
||||
/// <param name="c">C.</param>
|
||||
public object Get (Controller c)
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the template route part.
|
||||
/// </summary>
|
||||
/// <value>The template.</value>
|
||||
public string Template {
|
||||
get {
|
||||
return "Tag.aspx";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
public string Name {
|
||||
get {
|
||||
throw new NotImplementedException ();
|
||||
|
@ -3,8 +3,15 @@ using System.Configuration;
|
||||
|
||||
namespace Yavsc.Model.WorkFlow.Configuration
|
||||
{
|
||||
/// <summary>
|
||||
/// WF provider.
|
||||
/// </summary>
|
||||
public class WFProvider:ConfigurationElement
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
[ConfigurationProperty("name", IsKey=true, IsRequired=true)]
|
||||
public string Name {
|
||||
get {
|
||||
@ -13,6 +20,10 @@ namespace Yavsc.Model.WorkFlow.Configuration
|
||||
set { base ["name"] = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the type.
|
||||
/// </summary>
|
||||
/// <value>The type.</value>
|
||||
[ConfigurationProperty("type")]
|
||||
public string Type {
|
||||
get { return (string) this ["type"]; }
|
||||
@ -20,6 +31,11 @@ namespace Yavsc.Model.WorkFlow.Configuration
|
||||
this ["type"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the application.
|
||||
/// </summary>
|
||||
/// <value>The name of the application.</value>
|
||||
[ConfigurationProperty("applicationName")]
|
||||
public string ApplicationName {
|
||||
get {
|
||||
@ -30,6 +46,10 @@ namespace Yavsc.Model.WorkFlow.Configuration
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the connection string.
|
||||
/// </summary>
|
||||
/// <value>The name of the connection string.</value>
|
||||
[ConfigurationProperty("connectionStringName")]
|
||||
public string ConnectionStringName {
|
||||
get { return (string)this ["connectionStringName"]; }
|
||||
|
@ -3,16 +3,33 @@ using System.Configuration;
|
||||
|
||||
namespace Yavsc.Model.WorkFlow.Configuration
|
||||
{
|
||||
/// <summary>
|
||||
/// WF provider collection.
|
||||
/// </summary>
|
||||
public class WFProviderCollection : ConfigurationElementCollection
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the element key.
|
||||
/// </summary>
|
||||
/// <returns>The element key.</returns>
|
||||
/// <param name="element">Element.</param>
|
||||
protected override object GetElementKey (ConfigurationElement element)
|
||||
{
|
||||
return ((WFProvider) element).Name;
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates the new element.
|
||||
/// </summary>
|
||||
/// <returns>The new element.</returns>
|
||||
protected override ConfigurationElement CreateNewElement ()
|
||||
{
|
||||
return new WFProvider();
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the element.
|
||||
/// </summary>
|
||||
/// <returns>The element.</returns>
|
||||
/// <param name="name">Name.</param>
|
||||
public WFProvider GetElement (string name)
|
||||
{
|
||||
return this.BaseGet (name) as WFProvider;
|
||||
|
@ -3,6 +3,9 @@ using System.Configuration;
|
||||
|
||||
namespace Yavsc.Model.WorkFlow.Configuration
|
||||
{
|
||||
/// <summary>
|
||||
/// Workflow configuration.
|
||||
/// </summary>
|
||||
public class WorkflowConfiguration : ConfigurationSection
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -4,26 +4,62 @@ using System.ComponentModel;
|
||||
|
||||
namespace Yavsc.Model.WorkFlow
|
||||
{
|
||||
/// <summary>
|
||||
/// Estimate.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class Estimate
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.WorkFlow.Estimate"/> class.
|
||||
/// </summary>
|
||||
public Estimate ()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the title.
|
||||
/// </summary>
|
||||
/// <value>The title.</value>
|
||||
[Required]
|
||||
[Display(ResourceType = typeof(LocalizedText),Name="Title")]
|
||||
public string Title { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the description.
|
||||
/// </summary>
|
||||
/// <value>The description.</value>
|
||||
[Required]
|
||||
[DisplayName("Description")]
|
||||
public string Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the responsible.
|
||||
/// </summary>
|
||||
/// <value>The responsible.</value>
|
||||
[Required]
|
||||
[DisplayName("Responsable")]
|
||||
public string Responsible { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the client.
|
||||
/// </summary>
|
||||
/// <value>The client.</value>
|
||||
[Required]
|
||||
[DisplayName("Client")]
|
||||
public string Client { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the identifier.
|
||||
/// </summary>
|
||||
/// <value>The identifier.</value>
|
||||
public long Id { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the ciffer.
|
||||
/// </summary>
|
||||
/// <value>The ciffer.</value>
|
||||
[Display(ResourceType = typeof(LocalizedText),Name="Ciffer")]
|
||||
public decimal Ciffer {
|
||||
get {
|
||||
@ -36,6 +72,10 @@ namespace Yavsc.Model.WorkFlow
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the lines.
|
||||
/// </summary>
|
||||
/// <value>The lines.</value>
|
||||
public Writting[] Lines { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -41,8 +41,10 @@ namespace Yavsc.Model.WorkFlow
|
||||
/// Creates the estimate.
|
||||
/// </summary>
|
||||
/// <returns>The estimate.</returns>
|
||||
/// <param name="responsible">Responsible.</param>
|
||||
/// <param name="client">Client.</param>
|
||||
/// <param name="title">Title.</param>
|
||||
/// <param name="description">Description.</param>
|
||||
Estimate CreateEstimate (string responsible, string client, string title, string description);
|
||||
/// <summary>
|
||||
/// Add a line to the specified estimate by id,
|
||||
@ -87,17 +89,16 @@ namespace Yavsc.Model.WorkFlow
|
||||
/// </summary>
|
||||
/// <param name="wrid">Wrid.</param>
|
||||
/// <param name="tag">Tag.</param>
|
||||
void DropTagWritting (long wrid,string tag);
|
||||
void DropWrittingTag (long wrid,string tag);
|
||||
/// <summary>
|
||||
/// Updates the writting.
|
||||
/// </summary>
|
||||
/// <param name="wr">Wr.</param>
|
||||
void UpdateWritting (Writting wr);
|
||||
/// <summary>
|
||||
/// Sets the title for a specified estimate by id.
|
||||
/// Updates the estimate.
|
||||
/// </summary>
|
||||
/// <param name="estid">Estid.</param>
|
||||
/// <param name="newTitle">New title.</param>
|
||||
/// <param name="estim">Estim.</param>
|
||||
void UpdateEstimate (Estimate estim);
|
||||
/// <summary>
|
||||
/// Sets the writting status.
|
||||
@ -119,6 +120,13 @@ namespace Yavsc.Model.WorkFlow
|
||||
/// <returns>The command id in db.</returns>
|
||||
/// <param name="com">COM.</param>
|
||||
long RegisterCommand (Commande com);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the stock status.
|
||||
/// </summary>
|
||||
/// <returns>The stock status.</returns>
|
||||
/// <param name="productReference">Product reference.</param>
|
||||
StockStatus GetStockStatus (string productReference);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,10 +6,23 @@ using System.Collections.Specialized;
|
||||
|
||||
namespace Yavsc.Model.WorkFlow
|
||||
{
|
||||
/// <summary>
|
||||
/// New estimate even arguments.
|
||||
/// </summary>
|
||||
public class NewEstimateEvenArgs: EventArgs
|
||||
{
|
||||
private Estimate data=null;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the data.
|
||||
/// </summary>
|
||||
/// <value>The data.</value>
|
||||
public Estimate Data{ get { return data; } }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.WorkFlow.NewEstimateEvenArgs"/> class.
|
||||
/// </summary>
|
||||
/// <param name="created">Created.</param>
|
||||
public NewEstimateEvenArgs(Estimate created)
|
||||
{
|
||||
data = created;
|
||||
|
@ -2,15 +2,32 @@ using System;
|
||||
|
||||
namespace Yavsc.Model.WorkFlow
|
||||
{
|
||||
/// <summary>
|
||||
/// Order status changed event arguments.
|
||||
/// </summary>
|
||||
public class OrderStatusChangedEventArgs: EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.WorkFlow.OrderStatusChangedEventArgs"/> class.
|
||||
/// </summary>
|
||||
/// <param name="oldstatus">Oldstatus.</param>
|
||||
/// <param name="newstatus">Newstatus.</param>
|
||||
/// <param name="reason">Reason.</param>
|
||||
public OrderStatusChangedEventArgs (int oldstatus, int newstatus, string reason)
|
||||
{
|
||||
oldstat = oldstatus;
|
||||
newstat = newstatus;
|
||||
}
|
||||
private int oldstat, newstat;
|
||||
/// <summary>
|
||||
/// Gets the old status.
|
||||
/// </summary>
|
||||
/// <value>The old status.</value>
|
||||
public int OldStatus { get { return oldstat; } }
|
||||
/// <summary>
|
||||
/// Gets the new status.
|
||||
/// </summary>
|
||||
/// <value>The new status.</value>
|
||||
public int NewStatus { get { return newstat; } }
|
||||
}
|
||||
}
|
||||
|
@ -4,8 +4,19 @@ using System.Web.Mvc;
|
||||
|
||||
namespace Yavsc.Model.WorkFlow
|
||||
{
|
||||
/// <summary>
|
||||
/// Status change.
|
||||
/// </summary>
|
||||
public class StatusChange {
|
||||
/// <summary>
|
||||
/// Gets or sets the status.
|
||||
/// </summary>
|
||||
/// <value>The status.</value>
|
||||
public int Status { get; set;}
|
||||
/// <summary>
|
||||
/// Gets or sets the date.
|
||||
/// </summary>
|
||||
/// <value>The date.</value>
|
||||
public DateTime date { get; set;}
|
||||
}
|
||||
}
|
||||
|
@ -14,13 +14,26 @@ namespace Yavsc.Model.WorkFlow
|
||||
/// </summary>
|
||||
public class WorkFlowManager
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the catalog.
|
||||
/// </summary>
|
||||
/// <value>The catalog.</value>
|
||||
public static Catalog Catalog { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Registers the command.
|
||||
/// </summary>
|
||||
/// <returns>The command.</returns>
|
||||
/// <param name="com">COM.</param>
|
||||
public long RegisterCommand(Commande com)
|
||||
{
|
||||
return ContentProvider.RegisterCommand (com);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the estimate.
|
||||
/// </summary>
|
||||
/// <param name="estim">Estim.</param>
|
||||
public void UpdateEstimate (Estimate estim)
|
||||
{
|
||||
ContentProvider.UpdateEstimate (estim);
|
||||
@ -34,27 +47,56 @@ namespace Yavsc.Model.WorkFlow
|
||||
{
|
||||
return ContentProvider.GetEstimate (estid);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the estimates.
|
||||
/// </summary>
|
||||
/// <returns>The estimates.</returns>
|
||||
/// <param name="client">Client.</param>
|
||||
public Estimate [] GetEstimates (string client)
|
||||
{
|
||||
return ContentProvider.GetEstimates (client);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the stock for a given product reference.
|
||||
/// </summary>
|
||||
/// <returns>The stock status.</returns>
|
||||
/// <param name="productReference">Product reference.</param>
|
||||
public StockStatus GetStock(string productReference)
|
||||
{
|
||||
return ContentProvider.GetStockStatus (productReference);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the writting.
|
||||
/// </summary>
|
||||
/// <param name="wr">Wr.</param>
|
||||
public void UpdateWritting (Writting wr)
|
||||
{
|
||||
ContentProvider.UpdateWritting (wr);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Drops the writting.
|
||||
/// </summary>
|
||||
/// <param name="wrid">Wrid.</param>
|
||||
public void DropWritting (long wrid)
|
||||
{
|
||||
ContentProvider.DropWritting (wrid);
|
||||
}
|
||||
/// <summary>
|
||||
/// Drops the estimate.
|
||||
/// </summary>
|
||||
/// <param name="estid">Estid.</param>
|
||||
public void DropEstimate (long estid)
|
||||
{
|
||||
ContentProvider.DropEstimate(estid);
|
||||
}
|
||||
IContentProvider contentProvider;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the content provider.
|
||||
/// </summary>
|
||||
/// <value>The content provider.</value>
|
||||
public IContentProvider ContentProvider {
|
||||
get {
|
||||
WorkflowConfiguration c = (WorkflowConfiguration) ConfigurationManager.GetSection ("system.web/workflow");
|
||||
@ -97,15 +139,25 @@ namespace Yavsc.Model.WorkFlow
|
||||
/// <summary>
|
||||
/// Creates the estimate.
|
||||
/// </summary>
|
||||
/// <returns>The estimate identifier.</returns>
|
||||
/// <returns>The estimate.</returns>
|
||||
/// <param name="responsible">Responsible.</param>
|
||||
/// <param name="client">Client.</param>
|
||||
/// <param name="title">Title.</param>
|
||||
|
||||
/// <param name="description">Description.</param>
|
||||
public Estimate CreateEstimate(string responsible, string client, string title, string description)
|
||||
{
|
||||
Estimate created = ContentProvider.CreateEstimate (responsible, client, title, description);
|
||||
return created;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write the specified estid, desc, ucost, count and productid.
|
||||
/// </summary>
|
||||
/// <param name="estid">Estid.</param>
|
||||
/// <param name="desc">Desc.</param>
|
||||
/// <param name="ucost">Ucost.</param>
|
||||
/// <param name="count">Count.</param>
|
||||
/// <param name="productid">Productid.</param>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the estimate status.
|
||||
/// </summary>
|
||||
/// <param name="estid">Estid.</param>
|
||||
/// <param name="status">Status.</param>
|
||||
/// <param name="username">Username.</param>
|
||||
public void SetEstimateStatus(long estid, int status, string username)
|
||||
{
|
||||
ContentProvider.SetEstimateStatus (estid, status, username);
|
||||
|
@ -47,7 +47,10 @@ namespace Yavsc.Model.WorkFlow
|
||||
[StringLength (2048)]
|
||||
[Display(ResourceType = typeof(LocalizedText),Name="Description")]
|
||||
public string Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns a <see cref="System.String"/> that represents the current <see cref="Yavsc.Model.WorkFlow.Writting"/>.
|
||||
/// </summary>
|
||||
/// <returns>A <see cref="System.String"/> that represents the current <see cref="Yavsc.Model.WorkFlow.Writting"/>.</returns>
|
||||
public override string ToString ()
|
||||
{
|
||||
return string.Format ("[Writting: Id={0}, UnitaryCost={1}, Count={2}, ProductReference={3}, Description={4}]", Id, UnitaryCost, Count, ProductReference, Description);
|
||||
|
@ -49,7 +49,6 @@
|
||||
<Compile Include="RolesAndMemebers\NewAdminModel.cs" />
|
||||
<Compile Include="RolesAndMemebers\NewRoleModel.cs" />
|
||||
<Compile Include="RolesAndMemebers\RegisterViewModel.cs" />
|
||||
<Compile Include="WorkFlow\NewProjectModel.cs" />
|
||||
<Compile Include="Blogs\BlogEditEntryModel.cs" />
|
||||
<Compile Include="Admin\RestoreQuery.cs" />
|
||||
<Compile Include="Admin\DataAccess.cs" />
|
||||
@ -90,7 +89,6 @@
|
||||
<Compile Include="Google\CalendarList.cs" />
|
||||
<Compile Include="Google\CalendarListEntry.cs" />
|
||||
<Compile Include="Google\AskForADate.cs" />
|
||||
<Compile Include="Google\CalendarEntryList.cs" />
|
||||
<Compile Include="IRenderer.cs" />
|
||||
<Compile Include="ITagHandler.cs" />
|
||||
<Compile Include="IViewRenderer.cs" />
|
||||
@ -133,6 +131,13 @@
|
||||
<Compile Include="FrontOffice\Catalog\CatalogHelper.cs" />
|
||||
<Compile Include="FrontOffice\Catalog\CatalogManager.cs" />
|
||||
<Compile Include="FrontOffice\Catalog\CatalogProvider.cs" />
|
||||
<Compile Include="FileSystem\FileSystemManager.cs" />
|
||||
<Compile Include="FileSystem\DirNotFoundException.cs" />
|
||||
<Compile Include="FileSystem\InvalidDirNameException.cs" />
|
||||
<Compile Include="FileSystem\WebFileInfo.cs" />
|
||||
<Compile Include="Google\CalendarEntryList.cs" />
|
||||
<Compile Include="FrontOffice\WebFileInfoCollection.cs" />
|
||||
<Compile Include="FrontOffice\CommandStatus.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
|
Reference in New Issue
Block a user