Refactorisation du workflow:

le manager devient statique, et les procédures
relatives au fichiers utisateur sont uniformisée,
que l'utilisateur soit enregistré ou anonyme,
que ce soit pour le blogspot, le frontoffice ou le workflow.

* YavscModel.csproj:
* Commande.cs:
* WorkFlowManager.cs:
* WebFileSystemManager.cs:
* UserFileSystemManager.cs: refactorisation du code, en vue de la mise
  en place
de la commande sans enregistrement du client sur le site.

* BasketController.cs:
* WorkFlowController.cs:
* FrontOfficeController.cs:
* FrontOfficeController.cs: Le manager de flux de travaux est devient
  un objet statique.

* FileSystemController.cs: refactorisation du code, en vue de la mise
  en place
de la commande sans enregistrement du client sur le site.

* Web.csproj: ajoute les références au déployement des sites
* Totem prod
* Totem pré
Leur configuration n'est pas maintenue sous Git.
This commit is contained in:
Paul Schneider 2015-11-22 14:00:59 +01:00
commit 439759cb16
13 changed files with 233 additions and 166 deletions

View file

@ -19,25 +19,6 @@ namespace Yavsc.ApiControllers
/// </summary>
public class WorkFlowController : ApiController
{
string adminRoleName="Admin";
/// <summary>
/// The wfmgr.
/// </summary>
protected WorkFlowManager wfmgr = null;
/// <summary>
/// Initialize the specified controllerContext.
/// </summary>
/// <param name="controllerContext">Controller context.</param>
protected override void Initialize (HttpControllerContext controllerContext)
{
// TODO move it in a module initialization
base.Initialize (controllerContext);
if (!Roles.RoleExists (adminRoleName)) {
Roles.CreateRole (adminRoleName);
}
wfmgr = new WorkFlowManager ();
}
/// <summary>
/// Creates the estimate.
/// </summary>
@ -49,7 +30,7 @@ namespace Yavsc.ApiControllers
[Authorize]
public Estimate CreateEstimate (string title,string client,string description)
{
return wfmgr.CreateEstimate (
return WorkFlowManager.CreateEstimate (
Membership.GetUser().UserName,client,title,description);
}
@ -102,7 +83,7 @@ namespace Yavsc.ApiControllers
[Authorize]
public void DropWritting(long wrid)
{
wfmgr.DropWritting (wrid);
WorkFlowManager.DropWritting (wrid);
}
/// <summary>
@ -114,14 +95,14 @@ namespace Yavsc.ApiControllers
public void DropEstimate(long estid)
{
string username = Membership.GetUser().UserName;
Estimate e = wfmgr.GetEstimate (estid);
Estimate e = WorkFlowManager.GetEstimate (estid);
if (e == null)
throw new InvalidOperationException("not an estimate id:"+estid);
if (username != e.Responsible
&& !Roles.IsUserInRole ("FrontOffice"))
throw new UnauthorizedAccessException ("You're not allowed to drop this estimate");
wfmgr.DropEstimate (estid);
WorkFlowManager.DropEstimate (estid);
}
/// <summary>
@ -146,7 +127,7 @@ namespace Yavsc.ApiControllers
[ValidateAjax]
public HttpResponseMessage UpdateWritting([FromBody] Writting wr)
{
wfmgr.UpdateWritting (wr);
WorkFlowManager.UpdateWritting (wr);
return Request.CreateResponse<string> (System.Net.HttpStatusCode.OK,"WrittingUpdated:"+wr.Id);
}
@ -166,7 +147,7 @@ namespace Yavsc.ApiControllers
}
try {
return Request.CreateResponse(System.Net.HttpStatusCode.OK,
wfmgr.Write(estid, wr.Description,
WorkFlowManager.Write(estid, wr.Description,
wr.UnitaryCost, wr.Count, wr.ProductReference));
}
catch (Exception ex) {