using Neo.Afx.Services.Workflows; using Neo.LegitimateLicences.Common; using Neo.LegitimateLicences.Data.Models; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using Neo.LegitimateLicences.Common.Helpers; using Neo.Afx.Common; using Neo.Afx.Mvc; namespace Neo.LegitimateLicences.InterDepartment { public class InterDepartmentController : Neo.LegitimateLicences.Common.ControllerBase { #region ReleaseData public ActionResult ReleaseData() { if (!SecurityHelper.UserHasAccessToSecurable(Profile.Securables.ToList(), Common.SecurableEnum.InterDepartmentModule_ReleaseData)) { return RedirectToAction("Default", "Dashboard"); } var m = new ReleaseDataModel(); var db = new LegitimateDatabase(); var wf = new WorkflowsDatabase(); m.PendingApplications = db.GetTATApplicationsPendingDataRelease(Profile.UserID); WebHelper.SetLastPageVisited(HttpContext, "InterDepartment/ReleaseData"); ViewBag.Controller = "InterDepartment"; ViewBag.Page = "ReleaseData"; return View("ReleaseData", m); } #endregion #region ReleaseTATApplicationsPendingData [HttpPost] public JsonResult ReleaseTATApplicationsPendingData(long applicationDetailID, string comments) { if (!SecurityHelper.UserHasAccessToSecurable(Profile.Securables.ToList(), Common.SecurableEnum.InterDepartmentModule_ReleaseData)) { throw new Exception("Security error"); } var db = new LegitimateDatabase(); var errorMessage = ""; bool success = true; List result = new List(); try { db.ReleaseTATApplicationsPendingData(applicationDetailID, comments, Profile.UserID); result = db.GetTATApplicationsPendingDataRelease(Profile.UserID); } catch (Exception ex) { errorMessage = ExceptionHelper.GetInnermostMessage(ex); success = false; } var results = new { ErrorMessage = errorMessage, Success = success, Result = result }; return Json(results, JsonSerializerOptions.None); } #endregion } }