protected override void Dispose(bool disposing) { if (disposing) { if (_manuscriptDBRepositoryReadSide != null) { _manuscriptDBRepositoryReadSide.Dispose(); } } base.Dispose(disposing); }
public ActionResult HomePage(ManuscripScreeningVM manuscriptVM) { try { manuscriptVM.OverallAnalysis = "Okay to proceed"; IDictionary <string, string> dataErrors = new Dictionary <string, string>(); if (manuscriptVM.ID == 0) { if (!_manuscriptDBRepositoryReadSide.IsMSIDAvailable(manuscriptVM.MSID, manuscriptVM.ID)) { TempData["MSIDError"] = "<script>alert('Manuscript Number is already present.');</script>"; } else { _manuscriptService.SaveManuscriptScreeningVM(dataErrors, manuscriptVM); TempData["msg"] = "<script>alert('Record added succesfully');</script>"; manuscriptVM = _manuscriptService.GetManuscriptScreeningVM(manuscriptVM.ID); } } else { if (_manuscriptDBRepositoryReadSide.IsMSIDAvailable(manuscriptVM.MSID, manuscriptVM.ID)) { //ModelState.AddModelError("MSID", "Manuscript Number is already present."); TempData["MSIDError"] = "<script>alert('Manuscript Number is already present.');</script>"; } else { _manuscriptService.SaveManuscriptScreeningVM(dataErrors, manuscriptVM); TempData["msg"] = "<script>alert('Record updated succesfully');</script>"; manuscriptVM = _manuscriptService.GetManuscriptScreeningVM(manuscriptVM.ID); } } foreach (KeyValuePair <String, String> item in dataErrors) { ModelState.AddModelError(item.Key, item.Value); } ViewBag.SearchList = _manuscriptDBRepositoryReadSide.GetSearchList(); ViewBag.JournalList = _manuscriptDBRepositoryReadSide.GetJournalList(); ViewBag.RoleList = _manuscriptDBRepositoryReadSide.GetRoleList(); ViewBag.iThenticateResult = JsonConvert.SerializeObject(_manuscriptDBRepositoryReadSide.GetList(1)); ViewBag.EnglishLangQuality = JsonConvert.SerializeObject(_manuscriptDBRepositoryReadSide.GetList(2)); ViewBag.EthicsComplience = JsonConvert.SerializeObject(_manuscriptDBRepositoryReadSide.GetList(3)); ViewBag.OverallAnalysis = JsonConvert.SerializeObject(_manuscriptDBRepositoryReadSide.GetList(4)); //throw new Exception("test exception"); } catch (Exception ex) { ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator. [exception] " + ex.Message); } finally { int journalID = Convert.ToInt32(manuscriptVM.JournalID); ViewBag.ArticleList = _manuscriptDBRepositoryReadSide.GetArticleList(journalID); ViewBag.SectionList = _manuscriptDBRepositoryReadSide.GetSectionList(journalID); _manuscriptDBRepositoryReadSide.Dispose(); } return(View("HomePage", manuscriptVM)); }