diff --git a/web/Controllers/AccountController.cs b/web/Controllers/AccountController.cs index bd471159..5d0bdfed 100644 --- a/web/Controllers/AccountController.cs +++ b/web/Controllers/AccountController.cs @@ -255,7 +255,7 @@ namespace Yavsc.Controllers /// Model. [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; diff --git a/web/Controllers/BasketController.cs b/web/Controllers/BasketController.cs index 93c7bc27..0dff26a7 100644 --- a/web/Controllers/BasketController.cs +++ b/web/Controllers/BasketController.cs @@ -21,6 +21,7 @@ namespace Yavsc.ApiControllers /// The wfmgr. /// protected WorkFlowManager wfmgr = null; + /// /// Initialize the specified controllerContext. /// @@ -78,10 +79,7 @@ namespace Yavsc.ApiControllers [AcceptVerbs("POST")] public void Post(long itemId) { - throw new NotImplementedException (); } - - } } \ No newline at end of file diff --git a/web/Controllers/BlogsApiController.cs b/web/Controllers/BlogsApiController.cs index 04620933..d7da2cda 100644 --- a/web/Controllers/BlogsApiController.cs +++ b/web/Controllers/BlogsApiController.cs @@ -51,16 +51,7 @@ namespace Yavsc.ApiControllers /// /// User. /// Title. - 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 ( diff --git a/web/Controllers/BlogsController.cs b/web/Controllers/BlogsController.cs index 2c0ec793..92c6c375 100644 --- a/web/Controllers/BlogsController.cs +++ b/web/Controllers/BlogsController.cs @@ -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); diff --git a/web/Controllers/GoogleController.cs b/web/Controllers/GoogleController.cs index 2f1d4cfc..c1969777 100644 --- a/web/Controllers/GoogleController.cs +++ b/web/Controllers/GoogleController.cs @@ -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 /// /// The calendar. /// Calchoice. + /// return Url. [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; diff --git a/web/Controllers/WorkFlowController.cs b/web/Controllers/WorkFlowController.cs index 5f27af4b..ed26a126 100644 --- a/web/Controllers/WorkFlowController.cs +++ b/web/Controllers/WorkFlowController.cs @@ -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 { diff --git a/web/Formatters/EstimToPdfFormatter.cs b/web/Formatters/EstimToPdfFormatter.cs index 3d058e67..72637b7d 100644 --- a/web/Formatters/EstimToPdfFormatter.cs +++ b/web/Formatters/EstimToPdfFormatter.cs @@ -20,14 +20,15 @@ // along with this program. If not, see . 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); } } + /// - /// Writes to stream. + /// Writes synchronously to the buffered stream. /// /// Type. /// Value. @@ -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(); + } + } } diff --git a/web/Formatters/RssFeedsFormatter.cs b/web/Formatters/RssFeedsFormatter.cs index 56983bf8..04f63e3f 100644 --- a/web/Formatters/RssFeedsFormatter.cs +++ b/web/Formatters/RssFeedsFormatter.cs @@ -48,7 +48,7 @@ namespace Yavsc.Formatters private const string dateformat = "ddd, dd MMM yyyy HH:mm:ss K"; /// - /// Writes to stream. + /// Writes synchronously to the buffered stream. /// /// Type. /// Value. diff --git a/web/Formatters/TexToPdfFormatter.cs b/web/Formatters/TexToPdfFormatter.cs index 71c18733..5f92be6c 100644 --- a/web/Formatters/TexToPdfFormatter.cs +++ b/web/Formatters/TexToPdfFormatter.cs @@ -25,9 +25,13 @@ using System.Collections.Generic; using System.IO; using System.Web; using System.Diagnostics; +using System.Net.Http; namespace Yavsc.Formatters { + /// + /// Tex to pdf formatter. + /// public class TexToPdfFormatter: BufferedMediaTypeFormatter { /// @@ -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; diff --git a/web/Global.asax.cs b/web/Global.asax.cs index c840fb65..8fd9f0f1 100644 --- a/web/Global.asax.cs +++ b/web/Global.asax.cs @@ -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 } ); } + /// - /// Applications the start. + /// Starts the Application. /// 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); } diff --git a/web/Helpers/BBCodeHelper.cs b/web/Helpers/BBCodeHelper.cs index d6d093c6..f16cc581 100644 --- a/web/Helpers/BBCodeHelper.cs +++ b/web/Helpers/BBCodeHelper.cs @@ -103,6 +103,9 @@ namespace Yavsc.Helpers /// public static void InitParser () { + // prevents a failure at second call + parent.Clear (); + BBTag urlBBTag = new BBTag ("url", "", "", true, true, UrlContentTransformer, new BBAttribute ("href", "",UrlAttributeTransformer), new BBAttribute ("href", "href",UrlAttributeTransformer)); BBTag bblist =new BBTag ("list", ""); @@ -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); // + } /// /// 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; } diff --git a/web/Helpers/Google/CalendarApi.cs b/web/Helpers/Google/CalendarApi.cs index 1a02706f..2f21630f 100644 --- a/web/Helpers/Google/CalendarApi.cs +++ b/web/Helpers/Google/CalendarApi.cs @@ -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 /// /// The calendars. /// Cred. - /// Json. - 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 (json); - } + res = (CalendarList) new DataContractJsonSerializer(typeof(CalendarList)).ReadObject (respstream); } resp.Close (); } @@ -89,8 +86,7 @@ namespace Yavsc.Helpers.Google /// Mindate. /// Maxdate. /// Upr. - /// Response string. - 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 (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 (); } diff --git a/web/Helpers/Google/OAuth2.cs b/web/Helpers/Google/OAuth2.cs index 5bd260c5..22b4a937 100644 --- a/web/Helpers/Google/OAuth2.cs +++ b/web/Helpers/Google/OAuth2.cs @@ -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 (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 (responseStr); - readStream.Close (); - } + gat = (AuthToken) new DataContractJsonSerializer(typeof(AuthToken)).ReadObject (responseStream); responseStream.Close (); } response.Close (); diff --git a/web/Helpers/SimpleJsonPostMethod.cs b/web/Helpers/SimpleJsonPostMethod.cs index 7a521efa..c608bd46 100644 --- a/web/Helpers/SimpleJsonPostMethod.cs +++ b/web/Helpers/SimpleJsonPostMethod.cs @@ -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 /// Query. 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 (responseStr); - readStream.Close (); - } - responseStream.Close (); + ans = (TAnswer) seransw.ReadObject(responseStream); } response.Close(); } diff --git a/web/Models/App.master b/web/Models/App.master index aa7de13a..7c5db7f0 100644 --- a/web/Models/App.master +++ b/web/Models/App.master @@ -11,7 +11,7 @@ - + @@ -52,12 +52,12 @@ Page d'accueil <%= Html.ActionLink("Login", "Login", "Account", new { returnUrl=Request.Url.PathAndQuery }, new { @class="actionlink" } ) %> Pour pouvoir poster ou commenter - ?returnUrl=<%=Request.Url.PathAndQuery%>" class="actionlink"> + ?returnUrl=<%=ViewData["returnUrl"]==null?Request.Url.PathAndQuery:(string)ViewData["returnUrl"]%>" class="actionlink"> Google sign in S'authentifier avec son compte Google+ <% } 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" }) %> Édition de votre profile @ <%= Html.ActionLink( YavscHelpers.SiteName, "Index", "Home" ,null, new { @class="actionlink" }) %> Page d'accueil diff --git a/web/MvcActionValueBinder.cs b/web/MvcActionValueBinder.cs deleted file mode 100644 index 83e19df7..00000000 --- a/web/MvcActionValueBinder.cs +++ /dev/null @@ -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. - /// - /// Mvc action value binder. - /// - 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"; - - /// - /// Gets the binding. - /// - /// The binding. - /// Action descriptor. - 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 vpfs = new List(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 ().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 - } - } - } -} - - diff --git a/web/Views/Account/Profile.aspx b/web/Views/Account/MyProfile.aspx similarity index 97% rename from web/Views/Account/Profile.aspx rename to web/Views/Account/MyProfile.aspx index fa9ea1cc..4cbc9534 100644 --- a/web/Views/Account/Profile.aspx +++ b/web/Views/Account/MyProfile.aspx @@ -11,7 +11,7 @@ table.layout { border-width: 0; } table.layout TR TD { max-width:40%; } <%= 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" })) %> <% { %>
Informations générales diff --git a/web/Views/Account/RegistrationPending.aspx b/web/Views/Account/RegistrationPending.aspx index 4cb3accf..f5e01246 100644 --- a/web/Views/Account/RegistrationPending.aspx +++ b/web/Views/Account/RegistrationPending.aspx @@ -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.
Pour valider votre compte, suivez le lien indiqué dans cet e-mail. diff --git a/web/Views/Home/AssemblyInfo.aspx b/web/Views/Home/AssemblyInfo.aspx index f8135996..5c43f73f 100644 --- a/web/Views/Home/AssemblyInfo.aspx +++ b/web/Views/Home/AssemblyInfo.aspx @@ -4,7 +4,7 @@ Running assembly : <%= GetType().Assembly.FullName %>

-Assemblies referenced by the controllers : +Assemblies referenced in this application :

    <% foreach (System.Reflection.AssemblyName item in Model) { %>
  • <%= item.FullName %>
  • diff --git a/web/Web.config b/web/Web.config index 74f6228c..104ebd03 100644 --- a/web/Web.config +++ b/web/Web.config @@ -28,27 +28,6 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx
    - - - - - - - - - - - - - + + @@ -73,26 +53,26 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx - - - + + + + + - - - + + + + - - + + @@ -103,6 +83,8 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx + + @@ -117,7 +99,7 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx - + @@ -302,4 +284,26 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/web/Web.csproj b/web/Web.csproj index 8b266c26..790a1408 100644 --- a/web/Web.csproj +++ b/web/Web.csproj @@ -53,7 +53,6 @@ - @@ -86,15 +85,23 @@ - - - - - + + + + ..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll + + + + ..\packages\PayPalCoreSDK.1.6.0\lib\net451\PayPalCoreSDK.dll + + + + + @@ -152,7 +159,6 @@ - @@ -211,7 +217,6 @@ - @@ -666,6 +671,7 @@ + diff --git a/web/favicon.png b/web/favicon.png index 1abcbea6..440d3a24 100644 Binary files a/web/favicon.png and b/web/favicon.png differ diff --git a/web/templates/Estim.cs b/web/templates/Estim.cs index 2058b477..ad7a2a4c 100644 --- a/web/templates/Estim.cs +++ b/web/templates/Estim.cs @@ -553,7 +553,9 @@ namespace Yavsc.templates { #line hidden return this.GenerationEnvironment.ToString(); } - + /// + /// Initialize this instance. + /// public virtual void Initialize() { if ((this.Errors.HasErrors == false)) { bool _estimAcquired = false; diff --git a/web/web.config b/web/web.config deleted file mode 100644 index 67113e62..00000000 --- a/web/web.config +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/yavscModel/Blogs/BlogManager.cs b/yavscModel/Blogs/BlogManager.cs index 08633862..052d76ea 100644 --- a/yavscModel/Blogs/BlogManager.cs +++ b/yavscModel/Blogs/BlogManager.cs @@ -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) diff --git a/yavscModel/Blogs/Configuration/BlogProvidersConfigurationSection.cs b/yavscModel/Blogs/Configuration/BlogProvidersConfigurationSection.cs index 259706aa..cc4a0c7a 100644 --- a/yavscModel/Blogs/Configuration/BlogProvidersConfigurationSection.cs +++ b/yavscModel/Blogs/Configuration/BlogProvidersConfigurationSection.cs @@ -16,13 +16,12 @@ namespace Yavsc.Model.Blogs.Configuration set { this["defaultProvider"] = value; } } - - [ConfigurationProperty("providers")] [ConfigurationCollection(typeof(BlogProvidersConfigurationCollection), AddItemName = "add", ClearItemsName = "clear", RemoveItemName = "remove")] + /// /// Gets or sets the providers. /// diff --git a/yavscModel/FrontOffice/Basket.cs b/yavscModel/FrontOffice/Basket.cs index 23f8d79d..1d8be19b 100644 --- a/yavscModel/FrontOffice/Basket.cs +++ b/yavscModel/FrontOffice/Basket.cs @@ -24,8 +24,14 @@ using Yavsc.Model.WorkFlow; namespace Yavsc.Model.FrontOffice { + /// + /// Basket. + /// public class Basket: List { + /// + /// Initializes a new instance of the class. + /// public Basket () { } diff --git a/yavscModel/FrontOffice/Catalog/Brand.cs b/yavscModel/FrontOffice/Catalog/Brand.cs index 470a7bcf..e2fe27ba 100644 --- a/yavscModel/FrontOffice/Catalog/Brand.cs +++ b/yavscModel/FrontOffice/Catalog/Brand.cs @@ -3,19 +3,41 @@ using System.ComponentModel.DataAnnotations; namespace Yavsc.Model.FrontOffice { + /// + /// Brand. + /// public class Brand { + /// + /// Initializes a new instance of the class. + /// public Brand () { } - + + /// + /// Gets or sets the name. + /// + /// The name. [Required] public string Name { get; set; } + /// + /// Gets or sets the slogan. + /// + /// The slogan. public string Slogan { get; set; } + /// + /// Gets or sets the logo. + /// + /// The logo. public ProductImage Logo { get; set; } + /// + /// Gets or sets the categories. + /// + /// The categories. public ProductCategory[] Categories { get; set; } /// /// Gets or sets the default form. @@ -23,10 +45,21 @@ namespace Yavsc.Model.FrontOffice /// The default form. public SaleForm DefaultForm { get; set; } + /// + /// Gets the product category. + /// + /// The product category. + /// Reference. public ProductCategory GetProductCategory(string reference) { return Array.Find(Categories, c => c.Reference == reference); } + + /// + /// Gets the name of the product category by. + /// + /// The product category by name. + /// Cat name. public ProductCategory GetProductCategoryByName(string catName) { return Array.Find(Categories, c => c.Name == catName); diff --git a/yavscModel/FrontOffice/Commande.cs b/yavscModel/FrontOffice/Commande.cs index 4aa62c3e..a08bb116 100644 --- a/yavscModel/FrontOffice/Commande.cs +++ b/yavscModel/FrontOffice/Commande.cs @@ -7,17 +7,39 @@ using Newtonsoft.Json; namespace Yavsc.Model.FrontOffice { + /// + /// Commande. + /// public class Commande { + /// + /// Gets or sets the creation date. + /// + /// The creation date. public DateTime CreationDate { get; set; } + /// + /// Gets or sets the identifier. + /// + /// The identifier. public long Id { get; set; } + /// + /// Gets or sets the prod reference. + /// + /// The prod reference. public string ProdRef { get; set; } - + /// + /// The parameters. + /// public StringDictionary Parameters = new StringDictionary(); - + /// + /// Initializes a new instance of the class. + /// public Commande() { } - + /// + /// Create the specified collection. + /// + /// Collection. public static Commande Create(NameValueCollection collection) { Commande cmd = new Commande (); diff --git a/yavscModel/Google/GoogleErrorMessage.cs b/yavscModel/Google/GoogleErrorMessage.cs index 48ef7dfd..b28ee77e 100644 --- a/yavscModel/Google/GoogleErrorMessage.cs +++ b/yavscModel/Google/GoogleErrorMessage.cs @@ -25,11 +25,25 @@ using Newtonsoft.Json; namespace Yavsc.Model.Google { + /// + /// Google error exception. + /// public class GoogleErrorException : Exception { + /// + /// Gets or sets the title. + /// + /// The title. public string Title { get; set; } + /// + /// Gets or sets the content. + /// + /// The content. public string Content { get; set; } - + /// + /// Initializes a new instance of the class. + /// + /// Ex. 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) { + /// + /// Initializes a new instance of the class. + /// + /// Ex. + /// Message. + [Obsolete] + public GoogleErrorException(Exception ex, string message) { Content = message; Title = ex.Message; } + /// + /// Initializes a new instance of the class. + /// + /// Ex. + [Obsolete] + public GoogleErrorException(Exception ex) { + Content = ex.Message; + Title = ex.GetType().FullName; + } } } diff --git a/yavscModel/RolesAndMemebers/ChangePasswordModel.cs b/yavscModel/RolesAndMemebers/ChangePasswordModel.cs index b8d5d12a..30c60f7d 100644 --- a/yavscModel/RolesAndMemebers/ChangePasswordModel.cs +++ b/yavscModel/RolesAndMemebers/ChangePasswordModel.cs @@ -3,17 +3,36 @@ using System.ComponentModel.DataAnnotations; namespace Yavsc.Model.RolesAndMembers { + /// + /// Change password model. + /// public class ChangePasswordModel { + /// + /// Gets or sets the username. + /// + /// The username. [Required(ErrorMessage = "Please enter a Username")] public string Username { get; set; } + /// + /// Gets or sets the old password. + /// + /// The old password. [Required(ErrorMessage = "Please your old Password")] public string OldPassword { get; set; } + /// + /// Gets or sets the new password. + /// + /// The new password. [Required(ErrorMessage = "Please enter a new Password")] public string NewPassword { get; set; } + /// + /// Gets or sets the confirm password. + /// + /// The confirm password. [Required(ErrorMessage = "Please confirm the new Password")] public string ConfirmPassword { get; set; }