Skip to content

Commit

Permalink
Improved multilanguage
Browse files Browse the repository at this point in the history
  • Loading branch information
mesquidar committed Apr 3, 2023
1 parent 7fac555 commit daf9b40
Show file tree
Hide file tree
Showing 42 changed files with 1,075 additions and 305 deletions.
33 changes: 17 additions & 16 deletions Cervantes.Web/Areas/Workspace/Controllers/ChecklistController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ public IActionResult Wstg(Guid project, Guid id)
}
catch (Exception e)
{
TempData["error"] = "Error loading wstg!";
TempData["errorLaodingWSTG"] = "Error loading wstg!";
_logger.LogError(e, "An error ocurred loading Checklist Workspace WSTG form.Project: {0} User: {1} Checklist: {2}", project,
User.FindFirstValue(ClaimTypes.Name), id);
return RedirectToAction(nameof(Index));
Expand Down Expand Up @@ -563,18 +563,18 @@ public IActionResult Wstg(Guid project, WSTGViewModel model)
result.Sess09Status = model.Sess.Sess09Status;

wstgManager.Context.SaveChanges();
TempData["edited"] = "Checklist edited successfully!";
TempData["editedWSTG"] = "Checklist edited successfully!";

_logger.LogInformation("User: {0} edited Checklist: {1} on Project: {2}", User.FindFirstValue(ClaimTypes.Name), result.Id,
project);
return RedirectToAction("Index");
return RedirectToAction("Wstg", new {id = model.TargetId});
}
catch (Exception e)
{
TempData["error"] = "Error loading wstg!";
TempData["errorSaveWSTG"] = "Error loading wstg!";
_logger.LogError(e, "An error ocurred loading Checlist Workspace WSTG form. Project: {0} User: {1}", project,
User.FindFirstValue(ClaimTypes.Name));
return RedirectToAction(nameof(Index));
return RedirectToAction("Wstg", new {id = model.TargetId});
}

}
Expand Down Expand Up @@ -613,7 +613,7 @@ public IActionResult Create(Guid project)
}
catch (Exception e)
{
TempData["error"] = "Error loading create form!";
TempData["errorCreateChecklist"] = "Error loading create form!";
_logger.LogError(e, "An error ocurred loading Checklist Workspace create form.Project: {0} User: {1}", project,
User.FindFirstValue(ClaimTypes.Name));
return RedirectToAction(nameof(Index));
Expand Down Expand Up @@ -739,7 +739,7 @@ public IActionResult Delete(Guid project, Guid id, ChecklistType type)
}
catch (Exception e)
{
TempData["error"] = "Error loading create form!";
TempData["errorChecklist"] = "Error loading create form!";
_logger.LogError(e, "An error ocurred loading Checklist Workspace delete form.Project: {0} User: {1}", project,
User.FindFirstValue(ClaimTypes.Name));
return RedirectToAction(nameof(Index));
Expand All @@ -765,7 +765,7 @@ public IActionResult Delete(Guid project, ChecklistDeleteViewModel model)
var result = wstgManager.GetById(model.Wstg.Id);
wstgManager.Remove(result);
wstgManager.Context.SaveChanges();
TempData["deleted"] = "Checklist deleted!";
TempData["deletedWSTG"] = "Checklist deleted!";
_logger.LogInformation("A Checklist has been deleted.Project: {0} User: {1} Checklist: {2}", project,
User.FindFirstValue(ClaimTypes.Name), result.Id);

Expand All @@ -774,6 +774,7 @@ public IActionResult Delete(Guid project, ChecklistDeleteViewModel model)
var result2 = mastgManager.GetById(model.Mastg.Id);
mastgManager.Remove(result2);
mastgManager.Context.SaveChanges();
TempData["deletedMASTG"] = "Checklist deleted!";
_logger.LogInformation("A Checklist has been deleted.Project: {0} User: {1} Checklist: {2}", project,
User.FindFirstValue(ClaimTypes.Name), result2.Id);
return RedirectToAction(nameof(Index));
Expand All @@ -784,7 +785,7 @@ public IActionResult Delete(Guid project, ChecklistDeleteViewModel model)
}
catch (Exception e)
{
TempData["error"] = "Error loading create form!";
TempData["errorCheckDelete"] = "Error loading create form!";
_logger.LogError(e, "An error ocurred loading Checklist Workspace delete form.Project: {0} User: {1}", project,
User.FindFirstValue(ClaimTypes.Name));
return RedirectToAction(nameof(Index));
Expand Down Expand Up @@ -1020,7 +1021,7 @@ public IActionResult Mastg(Guid project, Guid id)
}
catch (Exception e)
{
TempData["error"] = "Error loading create form!";
TempData["errorLaodingMASTG"] = "Error loading create form!";
_logger.LogError(e, "An error ocurred loading Checklist Workspace MASTG form.Project: {0} User: {1}", project,
User.FindFirstValue(ClaimTypes.Name));
return RedirectToAction(nameof(Index));
Expand Down Expand Up @@ -1219,18 +1220,18 @@ public IActionResult Mastg(Guid project, MASTGViewModel model)
result.PlatformStatus11= model.Platform.PlatformStatus11;

mastgManager.Context.SaveChanges();
TempData["edited"] = "Checklist edited successfully!";
TempData["editedMASTG"] = "Checklist edited successfully!";

_logger.LogInformation("User: {0} edited Checklist: {1} on Project: {2}", User.FindFirstValue(ClaimTypes.Name), result.Id,
project);
return RedirectToAction("Index");
return RedirectToAction("Mastg", new {id = model.TargetId});
}
catch (Exception e)
{
TempData["error"] = "Error loading wstg!";
TempData["errorSaveMastg"] = "Error loading wstg!";
_logger.LogError(e, "An error ocurred loading Checlist Workspace WSTG form. Project: {0} User: {1}", project,
User.FindFirstValue(ClaimTypes.Name));
return RedirectToAction(nameof(Index));
return RedirectToAction("Mastg", new {id = model.TargetId});
}

}
Expand Down Expand Up @@ -1921,7 +1922,7 @@ where c.InnerText.Contains("Info01Note") ||
}
catch (Exception e)
{
TempData["errorReport"] = "Error generating report!";
TempData["errorReportWSTG"] = "Error generating report!";
_logger.LogError(e, "An error ocurred generating Checlist Workspace WSTG report. User: {1}",
User.FindFirstValue(ClaimTypes.Name));
return RedirectToAction(nameof(Index));
Expand Down Expand Up @@ -2540,7 +2541,7 @@ where c.InnerText.Contains("ArchNote01") ||
}
catch (Exception e)
{
TempData["errorReport"] = "Error generating report!";
TempData["errorReportMASTG"] = "Error generating report!";
_logger.LogError(e, "An error ocurred generating Checlist Workspace WSTG report. User: {1}",
User.FindFirstValue(ClaimTypes.Name));
return RedirectToAction(nameof(Index));
Expand Down
35 changes: 19 additions & 16 deletions Cervantes.Web/Areas/Workspace/Controllers/ProjectController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ public IActionResult ExecutiveSummary(Guid project)
}
catch (Exception ex)
{
TempData["error"] = "loading project";
TempData["errorExecutive"] = "loading project";
_logger.LogError(ex, "An error ocurred loading Project Executive Summary: {0}. User: {1}", project,
User.FindFirstValue(ClaimTypes.Name));
return RedirectToAction("Index");
return RedirectToAction("Error", "Home");
}

}
Expand All @@ -115,15 +115,18 @@ public IActionResult ExecutiveSummary(Guid project, ExecutiveSummaryViewModel mo
pro.ExecutiveSummary = sanitizer.Sanitize(HttpUtility.HtmlDecode(model.ExecutiveSummary));

projectManager.Context.SaveChanges();

return RedirectToAction("ExecutiveSummary", "Project", new {project = project});
TempData["executiveSaved"] = "saved";
_logger.LogInformation("User: {0} Edited a new Executive Summary on Project {1}",
User.FindFirstValue(ClaimTypes.Name),
project);
return RedirectToAction("ExecutiveSummary");
}
catch (Exception ex)
{
TempData["error"] = "loading project";
TempData["errorExecutiveSave"] = "loading project";
_logger.LogError(ex, "An error ocurred loading Project Executive Summary: {0}. User: {1}", project,
User.FindFirstValue(ClaimTypes.Name));
return RedirectToAction("Index");
return RedirectToAction("ExecutiveSummary");
}

}
Expand Down Expand Up @@ -194,7 +197,7 @@ public ActionResult Details(Guid project)
}
catch (Exception ex)
{
TempData["error"] = "loading project";
TempData["errorLoadingProject"] = "loading project";
_logger.LogError(ex, "An error ocurred loading Project: {0}. User: {1}", project,
User.FindFirstValue(ClaimTypes.Name));
return RedirectToAction("Index");
Expand Down Expand Up @@ -274,7 +277,7 @@ public IActionResult AddMember(Guid project, string users)
}
catch (Exception ex)
{
TempData["error"] = "adding member to ";
TempData["errorMember"] = "adding member to ";
_logger.LogError(ex, "An error ocurred adding a new Memeber on Project: {0}. User: {1}", project,
User.FindFirstValue(ClaimTypes.Name));
return RedirectToAction("Details", "Project", new {id = project});
Expand Down Expand Up @@ -307,7 +310,7 @@ public IActionResult DeleteMember(Guid project, string user)
}
catch (Exception ex)
{
TempData["error"] = "deleting memeber from ";
TempData["errorDeletedMember"] = "deleting memeber from ";
_logger.LogError(ex, "An error ocurred deleteing a Memeber on Project: {0}. User: {1}", project,
User.FindFirstValue(ClaimTypes.Name));
return RedirectToAction("Details", "Project", new {id = project});
Expand Down Expand Up @@ -346,7 +349,7 @@ public IActionResult AddTarget(IFormCollection form)
}
catch (Exception ex)
{
TempData["error"] = "adding target to ";
TempData["errorAddedTarget"] = "adding target to ";
_logger.LogError(ex, "An error ocurred adding a new Target on Project: {0}. User: {1}",
form["project"], User.FindFirstValue(ClaimTypes.Name));
return RedirectToAction("Details", "Project", new {id = form["project"]});
Expand Down Expand Up @@ -376,7 +379,7 @@ public IActionResult DeleteTarget(Guid target, Guid project)
}
catch (Exception ex)
{
TempData["error"] = "deleting target from ";
TempData["errorDeletingTarget"] = "deleting target from ";
_logger.LogError(ex, "An error ocurred deleting a Target: {0} on Project: {1}. User: {2}", project, target,
User.FindFirstValue(ClaimTypes.Name));
return RedirectToAction("Details", "Project", new {id = project});
Expand Down Expand Up @@ -415,7 +418,7 @@ public IActionResult AddNote(IFormCollection form)
}
catch (Exception ex)
{
TempData["error"] = "adding note to ";
TempData["errorAddedNote"] = "adding note to ";
_logger.LogError(ex, "An error ocurred adding a Note on Project: {1}. User: {2}",
form["project"], User.FindFirstValue(ClaimTypes.Name));
return RedirectToAction("Details", "Project", new {id = form["project"]});
Expand Down Expand Up @@ -447,7 +450,7 @@ public IActionResult DeleteNote(Guid id, Guid project)
}
catch (Exception ex)
{
TempData["error"] = "deleting note from ";
TempData["errorDeletingNote"] = "deleting note from ";
_logger.LogError(ex, "An error ocurred deleting a Note on Project: {1}. User: {2}", project,
User.FindFirstValue(ClaimTypes.Name));
return RedirectToAction("Details", "Project", new {id = project});
Expand Down Expand Up @@ -511,7 +514,7 @@ public IActionResult AddAttachment(IFormCollection form, IFormFile upload)
}
catch (Exception ex)
{
TempData["error"] = "adding attachment to ";
TempData["errorAttachment"] = "adding attachment to ";
_logger.LogError(ex, "An error ocurred adding an Attachment on Project: {1}. User: {2}",
form["project"], User.FindFirstValue(ClaimTypes.Name));
return RedirectToAction("Details", "Project", new {id = form["project"]});
Expand Down Expand Up @@ -548,7 +551,7 @@ public IActionResult DeleteAttachment(Guid id, Guid project)
}
catch (Exception ex)
{
TempData["error"] = "deleting attachment from ";
TempData["errorDeletingAttachment"] = "deleting attachment from ";
_logger.LogError(ex, "An error ocurred deleting an Attachment on Project: {1}. User: {2}", project,
User.FindFirstValue(ClaimTypes.Name));
return RedirectToAction("Details", "Project", new {id = project});
Expand All @@ -563,7 +566,7 @@ public ActionResult Download(Guid id)
var filePath = Path.Combine(_appEnvironment.WebRootPath, attachment.FilePath);

var fileBytes = System.IO.File.ReadAllBytes(filePath);

TempData["downloadedReport"] = "deleting attachment from ";
return File(fileBytes, attachment.Name);
}
}
Loading

0 comments on commit daf9b40

Please sign in to comment.