Exemple #1
0
 public ActionResult Add(BusinessObjects.Models.Counter counter, int branchId)
 {
     try
     {
         if (ModelState.IsValid)
         {
             BusinessAccessLayer.BALCounter.BALCounter bALCounter = new BusinessAccessLayer.BALCounter.BALCounter();
             counter.branchId = branchId;
             BusinessObjects.Models.ResultsEnum checkInserted = bALCounter.insertCounter(counter, ((BusinessObjects.Models.User)Session["UserObj"]).bankId);
             if (checkInserted == BusinessObjects.Models.ResultsEnum.notInserted)
             {
                 TempData["errorMsg"] = LangText.checkConnection;
                 return(RedirectToAction("Home", "Counters", new { branchId = branchId }));
             }
             else if (checkInserted == BusinessObjects.Models.ResultsEnum.inserted)
             {
                 return(RedirectToAction("Home", "Counters", new { branchId = branchId }));
             }
             else
             {
                 TempData["errorMsg"] = LangText.somethingWentWrongAlert;
                 return(RedirectToAction("Home", "Counters", new { branchId = branchId }));
             }
         }
         else
         {
             return(View());
         }
     }
     catch (Exception ex)
     {
         ExceptionsWriter.saveExceptionToLogFile(ex);
         return(View("Error"));
     }
 }
Exemple #2
0
 public ActionResult Edit(int counterId, int branchId)
 {
     try
     {
         ViewBag.branchId = branchId;
         BusinessAccessLayer.BALCounter.BALCounter bALCounter = new BusinessAccessLayer.BALCounter.BALCounter();
         BusinessObjects.Models.Counter            counter    = bALCounter.selectCounterById(counterId, ((BusinessObjects.Models.User)Session["UserObj"]).bankId);
         if (counter == null)
         {
             TempData["errorMsg"] = LangText.checkConnection;
             return(RedirectToAction("Home", "Counters", new { branchId = branchId }));
         }
         else if (counter.id == 0)
         {
             TempData["errorMsg"] = LangText.somethingWentWrongAlert;
             return(RedirectToAction("Home", "Counters", new { branchId = branchId }));
         }
         else
         {
             return(View(counter));
         }
     }
     catch (Exception ex)
     {
         ExceptionsWriter.saveExceptionToLogFile(ex);
         return(View("Error"));
     }
 }
 public ActionResult Edit(int counterId, int branchId)
 {
     try
     {
         ViewBag.branchId = branchId;
         BusinessAccessLayer.BALCounter.BALCounter bALCounter = new BusinessAccessLayer.BALCounter.BALCounter();
         ClaimsPrincipal principal = HttpContext.User as ClaimsPrincipal;
         var             bankId    = Convert.ToInt32(principal.FindFirst("BankId").Value);
         BusinessObjects.Models.Counter counter = bALCounter.selectCounterById(counterId, bankId);
         if (counter == null)
         {
             TempData["errorMsg"] = LangText.checkConnection;
             return(RedirectToAction("Home", "Counters", new { branchId = branchId }));
         }
         else if (counter.id == 0)
         {
             TempData["errorMsg"] = LangText.somethingWentWrongAlert;
             return(RedirectToAction("Home", "Counters", new { branchId = branchId }));
         }
         else
         {
             return(View(counter));
         }
     }
     catch (Exception ex)
     {
         ExceptionsWriter.saveEventsAndExceptions(ex, "Exceptions not handled", EventLogEntryType.Error);
         return(View("Error"));
     }
 }
Exemple #4
0
 public BusinessObjects.Models.ResultsEnum updateCounter(BusinessObjects.Models.Counter counter, int bankId)
 {
     try
     {
         DataAccessLayer.DALCounter.DALCounter dALCounter = new DataAccessLayer.DALCounter.DALCounter();
         return(dALCounter.updateCounter(counter, bankId));
     }
     catch (Exception ex)
     {
         ExceptionsWriter.saveExceptionToLogFile(ex);
         return(BusinessObjects.Models.ResultsEnum.notUpdated);
     }
 }
Exemple #5
0
 public BusinessObjects.Models.ResultsEnum updateCounter(BusinessObjects.Models.Counter counter, int bankId)
 {
     try
     {
         DataAccessLayer.DALCounter.DALCounter dALCounter = new DataAccessLayer.DALCounter.DALCounter();
         return(dALCounter.updateCounter(counter, bankId));
     }
     catch (Exception ex)
     {
         ExceptionsWriter.saveEventsAndExceptions(ex, "Exceptions not handled", EventLogEntryType.Error);
         return(BusinessObjects.Models.ResultsEnum.notUpdated);
     }
 }
 public ActionResult Add(BusinessObjects.Models.Counter counter, int branchId)
 {
     try
     {
         if (ModelState.IsValid)
         {
             BusinessAccessLayer.BALCounter.BALCounter bALCounter = new BusinessAccessLayer.BALCounter.BALCounter();
             counter.branchId = branchId;
             ClaimsPrincipal principal = HttpContext.User as ClaimsPrincipal;
             var             bankId    = Convert.ToInt32(principal.FindFirst("BankId").Value);
             BusinessObjects.Models.ResultsEnum checkInserted = bALCounter.insertCounter(counter, bankId);
             if (checkInserted == BusinessObjects.Models.ResultsEnum.notInserted)
             {
                 TempData["errorMsg"] = LangText.checkConnection;
                 return(RedirectToAction("Home", "Counters", new { branchId = branchId }));
             }
             else if (checkInserted == BusinessObjects.Models.ResultsEnum.inserted)
             {
                 return(RedirectToAction("Home", "Counters", new { branchId = branchId }));
             }
             else
             {
                 TempData["errorMsg"] = LangText.somethingWentWrongAlert;
                 return(RedirectToAction("Home", "Counters", new { branchId = branchId }));
             }
         }
         else
         {
             return(View());
         }
     }
     catch (Exception ex)
     {
         ExceptionsWriter.saveEventsAndExceptions(ex, "Exceptions not handled", EventLogEntryType.Error);
         return(View("Error"));
     }
 }