public ActionResult Assign(string empId, string visaId) { var employeeVisa = new EmployeeVisaViewModel(); if (!string.IsNullOrEmpty(empId)) { employeeVisa.IsEmployeeAssigned = true; var employeeId = EncryptionUtility.Hash64Decode(empId); if (employeeId < 1) { return(View("Error", new HandleErrorInfo(new Exception("Invalid url"), "Employee", "Index"))); } // Redirect("/Employee/Index"); var employee = new EmployeeService(true, true).GetAll().FirstOrDefault(e => e.Id == employeeId); if (employee != null) { employeeVisa.Employee = employee; if (employee.Visa != null) { employeeVisa.Visa = employee.Visa; employeeVisa.IsVisaAssigned = true; } } } if (!string.IsNullOrEmpty(visaId)) { employeeVisa.IsVisaAssigned = true; } return(View(employeeVisa)); }
public ActionResult ShortDetail(EmployeeVisaViewModel employeeVisaVm) { if (employeeVisaVm.Employee.Id != 0 && employeeVisaVm.Visa.Id != 0) { var empService = new EmployeeService(false, false); try { var empDto = empService.Find(employeeVisaVm.Employee.Id.ToString()); empDto.VisaId = employeeVisaVm.Visa.Id; empDto.AgentId = employeeVisaVm.Visa.ForeignAgentId; empService.InsertOrUpdate(empDto); //Set AgencyId=empDto.AgencyId - If AgencyId is null and Qty==1 in VisaDTO, and save Visa //Otherwise Visa might be distributed to many Agencies } catch (Exception ex) { ModelState.AddModelError("", ex.Message); } finally { empService.Dispose(); } } return(RedirectToAction("Index")); }
public ActionResult Track(string trackId) { var employeeVisa = new EmployeeVisaViewModel { IsVisaAssigned = false, Comment = "" }; if (!string.IsNullOrEmpty(trackId)) { //int empId = Convert.ToInt32(trackId.Substring(1)); //var employeeId = empId / 741705; //Convert.ToInt32(trackId); var criteria = new SearchCriteria <EmployeeDTO> { CurrentUserId = 1 }; var searchText = trackId.ToLower(); criteria.FiList.Add(bp => bp.PassportNumber.Contains(searchText) || (bp.Address != null && bp.Address.Mobile.Contains(searchText)) || (bp.Visa != null && bp.Visa.VisaNumber.Contains(searchText)) || (bp.Visa != null && bp.Visa.Sponsor != null && (bp.Visa.Sponsor.PassportNumber.Contains(searchText) || (bp.Visa.Sponsor.Address != null && bp.Visa.Sponsor.Address.Mobile.Contains(searchText)))) ); var employee = new EmployeeService(true, true).GetAll(criteria).FirstOrDefault(); if (employee != null && employee.Visa != null) { employeeVisa = new EmployeeVisaViewModel { Employee = employee, Visa = employee.Visa, IsVisaAssigned = true, Comment = "" }; } else { employeeVisa.Comment = "No visa found..."; } } if (Request.IsAjaxRequest()) { if (!Request.IsAuthenticated) { Redirect("~/Account/Login"); } return(PartialView("_visaTrack", employeeVisa)); } return(View(employeeVisa)); }
public ActionResult ShortDetail(string searchText, string employeeId) { var empId = Convert.ToInt32(employeeId); var visas = GetVisaDtos(searchText, null, null, null, 1, null, null).ToList(); var empVisa = new EmployeeVisaViewModel(); if (visas.Any()) { empVisa = new EmployeeVisaViewModel { Visa = visas.FirstOrDefault(), Employee = new EmployeeDTO { Id = empId }, IsVisaAssigned = true } } ; return(PartialView("_visaShortDetail", empVisa)); }
public ActionResult Index(bool?logout) { var employeeVisa = new EmployeeVisaViewModel { IsVisaAssigned = false, Comment = "" }; //@ViewData["AgentFilterVisibility"] = Singleton.User != null && !Singleton.User.IsUserAgent ? "hidden" : "visible"; ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application."; try { if (logout != null && (bool)logout) { WebSecurity.Logout(); Redirect("~/Home/Index"); } } catch { } return(View(employeeVisa)); }