示例#1
0
 public ActionResult Edit(int serviceId)
 {
     try
     {
         BusinessAccessLayer.BALService.BALService bALServices = new BusinessAccessLayer.BALService.BALService();
         ClaimsPrincipal principal = HttpContext.User as ClaimsPrincipal;
         var             bankId    = Convert.ToInt32(principal.FindFirst("BankId").Value);
         BusinessObjects.Models.Service service = bALServices.selectServiceById(serviceId, bankId);
         if (service == null)
         {
             TempData["errorMsg"] = LangText.checkConnection;
             return(RedirectToAction("Home", "Services"));
         }
         else if (service.id == 0)
         {
             TempData["errorMsg"] = LangText.somethingWentWrongAlert;
             return(RedirectToAction("Home", "Services"));
         }
         else
         {
             service.minimumServiceTime = service.minimumServiceTime != 0 ? service.minimumServiceTime : 45;
             service.maximumServiceTime = service.maximumServiceTime != 0 ? service.maximumServiceTime : 300;
             return(View(service));
         }
     }
     catch (Exception ex)
     {
         ExceptionsWriter.saveEventsAndExceptions(ex, "Exceptions not handled", EventLogEntryType.Error);
         return(View("Error"));
     }
 }
 public ActionResult Edit(int serviceId)
 {
     try
     {
         BusinessAccessLayer.BALService.BALService bALServices = new BusinessAccessLayer.BALService.BALService();
         BusinessObjects.Models.Service            service     = bALServices.selectServiceById(serviceId, ((BusinessObjects.Models.User)Session["UserObj"]).bankId);
         if (service == null)
         {
             TempData["errorMsg"] = LangText.checkConnection;
             return(RedirectToAction("Home", "Services"));
         }
         else if (service.id == 0)
         {
             TempData["errorMsg"] = LangText.somethingWentWrongAlert;
             return(RedirectToAction("Home", "Services"));
         }
         else
         {
             return(View(service));
         }
     }
     catch (Exception ex)
     {
         ExceptionsWriter.saveExceptionToLogFile(ex);
         return(View("Error"));
     }
 }
 public ActionResult Add(BusinessObjects.Models.Service service)
 {
     try
     {
         if (ModelState.IsValid)
         {
             service.bankId = ((BusinessObjects.Models.User)Session["UserObj"]).bankId;
             BusinessAccessLayer.BALService.BALService bALServices   = new BusinessAccessLayer.BALService.BALService();
             BusinessObjects.Models.ResultsEnum        checkInserted = bALServices.insertService(service);
             if (checkInserted == BusinessObjects.Models.ResultsEnum.notInserted)
             {
                 TempData["errorMsg"] = LangText.checkConnection;
                 return(RedirectToAction("Home", "Services"));
             }
             else if (checkInserted == BusinessObjects.Models.ResultsEnum.inserted)
             {
                 return(RedirectToAction("Home", "Services"));
             }
             else
             {
                 TempData["errorMsg"] = LangText.somethingWentWrongAlert;
                 return(RedirectToAction("Home", "Services"));
             }
         }
         else
         {
             return(View());
         }
     }
     catch (Exception ex)
     {
         ExceptionsWriter.saveExceptionToLogFile(ex);
         return(View("Error"));
     }
 }
        private CustomerServiceModel GetServices(int currentPage)
        {
            int maxRows = 8;

            BusinessAccessLayer.BALCommon.BALCommon   bALCommon   = new BusinessAccessLayer.BALCommon.BALCommon();
            BusinessAccessLayer.BALService.BALService bALService  = new BusinessAccessLayer.BALService.BALService();
            List <BusinessObjects.Models.Service>     lstServices = bALService.selectServicesByBankId(((BusinessObjects.Models.User)Session["UserObj"]).bankId);
            CustomerServiceModel servicesModel = new CustomerServiceModel();

            servicesModel.Services = lstServices.ToList().Skip((currentPage - 1) * maxRows).Take(maxRows).ToList();
            double pageCount = (double)((decimal)lstServices.Count() / Convert.ToDecimal(maxRows));

            servicesModel.PageCount        = (int)Math.Ceiling(pageCount);
            servicesModel.CurrentPageIndex = currentPage;
            return(servicesModel);
        }
示例#5
0
 /// <summary>
 /// Get counters for services that are not allocated to current selected counter
 /// </summary>
 public BusinessObjects.Models.ResultsEnum FillAllocateBag(int counterId)
 {
     try
     {
         ViewBag.counterId = counterId;
         BusinessAccessLayer.BALCommon.BALCommon bALCommon = new BusinessAccessLayer.BALCommon.BALCommon();
         BusinessAccessLayer.BALAllocateCounterService.BALAllocateCounterService bALAllocateCounterService = new BusinessAccessLayer.BALAllocateCounterService.BALAllocateCounterService();
         BusinessAccessLayer.BALService.BALService bALService         = new BusinessAccessLayer.BALService.BALService();
         List <Models.ServiceAllocate>             lstServiceAllocate = new List <ServiceAllocate>();
         ClaimsPrincipal principal = HttpContext.User as ClaimsPrincipal;
         var             bankId    = Convert.ToInt32(principal.FindFirst("BankId").Value);
         List <BusinessObjects.Models.Service> lstServices = bALService.selectServicesByBankId(bankId);
         List <BusinessObjects.Models.AllocateCounterService> lstAllocateCounterService = bALAllocateCounterService.selectAllocateCounterService(counterId, bankId);
         if (lstAllocateCounterService == null)
         {
             ViewBag.AllocateId = new SelectList(lstServiceAllocate, "id", System.Globalization.CultureInfo.CurrentCulture.ToString() == "en" ? "enName" : "arName");
             return(BusinessObjects.Models.ResultsEnum.error);
         }
         else if (lstAllocateCounterService.Count == 0 || lstAllocateCounterService.FirstOrDefault().id > 0)
         {
             foreach (var item in lstServices)
             {
                 if (lstAllocateCounterService.Where(x => x.serviceId == item.id).FirstOrDefault() != null)
                 {
                     item.isDeleted = true;
                 }
                 else
                 {
                     lstServiceAllocate.Add(new ServiceAllocate(item.id, item.enName, item.arName, counterId, null));
                 }
             }
             ViewBag.AllocateId = new SelectList(lstServiceAllocate, "id", System.Globalization.CultureInfo.CurrentCulture.ToString() == "en" ? "enName" : "arName");
             return(BusinessObjects.Models.ResultsEnum.filled);
         }
         else
         {
             ViewBag.AllocateId = new SelectList(lstServiceAllocate, "id", System.Globalization.CultureInfo.CurrentCulture.ToString() == "en" ? "enName" : "arName");
             return(BusinessObjects.Models.ResultsEnum.notFound);
         }
     }
     catch (Exception ex)
     {
         ExceptionsWriter.saveEventsAndExceptions(ex, "Exceptions not handled", EventLogEntryType.Error);
         return(BusinessObjects.Models.ResultsEnum.error);
     }
 }
示例#6
0
        private CustomerServiceModel GetServices(int currentPage)
        {
            int maxRows = 7;

            BusinessAccessLayer.BALCommon.BALCommon   bALCommon  = new BusinessAccessLayer.BALCommon.BALCommon();
            BusinessAccessLayer.BALService.BALService bALService = new BusinessAccessLayer.BALService.BALService();
            ClaimsPrincipal principal = HttpContext.User as ClaimsPrincipal;
            var             bankId    = Convert.ToInt32(principal.FindFirst("BankId").Value);
            List <BusinessObjects.Models.Service> lstServices = bALService.selectServicesByBankId(bankId);
            CustomerServiceModel servicesModel = new CustomerServiceModel();

            servicesModel.Services = lstServices.ToList().Skip((currentPage - 1) * maxRows).Take(maxRows).ToList();
            double pageCount = (double)((decimal)lstServices.Count() / Convert.ToDecimal(maxRows));

            servicesModel.PageCount        = (int)Math.Ceiling(pageCount);
            servicesModel.CurrentPageIndex = currentPage;
            return(servicesModel);
        }
示例#7
0
 /// <summary>
 /// Get counters for services that are not allocated to current selected counter
 /// </summary>
 public BusinessObjects.Models.ResultsEnum FillAllocateBag(int counterId)
 {
     try
     {
         ViewBag.counterId = counterId;
         BusinessAccessLayer.BALCommon.BALCommon bALCommon = new BusinessAccessLayer.BALCommon.BALCommon();
         BusinessAccessLayer.BALAllocateCounterService.BALAllocateCounterService bALAllocateCounterService = new BusinessAccessLayer.BALAllocateCounterService.BALAllocateCounterService();
         BusinessAccessLayer.BALService.BALService            bALService                = new BusinessAccessLayer.BALService.BALService();
         List <Models.ServiceAllocate>                        lstServiceAllocate        = new List <ServiceAllocate>();
         List <BusinessObjects.Models.Service>                lstServices               = bALService.selectServicesByBankId(((BusinessObjects.Models.User)Session["UserObj"]).bankId);
         List <BusinessObjects.Models.AllocateCounterService> lstAllocateCounterService = bALAllocateCounterService.selectAllocateCounterService(counterId, ((BusinessObjects.Models.User)Session["UserObj"]).bankId);
         if (lstAllocateCounterService == null)
         {
             ViewBag.AllocateId = new SelectList(lstServiceAllocate, "id", System.Globalization.CultureInfo.CurrentCulture.ToString() == "en" ? "enName" : "arName");
             return(BusinessObjects.Models.ResultsEnum.error);
         }
         else if (lstAllocateCounterService.Count == 0 || lstAllocateCounterService.FirstOrDefault().id > 0)
         {
             foreach (var item in lstServices)
             {
                 if (lstAllocateCounterService.Where(x => x.serviceId == item.id).FirstOrDefault() != null)
                 {
                     item.isDeleted = true;
                 }
                 else
                 {
                     lstServiceAllocate.Add(new ServiceAllocate(item.id, item.enName, item.arName, counterId, null));
                 }
             }
             ViewBag.AllocateId = new SelectList(lstServiceAllocate, "id", System.Globalization.CultureInfo.CurrentCulture.ToString() == "en" ? "enName" : "arName");
             return(BusinessObjects.Models.ResultsEnum.filled);
         }
         else
         {
             ViewBag.AllocateId = new SelectList(lstServiceAllocate, "id", System.Globalization.CultureInfo.CurrentCulture.ToString() == "en" ? "enName" : "arName");
             return(BusinessObjects.Models.ResultsEnum.deleted);
         }
     }
     catch (Exception ex)
     {
         ExceptionsWriter.saveExceptionToLogFile(ex);
         return(BusinessObjects.Models.ResultsEnum.error);
     }
 }
 public ActionResult Delete(int serviceId)
 {
     try
     {
         BusinessAccessLayer.BALService.BALService bALServices  = new BusinessAccessLayer.BALService.BALService();
         BusinessObjects.Models.ResultsEnum        checkDeleted = bALServices.deleteServiceById(serviceId, ((BusinessObjects.Models.User)Session["UserObj"]).bankId);
         if (checkDeleted == BusinessObjects.Models.ResultsEnum.deleted)
         {
             return(RedirectToAction("Home"));
         }
         else
         {
             TempData["errorMsg"] = LangText.somethingWentWrongAlert;
             return(RedirectToAction("Home"));
         }
     }
     catch (Exception ex)
     {
         ExceptionsWriter.saveExceptionToLogFile(ex);
         return(View("Error"));
     }
 }
示例#9
0
 public ActionResult Edit(BusinessObjects.Models.Service service)
 {
     try
     {
         if (ModelState.IsValid)
         {
             ClaimsPrincipal principal = HttpContext.User as ClaimsPrincipal;
             var             bankId    = Convert.ToInt32(principal.FindFirst("BankId").Value);
             service.bankId = bankId;
             BusinessAccessLayer.BALCommon.BALCommon   bALCommon    = new BusinessAccessLayer.BALCommon.BALCommon();
             BusinessAccessLayer.BALService.BALService bALServices  = new BusinessAccessLayer.BALService.BALService();
             BusinessObjects.Models.ResultsEnum        checkUpdated = bALServices.updateService(service);
             if (checkUpdated == BusinessObjects.Models.ResultsEnum.notUpdated)
             {
                 TempData["errorMsg"] = LangText.checkConnection;
                 return(RedirectToAction("Home", "Services"));
             }
             else if (checkUpdated == BusinessObjects.Models.ResultsEnum.updated)
             {
                 return(RedirectToAction("Home", "Services"));
             }
             else
             {
                 TempData["errorMsg"] = LangText.somethingWentWrongAlert;
                 return(RedirectToAction("Home", "Services"));
             }
         }
         else
         {
             return(View());
         }
     }
     catch (Exception ex)
     {
         ExceptionsWriter.saveEventsAndExceptions(ex, "Exceptions not handled", EventLogEntryType.Error);
         return(View("Error"));
     }
 }
示例#10
0
 public ActionResult Delete(int serviceId)
 {
     try
     {
         BusinessAccessLayer.BALService.BALService bALServices = new BusinessAccessLayer.BALService.BALService();
         ClaimsPrincipal principal = HttpContext.User as ClaimsPrincipal;
         var             bankId    = Convert.ToInt32(principal.FindFirst("BankId").Value);
         BusinessObjects.Models.sqlResultsEnum checkDeleted = bALServices.deleteServiceById(serviceId, bankId);
         if (checkDeleted == BusinessObjects.Models.sqlResultsEnum.success)
         {
             return(RedirectToAction("Home"));
         }
         else
         {
             TempData["errorMsg"] = LangText.somethingWentWrongAlert;
             return(RedirectToAction("Home"));
         }
     }
     catch (Exception ex)
     {
         ExceptionsWriter.saveEventsAndExceptions(ex, "Exceptions not handled", EventLogEntryType.Error);
         return(View("Error"));
     }
 }