Exemplo n.º 1
0
 public ActionResult Home()
 {
     try
     {
         if (TempData["errorMsg"] != null)
         {
             ViewBag.errorMsg     = TempData["errorMsg"];
             TempData["errorMsg"] = null;
         }
         BusinessAccessLayer.BALCommon.BALCommon     bALCommon   = new BusinessAccessLayer.BALCommon.BALCommon();
         BusinessAccessLayer.BALBranches.BALBranches bALBranches = new BusinessAccessLayer.BALBranches.BALBranches();
         ClaimsPrincipal principal = HttpContext.User as ClaimsPrincipal;
         var             bankId    = Convert.ToInt32(principal.FindFirst("BankId").Value);
         List <BusinessObjects.Models.Branch> lstBranches = bALBranches.selectBranchesByBankId(bankId);
         if (lstBranches == null)
         {
             TempData["errorMsg"] = LangText.checkConnection;
             return(RedirectToAction("login", "Login"));
         }
         else if (lstBranches.Count == 0)
         {
             return(View());
         }
         else if (lstBranches.FirstOrDefault().id == 0)
         {
             TempData["errorMsg"] = LangText.somethingWentWrongAlert;
             return(RedirectToAction("login", "Login"));
         }
         else
         {
             return(View(lstBranches));
         }
     }
     catch (Exception ex)
     {
         ExceptionsWriter.saveEventsAndExceptions(ex, "Exceptions not handled", EventLogEntryType.Error);
         return(View("Error"));
     }
 }
Exemplo n.º 2
0
 public ActionResult Home()
 {
     try
     {
         if (TempData["errorMsg"] != null)
         {
             ViewBag.errorMsg     = TempData["errorMsg"];
             TempData["errorMsg"] = null;
         }
         BusinessAccessLayer.BALCommon.BALCommon     bALCommon   = new BusinessAccessLayer.BALCommon.BALCommon();
         BusinessAccessLayer.BALBranches.BALBranches bALBranches = new BusinessAccessLayer.BALBranches.BALBranches();
         List <BusinessObjects.Models.Branch>        lstBranches = bALBranches.selectBranchesByBankId(((BusinessObjects.Models.User)Session["UserObj"]).bankId);
         if (lstBranches == null)
         {
             TempData["errorMsg"] = LangText.checkConnection;
             return(RedirectToAction("login", "Login"));
         }
         else if (lstBranches.Count == 0)
         {
             return(View());
         }
         else if (lstBranches.FirstOrDefault().id == 0)
         {
             TempData["errorMsg"] = LangText.somethingWentWrongAlert;
             return(RedirectToAction("login", "Login"));
         }
         else
         {
             return(View(lstBranches));
         }
     }
     catch (Exception ex)
     {
         ExceptionsWriter.saveExceptionToLogFile(ex);
         return(View("Error"));
     }
 }