Exemplo n.º 1
0
        public ActionResult Ranks()
        {
            if (!ViewBag.AllowView)
            {
                ViewBag.Error = "You are not Authorize to use this Page";
                return(PartialView("_partialviewNotFound"));
            }


            IEnumerable <RankDTO> RankList = _rankService.GetRankList();

            return(View(RankList));
        }
Exemplo n.º 2
0
        //[Route("training/{id}")]
        //public ActionResult EmployeeTraining(int id)
        //{
        //    if (!ViewBag.AllowView)
        //    {
        //        ViewBag.Error = "You are not Authorize to use this Page";
        //        return PartialView("_partialviewNotFound");
        //    }
        //    IEnumerable<EmployeeTrainingDTO> res = _employeeTrainingService.GetAllTrainingOfEmployee(id);
        //    ViewBag.EmployeeDetail = _employeeService.GetEmployeeDetails(id);
        //    ViewBag.SideBar = _moduleService.AdminEmployeeDetailsMenu(id);
        //    return View("../Employee/Training/Index", res);
        //}

        //[Route("training/{id}/create")]
        //public ActionResult EmployeeTrainingCreate(int id)
        //{
        //    if (!ViewBag.AllowCreate)
        //    {
        //        ViewBag.Error = "You are not Authorize to use this Page";
        //        return PartialView("_partialviewNotFound");
        //    }
        //    ViewBag.EmployeeDetail = _employeeService.GetEmployeeDetails(id);
        //    ViewBag.SideBar = _moduleService.AdminEmployeeDetailsMenu(id);
        //    IEnumerable<SelectListItem> CountryList = _countryService.GetCountryList();
        //    ViewBag.countryList = CountryList;
        //    EmployeeTrainingDTO Record = new EmployeeTrainingDTO();
        //    EmployeeDTO EmployeeRecord = _employeeService.GetEmployeeDTOById(id);
        //    Record.CurrentRank = EmployeeRecord.EmpRankId;
        //    Record.CurrentDesignation = EmployeeRecord.EmpDesgId;
        //    Record.CurrentOffice = EmployeeRecord.EmpOfficeId;
        //    Record.AssignedByList = _employeeService.GetEmployeeSelectList();
        //    Record.SponsorshipList = _employeeService.GetSponsorshipList();
        //    Record.NationalInternationalList = _employeeService.GetNationInternationalList();
        //    return View("../Employee/Training/Create", Record);
        //}

        //[Route("training/{id}/create")]
        //[HttpPost]
        //public ActionResult EmployeeTrainingCreate(int id, EmployeeTrainingDTO data)
        //{
        //    data.AssignedByList = _employeeService.GetEmployeeSelectList();
        //    data.SponsorshipList = _employeeService.GetSponsorshipList();
        //    data.NationalInternationalList = _employeeService.GetNationInternationalList();
        //    if (!ViewBag.AllowCreate)
        //    {
        //        ViewBag.Error = "You are not Authorize to use this Page";
        //        return PartialView("_partialviewNotFound");
        //    }
        //    ViewBag.EmployeeDetail = _employeeService.GetEmployeeDetails(id);
        //    ViewBag.SideBar = _moduleService.AdminEmployeeDetailsMenu(id);
        //    IEnumerable<SelectListItem> CountryList = _countryService.GetCountryList();
        //    ViewBag.countryList = CountryList;
        //    try
        //    {
        //        if (ModelState.IsValid)
        //        {
        //            data.EmpCode = id;
        //            _employeeTrainingService.InsertEmployeeTraining(data);
        //            TempData["Success"] = "Employee created successfully.";
        //            return RedirectToAction("EmployeeTraining", id);
        //        }
        //        else
        //        {
        //            ViewBag.Error = "Form validation error";
        //            return View("../Employee/Training/Create", data);
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        ViewBag.Error = ex.Message;
        //        return View("../Employee/Training/Create", data);
        //    }
        //}

        //[Route("training/{empCode}/TrainingEdit/{trainingId}")]
        //public ActionResult EmployeeTrainingEdit(int empCode, int trainingId)
        //{
        //    if (!ViewBag.AllowEdit)
        //    {
        //        ViewBag.Error = "You are not Authorize to use this Page";
        //        return PartialView("_partialviewNotFound");
        //    }
        //    ViewBag.EmployeeDetail = _employeeService.GetEmployeeDetails(empCode);
        //    ViewBag.SideBar = _moduleService.AdminEmployeeDetailsMenu(empCode);
        //    IEnumerable<SelectListItem> CountryList = _countryService.GetCountryList();
        //    ViewBag.countryList = CountryList;
        //    EmployeeTrainingDTO res = _employeeTrainingService.GetTrainingById(trainingId);
        //    res.AssignedByList = _employeeService.GetEmployeeSelectList();
        //    res.SponsorshipList = _employeeService.GetSponsorshipList();
        //    res.NationalInternationalList = _employeeService.GetNationInternationalList();
        //    return View("../Employee/Training/Edit", res);
        //}

        //[Route("training/{empCode}/TrainingEdit/{trainingId}")]
        //[HttpPost]
        //public ActionResult EmployeeTrainingEdit(int empCode, int trainingId, EmployeeTrainingDTO data)
        //{
        //    if (!ViewBag.AllowEdit)
        //    {
        //        ViewBag.Error = "You are not Authorize to use this Page";
        //        return PartialView("_partialviewNotFound");
        //    }
        //    ViewBag.EmployeeDetail = _employeeService.GetEmployeeDetails(empCode);
        //    ViewBag.SideBar = _moduleService.AdminEmployeeDetailsMenu(empCode);

        //    IEnumerable<SelectListItem> CountryList = _countryService.GetCountryList();
        //    ViewBag.countryList = CountryList;
        //    try
        //    {
        //        data.EmpCode = empCode;
        //        data.TrainingDays = (data.TrainingEndDate - data.TrainingStartDate).Value.Days;
        //        data.TrainingYear = data.TrainingStartDate.Value.Year;
        //        int res = _employeeTrainingService.UpdateTraining(data);
        //        if (res > 0)
        //            return RedirectToAction("EmployeeTraining", new { id = empCode });
        //        else
        //        {
        //            ViewBag.Error = "Couldn't update";
        //            return View("../Employee/Training/Edit");
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        ViewBag.Error = ex.Message;
        //        return View("../Employee/Training/Edit", data);
        //    }

        //}

        //[Route("training/{empCode}/TrainingDelete/{id}")]
        //public ActionResult EmployeeTrainingDelete(int empCode, int id)
        //{
        //    if (!ViewBag.AllowDelete)
        //    {
        //        ViewBag.Error = "You are not Authorize to use this Page";
        //        return PartialView("_partialviewNotFound");
        //    }
        //    _employeeTrainingService.DeleteTrainingById(id);
        //    return RedirectToAction("EmployeeTraining", new { id = empCode });
        //}
        #endregion
        #region EmpTraining



        public void ListOfDatas(int empCode)
        {
            ViewBag.EmployeeDetail = _employeeService.GetEmployeeDetails(empCode);
            ViewBag.SideBar        = _moduleService.AdminEmployeeDetailsMenu(empCode);

            foreach (var row in _officeService.GetOfficeAllData())
            {
                OfficeList.Add(new SelectListItem
                {
                    Text  = row.OfficeName,
                    Value = row.OfficeId.ToString()
                });
            }



            foreach (var row in _designationService.GetDesignationList())
            {
                DesignationList.Add(new SelectListItem
                {
                    Text  = row.DsgName,
                    Value = row.DsgId.ToString()
                });
            }

            foreach (var row in _rankService.GetRankList())
            {
                RankList.Add(new SelectListItem
                {
                    Text  = row.RankName.ToString(),
                    Value = row.RankId.ToString()
                });
            }


            ViewBag.officeList = OfficeList;

            ViewBag.designationList = DesignationList;
            ViewBag.rankList        = RankList;
        }
        public void ListOfDatas(int empCode)
        {
            ViewBag.EmployeeDetail = _employeeService.GetEmployeeDetails(empCode);
            List <SelectListItem> OfficeList = new List <SelectListItem>();

            foreach (var row in _officeService.GetOfficeAllData())
            {
                OfficeList.Add(new SelectListItem
                {
                    Text  = row.OfficeName,
                    Value = row.OfficeId.ToString()
                });
            }
            List <SelectListItem> DepartmentList = new List <SelectListItem>();

            foreach (var row in _departmentServices.GetDepartmentlist())
            {
                DepartmentList.Add(new SelectListItem
                {
                    Text  = row.DeptName,
                    Value = row.DeptId.ToString()
                });
            }
            List <SelectListItem> SectionList = new List <SelectListItem>();

            foreach (var row in _sectionServices.GetSectionList())
            {
                SectionList.Add(new SelectListItem
                {
                    Text  = row.SectionName,
                    Value = row.SectionId.ToString()
                });
            }
            List <SelectListItem> DesignationList = new List <SelectListItem>();

            foreach (var row in _designationServices.GetDesignationList())
            {
                DesignationList.Add(new SelectListItem
                {
                    Text  = row.DsgName,
                    Value = row.DsgId.ToString()
                });
            }
            List <SelectListItem> RankList = new List <SelectListItem>();

            foreach (var row in _rankServices.GetRankList())
            {
                RankList.Add(new SelectListItem
                {
                    Text  = row.RankName.ToString(),
                    Value = row.RankId.ToString()
                });
            }
            List <SelectListItem> LevelList = new List <SelectListItem>();

            foreach (var row in _levelServices.GetLevellist())
            {
                LevelList.Add(new SelectListItem
                {
                    Text  = row.LevelName,
                    Value = row.LevelId.ToString()
                });
            }
            List <SelectListItem> BusinessGroupList = new List <SelectListItem>();

            foreach (var row in _bgGroupService.GetBusinessGroupList())
            {
                BusinessGroupList.Add(new SelectListItem
                {
                    Text  = row.BgName,
                    Value = row.BgId.ToString()
                });
            }
            List <SelectListItem> ShiftList = new List <SelectListItem>();

            foreach (var row in _shiftService.GetShiftsLIst())
            {
                ShiftList.Add(new SelectListItem
                {
                    Text  = row.ShiftName,
                    Value = row.ShiftId.ToString()
                });
            }
            List <SelectListItem> RemoteList = new List <SelectListItem>();

            foreach (var row in _remoteService.GetRemoteList())
            {
                RemoteList.Add(new SelectListItem
                {
                    Text  = row.RemoteAreaName,
                    Value = row.RemoteId.ToString()
                });
            }
            List <SelectListItem> JobTypeList = new List <SelectListItem>();

            foreach (var row in _jobTypeservices.GetJobTypeList())
            {
                JobTypeList.Add(new SelectListItem
                {
                    Text  = row.JobTypeName,
                    Value = row.JobtypeId.ToString()
                });
            }
            List <SelectListItem> ServiceEventList = new List <SelectListItem>();

            foreach (var row in _serviceEventService.GetServiceEventList())
            {
                ServiceEventList.Add(new SelectListItem
                {
                    Text  = row.ServiceEventGroupName,
                    Value = row.ServiceEventId.ToString()
                });
            }
            List <SelectListItem> EmployeesList = new List <SelectListItem>();

            foreach (var row in _employeeService.GetEmployeeList(2))
            {
                EmployeesList.Add(new SelectListItem
                {
                    Text  = row.EmpName,
                    Value = row.EmpCode.ToString()
                });
            }
            ViewBag.officeList        = OfficeList;
            ViewBag.departmentList    = DepartmentList;
            ViewBag.sectionList       = SectionList;
            ViewBag.designationList   = DesignationList;
            ViewBag.rankList          = RankList;
            ViewBag.levelList         = LevelList;
            ViewBag.businessGroupList = BusinessGroupList;
            ViewBag.shiftList         = ShiftList;
            ViewBag.remoteList        = RemoteList;
            ViewBag.jobTypeList       = JobTypeList;
            ViewBag.serviceEventList  = ServiceEventList;
            ViewBag.employeeList      = EmployeesList;
        }
Exemplo n.º 4
0
        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());
            }
        }
Exemplo n.º 5
0
 public IActionResult GetRankList()
 {
     return(Ok(_rankService.GetRankList()));
 }