xml doc
This commit is contained in:
@ -7,6 +7,7 @@ using Yavsc.Model.WorkFlow;
|
||||
using System.Web.Mvc;
|
||||
using System.Configuration.Provider;
|
||||
using System.Collections.Generic;
|
||||
using Yavsc.Model.FrontOffice;
|
||||
|
||||
namespace WorkFlowProvider
|
||||
{
|
||||
@ -18,7 +19,7 @@ namespace WorkFlowProvider
|
||||
using (NpgsqlConnection cnx = CreateConnection ()) {
|
||||
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
|
||||
cmd.CommandText =
|
||||
"insert into commandes (pref,creation) values (@pref,@creat) returning _id";
|
||||
"insert into commandes (prdref,creation) values (@pref,@creat) returning id";
|
||||
cmd.Parameters.Add ("@pref", com.ProdRef);
|
||||
cmd.Parameters.Add ("@creat", com.CreationDate);
|
||||
cnx.Open ();
|
||||
|
@ -64,15 +64,5 @@ namespace Yavsc.ApiControllers
|
||||
return wfmgr.GetEstimates (
|
||||
Membership.GetUser().UserName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Order the specified bi.
|
||||
/// </summary>
|
||||
/// <param name="bi">Bi.</param>
|
||||
[HttpGet]
|
||||
public object Order (BasketImpact bi)
|
||||
{
|
||||
return new { c="lmk,", message="Panier impacté", impactRef=bi.ProductRef, count=bi.Count};
|
||||
}
|
||||
}
|
||||
}
|
@ -13,6 +13,7 @@ using Yavsc.Model.WorkFlow;
|
||||
using WorkFlowProvider;
|
||||
using System.Web.Security;
|
||||
using System.Threading;
|
||||
using Yavsc.Model.FrontOffice;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
@ -26,6 +27,7 @@ namespace Yavsc.Controllers
|
||||
/// The wfmgr.
|
||||
/// </summary>
|
||||
protected WorkFlowManager wfmgr = null;
|
||||
|
||||
/// <summary>
|
||||
/// Initialize the specified requestContext.
|
||||
/// </summary>
|
||||
@ -35,6 +37,7 @@ namespace Yavsc.Controllers
|
||||
base.Initialize (requestContext);
|
||||
wfmgr = new WorkFlowManager ();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Index this instance.
|
||||
/// </summary>
|
||||
@ -42,6 +45,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
return View ();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Estimates this instance.
|
||||
/// </summary>
|
||||
@ -50,15 +54,16 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
string username = Membership.GetUser ().UserName;
|
||||
|
||||
return View(wfmgr.GetEstimates (username));
|
||||
return View (wfmgr.GetEstimates (username));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Estimate the specified model and submit.
|
||||
/// </summary>
|
||||
/// <param name="model">Model.</param>
|
||||
/// <param name="submit">Submit.</param>
|
||||
[Authorize]
|
||||
public ActionResult Estimate(Estimate model,string submit)
|
||||
public ActionResult Estimate (Estimate model, string submit)
|
||||
{
|
||||
ViewData ["WebApiBase"] = "http://" + Request.Url.Authority + "/api";
|
||||
ViewData ["WABASEWF"] = ViewData ["WebApiBase"] + "/WorkFlow";
|
||||
@ -80,12 +85,12 @@ namespace Yavsc.Controllers
|
||||
} else {
|
||||
string username = HttpContext.User.Identity.Name;
|
||||
if (model.Id == 0) {
|
||||
model.Responsible=username;
|
||||
model.Responsible = username;
|
||||
ModelState.Clear ();
|
||||
}
|
||||
if (ModelState.IsValid) {
|
||||
if (username != model.Responsible
|
||||
&& !Roles.IsUserInRole ("FrontOffice"))
|
||||
&& !Roles.IsUserInRole ("FrontOffice"))
|
||||
throw new UnauthorizedAccessException ("You're not allowed to modify this estimate");
|
||||
|
||||
if (model.Id == 0)
|
||||
@ -98,12 +103,13 @@ namespace Yavsc.Controllers
|
||||
}
|
||||
}
|
||||
}
|
||||
return View(model);
|
||||
return View (model);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Catalog this instance.
|
||||
/// </summary>
|
||||
[AcceptVerbs("GET")]
|
||||
[AcceptVerbs ("GET")]
|
||||
public ActionResult Catalog ()
|
||||
{
|
||||
return View (
|
||||
@ -114,12 +120,12 @@ namespace Yavsc.Controllers
|
||||
/// <summary>
|
||||
/// Catalog this instance.
|
||||
/// </summary>
|
||||
[AcceptVerbs("GET")]
|
||||
[AcceptVerbs ("GET")]
|
||||
public ActionResult Brand (string id)
|
||||
{
|
||||
Catalog c = CatalogManager.GetCatalog (Request.Url.AbsolutePath);
|
||||
ViewData ["BrandName"] = id;
|
||||
return View ( c.GetBrand (id) );
|
||||
return View (c.GetBrand (id));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -128,7 +134,7 @@ namespace Yavsc.Controllers
|
||||
/// <returns>The category object.</returns>
|
||||
/// <param name="brandid">Brand id.</param>
|
||||
/// <param name="pcid">Product category Id.</param>
|
||||
[AcceptVerbs("GET")]
|
||||
[AcceptVerbs ("GET")]
|
||||
public ActionResult ProductCategory (string brandid, string pcid)
|
||||
{
|
||||
ViewData ["BrandId"] = brandid;
|
||||
@ -137,13 +143,14 @@ namespace Yavsc.Controllers
|
||||
CatalogManager.GetCatalog (Request.Url.AbsolutePath).GetBrand (brandid).GetProductCategory (pcid)
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Product the specified id, pc and pref.
|
||||
/// </summary>
|
||||
/// <param name="id">Identifier.</param>
|
||||
/// <param name="pc">Pc.</param>
|
||||
/// <param name="pref">Preference.</param>
|
||||
[AcceptVerbs("GET")]
|
||||
[AcceptVerbs ("GET")]
|
||||
public ActionResult Product (string id, string pc, string pref)
|
||||
{
|
||||
Product p = null;
|
||||
@ -168,62 +175,68 @@ namespace Yavsc.Controllers
|
||||
}
|
||||
ViewData ["ProdCatName"] = pcat.Name;
|
||||
p = pcat.GetProduct (pref);
|
||||
if (p.CommandForm==null)
|
||||
if (p.CommandForm == null)
|
||||
p.CommandForm = b.DefaultForm;
|
||||
|
||||
return View ((p is Service)?"Service":"Product", p);
|
||||
return View ((p is Service) ? "Service" : "Product", p);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Command this instance.
|
||||
/// </summary>
|
||||
public ActionResult Command()
|
||||
public ActionResult Command ()
|
||||
{
|
||||
return View ();
|
||||
}
|
||||
|
||||
private Basket GetBasket ()
|
||||
{
|
||||
if (Session ["Basket"] == null)
|
||||
Session ["Basket"] = new Basket();
|
||||
return Session ["Basket"] as Basket;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Command the specified collection.
|
||||
/// </summary>
|
||||
/// <param name="collection">Collection.</param>
|
||||
[HttpPost]
|
||||
[Authorize]
|
||||
public ActionResult Command(FormCollection collection)
|
||||
public ActionResult Command (FormCollection collection)
|
||||
{
|
||||
try {
|
||||
// get files from the request
|
||||
string fnre = "[A-Za-z0-9~\\-.]+";
|
||||
HttpFileCollectionBase hfc = Request.Files;
|
||||
|
||||
foreach (String h in hfc.AllKeys)
|
||||
{
|
||||
if (!Regex.Match(hfc[h].FileName,fnre).Success)
|
||||
{
|
||||
foreach (String h in hfc.AllKeys) {
|
||||
if (!Regex.Match (hfc [h].FileName, fnre).Success) {
|
||||
ViewData ["Message"] = "File name refused";
|
||||
ModelState.AddModelError(
|
||||
ModelState.AddModelError (
|
||||
h,
|
||||
string.Format(
|
||||
string.Format (
|
||||
"The file name {0} dosn't match an acceptable file name {1}",
|
||||
hfc[h].FileName,fnre))
|
||||
;
|
||||
return View(collection);
|
||||
hfc [h].FileName, fnre));
|
||||
return View (collection);
|
||||
}
|
||||
}
|
||||
foreach (String h in hfc.AllKeys)
|
||||
{
|
||||
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 (FileSystemController.BaseDir, hfc [h].FileName));
|
||||
}
|
||||
if (Session["Basket"]==null)
|
||||
Session["Basket"]=new List<Commande>();
|
||||
List<Commande> basket = Session["Basket"] as List<Commande>;
|
||||
// Add specified product command to the basket,
|
||||
basket.Add(Commande.Create(collection));
|
||||
GetBasket().Add (Commande.Create (collection));
|
||||
ViewData ["Message"] = LocalizedText.Item_added_to_basket;
|
||||
return View (collection);
|
||||
} catch (Exception e)
|
||||
{
|
||||
ViewData ["Message"] = "Exception:"+e.Message;
|
||||
} catch (Exception e) {
|
||||
ViewData ["Message"] = "Exception:" + e.Message;
|
||||
return View (collection);
|
||||
}
|
||||
}
|
||||
|
||||
ActionResult YourCommands ()
|
||||
{
|
||||
return View (GetBasket());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,11 +30,29 @@ using System.Net;
|
||||
|
||||
namespace Yavsc.Formatters
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Formats a given error message to respond
|
||||
/// in case of error, and in an html format
|
||||
/// </summary>
|
||||
public class ErrorHtmlFormatter:SimpleFormatter {
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the title.
|
||||
/// </summary>
|
||||
/// <value>The title.</value>
|
||||
public string Title { get ; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the error code.
|
||||
/// </summary>
|
||||
/// <value>The error code.</value>
|
||||
public HttpStatusCode ErrorCode { get ; set; }
|
||||
|
||||
string doctype="<!DOCTYPE html>";
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Formatters.ErrorHtmlFormatter"/> class.
|
||||
/// </summary>
|
||||
/// <param name="errorCode">Error code.</param>
|
||||
/// <param name="title">Title.</param>
|
||||
public ErrorHtmlFormatter
|
||||
(HttpStatusCode errorCode, string title):base("text/html")
|
||||
{
|
||||
@ -42,7 +60,13 @@ namespace Yavsc.Formatters
|
||||
Title = title;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Writes to stream.
|
||||
/// </summary>
|
||||
/// <param name="type">Type.</param>
|
||||
/// <param name="value">Value.</param>
|
||||
/// <param name="stream">Stream.</param>
|
||||
/// <param name="contentHeaders">Content headers.</param>
|
||||
public override void WriteToStream (Type type, object value, Stream stream, HttpContentHeaders contentHeaders)
|
||||
{
|
||||
// TODO create a type containing T4 parameters, and generate from them
|
||||
|
@ -32,18 +32,28 @@ using System.Text;
|
||||
|
||||
namespace Yavsc.Formatters
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Rss feeds formatter.
|
||||
/// </summary>
|
||||
public class RssFeedsFormatter:SimpleFormatter
|
||||
{
|
||||
string doctype = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Formatters.RssFeedsFormatter"/> class.
|
||||
/// </summary>
|
||||
public RssFeedsFormatter
|
||||
() : base ("application/rss+xml")
|
||||
{
|
||||
}
|
||||
|
||||
private const string dateformat = "ddd, dd MMM yyyy HH:mm:ss K";
|
||||
|
||||
/// <summary>
|
||||
/// Writes to stream.
|
||||
/// </summary>
|
||||
/// <param name="type">Type.</param>
|
||||
/// <param name="value">Value.</param>
|
||||
/// <param name="stream">Stream.</param>
|
||||
/// <param name="contentHeaders">Content headers.</param>
|
||||
public override void WriteToStream (Type type, object value, Stream stream, HttpContentHeaders contentHeaders)
|
||||
{
|
||||
RssFeedsChannel feeds = value as RssFeedsChannel;
|
||||
|
@ -30,29 +30,48 @@ using Newtonsoft.Json;
|
||||
|
||||
namespace Yavsc.Helpers.Google
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Google base API client.
|
||||
/// This class implements the identification values for a Google Api,
|
||||
/// and provides some scope values.
|
||||
/// </summary>
|
||||
public class ApiClient
|
||||
{
|
||||
/// <summary>
|
||||
/// The CLIENT Id.
|
||||
/// </summary>
|
||||
protected static string CLIENT_ID = "325408689282-6bekh7p3guj4k0f3301a6frf025cnrk1.apps.googleusercontent.com";
|
||||
/// <summary>
|
||||
/// The CLIENt SECREt
|
||||
/// </summary>
|
||||
protected static string CLIENT_SECRET = "MaxYcvJJCs2gDGvaELZbzwfL";
|
||||
|
||||
/// <summary>
|
||||
/// The API KEY.
|
||||
/// </summary>
|
||||
protected static string API_KEY="AIzaSyBV_LQHb22nGgjNvFzZwnQHjao3Q7IewRw";
|
||||
/* // to use in descendence
|
||||
*
|
||||
protected static string getPeopleUri = "https://www.googleapis.com/plus/v1/people";
|
||||
private static string authUri = "https://accounts.google.com/o/oauth2/auth";
|
||||
*/
|
||||
|
||||
/// <summary>
|
||||
/// The Map tracks scope .
|
||||
/// </summary>
|
||||
protected static string scopeTracks = "https://www.googleapis.com/auth/tracks";
|
||||
/// <summary>
|
||||
/// The calendar scope.
|
||||
/// </summary>
|
||||
protected static string scopeCalendar = "https://www.googleapis.com/auth/calendar";
|
||||
|
||||
/// <summary>
|
||||
/// The scope openid.
|
||||
/// </summary>
|
||||
protected static string[] scopeOpenid = {
|
||||
"openid",
|
||||
"profile",
|
||||
"email"
|
||||
};
|
||||
|
||||
// private static string dateFormat = "yyyy-MM-ddTHH:mm:ss";
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -31,14 +31,36 @@ using System.Web;
|
||||
|
||||
namespace Yavsc.Helpers.Google
|
||||
{
|
||||
/// <summary>
|
||||
/// Google Calendar API client.
|
||||
/// </summary>
|
||||
public class CalendarApi: ApiClient
|
||||
{
|
||||
/// <summary>
|
||||
/// The get cal list URI.
|
||||
/// </summary>
|
||||
protected static string getCalListUri = "https://www.googleapis.com/calendar/v3/users/me/calendarList";
|
||||
/// <summary>
|
||||
/// The get cal entries URI.
|
||||
/// </summary>
|
||||
protected static string getCalEntriesUri = "https://www.googleapis.com/calendar/v3/calendars/{0}/events";
|
||||
|
||||
/// <summary>
|
||||
/// The date format.
|
||||
/// </summary>
|
||||
private static string dateFormat = "yyyy-MM-ddTHH:mm:ss";
|
||||
|
||||
/// <summary>
|
||||
/// The time zone. TODO Fixme with machine time zone
|
||||
/// </summary>
|
||||
private string timeZone = "+01:00";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the calendar list.
|
||||
/// </summary>
|
||||
/// <returns>The calendars.</returns>
|
||||
/// <param name="cred">Cred.</param>
|
||||
/// <param name="json">Json.</param>
|
||||
public CalendarList GetCalendars (string cred, out string json)
|
||||
{
|
||||
CalendarList res = null;
|
||||
@ -59,6 +81,15 @@ namespace Yavsc.Helpers.Google
|
||||
return res;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a calendar.
|
||||
/// </summary>
|
||||
/// <returns>The calendar.</returns>
|
||||
/// <param name="calid">Calid.</param>
|
||||
/// <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)
|
||||
{
|
||||
string uri = string.Format (
|
||||
|
@ -30,9 +30,17 @@ using Newtonsoft.Json;
|
||||
|
||||
namespace Yavsc.Helpers.Google
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Entity query.
|
||||
/// </summary>
|
||||
public class EntityQuery {
|
||||
/// <summary>
|
||||
/// The entity identifiers.
|
||||
/// </summary>
|
||||
public string [] EntityIds;
|
||||
/// <summary>
|
||||
/// The minimum identifier.
|
||||
/// </summary>
|
||||
public string MinId;
|
||||
}
|
||||
}
|
||||
|
@ -29,8 +29,14 @@ using Newtonsoft.Json;
|
||||
|
||||
namespace Yavsc.Helpers.Google
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Google Map tracks Api client.
|
||||
/// </summary>
|
||||
public class MapTracks:ApiClient {
|
||||
|
||||
/// <summary>
|
||||
/// The google map tracks path (uri of the service).
|
||||
/// </summary>
|
||||
protected static string googleMapTracksPath = "https://www.googleapis.com/tracks/v1/";
|
||||
// entities/[create|list|delete]
|
||||
// collections/[list|create|[add|remove]entities|delete]
|
||||
@ -41,8 +47,12 @@ namespace Yavsc.Helpers.Google
|
||||
// collections/[list|create|[add|remove]entities|delete]
|
||||
// crumbs/[record|getrecent|gethistory|report|summarize|getlocationinfo|delete
|
||||
|
||||
|
||||
static string [] CreateEntity( Entity[] entities ) {
|
||||
/// <summary>
|
||||
/// Creates the entity.
|
||||
/// </summary>
|
||||
/// <returns>The entity.</returns>
|
||||
/// <param name="entities">Entities.</param>
|
||||
public static string [] CreateEntity( Entity[] entities ) {
|
||||
string [] ans = null;
|
||||
using (SimpleJsonPostMethod< Entity[] ,string []> wr =
|
||||
new SimpleJsonPostMethod< Entity[] ,string[]> (googleMapTracksPath + "entities/create"))
|
||||
@ -51,6 +61,12 @@ namespace Yavsc.Helpers.Google
|
||||
}
|
||||
return ans;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Lists the entities.
|
||||
/// </summary>
|
||||
/// <returns>The entities.</returns>
|
||||
/// <param name="eq">Eq.</param>
|
||||
static Entity[] ListEntities (EntityQuery eq)
|
||||
{
|
||||
Entity [] ans = null;
|
||||
|
@ -30,11 +30,18 @@ using Yavsc.Model;
|
||||
|
||||
namespace Yavsc.Helpers.Google
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Google People API.
|
||||
/// </summary>
|
||||
public class PeopleApi: ApiClient
|
||||
{
|
||||
private static string getPeopleUri = "https://www.googleapis.com/plus/v1/people";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the People object associated to the given Google Access Token
|
||||
/// </summary>
|
||||
/// <returns>The me.</returns>
|
||||
/// <param name="gat">The Google Access Token object <see cref="AuthToken"/> class.</param>
|
||||
public static People GetMe (AuthToken gat)
|
||||
{
|
||||
People me;
|
||||
@ -57,13 +64,31 @@ namespace Yavsc.Helpers.Google
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Google O auth2 client.
|
||||
/// </summary>
|
||||
public class OAuth2:ApiClient
|
||||
{
|
||||
/// <summary>
|
||||
/// The URI used to get tokens.
|
||||
/// </summary>
|
||||
protected static string tokenUri = "https://accounts.google.com/o/oauth2/token";
|
||||
|
||||
/// <summary>
|
||||
/// The URI used to get authorized to.
|
||||
/// </summary>
|
||||
protected static string authUri = "https://accounts.google.com/o/oauth2/auth";
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the redirect URI sent to Google.
|
||||
/// </summary>
|
||||
/// <value>The redirect URI.</value>
|
||||
public string RedirectUri { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Helpers.Google.OAuth2"/> class.
|
||||
/// </summary>
|
||||
/// <param name="redirectUri">Redirect URI.</param>
|
||||
public OAuth2 (string redirectUri)
|
||||
{
|
||||
RedirectUri = redirectUri;
|
||||
@ -84,7 +109,11 @@ namespace Yavsc.Helpers.Google
|
||||
CLIENT_ID, RedirectUri, scope, state);
|
||||
GetAuthResponse (bresp, prms);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the cal authorization.
|
||||
/// </summary>
|
||||
/// <param name="bresp">Bresp.</param>
|
||||
/// <param name="state">State.</param>
|
||||
public void GetCalAuth (HttpResponseBase bresp, string state)
|
||||
{
|
||||
string scope = string.Join ("%20", scopeOpenid);
|
||||
@ -130,7 +159,13 @@ namespace Yavsc.Helpers.Google
|
||||
HttpUtility.UrlEncode (code));
|
||||
return postdata;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Google Authorization token.
|
||||
/// </summary>
|
||||
/// <returns>The token.</returns>
|
||||
/// <param name="rq">Rq.</param>
|
||||
/// <param name="state">State.</param>
|
||||
/// <param name="message">Message.</param>
|
||||
public AuthToken GetToken (HttpRequestBase rq, string state, out string message)
|
||||
{
|
||||
string code = OAuth2.GetCodeFromRequest (rq, state, out message);
|
||||
@ -138,12 +173,6 @@ namespace Yavsc.Helpers.Google
|
||||
return GetTokenPosting (postdata);
|
||||
}
|
||||
|
||||
[Obsolete ("Use GetToken instead.")]
|
||||
public static AuthToken GetTokenFromBody (string postdata)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
internal static AuthToken GetTokenPosting (string postdata)
|
||||
{
|
||||
HttpWebRequest webreq = WebRequest.CreateHttp (tokenUri);
|
||||
@ -174,6 +203,13 @@ namespace Yavsc.Helpers.Google
|
||||
return gat;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the code from the Google request.
|
||||
/// </summary>
|
||||
/// <returns>The code from request.</returns>
|
||||
/// <param name="rq">Rq.</param>
|
||||
/// <param name="state">State.</param>
|
||||
/// <param name="message">Message.</param>
|
||||
public static string GetCodeFromRequest (HttpRequestBase rq, string state, out string message)
|
||||
{
|
||||
message = "";
|
||||
@ -194,6 +230,11 @@ namespace Yavsc.Helpers.Google
|
||||
return code;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets fresh google credential.
|
||||
/// </summary>
|
||||
/// <returns>The fresh google credential.</returns>
|
||||
/// <param name="pr">Pr.</param>
|
||||
public static string GetFreshGoogleCredential (ProfileBase pr)
|
||||
{
|
||||
string token = (string)pr.GetPropertyValue ("gtoken");
|
||||
|
@ -97,14 +97,10 @@ namespace Yavsc.Helpers
|
||||
}
|
||||
|
||||
#region IDisposable implementation
|
||||
|
||||
/// <summary>
|
||||
/// Releases all resource used by the <see cref="Yavsc.Helpers.SimpleJsonPostMethod`2"/> object.
|
||||
/// Releases all resource used by the Yavsc.Helpers.SimpleJsonPostMethod object.
|
||||
/// </summary>
|
||||
/// <remarks>Call <see cref="Dispose"/> when you are finished using the <see cref="Yavsc.Helpers.SimpleJsonPostMethod`2"/>. The
|
||||
/// <see cref="Dispose"/> method leaves the <see cref="Yavsc.Helpers.SimpleJsonPostMethod`2"/> in an unusable state.
|
||||
/// After calling <see cref="Dispose"/>, you must release all references to the
|
||||
/// <see cref="Yavsc.Helpers.SimpleJsonPostMethod`2"/> so the garbage collector can reclaim the memory that the
|
||||
/// <see cref="Yavsc.Helpers.SimpleJsonPostMethod`2"/> was occupying.</remarks>
|
||||
public void Dispose ()
|
||||
{
|
||||
if (Request != null) Request.Abort ();
|
||||
|
@ -23,12 +23,21 @@ using System.Configuration;
|
||||
|
||||
namespace Yavsc.Settings
|
||||
{
|
||||
/// <summary>
|
||||
/// Module configuration element. (NOTUSED)
|
||||
/// </summary>
|
||||
public class ModuleConfigurationElement : ConfigurationElement
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Settings.ModuleConfigurationElement"/> class.
|
||||
/// </summary>
|
||||
public ModuleConfigurationElement ()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the module.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
[ConfigurationProperty("name", IsKey=true, IsRequired=true)]
|
||||
public string Name {
|
||||
get {
|
||||
@ -36,7 +45,10 @@ namespace Yavsc.Settings
|
||||
}
|
||||
set { base ["name"] = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the class.
|
||||
/// </summary>
|
||||
/// <value>The name of the class.</value>
|
||||
[ConfigurationProperty("name", IsKey=true, IsRequired=true)]
|
||||
public string ClassName {
|
||||
get {
|
||||
|
@ -23,8 +23,15 @@ using System.Configuration;
|
||||
|
||||
namespace Yavsc.Settings
|
||||
{
|
||||
/// <summary>
|
||||
/// Modules configuration section.
|
||||
/// This class is not yet used ...
|
||||
/// </summary>
|
||||
public class ModulesConfigurationSection : ConfigurationSection
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Settings.ModulesConfigurationSection"/> class.
|
||||
/// </summary>
|
||||
public ModulesConfigurationSection ()
|
||||
{
|
||||
}
|
||||
|
@ -3,16 +3,35 @@ using System.Configuration;
|
||||
|
||||
namespace Yavsc
|
||||
{
|
||||
/// <summary>
|
||||
/// Thanks configuration collection.
|
||||
/// Imlements the configuration,
|
||||
/// providing the thanks collection
|
||||
/// </summary>
|
||||
public class ThanksConfigurationCollection : ConfigurationElementCollection
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the element key.
|
||||
/// </summary>
|
||||
/// <returns>The element key.</returns>
|
||||
/// <param name="element">Element.</param>
|
||||
protected override object GetElementKey (ConfigurationElement element)
|
||||
{
|
||||
return ((ThanksConfigurationElement) element).Name;
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates the new element.
|
||||
/// </summary>
|
||||
/// <returns>The new element.</returns>
|
||||
protected override ConfigurationElement CreateNewElement ()
|
||||
{
|
||||
return new ThanksConfigurationElement();
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the element.
|
||||
/// </summary>
|
||||
/// <returns>The element.</returns>
|
||||
/// <param name="name">Name.</param>
|
||||
public ThanksConfigurationElement GetElement (string name)
|
||||
{
|
||||
return this.BaseGet(name) as ThanksConfigurationElement;
|
||||
|
@ -4,8 +4,16 @@ using System.Collections.Generic;
|
||||
|
||||
namespace Yavsc
|
||||
{
|
||||
/// <summary>
|
||||
/// Thanks helper.
|
||||
/// </summary>
|
||||
public static class ThanksHelper {
|
||||
static private ThanksConfigurationSection configurationSection=null;
|
||||
|
||||
static private ThanksConfigurationSection configurationSection=null;
|
||||
/// <summary>
|
||||
/// Gets the configuration section.
|
||||
/// </summary>
|
||||
/// <value>The configuration section.</value>
|
||||
static public ThanksConfigurationSection ConfigurationSection {
|
||||
get {
|
||||
if (configurationSection==null)
|
||||
@ -13,7 +21,9 @@ namespace Yavsc
|
||||
return configurationSection;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Html code for each entry
|
||||
/// </summary>
|
||||
public static string[] Links ()
|
||||
{
|
||||
List<string> result = new List<string>() ;
|
||||
|
@ -1,4 +1,12 @@
|
||||
<%@ Page Title="Commande" Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage<FormCollection>" %>
|
||||
<asp:Content ID="MainContentContent" ContentPlaceHolderID="MainContent" runat="server">
|
||||
rha
|
||||
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="MASContentContent" ContentPlaceHolderID="MASContent" runat="server">
|
||||
<ul><li>
|
||||
<%= Html.ActionLink("Catalog","Catalog" ) %>
|
||||
</li><li>
|
||||
<%= Html.ActionLink("Estimates","Estimates" ) %>
|
||||
</li></ul>
|
||||
</asp:Content>
|
@ -24,6 +24,9 @@ namespace Yavsc.templates
|
||||
{
|
||||
public partial class Estim
|
||||
{
|
||||
/// <summary>
|
||||
/// Inits this instance.
|
||||
/// </summary>
|
||||
public void Init ()
|
||||
{
|
||||
this.Initialize();
|
||||
|
35
yavscModel/FrontOffice/Basket.cs
Normal file
35
yavscModel/FrontOffice/Basket.cs
Normal file
@ -0,0 +1,35 @@
|
||||
//
|
||||
// Basket.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 Yavsc.Model.WorkFlow;
|
||||
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
public class Basket: List<Commande>
|
||||
{
|
||||
public Basket ()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -3,9 +3,10 @@ using Yavsc;
|
||||
using SalesCatalog;
|
||||
using SalesCatalog.Model;
|
||||
using System.Collections.Specialized;
|
||||
using Yavsc.Model.WorkFlow;
|
||||
|
||||
|
||||
namespace Yavsc.Model.WorkFlow
|
||||
namespace Yavsc.Model.FrontOffice
|
||||
{
|
||||
public class Commande
|
||||
{
|
||||
@ -19,7 +20,7 @@ namespace Yavsc.Model.WorkFlow
|
||||
{
|
||||
Commande cmd = new Commande ();
|
||||
// string catref=collection["catref"]; // Catalog Url from which formdata has been built
|
||||
cmd.ProdRef=collection["prodref"]; // Required product reference
|
||||
cmd.ProdRef=collection["ref"]; // Required product reference
|
||||
cmd.CreationDate = DateTime.Now;
|
||||
WorkFlowManager wm = new WorkFlowManager ();
|
||||
wm.RegisterCommand (cmd); // sets cmd.Id
|
6
yavscModel/LocalizedText.Designer.cs
generated
6
yavscModel/LocalizedText.Designer.cs
generated
@ -52,6 +52,12 @@ namespace Yavsc.Model {
|
||||
}
|
||||
}
|
||||
|
||||
public static string Item_added_to_basket {
|
||||
get {
|
||||
return ResourceManager.GetString("Item_added_to_basket", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
public static string Unitary_cost {
|
||||
get {
|
||||
return ResourceManager.GetString("Unitary_cost", resourceCulture);
|
||||
|
@ -45,5 +45,5 @@
|
||||
<data name="was_added_to_the_empty_role"><value>Il n'y avait pas 'utilisateur dans le rôle '{1}'. Vous ({0}) avez été ajouté au rôle '{1}'.</value></data>
|
||||
<data name="younotadmin"><value>Vous n'êtes pas administrateur</value></data>
|
||||
<data name="role_created"><value>Rôle créé</value></data>
|
||||
|
||||
<data name="Item_added_to_basket"><value>Article ajouté au panier</value></data>
|
||||
</root>
|
||||
|
@ -45,4 +45,5 @@
|
||||
<data name="was_added_to_the_empty_role"><value>There was no user in the '{1}' role. You ({0}) was just added as firt user in the '{1}' role.</value></data>
|
||||
<data name="younotadmin"><value>You're not administrator</value></data>
|
||||
<data name="role_created"><value>role created</value></data>
|
||||
<data name="Item_added_to_basket"><value>Item added to basket</value></data>
|
||||
</root>
|
||||
|
@ -1,16 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace Yavsc.Model.WorkFlow
|
||||
{
|
||||
|
||||
public class BasketImpact
|
||||
{
|
||||
public string ProductRef { get; set; }
|
||||
public int Count { get; set; }
|
||||
public string Message { get; set; }
|
||||
}
|
||||
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Mvc;
|
||||
using Yavsc.Model.FrontOffice;
|
||||
|
||||
namespace Yavsc.Model.WorkFlow
|
||||
{
|
||||
|
@ -1,25 +0,0 @@
|
||||
using System;
|
||||
using Yavsc.Model.WorkFlow;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace Yavsc.Model.WorkFlow
|
||||
{
|
||||
public interface IWFModule
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the state for an order (assuming it was passed to <c>Handle</c>).
|
||||
/// </summary>
|
||||
/// <returns>The state.</returns>
|
||||
/// <param name="c">C.</param>
|
||||
int GetState (IWFOrder c);
|
||||
/// <summary>
|
||||
/// Handle the specified order and form input value collection.
|
||||
/// </summary>
|
||||
/// <param name="order">l'ordre</param>
|
||||
/// <param name="collection">La collection de valeur de champs d'entée de formulaires.</param>
|
||||
/// <returns>0 when the module accepts to handle the order, non null value otherwize<returns>
|
||||
int Handle (IWFOrder order,FormCollection collection);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,22 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Yavsc.Model.WorkFlow
|
||||
{
|
||||
public interface IWFOrder
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the unique Identifier for this order, in this application.
|
||||
/// </summary>
|
||||
/// <value>The unique I.</value>
|
||||
long UniqueID {
|
||||
get;
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the actual status for this order.
|
||||
/// </summary>
|
||||
/// <returns>The status.</returns>
|
||||
string GetStatus();
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ using System.Configuration;
|
||||
using Yavsc.Model.WorkFlow.Configuration;
|
||||
using System.Collections.Specialized;
|
||||
using SalesCatalog.Model;
|
||||
using Yavsc.Model.FrontOffice;
|
||||
|
||||
namespace Yavsc.Model.WorkFlow
|
||||
{
|
||||
|
@ -58,10 +58,7 @@
|
||||
<Compile Include="FileSystem\FileInfoCollection.cs" />
|
||||
<Compile Include="WorkFlow\Writting.cs" />
|
||||
<Compile Include="WorkFlow\Estimate.cs" />
|
||||
<Compile Include="WorkFlow\WFOrder.cs" />
|
||||
<Compile Include="WorkFlow\IContentProvider.cs" />
|
||||
<Compile Include="WorkFlow\IWFModule.cs" />
|
||||
<Compile Include="WorkFlow\IWFOrder.cs" />
|
||||
<Compile Include="WorkFlow\OrderStatusChangedEventArgs.cs" />
|
||||
<Compile Include="Blogs\BlogEntry.cs" />
|
||||
<Compile Include="Blogs\Blog.cs" />
|
||||
@ -70,8 +67,6 @@
|
||||
<Compile Include="Blogs\FindBlogEntryFlags.cs" />
|
||||
<Compile Include="WorkFlow\StatusChange.cs" />
|
||||
<Compile Include="IModule.cs" />
|
||||
<Compile Include="WorkFlow\BasketImpact.cs" />
|
||||
<Compile Include="WorkFlow\Commande.cs" />
|
||||
<Compile Include="Blogs\BlogManager.cs" />
|
||||
<Compile Include="Blogs\BlogProvider.cs" />
|
||||
<Compile Include="WorkFlow\WorkFlowManager.cs" />
|
||||
@ -102,6 +97,8 @@
|
||||
<Compile Include="ViewRenderer.cs" />
|
||||
<Compile Include="Google\GoogleErrorMessage.cs" />
|
||||
<Compile Include="RssFeeds.cs" />
|
||||
<Compile Include="FrontOffice\Commande.cs" />
|
||||
<Compile Include="FrontOffice\Basket.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
@ -111,6 +108,7 @@
|
||||
<Folder Include="Admin\" />
|
||||
<Folder Include="FileSystem\" />
|
||||
<Folder Include="Google\" />
|
||||
<Folder Include="FrontOffice\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SalesCatalog\SalesCatalog.csproj">
|
||||
|
Reference in New Issue
Block a user