* Web.csproj:

* Profile.aspx:
* MyProfile.aspx:
* AccountController.cs: renamed the Profile method to "MyProfile",
  could avoid issue at migrating to MVC5

* favicon.png: favicon now displays a ~"Yavsc"

* BlogManager.cs:
* BlogsApiController.cs: The authorisation for removing a post is now
  implemented at Manager's side

* BlogsController.cs: Removes this odd call to a static method from
  the Api controller

* CalendarApi.cs:
* GoogleController.cs: no more json output for the calls to the Google
  Api

* WorkFlowController.cs: sorted using clauses

* Basket.cs:
* Commande.cs:
* EstimToPdfFormatter.cs:
* Brand.cs: adds xml doc

* RssFeedsFormatter.cs: modifies xml doc

* TexToPdfFormatter.cs: refactoring

* Global.asax.cs: Document formatting

* BBCodeHelper.cs: encapsulates the url display from the BBCode in
  starting and closing characters : "<>"

* OAuth2.cs:
* SimpleJsonPostMethod.cs: using System.Runtime.Serialization.Json
  instead of Newtonsof.Json

* App.master: updating the favicon

* RegistrationPending.aspx: fixes the returnUrl usage

* AssemblyInfo.aspx: better explanation for this list

* Web.config: tried to migrate to MVC5 (using NuGets)

* Estim.cs:
* ChangePasswordModel.cs: adds xmldoc

* BasketController.cs:
* BlogProvidersConfigurationSection.cs: cosmetic change

* GoogleErrorMessage.cs: - adds xml docs
- renders ctor from JsonReaderException obsolete

* MvcActionValueBinder.cs: not used

* web.config: no more used, gave it up to migrate to MVC5
This commit is contained in:
Paul Schneider
2015-02-12 16:08:16 +01:00
parent a342b744df
commit e676d2fdbf
31 changed files with 250 additions and 238 deletions

View File

@ -2,6 +2,7 @@ using System;
using Yavsc.Model.Blogs;
using Yavsc.Model.RolesAndMembers;
using System.Web;
using System.Web.Security;
namespace Yavsc.Model.Blogs
@ -49,6 +50,15 @@ namespace Yavsc.Model.Blogs
}
public static void RemovePost (string username, string title)
{
if (!Roles.IsUserInRole ("Admin")) {
string rguser = Membership.GetUser ().UserName;
if (rguser != username) {
throw new AccessViolationException (
string.Format (
"{1}, Vous n'avez pas le droit de suprimer des billets du Blog de {0}",
username,rguser));
}
}
Provider.RemovePost (username, title);
}
public static BlogEntryCollection LastPosts (int pageIndex, int pageSize, out int totalRecords)

View File

@ -16,13 +16,12 @@ namespace Yavsc.Model.Blogs.Configuration
set { this["defaultProvider"] = value; }
}
[ConfigurationProperty("providers")]
[ConfigurationCollection(typeof(BlogProvidersConfigurationCollection),
AddItemName = "add",
ClearItemsName = "clear",
RemoveItemName = "remove")]
/// <summary>
/// Gets or sets the providers.
/// </summary>

View File

@ -24,8 +24,14 @@ using Yavsc.Model.WorkFlow;
namespace Yavsc.Model.FrontOffice
{
/// <summary>
/// Basket.
/// </summary>
public class Basket: List<Commande>
{
/// <summary>
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.Basket"/> class.
/// </summary>
public Basket ()
{
}

View File

@ -3,19 +3,41 @@ using System.ComponentModel.DataAnnotations;
namespace Yavsc.Model.FrontOffice
{
/// <summary>
/// Brand.
/// </summary>
public class Brand
{
/// <summary>
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.Brand"/> class.
/// </summary>
public Brand ()
{
}
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
[Required]
public string Name { get; set; }
/// <summary>
/// Gets or sets the slogan.
/// </summary>
/// <value>The slogan.</value>
public string Slogan { get; set; }
/// <summary>
/// Gets or sets the logo.
/// </summary>
/// <value>The logo.</value>
public ProductImage Logo { get; set; }
/// <summary>
/// Gets or sets the categories.
/// </summary>
/// <value>The categories.</value>
public ProductCategory[] Categories { get; set; }
/// <summary>
/// Gets or sets the default form.
@ -23,10 +45,21 @@ namespace Yavsc.Model.FrontOffice
/// <value>The default form.</value>
public SaleForm DefaultForm { get; set; }
/// <summary>
/// Gets the product category.
/// </summary>
/// <returns>The product category.</returns>
/// <param name="reference">Reference.</param>
public ProductCategory GetProductCategory(string reference)
{
return Array.Find<ProductCategory>(Categories, c => c.Reference == reference);
}
/// <summary>
/// Gets the name of the product category by.
/// </summary>
/// <returns>The product category by name.</returns>
/// <param name="catName">Cat name.</param>
public ProductCategory GetProductCategoryByName(string catName)
{
return Array.Find<ProductCategory>(Categories, c => c.Name == catName);

View File

@ -7,17 +7,39 @@ using Newtonsoft.Json;
namespace Yavsc.Model.FrontOffice
{
/// <summary>
/// Commande.
/// </summary>
public class Commande
{
/// <summary>
/// Gets or sets the creation date.
/// </summary>
/// <value>The creation date.</value>
public DateTime CreationDate { get; set; }
/// <summary>
/// Gets or sets the identifier.
/// </summary>
/// <value>The identifier.</value>
public long Id { get; set; }
/// <summary>
/// Gets or sets the prod reference.
/// </summary>
/// <value>The prod reference.</value>
public string ProdRef { 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() {
}
/// <summary>
/// Create the specified collection.
/// </summary>
/// <param name="collection">Collection.</param>
public static Commande Create(NameValueCollection collection)
{
Commande cmd = new Commande ();

View File

@ -25,11 +25,25 @@ using Newtonsoft.Json;
namespace Yavsc.Model.Google
{
/// <summary>
/// Google error exception.
/// </summary>
public class GoogleErrorException : Exception
{
/// <summary>
/// Gets or sets the title.
/// </summary>
/// <value>The title.</value>
public string Title { get; set; }
/// <summary>
/// Gets or sets the content.
/// </summary>
/// <value>The content.</value>
public string Content { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="Yavsc.Model.Google.GoogleErrorException"/> class.
/// </summary>
/// <param name="ex">Ex.</param>
public GoogleErrorException (WebException ex) {
// ASSERT ex != null;
Title = ex.Message;
@ -40,10 +54,25 @@ namespace Yavsc.Model.Google
Content = reader.ReadToEnd();
}
}
public GoogleErrorException(JsonReaderException ex, string message) {
/// <summary>
/// Initializes a new instance of the <see cref="Yavsc.Model.Google.GoogleErrorException"/> class.
/// </summary>
/// <param name="ex">Ex.</param>
/// <param name="message">Message.</param>
[Obsolete]
public GoogleErrorException(Exception ex, string message) {
Content = message;
Title = ex.Message;
}
/// <summary>
/// Initializes a new instance of the <see cref="Yavsc.Model.Google.GoogleErrorException"/> class.
/// </summary>
/// <param name="ex">Ex.</param>
[Obsolete]
public GoogleErrorException(Exception ex) {
Content = ex.Message;
Title = ex.GetType().FullName;
}
}
}

View File

@ -3,17 +3,36 @@ using System.ComponentModel.DataAnnotations;
namespace Yavsc.Model.RolesAndMembers
{
/// <summary>
/// Change password model.
/// </summary>
public class ChangePasswordModel
{
/// <summary>
/// Gets or sets the username.
/// </summary>
/// <value>The username.</value>
[Required(ErrorMessage = "Please enter a Username")]
public string Username { get; set; }
/// <summary>
/// Gets or sets the old password.
/// </summary>
/// <value>The old password.</value>
[Required(ErrorMessage = "Please your old Password")]
public string OldPassword { get; set; }
/// <summary>
/// Gets or sets the new password.
/// </summary>
/// <value>The new password.</value>
[Required(ErrorMessage = "Please enter a new Password")]
public string NewPassword { get; set; }
/// <summary>
/// Gets or sets the confirm password.
/// </summary>
/// <value>The confirm password.</value>
[Required(ErrorMessage = "Please confirm the new Password")]
public string ConfirmPassword { get; set; }