diff --git a/web/Catalog.xml b/web/Catalog.xml index 34ccc98d..10d6b2b6 100644 --- a/web/Catalog.xml +++ b/web/Catalog.xml @@ -1,65 +1,72 @@  - - - shdsi - Votre logiciel, efficace, sûr, et sur mesure - - /images/logoDev.png - - - - - Systèmes d'information et sites Web - ntic - - - Développement - Votre Extranet, Intranet, + + + shdsi + Votre logiciel, efficace, sûr, et sur mesure + + /images/logoDev.png + + + + + + Systèmes d'information et sites Web + ntic + + + Développement + Votre Extranet, Intranet, site Web, sur mesure, élégant et efficace, au look racé, accessible, et développé en cycles courts - nticdev - - - Maintenance - Correction des anomalies, réalisation des évolutions, prévision des besoins - nticmaint - - - - - - /Commande - - - Entrez un commentaire : - - - comment - Commentaire - - - Choisissez le type d'intervention souhaité: - - - - testarray[] - xxxxxxxxxx - - - testarray[] - - - - ad - - à distance - sur site - - 0 - - - - - - + nticdev + + + Maintenance + Correction des anomalies, réalisation des évolutions, prévision des besoins + nticmaint + + + + + + /Commande + + + Entrez un commentaire : + + + comment + Commentaire + + + Choisissez le type d'intervention souhaité: + + + ad + + + + + 0 + + + testarray[] + xxxxxxxxxx + + + testarray[] + + + + + + + + \ No newline at end of file diff --git a/web/Controllers/FileSystemController.cs b/web/Controllers/FileSystemController.cs index a9a847c8..5318db27 100644 --- a/web/Controllers/FileSystemController.cs +++ b/web/Controllers/FileSystemController.cs @@ -12,9 +12,10 @@ namespace Yavsc.Controllers /// /// File system controller. /// - public class FileSystemController : Controller - { - private static string usersDir ="~/users"; + public class FileSystemController : Controller + { + private static string usersDir = "~/users"; + /// /// Gets the users dir. /// @@ -24,51 +25,54 @@ namespace Yavsc.Controllers return usersDir; } } + /// /// Index this instance. /// [Authorize] - public ActionResult Index() - { + public ActionResult Index () + { string user = Membership.GetUser ().UserName; ViewData ["UserName"] = user; DirectoryInfo di = new DirectoryInfo ( - Path.Combine( - Server.MapPath(UsersDir), - user)); + Path.Combine ( + Server.MapPath (UsersDir), + user)); if (!di.Exists) di.Create (); - return View (new FileInfoCollection( di.GetFiles())); - } + return View (new FileInfoCollection (di.GetFiles ())); + } + /// /// Details the specified id. /// /// Identifier. - public ActionResult Details(string id) - { + public ActionResult Details (string id) + { foreach (char x in Path.GetInvalidPathChars()) { if (id.Contains (x)) { ViewData ["Message"] = string.Format ( - "Something went wrong following the following path : {0} (\"{1}\")", - id,x); + "Something went wrong following the following path : {0} (\"{1}\")", + id, x); return RedirectToAction ("Index"); } } string fpath = Path.Combine (BaseDir, id); - ViewData["Content"] = Url.Content (fpath); + ViewData ["Content"] = Url.Content (fpath); FileInfo fi = new FileInfo (fpath); return View (fi); - } + } + /// /// Create this instance. /// - public ActionResult Create() - { - return View (); - } + public ActionResult Create () + { + return View (); + } /// /// Create the specified collection. @@ -76,36 +80,32 @@ namespace Yavsc.Controllers /// Collection. [HttpPost] [Authorize] - public ActionResult Create(FormCollection collection) + public ActionResult Create (FormCollection collection) { try { string fnre = "[A-Za-z0-9~\\-.]+"; HttpFileCollectionBase hfc = Request.Files; - for (int i=0; iFile name '{0}' refused

",hfc[i].FileName); - ModelState.AddModelError( + for (int i = 0; i < hfc.Count; i++) { + if (!Regex.Match (hfc [i].FileName, fnre).Success) { + ViewData ["Message"] += string.Format ("

File name '{0}' refused

", hfc [i].FileName); + ModelState.AddModelError ( "AFile", - string.Format( + string.Format ( "The file name {0} dosn't match an acceptable file name {1}", - hfc[i].FileName,fnre)) - ; - return View(); + hfc [i].FileName, fnre)); + return View (); } } - for (int i=0; iFile name '{0}' saved

",hfc[i].FileName); + string filename = Path.Combine (Server.MapPath (BaseDir), hfc [i].FileName); + hfc [i].SaveAs (filename); + ViewData ["Message"] += string.Format ("

File name '{0}' saved

", hfc [i].FileName); } - return RedirectToAction ("Index","FileSystem"); + return RedirectToAction ("Index", "FileSystem"); } catch (Exception e) { - ViewData ["Message"] = "Exception:"+e.Message; + ViewData ["Message"] = "Exception:" + e.Message; return View (); } } @@ -115,49 +115,53 @@ namespace Yavsc.Controllers ///
/// The base dir. public static string BaseDir { get { return Path.Combine (UsersDir, Membership.GetUser ().UserName); } } + /// /// Edit the specified id. /// /// Identifier. - public ActionResult Edit(int id) - { - return View (); - } + public ActionResult Edit (int id) + { + return View (); + } + /// /// Edit the specified id and collection. /// /// Identifier. /// Collection. - [HttpPost] - public ActionResult Edit(int id, FormCollection collection) - { - try { - return RedirectToAction ("Index"); - } catch { - return View (); - } - } + [HttpPost] + public ActionResult Edit (int id, FormCollection collection) + { + try { + return RedirectToAction ("Index"); + } catch { + return View (); + } + } + /// /// Delete the specified id. /// /// Identifier. - public ActionResult Delete(int id) - { - return View (); - } + public ActionResult Delete (int id) + { + return View (); + } + /// /// Delete the specified id and collection. /// /// Identifier. /// Collection. - [HttpPost] - public ActionResult Delete(int id, FormCollection collection) - { - try { - return RedirectToAction ("Index"); - } catch { - return View (); - } - } - } + [HttpPost] + public ActionResult Delete (int id, FormCollection collection) + { + try { + return RedirectToAction ("Index"); + } catch { + return View (); + } + } + } } \ No newline at end of file diff --git a/web/Controllers/FrontOfficeApiController.cs b/web/Controllers/FrontOfficeApiController.cs index 49dc0e00..a5d93406 100644 --- a/web/Controllers/FrontOfficeApiController.cs +++ b/web/Controllers/FrontOfficeApiController.cs @@ -49,23 +49,23 @@ namespace Yavsc.ApiControllers /// /// Catalog this instance. /// - [AcceptVerbs("GET")] + [AcceptVerbs ("GET")] public Catalog Catalog () { Catalog c = CatalogManager.GetCatalog (Request.RequestUri.AbsolutePath); return c; } + /// /// Gets the product categorie. /// /// The product categorie. /// Brand name. /// Prod categorie. - [AcceptVerbs("GET")] + [AcceptVerbs ("GET")] public ProductCategory GetProductCategorie (string brandName, string prodCategorie) { - return CatalogManager.GetCatalog (Request.RequestUri.AbsolutePath).GetBrand (brandName).GetProductCategory (prodCategorie) - ; + return CatalogManager.GetCatalog (Request.RequestUri.AbsolutePath).GetBrand (brandName).GetProductCategory (prodCategorie); } /// @@ -81,30 +81,32 @@ namespace Yavsc.ApiControllers return est; } + + /// /// Gets the estim tex. /// /// The estim tex. /// Estimid. - [AcceptVerbs("GET")] - public HttpResponseMessage GetEstimTex(long estimid) + [AcceptVerbs ("GET")] + public HttpResponseMessage GetEstimTex (long estimid) { string texest = null; try { texest = getEstimTex (estimid); - } - catch (TemplateException ex) { - return new HttpResponseMessage (HttpStatusCode.OK){ Content = + } catch (TemplateException ex) { + return new HttpResponseMessage (HttpStatusCode.OK) { Content = new ObjectContent (typeof(string), - ex.Message, new ErrorHtmlFormatter(HttpStatusCode.NotAcceptable, - LocalizedText.DocTemplateException - ))}; - } - catch (Exception ex) { + ex.Message, new ErrorHtmlFormatter (HttpStatusCode.NotAcceptable, + LocalizedText.DocTemplateException + )) + }; + } catch (Exception ex) { - return new HttpResponseMessage (HttpStatusCode.OK){ Content = + return new HttpResponseMessage (HttpStatusCode.OK) { Content = new ObjectContent (typeof(string), - ex.Message, new SimpleFormatter("text/text")) }; + ex.Message, new SimpleFormatter ("text/text")) + }; } if (texest == null) return new HttpResponseMessage (HttpStatusCode.OK) { Content = @@ -119,20 +121,20 @@ namespace Yavsc.ApiControllers }; } - private string getEstimTex(long estimid) + private string getEstimTex (long estimid) { - Yavsc.templates.Estim tmpe = new Yavsc.templates.Estim(); + Yavsc.templates.Estim tmpe = new Yavsc.templates.Estim (); Estimate e = wfmgr.GetEstimate (estimid); - tmpe.Session = new Dictionary(); + tmpe.Session = new Dictionary (); tmpe.Session.Add ("estim", e); - Profile prpro = new Profile(ProfileBase.Create(e.Responsible)); + Profile prpro = new Profile (ProfileBase.Create (e.Responsible)); if (!prpro.HasBankAccount) - throw new TemplateException ("NotBankable:"+e.Responsible); + throw new TemplateException ("NotBankable:" + e.Responsible); - Profile prcli = new Profile(ProfileBase.Create(e.Client)); + Profile prcli = new Profile (ProfileBase.Create (e.Client)); if (!prcli.IsBillable) - throw new TemplateException ("NotBillable:"+e.Client); + throw new TemplateException ("NotBillable:" + e.Client); tmpe.Session.Add ("from", prpro); tmpe.Session.Add ("to", prcli); tmpe.Init (); @@ -145,7 +147,7 @@ namespace Yavsc.ApiControllers /// /// The estim pdf. /// Estimid. - public HttpResponseMessage GetEstimPdf(long estimid) + public HttpResponseMessage GetEstimPdf (long estimid) { Estimate estim = wfmgr.GetEstimate (estimid); //TODO better with pro.IsBankable && cli.IsBillable diff --git a/web/Controllers/PaypalApiController.cs b/web/Controllers/PaypalApiController.cs new file mode 100644 index 00000000..233ca785 --- /dev/null +++ b/web/Controllers/PaypalApiController.cs @@ -0,0 +1,48 @@ +// +// PaypalApiController.cs +// +// Author: +// Paul Schneider +// +// 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 . +using System; +using System.Web.Http; + +#if HASPAYPALAPI + +using PayPal.Api; + +namespace Yavsc.ApiControllers +{ + public class PaypalApiController: ApiController + { + public void GetPayments() + { + OAuthTokenCredential tokenCredential = + new OAuthTokenCredential("", ""); + + string accessToken = tokenCredential.GetAccessToken(); + var parameters = new PayPal.Util.QueryParameters(); + parameters.Add ("Count", "10"); + + PaymentHistory paymentHistory = Payment.Get(apiContext, accessToken, parameters); + + + } + } +} + +#endif diff --git a/web/Controllers/WorkFlowController.cs b/web/Controllers/WorkFlowController.cs index e5fde235..5f27af4b 100644 --- a/web/Controllers/WorkFlowController.cs +++ b/web/Controllers/WorkFlowController.cs @@ -108,7 +108,7 @@ namespace Yavsc.ApiControllers public HttpResponseMessage UpdateWritting([FromBody] Writting wr) { wfmgr.UpdateWritting (wr); - return Request.CreateResponse (System.Net.HttpStatusCode.OK); + return Request.CreateResponse (System.Net.HttpStatusCode.OK,"WrittingUpdated:"+wr.Id); } /// diff --git a/web/Formatters/SimpleFormatter.cs b/web/Formatters/SimpleFormatter.cs index e745c692..132c60c2 100644 --- a/web/Formatters/SimpleFormatter.cs +++ b/web/Formatters/SimpleFormatter.cs @@ -84,8 +84,6 @@ namespace Yavsc.Formatters writer.Write (doc); } } - } - } diff --git a/web/Global.asax.cs b/web/Global.asax.cs index 30678f1f..fed7766c 100644 --- a/web/Global.asax.cs +++ b/web/Global.asax.cs @@ -8,6 +8,7 @@ using System.Web.Mvc; using System.Web.Routing; using System.Web.Http; using Yavsc.Formatters; +using Yavsc.Model.FrontOffice; namespace Yavsc { diff --git a/web/Helpers/SimpleJsonPostMethod.cs b/web/Helpers/SimpleJsonPostMethod.cs index 5073c649..7a521efa 100644 --- a/web/Helpers/SimpleJsonPostMethod.cs +++ b/web/Helpers/SimpleJsonPostMethod.cs @@ -74,7 +74,8 @@ namespace Yavsc.Helpers /// Query. public TAnswer Invoke(TQuery query) { - Byte[] bytes = System.Text.Encoding.UTF8.GetBytes (JsonConvert.SerializeObject(query)); + Byte[] bytes = System.Text.Encoding.UTF8.GetBytes ( + JsonConvert.SerializeObject(query)); Request.ContentLength = bytes.Length; using (Stream dataStream = Request.GetRequestStream ()) { diff --git a/web/Views/Web.config b/web/Views/Web.config index 381b7060..2b135949 100644 --- a/web/Views/Web.config +++ b/web/Views/Web.config @@ -20,7 +20,6 @@ - @@ -29,6 +28,8 @@ + + diff --git a/web/Web.config b/web/Web.config index be41dd8f..107ba492 100644 --- a/web/Web.config +++ b/web/Web.config @@ -8,12 +8,8 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx --> - - + +
@@ -23,23 +19,14 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx +
+
-
+
- -
-
-
- - -
-
-
-
- + @@ -296,6 +284,35 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -312,5 +329,6 @@ 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 69f08d02..e94258a3 100644 --- a/web/Web.csproj +++ b/web/Web.csproj @@ -9,7 +9,7 @@ {349C5851-65DF-11DA-9384-00065B846F21};{603C0E0B-DB56-11DC-BE95-000D561079B0};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} Library Yavsc - v4.5 + v4.5.1 true @@ -88,10 +88,13 @@ - + + ..\packages\PayPalCoreSDK.1.6.0\lib\net451\PayPalCoreSDK.dll + + @@ -124,6 +127,7 @@ + @@ -179,6 +183,7 @@ + diff --git a/web/packages.config b/web/packages.config index 23603534..a676dd8c 100644 --- a/web/packages.config +++ b/web/packages.config @@ -3,4 +3,6 @@ + + \ No newline at end of file