* 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:
@ -255,7 +255,7 @@ namespace Yavsc.Controllers
|
||||
/// <param name="model">Model.</param>
|
||||
[Authorize]
|
||||
[HttpGet]
|
||||
public ActionResult Profile (Profile model)
|
||||
public ActionResult MyProfile (Profile model)
|
||||
{
|
||||
string username = Membership.GetUser ().UserName;
|
||||
ViewData ["UserName"] = username;
|
||||
@ -272,7 +272,7 @@ namespace Yavsc.Controllers
|
||||
[Authorize]
|
||||
[HttpPost]
|
||||
// ASSERT("Membership.GetUser ().UserName is made of simple characters, no slash nor backslash"
|
||||
public ActionResult Profile (Profile model, HttpPostedFileBase AvatarFile)
|
||||
public ActionResult MyProfile (Profile model, HttpPostedFileBase AvatarFile)
|
||||
{
|
||||
string username = Membership.GetUser ().UserName;
|
||||
ViewData ["UserName"] = username;
|
||||
|
@ -21,6 +21,7 @@ namespace Yavsc.ApiControllers
|
||||
/// The wfmgr.
|
||||
/// </summary>
|
||||
protected WorkFlowManager wfmgr = null;
|
||||
|
||||
/// <summary>
|
||||
/// Initialize the specified controllerContext.
|
||||
/// </summary>
|
||||
@ -78,10 +79,7 @@ namespace Yavsc.ApiControllers
|
||||
[AcceptVerbs("POST")]
|
||||
public void Post(long itemId)
|
||||
{
|
||||
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -51,16 +51,7 @@ namespace Yavsc.ApiControllers
|
||||
/// </summary>
|
||||
/// <param name="user">User.</param>
|
||||
/// <param name="title">Title.</param>
|
||||
public static void RemovePost(string user, string title) {
|
||||
if (!Roles.IsUserInRole ("Admin")) {
|
||||
string rguser = Membership.GetUser ().UserName;
|
||||
if (rguser != user) {
|
||||
throw new AccessViolationException (
|
||||
string.Format (
|
||||
"Vous n'avez pas le droit de suprimer des billets du Blog de {0}",
|
||||
user));
|
||||
}
|
||||
}
|
||||
public void RemovePost(string user, string title) {
|
||||
BlogEntry e = BlogManager.GetPost (user, title);
|
||||
if (e == null) {
|
||||
throw new KeyNotFoundException (
|
||||
|
@ -342,7 +342,7 @@ namespace Yavsc.Controllers
|
||||
ViewData["returnUrl"]=returnUrl;
|
||||
if (!confirm)
|
||||
return View ("RemovePost");
|
||||
BlogsApiController.RemovePost (user,title);
|
||||
BlogManager.RemovePost (user,title);
|
||||
if (returnUrl == null)
|
||||
RedirectToAction ("Index",new { user = user });
|
||||
return Redirect (returnUrl);
|
||||
|
@ -241,10 +241,9 @@ namespace Yavsc.Controllers
|
||||
});
|
||||
}
|
||||
string cred = OAuth2.GetFreshGoogleCredential (HttpContext.Profile);
|
||||
string json;
|
||||
|
||||
CalendarApi c = new CalendarApi ();
|
||||
CalendarList cl = c.GetCalendars (cred, out json);
|
||||
ViewData ["json"] = json;
|
||||
CalendarList cl = c.GetCalendars (cred);
|
||||
ViewData ["returnUrl"] = returnUrl;
|
||||
return View (cl);
|
||||
}
|
||||
@ -254,6 +253,7 @@ namespace Yavsc.Controllers
|
||||
/// </summary>
|
||||
/// <returns>The calendar.</returns>
|
||||
/// <param name="calchoice">Calchoice.</param>
|
||||
/// <param name="returnUrl">return Url.</param>
|
||||
[HttpPost]
|
||||
[Authorize]
|
||||
public ActionResult SetCalendar (string calchoice,string returnUrl)
|
||||
@ -318,9 +318,8 @@ namespace Yavsc.Controllers
|
||||
|
||||
CalendarApi c = new CalendarApi ();
|
||||
CalendarEntryList res;
|
||||
string responseStr;
|
||||
try {
|
||||
res = c.GetCalendar (calid, mindate, maxdate, upr, out responseStr);
|
||||
res = c.GetCalendar (calid, mindate, maxdate, upr);
|
||||
} catch (GoogleErrorException ex) {
|
||||
ViewData ["Title"] = ex.Title;
|
||||
ViewData ["Content"] = ex.Content;
|
||||
|
@ -1,14 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using WorkFlowProvider;
|
||||
using Yavsc.Model.WorkFlow;
|
||||
using System.Web.Http.Controllers;
|
||||
using System.Web.Security;
|
||||
using System.Web.Http.ModelBinding;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
using System.Web.Http.Controllers;
|
||||
using System.Web.Http.ModelBinding;
|
||||
|
||||
namespace Yavsc.ApiControllers
|
||||
{
|
||||
|
@ -20,14 +20,15 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Net.Http.Formatting;
|
||||
using Yavsc.Model.WorkFlow;
|
||||
using Yavsc.Model.RolesAndMembers;
|
||||
using System.Web.Profile;
|
||||
using System.Web;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Formatting;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Web;
|
||||
using System.Web.Profile;
|
||||
using Yavsc.Model.RolesAndMembers;
|
||||
using Yavsc.Model.WorkFlow;
|
||||
|
||||
namespace Yavsc.Formatters
|
||||
{
|
||||
@ -69,8 +70,9 @@ namespace Yavsc.Formatters
|
||||
return enumerableType.IsAssignableFrom(type);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Writes to stream.
|
||||
/// Writes synchronously to the buffered stream.
|
||||
/// </summary>
|
||||
/// <param name="type">Type.</param>
|
||||
/// <param name="value">Value.</param>
|
||||
@ -97,7 +99,7 @@ namespace Yavsc.Formatters
|
||||
tmpe.Session.Add ("to", prcli);
|
||||
tmpe.Init ();
|
||||
|
||||
string content = tmpe.TransformText ();
|
||||
string contentStr = tmpe.TransformText ();
|
||||
|
||||
string name = string.Format ("tmpestimtex-{0}", e.Id);
|
||||
string fullname = Path.Combine (
|
||||
@ -106,7 +108,7 @@ namespace Yavsc.Formatters
|
||||
FileInfo fo = new FileInfo(fullname + ".pdf");
|
||||
using (StreamWriter sw = new StreamWriter (fi.FullName))
|
||||
{
|
||||
sw.Write (content);
|
||||
sw.Write (contentStr);
|
||||
}
|
||||
using (Process p = new Process ()) {
|
||||
p.StartInfo.WorkingDirectory = HttpRuntime.CodegenDir;
|
||||
@ -129,8 +131,10 @@ namespace Yavsc.Formatters
|
||||
}
|
||||
fi.Delete();
|
||||
fo.Delete();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ namespace Yavsc.Formatters
|
||||
|
||||
private const string dateformat = "ddd, dd MMM yyyy HH:mm:ss K";
|
||||
/// <summary>
|
||||
/// Writes to stream.
|
||||
/// Writes synchronously to the buffered stream.
|
||||
/// </summary>
|
||||
/// <param name="type">Type.</param>
|
||||
/// <param name="value">Value.</param>
|
||||
|
@ -25,9 +25,13 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Web;
|
||||
using System.Diagnostics;
|
||||
using System.Net.Http;
|
||||
|
||||
namespace Yavsc.Formatters
|
||||
{
|
||||
/// <summary>
|
||||
/// Tex to pdf formatter.
|
||||
/// </summary>
|
||||
public class TexToPdfFormatter: BufferedMediaTypeFormatter
|
||||
{
|
||||
/// <summary>
|
||||
@ -73,7 +77,7 @@ namespace Yavsc.Formatters
|
||||
public override void WriteToStream (Type type, object value, Stream stream, HttpContentHeaders contentHeaders)
|
||||
{
|
||||
|
||||
string content = value as string;
|
||||
string cntStr = value as string;
|
||||
string name = "tmpdoc-"+Guid.NewGuid().ToString();
|
||||
string fullname = Path.Combine (
|
||||
HttpRuntime.CodegenDir, name);
|
||||
@ -81,7 +85,7 @@ namespace Yavsc.Formatters
|
||||
FileInfo fo = new FileInfo(fullname + ".pdf");
|
||||
using (StreamWriter sw = new StreamWriter (fi.FullName))
|
||||
{
|
||||
sw.Write (content);
|
||||
sw.Write (cntStr);
|
||||
}
|
||||
using (Process p = new Process ()) {
|
||||
p.StartInfo.WorkingDirectory = HttpRuntime.CodegenDir;
|
||||
|
@ -6,9 +6,9 @@ using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Routing;
|
||||
using System.Web.Http;
|
||||
using Yavsc.Formatters;
|
||||
using Yavsc.Model.FrontOffice;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace Yavsc
|
||||
{
|
||||
@ -49,17 +49,18 @@ namespace Yavsc
|
||||
new { controller = "Blogs", action = "Index", user=UrlParameter.Optional, title = UrlParameter.Optional }
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Applications the start.
|
||||
/// Starts the Application.
|
||||
/// </summary>
|
||||
protected void Application_Start ()
|
||||
{
|
||||
AreaRegistration.RegisterAllAreas ();
|
||||
GlobalConfiguration.Configuration.Routes.MapHttpRoute(
|
||||
name: "DefaultApi",
|
||||
name: "DefaultApi",
|
||||
routeTemplate: "api/{controller}/{action}/{*id}",
|
||||
defaults: new { controller = "WorkFlow", action="Index", id=0 }
|
||||
);
|
||||
);
|
||||
|
||||
RegisterRoutes (RouteTable.Routes);
|
||||
}
|
||||
|
@ -103,6 +103,9 @@ namespace Yavsc.Helpers
|
||||
/// </summary>
|
||||
public static void InitParser ()
|
||||
{
|
||||
// prevents a failure at second call
|
||||
parent.Clear ();
|
||||
|
||||
BBTag urlBBTag = new BBTag ("url", "<a href=\"${href}\">", "</a>", true, true, UrlContentTransformer, new BBAttribute ("href", "",UrlAttributeTransformer), new BBAttribute ("href", "href",UrlAttributeTransformer));
|
||||
|
||||
BBTag bblist =new BBTag ("list", "<ul>", "</ul>");
|
||||
@ -177,12 +180,12 @@ namespace Yavsc.Helpers
|
||||
}
|
||||
);
|
||||
// used to build the doc toc
|
||||
parent.Clear ();
|
||||
parent.Add ("*", bblist);
|
||||
parent.Add ("sect3", bbs2);
|
||||
parent.Add ("sect2", bbs1);
|
||||
parent.Add ("sect1", bbdp);
|
||||
//
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Inits the document page.
|
||||
@ -270,7 +273,7 @@ namespace Yavsc.Helpers
|
||||
static string UrlContentTransformer (string instr)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace (instr)) {
|
||||
return urlValue;
|
||||
return "<"+urlValue+">";
|
||||
} else
|
||||
return instr;
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ using System.IO;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json;
|
||||
using System.Web;
|
||||
using System.Runtime.Serialization.Json;
|
||||
|
||||
namespace Yavsc.Helpers.Google
|
||||
{
|
||||
@ -60,8 +61,7 @@ namespace Yavsc.Helpers.Google
|
||||
/// </summary>
|
||||
/// <returns>The calendars.</returns>
|
||||
/// <param name="cred">Cred.</param>
|
||||
/// <param name="json">Json.</param>
|
||||
public CalendarList GetCalendars (string cred, out string json)
|
||||
public CalendarList GetCalendars (string cred)
|
||||
{
|
||||
CalendarList res = null;
|
||||
HttpWebRequest webreq = WebRequest.CreateHttp (getCalListUri);
|
||||
@ -70,10 +70,7 @@ namespace Yavsc.Helpers.Google
|
||||
webreq.ContentType = "application/http";
|
||||
using (WebResponse resp = webreq.GetResponse ()) {
|
||||
using (Stream respstream = resp.GetResponseStream ()) {
|
||||
using (StreamReader readresp = new StreamReader (respstream, Encoding.UTF8)) {
|
||||
json = readresp.ReadToEnd ();
|
||||
res = JsonConvert.DeserializeObject<CalendarList> (json);
|
||||
}
|
||||
res = (CalendarList) new DataContractJsonSerializer(typeof(CalendarList)).ReadObject (respstream);
|
||||
}
|
||||
resp.Close ();
|
||||
}
|
||||
@ -89,8 +86,7 @@ namespace Yavsc.Helpers.Google
|
||||
/// <param name="mindate">Mindate.</param>
|
||||
/// <param name="maxdate">Maxdate.</param>
|
||||
/// <param name="upr">Upr.</param>
|
||||
/// <param name="responseStr">Response string.</param>
|
||||
public CalendarEntryList GetCalendar (string calid, DateTime mindate, DateTime maxdate, ProfileBase upr, out string responseStr)
|
||||
public CalendarEntryList GetCalendar (string calid, DateTime mindate, DateTime maxdate, ProfileBase upr)
|
||||
{
|
||||
string uri = string.Format (
|
||||
getCalEntriesUri, HttpUtility.UrlEncode (calid)) +
|
||||
@ -107,18 +103,14 @@ namespace Yavsc.Helpers.Google
|
||||
try {
|
||||
using (WebResponse resp = webreq.GetResponse ()) {
|
||||
using (Stream respstream = resp.GetResponseStream ()) {
|
||||
using (StreamReader readresp = new StreamReader (respstream, Encoding.UTF8)) {
|
||||
responseStr = readresp.ReadToEnd ();
|
||||
try {
|
||||
res = JsonConvert.DeserializeObject<CalendarEntryList> (responseStr);
|
||||
} catch (JsonReaderException ex) {
|
||||
res = (CalendarEntryList) new DataContractJsonSerializer(typeof(CalendarEntryList)).ReadObject (respstream);
|
||||
} catch (Exception ex) {
|
||||
respstream.Close ();
|
||||
resp.Close ();
|
||||
webreq.Abort ();
|
||||
throw new GoogleErrorException(ex,responseStr);
|
||||
throw new GoogleErrorException(ex);
|
||||
}
|
||||
}
|
||||
respstream.Close ();
|
||||
}
|
||||
resp.Close ();
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ using Yavsc.Model.Google;
|
||||
using System.Web.Profile;
|
||||
using System.Web;
|
||||
using Yavsc.Model;
|
||||
using System.Runtime.Serialization.Json;
|
||||
|
||||
namespace Yavsc.Helpers.Google
|
||||
{
|
||||
@ -45,16 +46,14 @@ namespace Yavsc.Helpers.Google
|
||||
public static People GetMe (AuthToken gat)
|
||||
{
|
||||
People me;
|
||||
DataContractJsonSerializer ppser = new DataContractJsonSerializer (typeof(People));
|
||||
HttpWebRequest webreppro = WebRequest.CreateHttp (getPeopleUri + "/me");
|
||||
webreppro.ContentType = "application/http";
|
||||
webreppro.Headers.Add (HttpRequestHeader.Authorization, gat.token_type + " " + gat.access_token);
|
||||
webreppro.Method = "GET";
|
||||
using (WebResponse proresp = webreppro.GetResponse ()) {
|
||||
using (Stream prresponseStream = proresp.GetResponseStream ()) {
|
||||
using (StreamReader readproresp = new StreamReader (prresponseStream, Encoding.UTF8)) {
|
||||
string prresponseStr = readproresp.ReadToEnd ();
|
||||
me = JsonConvert.DeserializeObject<People> (prresponseStr);
|
||||
}
|
||||
me = (People) ppser.ReadObject (prresponseStream);
|
||||
prresponseStream.Close ();
|
||||
}
|
||||
proresp.Close ();
|
||||
@ -189,11 +188,7 @@ namespace Yavsc.Helpers.Google
|
||||
AuthToken gat = null;
|
||||
using (WebResponse response = webreq.GetResponse ()) {
|
||||
using (Stream responseStream = response.GetResponseStream ()) {
|
||||
using (StreamReader readStream = new StreamReader (responseStream, Encoding.UTF8)) {
|
||||
string responseStr = readStream.ReadToEnd ();
|
||||
gat = JsonConvert.DeserializeObject<AuthToken> (responseStr);
|
||||
readStream.Close ();
|
||||
}
|
||||
gat = (AuthToken) new DataContractJsonSerializer(typeof(AuthToken)).ReadObject (responseStream);
|
||||
responseStream.Close ();
|
||||
}
|
||||
response.Close ();
|
||||
|
@ -22,7 +22,7 @@ using System;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json;
|
||||
using System.Runtime.Serialization.Json;
|
||||
|
||||
namespace Yavsc.Helpers
|
||||
{
|
||||
@ -74,23 +74,18 @@ namespace Yavsc.Helpers
|
||||
/// <param name="query">Query.</param>
|
||||
public TAnswer Invoke(TQuery query)
|
||||
{
|
||||
Byte[] bytes = System.Text.Encoding.UTF8.GetBytes (
|
||||
JsonConvert.SerializeObject(query));
|
||||
Request.ContentLength = bytes.Length;
|
||||
|
||||
using (Stream dataStream = Request.GetRequestStream ()) {
|
||||
dataStream.Write (bytes, 0, bytes.Length);
|
||||
dataStream.Close ();
|
||||
DataContractJsonSerializer serquery = new DataContractJsonSerializer (typeof(TQuery));
|
||||
DataContractJsonSerializer seransw = new DataContractJsonSerializer (typeof(TAnswer));
|
||||
|
||||
using (MemoryStream streamQuery = new MemoryStream ()) {
|
||||
serquery.WriteObject (streamQuery, query);
|
||||
}
|
||||
|
||||
TAnswer ans = default (TAnswer);
|
||||
using (WebResponse response = Request.GetResponse ()) {
|
||||
using (Stream responseStream = response.GetResponseStream ()) {
|
||||
using (StreamReader readStream = new StreamReader (responseStream, Encoding.UTF8)) {
|
||||
string responseStr = readStream.ReadToEnd ();
|
||||
ans = JsonConvert.DeserializeObject<TAnswer> (responseStr);
|
||||
readStream.Close ();
|
||||
}
|
||||
responseStream.Close ();
|
||||
ans = (TAnswer) seransw.ReadObject(responseStream);
|
||||
}
|
||||
response.Close();
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="/Theme/style.css"/>
|
||||
<link rel="icon" type="image/png" href="/favicon.png" />
|
||||
<link rel="icon" type="image/png" href="/favicon.png?v=2" />
|
||||
<asp:ContentPlaceHolder id="head" runat="server">
|
||||
</asp:ContentPlaceHolder>
|
||||
<link href='http://fonts.googleapis.com/css?family=Dancing+Script:400,700' rel='stylesheet' type='text/css'/>
|
||||
@ -52,12 +52,12 @@
|
||||
<span class="hidcom"> Page d'accueil </span>
|
||||
<%= Html.ActionLink("Login", "Login", "Account", new { returnUrl=Request.Url.PathAndQuery }, new { @class="actionlink" } ) %>
|
||||
<span class="hidcom">Pour pouvoir poster ou commenter</span>
|
||||
<a href="<%=Request.Url.Scheme + "://" + Request.Url.Authority + "/Google/Login"%>?returnUrl=<%=Request.Url.PathAndQuery%>" class="actionlink">
|
||||
<a href="<%=Request.Url.Scheme + "://" + Request.Url.Authority + "/Google/Login"%>?returnUrl=<%=ViewData["returnUrl"]==null?Request.Url.PathAndQuery:(string)ViewData["returnUrl"]%>" class="actionlink">
|
||||
<img src="/images/sign-in-with-google-s.png" style="max-height:1.5em; max-width:6em;" alt="Google sign in">
|
||||
</a>
|
||||
<span class="hidcom">S'authentifier avec son compte Google+</span>
|
||||
<% } else { %>
|
||||
<%= Html.ActionLink(HttpContext.Current.User.Identity.Name, "Profile", "Account", null, new { @class="actionlink" }) %>
|
||||
<%= Html.ActionLink(HttpContext.Current.User.Identity.Name, "MyProfile", "Account", null, new { @class="actionlink" }) %>
|
||||
<span class="hidcom"> Édition de votre profile </span>
|
||||
@ <%= Html.ActionLink( YavscHelpers.SiteName, "Index", "Home" ,null, new { @class="actionlink" }) %>
|
||||
<span class="hidcom"> Page d'accueil </span>
|
||||
|
@ -1,97 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Formatting;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Http;
|
||||
using System.Web.Http.Controllers;
|
||||
using System.Web.Http.ModelBinding;
|
||||
using System.Web.Http.ValueProviders;
|
||||
using System.Web.Http.ValueProviders.Providers;
|
||||
|
||||
namespace Basic
|
||||
{
|
||||
// Binder with MVC semantics. Treat the body as KeyValue pairs and model bind it.
|
||||
/// <summary>
|
||||
/// Mvc action value binder.
|
||||
/// </summary>
|
||||
public class MvcActionValueBinder : DefaultActionValueBinder
|
||||
{
|
||||
// Per-request storage, uses the Request.Properties bag. We need a unique key into the bag.
|
||||
private const string Key = "5DC187FB-BFA0-462A-AB93-9E8036871EC8";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the binding.
|
||||
/// </summary>
|
||||
/// <returns>The binding.</returns>
|
||||
/// <param name="actionDescriptor">Action descriptor.</param>
|
||||
public override HttpActionBinding GetBinding (HttpActionDescriptor actionDescriptor)
|
||||
{
|
||||
|
||||
HttpActionBinding actionBinding = new HttpActionBinding ();
|
||||
|
||||
HttpParameterDescriptor[] parameters = actionDescriptor.GetParameters ().ToArray ();
|
||||
HttpParameterBinding[] binders = Array.ConvertAll (parameters, p => DetermineBinding (actionBinding, p));
|
||||
|
||||
actionBinding.ParameterBindings = binders;
|
||||
return actionBinding;
|
||||
}
|
||||
|
||||
private HttpParameterBinding DetermineBinding (HttpActionBinding actionBinding, HttpParameterDescriptor parameter)
|
||||
{
|
||||
HttpConfiguration config = parameter.Configuration;
|
||||
|
||||
var attr = new ModelBinderAttribute(); // use default settings
|
||||
|
||||
ModelBinderProvider provider = attr.GetModelBinderProvider(config);
|
||||
|
||||
// Alternatively, we could put this ValueProviderFactory in the global config.
|
||||
List<ValueProviderFactory> vpfs = new List<ValueProviderFactory>(attr.GetValueProviderFactories(config));
|
||||
vpfs.Add(new BodyValueProviderFactory());
|
||||
//vpfs.Add (new RouteDataValueProviderFactory ());
|
||||
return new ModelBinderParameterBinding(parameter, provider, vpfs);
|
||||
}
|
||||
|
||||
// Derive from ActionBinding so that we have a chance to read the body once and then share that with all the parameters.
|
||||
private class MvcActionBinding : HttpActionBinding
|
||||
{
|
||||
// Read the body upfront , add as a ValueProvider
|
||||
public override Task ExecuteBindingAsync (HttpActionContext actionContext, CancellationToken cancellationToken)
|
||||
{
|
||||
HttpRequestMessage request = actionContext.ControllerContext.Request;
|
||||
HttpContent content = request.Content;
|
||||
if (content != null) {
|
||||
// content.ReadAsStreamAsync ().Result;
|
||||
FormDataCollection fd = content.ReadAsAsync<FormDataCollection> ().Result;
|
||||
if (fd != null) {
|
||||
|
||||
NameValueCollection nvc = fd.ReadAsNameValueCollection ();
|
||||
|
||||
System.Web.Http.ValueProviders.IValueProvider vp = new System.Web.Http.ValueProviders.Providers.NameValueCollectionValueProvider (nvc, CultureInfo.InvariantCulture);
|
||||
|
||||
request.Properties.Add (Key, vp);
|
||||
}
|
||||
}
|
||||
|
||||
return base.ExecuteBindingAsync (actionContext, cancellationToken);
|
||||
}
|
||||
}
|
||||
// Get a value provider over the body. This can be shared by all parameters.
|
||||
// This gets the values computed in MvcActionBinding.
|
||||
private class BodyValueProviderFactory : System.Web.Http.ValueProviders.ValueProviderFactory
|
||||
{
|
||||
public override System.Web.Http.ValueProviders.IValueProvider GetValueProvider (HttpActionContext actionContext)
|
||||
{
|
||||
object vp;
|
||||
actionContext.Request.Properties.TryGetValue (Key, out vp);
|
||||
return (System.Web.Http.ValueProviders.IValueProvider)vp; // can be null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@ table.layout { border-width: 0; }
|
||||
table.layout TR TD { max-width:40%; }
|
||||
</style>
|
||||
<%= Html.ValidationSummary() %>
|
||||
<% using(Html.BeginForm("Profile", "Account", FormMethod.Post, new { enctype = "multipart/form-data" })) %>
|
||||
<% using(Html.BeginForm("MyProfile", "Account", FormMethod.Post, new { enctype = "multipart/form-data" })) %>
|
||||
<% { %>
|
||||
<fieldset><legend>Informations générales</legend>
|
||||
|
@ -8,6 +8,6 @@ a été créé, un e-mail de validation de votre compte a été envoyé a l'adre
|
||||
Vous devriez le recevoir rapidement.<br/>
|
||||
Pour valider votre compte, suivez le lien indiqué dans cet e-mail.
|
||||
<div>
|
||||
<a class="actionlink" href="<%=ViewData["ReturnUrl"]%>">Retour</a>
|
||||
<a class="actionlink" href="<%=ViewData["returnUrl"]%>">Retour</a>
|
||||
</div>
|
||||
</asp:Content>
|
||||
|
@ -4,7 +4,7 @@
|
||||
Running assembly :
|
||||
<%= GetType().Assembly.FullName %></p>
|
||||
<p>
|
||||
Assemblies referenced by the controllers :
|
||||
Assemblies referenced in this application :
|
||||
<ul>
|
||||
<% foreach (System.Reflection.AssemblyName item in Model) { %>
|
||||
<li><%= item.FullName %></li>
|
||||
|
@ -28,27 +28,6 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx
|
||||
<section name="workflow" type="Yavsc.Model.WorkFlow.Configuration.WorkflowConfiguration, YavscModel" allowLocation="true" requirePermission="false" allowDefinition="Everywhere" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<runtime>
|
||||
<!--
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Extensions" culture="neutral" publicKeyToken="31bf3856ad364e35" />
|
||||
<bindingRedirect oldVersion="3.5.0.0" newVersion="4.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
-->
|
||||
<!-- This prevents the Windows Event Log from frequently logging that HMAC1 is being used (when the other party needs it). -->
|
||||
<legacyHMACWarning enabled="0" />
|
||||
<!-- When targeting ASP.NET MVC 3, this assemblyBinding makes MVC 1 and 2 references relink
|
||||
to MVC 3 so libraries such as DotNetOpenAuth that compile against MVC 1 will work with it.
|
||||
-->
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
|
||||
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<system.web>
|
||||
<!--
|
||||
Set compilation debug="true" to insert debugging
|
||||
@ -56,8 +35,9 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx
|
||||
affects performance, set this value to true only
|
||||
during development.
|
||||
-->
|
||||
<compilation defaultLanguage="C#" debug="true">
|
||||
<compilation defaultLanguage="C#" debug="false">
|
||||
<assemblies>
|
||||
<add assembly="Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add assembly="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<add assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
@ -73,26 +53,26 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx
|
||||
<add assembly="Mono.Posix, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
|
||||
<add assembly="System.ServiceModel.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<add assembly="System.ServiceModel.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<add assembly="System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add assembly="System.Net.Http.WebRequest, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add assembly="System.Configuration.Install, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add assembly="Microsoft.Build.Tasks.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add assembly="Microsoft.Build.Utilities.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add assembly="Microsoft.Build, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add assembly="System.Net, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<add assembly="System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add assembly="System.Net.Http.WebRequest, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add assembly="System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<add assembly="System.Web.WebPages.Deployment, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<add assembly="System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<add assembly="System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<add assembly="System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<add assembly="System.Json, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<add assembly="System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<add assembly="System.Net.Http.Formatting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<add assembly="System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<add assembly="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<add assembly="System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
</assemblies>
|
||||
</compilation>
|
||||
<customErrors mode="Off" />
|
||||
<!--
|
||||
<customErrors mode="RemoteOnly" defaultRedirect="~/errors/GeneralError.aspx">
|
||||
<error statusCode="404" redirect="~/errors/PageNotFound.aspx" />
|
||||
</customErrors> -->
|
||||
<customErrors mode="RemoteOnly">
|
||||
</customErrors>
|
||||
<pages>
|
||||
<controls>
|
||||
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
|
||||
@ -103,6 +83,8 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx
|
||||
<add namespace="System.Web.Mvc.Ajax" />
|
||||
<add namespace="System.Web.Mvc.Html" />
|
||||
<add namespace="System.Web.Routing" />
|
||||
<add namespace="System.Web.Helpers" />
|
||||
<add namespace="System.Web.WebPages" />
|
||||
<add namespace="System.Linq" />
|
||||
<add namespace="System.Collections.Generic" />
|
||||
<add namespace="Yavsc.Helpers" />
|
||||
@ -117,7 +99,7 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx
|
||||
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
|
||||
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
|
||||
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false" />
|
||||
<add verb="*" path="*.mvc" validate="false" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
|
||||
<add verb="*" path="*.mvc" validate="false" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=5.2.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
|
||||
</httpHandlers>
|
||||
<httpModules>
|
||||
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
|
||||
@ -302,4 +284,26 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx
|
||||
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
|
||||
<add key="PayPalLogger" value="PayPal.Log.Log4netLogger" />
|
||||
</appSettings>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
|
||||
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
|
||||
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
|
||||
<bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Extensions" culture="neutral" publicKeyToken="31bf3856ad364e35" />
|
||||
<bindingRedirect oldVersion="3.5.0.0" newVersion="4.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
@ -53,7 +53,6 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Web.Routing" />
|
||||
@ -86,15 +85,23 @@
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Net.Http.WebRequest" />
|
||||
<Reference Include="System.Web.Mvc" />
|
||||
<Reference Include="System.Web.Http" />
|
||||
<Reference Include="System.Web.Http.WebHost" />
|
||||
<Reference Include="System.Json" />
|
||||
<Reference Include="System.Web.WebPages" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.WebPages.Deployment" />
|
||||
<Reference Include="System.Web.WebPages.Razor" />
|
||||
<Reference Include="PayPalCoreSDK">
|
||||
<HintPath>..\packages\PayPalCoreSDK.1.6.0\lib\net451\PayPalCoreSDK.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Http" />
|
||||
<Reference Include="System.Net.Http.Formatting" />
|
||||
<Reference Include="System.Web.Http.WebHost" />
|
||||
<Reference Include="Microsoft.Web.Infrastructure" />
|
||||
<Reference Include="System.Web.WebPages" />
|
||||
<Reference Include="System.Web.Mvc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Models\" />
|
||||
@ -152,7 +159,6 @@
|
||||
<Compile Include="Helpers\YavscHelpers.cs" />
|
||||
<Compile Include="Controllers\BasketController.cs" />
|
||||
<Compile Include="FileInfoCollection.cs" />
|
||||
<Compile Include="MvcActionValueBinder.cs" />
|
||||
<Compile Include="Controllers\BlogsApiController.cs" />
|
||||
<Compile Include="Controllers\AdminController.cs" />
|
||||
<Compile Include="Helpers\T.cs" />
|
||||
@ -211,7 +217,6 @@
|
||||
<Content Include="Views\Account\RegistrationPending.aspx" />
|
||||
<Content Include="Views\Account\Validate.aspx" />
|
||||
<Content Include="Views\FrontOffice\Catalog.aspx" />
|
||||
<Content Include="Views\Account\Profile.aspx" />
|
||||
<Content Include="Views\Blogs\TitleNotFound.aspx" />
|
||||
<Content Include="Views\FrontOffice\ProductCategory.aspx" />
|
||||
<Content Include="Views\FrontOffice\Product.aspx" />
|
||||
@ -666,6 +671,7 @@
|
||||
<Content Include="Scripts\img\map-load.gif" />
|
||||
<Content Include="Scripts\jquery.googlemaps.js" />
|
||||
<Content Include="Scripts\jquery.googlemaps.min.js" />
|
||||
<Content Include="Views\Account\MyProfile.aspx" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
|
BIN
web/favicon.png
BIN
web/favicon.png
Binary file not shown.
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.4 KiB |
@ -553,7 +553,9 @@ namespace Yavsc.templates {
|
||||
#line hidden
|
||||
return this.GenerationEnvironment.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initialize this instance.
|
||||
/// </summary>
|
||||
public virtual void Initialize() {
|
||||
if ((this.Errors.HasErrors == false)) {
|
||||
bool _estimAcquired = false;
|
||||
|
@ -1,3 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
</configuration>
|
@ -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)
|
||||
|
@ -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>
|
||||
|
@ -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 ()
|
||||
{
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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 ();
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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; }
|
||||
|
||||
|
Reference in New Issue
Block a user