* 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:
parent
a342b744df
commit
e676d2fdbf
31 changed files with 246 additions and 234 deletions
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue