public async Task <IActionResult> AddEmployee(EmployeeViewModel vm) { await eService.AddEmployeeAsync(vm.FirstName, vm.LastName, vm.StartingDate, vm.Salary, vm.VacationDays, byte.Parse(vm.ExperienceLevel)); var vm1 = new EmployeeSearchViewModel(); return(View("Index", vm1)); }
public async Task <IActionResult> RemoveEmployee(string submitButton) { await eService.RemoveEmployeeAsync(int.Parse(submitButton)); var vm1 = new EmployeeSearchViewModel(); return(View("Index", vm1)); }
public IActionResult Search(Employee empi) { int id = empi.Id; EmployeeSearchViewModel employeeSearchViewModel = new EmployeeSearchViewModel() { Employee = _employeeFunc.GetEmployee(id), PageTitle = "The details of Employee" }; // Employee emp = _employeeFunc.GetEmployee(id); return(View(employeeSearchViewModel)); }
public ActionResult Index(string name, string ageStart, string ageEnd, string managerId, string departmentId) { var joinedList = ( from ti in _context.Employee from st in _context.Department.Where(j => j.Id == ti.DepartmentId).DefaultIfEmpty() from emp in _context.Employee.Where(s => s.Id == ti.ManagerId).DefaultIfEmpty() select new Employee { Id = ti.Id, FirstName = ti.FirstName, LastName = ti.LastName, DepartmentId = ti.DepartmentId, DepartmentName = st.DepartmentName, ManagerId = ti.ManagerId, ManagerName = emp.Name, Age = ti.Age, JoiningDate = ti.JoiningDate, Gender = ti.Gender, Salary = ti.Salary } ); if (!string.IsNullOrEmpty(name)) { joinedList = joinedList.Where(s => s.FirstName.Contains(name) || s.LastName.Contains(name)); } if (!string.IsNullOrEmpty(ageStart) || !string.IsNullOrEmpty(ageEnd)) { int age1 = 0; if (ageStart != null) { int.TryParse(ageStart, out age1); } int age2 = 99; if (ageEnd != null) { int.TryParse(ageEnd, out age2); } joinedList = joinedList.Where(s => s.Age >= age1 && s.Age <= age2); } if (!string.IsNullOrEmpty(managerId)) { joinedList = joinedList.Where(s => s.ManagerId == int.Parse(managerId)); } if (!string.IsNullOrEmpty(departmentId)) { joinedList = joinedList.Where(s => s.DepartmentId == int.Parse(departmentId)); } var employeeSearchVM = new EmployeeSearchViewModel() { Employees = joinedList.ToList(), ManagerList = GetManagerSelectList(), DepartmentList = GetDepartmentSelectList() }; return(View(employeeSearchVM)); }
private static async Task <string> ValidateEmployeeDetailsOnSearchAllFiled(EmployeeSearchViewModel employeeSearchViewModel) { if (employeeSearchViewModel == null || (employeeSearchViewModel.DateOfBirthEnd == null && employeeSearchViewModel.DateOfBirthStart == null && employeeSearchViewModel.DateOfJoiningEnd == null && employeeSearchViewModel.DateOfJoiningStart == null && employeeSearchViewModel.Email == "" && employeeSearchViewModel.EmployeeId == "" && employeeSearchViewModel.FullName == "" && employeeSearchViewModel.Passport == "" && employeeSearchViewModel.TIN == "" )) { return("RequestFailed|2|Warning|At least provide one criteria for search"); } return(""); }
public async Task <IActionResult> Index(string keyword, int pageIndex = 1) { var pageSize = 30; var model = new EmployeeSearchViewModel { Keyword = keyword, PageIndex = pageIndex, PageSize = pageSize, Count = await _employeeService.CountAsync(keyword), Employees = await _employeeService.SearchAsync(keyword, pageIndex, pageSize) }; return(View(model)); }
public async Task <ActionResult> SearchingEmployeeByConsumer(String q, Int32 consumerId) { if (User == null) { return(null); } ConsumerManagement manage = new ConsumerManagement(_context); var employees = await manage.GetEmployeesByConsumer(q, consumerId); List <EmployeeSearchViewModel> searchModel = EmployeeSearchViewModel.GetList(employees); return(Json(new { data = searchModel }, JsonRequestBehavior.AllowGet)); }
public async Task <ActionResult> ServiceCoordinatorslist(String q, Int32?agencyId) { if (User == null) { return(null); } ConsumerManagement manage = new ConsumerManagement(_context); var contacts = await manage.GetServiceCoordinatorList(q, agencyId); List <EmployeeSearchViewModel> searchModel = EmployeeSearchViewModel.GetList(contacts); return(Json(new { data = searchModel }, JsonRequestBehavior.AllowGet)); }
// GET: Admin/Tblsalaries public async Task <IActionResult> Index(EmployeeSearchViewModel searchModel) { var _l = await(from e in _context.Tblemployee join d in _context.Tbldeparment on e.DepId equals d.DepId where e.EmpId.Contains(searchModel.EmpId) && e.DepId.Contains(searchModel.DepId == null ? "": searchModel.DepId) select new BasicEmployeeViewModel() { EmpId = e.EmpId, DepNm = d.DepNm, EmpNm = e.EmpNm }).ToListAsync(); ; ViewData["list_result"] = _l; return(View()); }
public async Task <IActionResult> Products_Read([DataSourceRequest] DataSourceRequest request , EmployeeSearchViewModel employeeSearchViewModel) { EmployeeSearchModel employeeSearchModel = new EmployeeSearchModel(); employeeSearchModel = _mapper.Map <EmployeeSearchModel>(employeeSearchViewModel); var employeeDetails = await this._IEmployeeManageService.GetEmployeesDetailsOnSearch(employeeSearchModel); List <EmployeeViewModel> EmployeesViewModel = new List <EmployeeViewModel>(); EmployeesViewModel = _mapper.Map <List <EmployeeViewModel> >(employeeDetails); return(Json(EmployeesViewModel.ToDataSourceResult(request))); }
private static async Task <string> ValidateEmployeeDetailsOnDOB(EmployeeSearchViewModel employeeSearchViewModel) { if (employeeSearchViewModel != null && (employeeSearchViewModel.DateOfBirthStart != null && employeeSearchViewModel.DateOfBirthEnd == null)) { return("RequestFailed|2|Warning|Please provide Date Of Birth End date "); } else if (employeeSearchViewModel != null && (employeeSearchViewModel.DateOfBirthStart == null && employeeSearchViewModel.DateOfBirthEnd != null)) { return("RequestFailed|2|Warning|Please provide Date Of Birth Start date "); } else if (employeeSearchViewModel != null && (employeeSearchViewModel.DateOfBirthStart != null && employeeSearchViewModel.DateOfBirthEnd != null) && (employeeSearchViewModel.DateOfBirthStart > employeeSearchViewModel.DateOfBirthEnd)) { return("RequestFailed|2|Warning| Date Of Birth Start date should be less than End Date "); } return(""); }
public async Task OnGetAsync(string pageNo, string employeeFirstName, string employeeLastName, string employeeMobile, string employeePhone, string employeeAddress, string employeeId, string userId, string divisionId, bool deleted, string status) { SearchInput = new EmployeeSearchViewModel { PageNo = pageNo.FixPageNumber(), Id = employeeId, Address = employeeAddress, Mobile = employeeMobile, Phone = employeePhone, FirstName = employeeFirstName, LastName = employeeLastName, UserId = userId, DivisionId = divisionId, IncludeDeletedItems = deleted }; Status = !string.IsNullOrEmpty(status) ? status : null; List = await _employeeService.ListAsync(SearchInput, false); }
public async Task <IActionResult> ValidateEmployeeDetailsOnSearch([FromBody] EmployeeSearchViewModel employeeSearchViewModel ) { var TaskValidateSearchAllFiled = ValidateEmployeeDetailsOnSearchAllFiled(employeeSearchViewModel); var TaskValidateSearchDOB = ValidateEmployeeDetailsOnDOB(employeeSearchViewModel); var TaskValidateSearchDOJ = ValidateEmployeeDetailsOnDOJ(employeeSearchViewModel); var ValidateResults = await Task.WhenAll(TaskValidateSearchAllFiled , TaskValidateSearchDOB , TaskValidateSearchDOJ); foreach (var validateResults in ValidateResults) { if (validateResults.Length > 0) { return(await Task.Run(() => new JsonResult(validateResults))); } } return(await Task.Run(() => new JsonResult("RequestPassed|0|Success|Validate Employee Details On Search Success"))); }
public ActionResult Index(int?page, string EmpName, int?SearchEmpCode, int?OfficeId, int?DeptId, int?DesgId, int?GroupId, int?BgId, int?LevelId, int?RankId, int?ShiftId, int?SectionId, int?JobTypeId) { if (!ViewBag.AllowView) { ViewBag.Error = "You are not Authorize to use this Page"; return(PartialView("_partialviewNotFound")); } if (ViewBag.AllowView == true) { ViewBag.dllOfficeTypeList = _officeTypeServices.GetClildOfficeListByEmpCode(Convert.ToInt32(ViewBag.EmpCode)); ViewBag.dllDepartmentList = _departmentServices.GetDepartmentlist(); ViewBag.dllDesginationList = _designationServices.GetDesignationList().ToList(); ViewBag.ddlGroupList = _groupServices.GetGroupList(); ViewBag.ddlBgGroupList = _bgGroupService.GetBusinessGroupByEmpRoleId(Convert.ToInt32(ViewBag.EmpRoleId)); ViewBag.dllLevelList = _levelServices.GetLevellist(); ViewBag.dllRankList = _rankServices.GetRankList(); ViewBag.dllShiftList = _shiftService.GetShiftsLIst(); ViewBag.dllSectionList = _sectionServices.GetSectionList(); ViewBag.dllJobTypeList = _jobTypeservices.GetJobTypeList(); int roleId = Convert.ToInt32(ViewBag.EmpRoleId); // // int curentemp = Convert.ToInt32(Session["Empcode"]); //Logged in user employee code // var emplist = _employeeService.GetEmployeeList(curentemp); EmployeeSearchViewModel searchModel = new EmployeeSearchViewModel(); ViewBag.SearchEmpCode = SearchEmpCode; ViewBag.EmpName = EmpName; ViewBag.BgId = BgId; ViewBag.OfficeId = OfficeId; ViewBag.DesgId = DesgId; ViewBag.GroupId = GroupId; ViewBag.LevelId = LevelId; ViewBag.RankId = RankId; ViewBag.ShiftId = ShiftId; ViewBag.SectionId = SectionId; ViewBag.JobTypeId = JobTypeId; var emplist = _employeeService. SearchEmployees(SearchEmpCode, EmpName, OfficeId, DeptId, DesgId, GroupId, BgId, roleId); if (LevelId > 0) { emplist = emplist.Where(a => a.EmpLevelId == searchModel.LevelId).ToList(); } if (RankId > 0) { emplist = emplist.Where(a => a.EmpRankId == searchModel.RankId).ToList(); } if (ShiftId > 0) { emplist = emplist.Where(a => a.EmpShiftId == searchModel.ShiftId).ToList(); } if (SectionId > 0) { emplist = emplist.Where(a => a.EmpSectionId == searchModel.SectionId).ToList(); } if (JobTypeId > 0) { emplist = emplist.Where(a => a.EmpJobTypeId == searchModel.JobTypeId).ToList(); } int pageSizes = 20; int pageNumber = (page ?? 1); return(View(emplist.ToPagedList(pageNumber, pageSizes))); } else { ViewBag.errorMsg = "Not Authorize"; return(View()); } }
public ActionResult Index(EmployeeSearchViewModel searchModel, string sortOrder, string currentFilter, string searchString, int?page, string pageSize) { ViewBag.CurrentSort = sortOrder; ViewBag.NameSortParm = String.IsNullOrEmpty(sortOrder) ? "name_desc" : ""; ViewBag.DateSortParm = sortOrder == "Date" ? "date_desc" : "Date"; if (searchString != null) { page = 1; } else { searchString = currentFilter; } ViewBag.CurrentFilter = searchString; if (!ViewBag.AllowView) { ViewBag.Error = "You are not Authorize to use this Page"; return(PartialView("_partialviewNotFound")); } if (ViewBag.AllowView == true) { ViewBag.Test = searchModel.OfficeId; ViewBag.dllOfficeTypeList = _officeTypeServices.GetOfficeListByEmpRole(Convert.ToInt32(ViewBag.EmpRoleId)); ViewBag.dllDepartmentList = _departmentServices.GetDepartmentlist(); ViewBag.dllDesginationList = _designationServices.GetDesignationList().ToList(); ViewBag.ddlGroupList = _groupServices.GetGroupList(); ViewBag.ddlBgGroupList = _bgGroupService.GetBusinessGroupByEmpRoleId(Convert.ToInt32(ViewBag.EmpRoleId)); ViewBag.dllLevelList = _levelServices.GetLevellist(); ViewBag.dllRankList = _rankServices.GetRankList(); ViewBag.dllShiftList = _shiftService.GetShiftsLIst(); ViewBag.dllSectionList = _sectionServices.GetSectionList(); ViewBag.dllJobTypeList = _jobTypeservices.GetJobTypeList(); ViewBag.SearchEmpCode = searchModel.EmpCode; ViewBag.EmpName = searchModel.EmpName; ViewBag.BgId = searchModel.BgId; ViewBag.OfficeId = searchModel.OfficeId; ViewBag.DesgId = searchModel.DesgId; ViewBag.DeptId = searchModel.DeptId; ViewBag.GroupId = searchModel.GroupId; ViewBag.LevelId = searchModel.LevelId; ViewBag.RankId = searchModel.RankId; ViewBag.ShiftId = searchModel.ShiftId; ViewBag.SectionId = searchModel.SectionId; ViewBag.JobTypeId = searchModel.JobTypeId; int roleId = Convert.ToInt32(ViewBag.EmpRoleId); var emplist = _employeeService. SearchEmployees(searchModel.EmpCode, searchModel.EmpName, searchModel.OfficeId, searchModel.DeptId, searchModel.DesgId, searchModel.GroupId, searchModel.BgId, roleId); if (searchModel.LevelId > 0) { emplist = emplist.Where(a => a.EmpLevelId == searchModel.LevelId).ToList(); } if (searchModel.RankId > 0) { emplist = emplist.Where(a => a.EmpRankId == searchModel.RankId).ToList(); } if (searchModel.ShiftId > 0) { emplist = emplist.Where(a => a.EmpShiftId == searchModel.ShiftId).ToList(); } if (searchModel.SectionId > 0) { emplist = emplist.Where(a => a.EmpSectionId == searchModel.SectionId).ToList(); } if (searchModel.JobTypeId > 0) { emplist = emplist.Where(a => a.EmpJobTypeId == searchModel.JobTypeId).ToList(); } int pageSizes = 20; int pageNumber = 1; return(View(emplist.ToPagedList(pageNumber, pageSizes))); } else { return(View()); } }
public List <EmployeeViewModel> Filter(EmployeeSearchViewModel search) { throw new NotImplementedException(); }
public IActionResult Index() { var vm = new EmployeeSearchViewModel(); return(View(vm)); }
public async Task <IEnumerable <EmployeeSearchViewModel> > GetEmployeeDetailsForSearch(EmployeeSearchViewModel employeeSearchViewModel) { IEnumerable <EmployeeSearchViewModel> employeeSearchResult = new List <EmployeeSearchViewModel>(); EmployeeSearchModel employeeSearchModel = new EmployeeSearchModel(); employeeSearchModel = _mapper.Map <EmployeeSearchModel>(employeeSearchViewModel); var employeSearchDetails = await this._IEmployeeManageService .GetEmployeesDetailsForSearch(employeeSearchModel); employeeSearchResult = _mapper.Map <List <EmployeeSearchViewModel> >(employeSearchDetails); return(employeeSearchResult); }
public EmployeeSearchPage() { InitializeComponent(); // BindingContext = new EmployeeSearchViewModel(ServiceLocator.Current.GetInstance<IEmployeeService>(), Navigation); BindingContext = new EmployeeSearchViewModel(Navigation); }