* LocalizedText.fr.resx: internationalisation de la saisie de
l'estimation * LocalizedText.resx: * FrontOfficeApiController.cs: renamed the Tex generation method * FrontOfficeController.cs: fixed the Estimate creation * WorkFlowController.cs: return model validation errors when updating a writting. * TexFormatter.cs: Simple mime-type content declaration * Global.asax.cs: * T4TemplateEstimate.cs: cleanning * BBCodeHelper.cs: BBCodes: docpage summary gone into a new aside element * App.master: thanks links are now contained in a div element * style.css: clearer * Estimate.aspx: Fixed the creation/edition/removal processes * Estim.tt: added the column "Count" to the writtings table. * RegisterViewModel.cs: internationalization * Writting.cs: stronger model * Estim.tex: cleaning
This commit is contained in:
parent
b4fefbce7e
commit
312585d4f0
16 changed files with 130 additions and 244 deletions
|
|
@ -30,6 +30,8 @@ namespace Yavsc.Controllers
|
|||
[Authorize]
|
||||
public ActionResult Estimate(Estimate model,string submit)
|
||||
{
|
||||
ViewData ["WebApiBase"] = "http://" + Request.Url.Authority + "/api";
|
||||
ViewData ["WABASEWF"] = ViewData ["WebApiBase"] + "/WorkFlow";
|
||||
if (submit == null) {
|
||||
if (model.Id > 0) {
|
||||
Estimate f = WorkFlowManager.GetEstimate (model.Id);
|
||||
|
|
@ -41,27 +43,31 @@ namespace Yavsc.Controllers
|
|||
ModelState.Clear ();
|
||||
string username = HttpContext.User.Identity.Name;
|
||||
if (username != model.Responsible
|
||||
&& username != model.Client
|
||||
&& !Roles.IsUserInRole ("FrontOffice"))
|
||||
&& username != model.Client
|
||||
&& !Roles.IsUserInRole ("FrontOffice"))
|
||||
throw new UnauthorizedAccessException ("You're not allowed to view this estimate");
|
||||
|
||||
}
|
||||
} else if (ModelState.IsValid) {
|
||||
|
||||
ViewData ["WebApiUrl"] = "http://" + Request.Url.Authority + "/api/WorkFlow";
|
||||
} else {
|
||||
string username = HttpContext.User.Identity.Name;
|
||||
if (username != model.Responsible
|
||||
&& username != model.Client
|
||||
&& !Roles.IsUserInRole ("FrontOffice"))
|
||||
throw new UnauthorizedAccessException ("You're not allowed to modify this estimate");
|
||||
if (model.Id == 0) {
|
||||
model.Responsible=username;
|
||||
ModelState.Clear ();
|
||||
}
|
||||
if (ModelState.IsValid) {
|
||||
if (username != model.Responsible
|
||||
&& username != model.Client
|
||||
&& !Roles.IsUserInRole ("FrontOffice"))
|
||||
throw new UnauthorizedAccessException ("You're not allowed to modify this estimate");
|
||||
|
||||
if (model.Id == 0)
|
||||
if (model.Id == 0)
|
||||
model = WorkFlowManager.CreateEstimate (
|
||||
username,
|
||||
model.Client, model.Title, model.Description);
|
||||
else
|
||||
WorkFlowManager.UpdateEstimate (model);
|
||||
|
||||
}
|
||||
}
|
||||
return View(model);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue