public IActionResult CreateClaims([Bind] ClaimsSubmission req, string tableName) { ViewBag.TableName = tableName; string httpContextUser = HttpContext.User.Identity.Name; string user = Utility.GetUser(httpContextUser); if (user == null) { user = WindowsIdentity.GetCurrent().Name; } ViewBag.UserAuthMessage = String.Format("{0} Authenticated", user);// for {1}!!", user, group); ViewBag.GetTableShortName = Utility.GetTableShortName(tableName); try { int claimsInserted = claimDataAccessLayer.AddAndEnrichClaims(req, tableName, user); if (claimsInserted > 0) { ViewBag.MessageInsertedClaims = String.Format("Successful Claim Rejects = {0} ", claimsInserted); } if (req.InvalidClaimList.Count > 0) { string dupClaimAppend = "INVALID CLAIM ERRORS!! = "; foreach (var invalidClaims in req.InvalidClaimList) { dupClaimAppend += invalidClaims + " "; } ViewBag.MessageInvalidClaims += dupClaimAppend; } if (req.DupClaimList.Count > 0) { string dupClaimAppend = "DUPLICATE CLAIM ERRORS!! = "; foreach (var dupClaim in req.DupClaimList) { dupClaimAppend += dupClaim + " "; } ViewBag.MessageDupClaims += dupClaimAppend; } } catch (Exception e) { ViewBag.Error = e.ToString(); } return(View()); }
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /// <summary> </summary> /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ public IActionResult GetAllClaims(string tableName, string message) { string group = ""; string httpContextUser = HttpContext.User.Identity.Name; string user = Utility.GetUser(httpContextUser); // ********************************** // ATUTHENTICATE USER // ********************************** try { if (!ClaimDataAccessLayer.IsUserAuthorized(user, out group)) { ViewBag.ErrorMessage += String.Format("User {0} is not authorized for {1}!!", user, group); ViewBag.IsAuthenticated = "FALSE"; ViewBag.UserAuthMessage = String.Format("{0} not Authenticated", user);// for {1}!!", user, group); return(RedirectToAction("Index", new { ViewBag.ErrorMessage, ViewBag.UserAuthMessage })); } } catch (Exception e) { ViewBag.ErrorMessage = string.Format("ERROR DURING AUTHENTICATION FOR {0} ... EXCEPTION = {1}", user, e.ToString()); return(RedirectToAction("Index", new { ViewBag.ErrorMessage })); } // ********************************** // CONNECT TO DB // ********************************** try { if (ConnStr == null) { ConnStr = Utility.AssignConnectionStringSybase(); SybaseConnString = Utility.GetSybaseConnection(ConnStr.DataSource, ConnStr.Port, ConnStr.Database, Startup.SecretUsername, Startup.SecretPassword); } } catch (Exception e) { ViewBag.ErrorMessage = string.Format("ERROR WHEN TRYING TO CONNECT TO DATABASE {0} !! ... EXCEPTION = {1}", ConnStr.Database, e.ToString()); return(RedirectToAction("Index", new { ViewBag.ErrorMessage })); } // ********************************** // READ STAGED CLAIMS TO BE DELETED // ********************************** try { claimSub = claimDataAccessLayer.GetAllClaims(claimSub, tableName); } catch (Exception e) { ViewBag.ErrorMessage = string.Format("ERROR WHEN TRYING TO READ FROM {0} !! ... EXCEPTION = {1}", tableName, e.ToString()); return(RedirectToAction("Index", new { ViewBag.ErrorMessage })); } ViewBag.GetTableShortName = Utility.GetTableShortName(tableName); ViewBag.TableName = tableName; ViewBag.UserAuthMessage = String.Format("{0} Authenticated", user);// for {1}!!", user, group); ViewBag.Message = message; ViewBag.TableCount = claimSub.ClaimList.Count; return(View(claimSub.ClaimList)); }