コード例 #1
0
        public IActionResult Approval()
        {
            string ESMJson           = HttpContext.Session.GetString("ESM");
            EmployeeSessionModel ESM = JsonConvert.DeserializeObject <EmployeeSessionModel>(ESMJson);

            return(View(ESM));
        }
コード例 #2
0
        public IActionResult Profile(int Id)
        {
            string ESMJson                    = HttpContext.Session.GetString("ESM");
            EmployeeSessionModel ESM          = new EmployeeSessionModel();
            EmployeeRepository   employeeRepo = new EmployeeRepository();

            if (!string.IsNullOrEmpty(ESMJson))
            {
                ESM = JsonConvert.DeserializeObject <EmployeeSessionModel>(ESMJson);
                Employee       employee = employeeRepo.GetEmployeeById(Convert.ToInt32(ESM.EmployeeId));
                EmployeeModels eModel   = new EmployeeModels();
                eModel.active          = true;
                eModel.Department      = employee.Department.Name;
                eModel.DepartmentId    = (int)employee.DepartmentId;
                eModel.Email           = employee.Email;
                eModel.Id              = employee.Id;
                eModel.Name            = ESM.Name;
                eModel.NIK             = ESM.NIK;
                eModel.Phone           = employee.Phone;
                eModel.Position        = ESM.Position;
                eModel.PositionId      = Convert.ToInt32(ESM.PositionId);
                eModel.Subdepartment   = ESM.SubDepartment;
                eModel.SubDepartmentId = Convert.ToInt32(ESM.SubDeparmentId);
                return(View(eModel));
            }
            else
            {
                return(View(new EmployeeModels()));
            }
        }
コード例 #3
0
        public IActionResult Login(LoginModels model, string returnUrl)
        {
            EmployeeRepository employeeRepo = new EmployeeRepository();
            Employee           employee     = employeeRepo.GetEmployeeByNIKAndPassword(model.NIK, Helper.HashSha256(model.Password));

            if (employee != null)
            {
                EmployeeSessionModel ESM = new EmployeeSessionModel();
                ESM.Department     = employee.Department.Name;
                ESM.DepartmentId   = employee.DepartmentId.ToString();
                ESM.EmployeeId     = employee.Id.ToString();
                ESM.Email          = employee.Email;
                ESM.Name           = employee.Name;
                ESM.NIK            = employee.Nik;
                ESM.Position       = employee.Position.Name;
                ESM.PositionId     = employee.PositionId.ToString();
                ESM.SubDepartment  = employee.Subdepartment.Name;
                ESM.SubDeparmentId = employee.SubdepartmentId.ToString();
                ESM.Level          = Convert.ToInt32(employee.Position.Level);

                string ESMJson = JsonConvert.SerializeObject(ESM);
                HttpContext.Session.SetString("ESM", ESMJson);
                if (!string.IsNullOrEmpty(returnUrl))
                {
                    return(Redirect(returnUrl));
                }
                else
                {
                    return(RedirectToAction("Profile", "Employee", new { Id = ESM.EmployeeId }));
                }
            }
            else
            {
                AdminRepository adminRepo = new AdminRepository();
                Admin           admin     = adminRepo.GetAdminByLoginNameAndPassword(model.NIK, Helper.HashSha256(model.Password));
                if (admin == null)
                {
                    TempData["alert"] = Helper.Alert("NIK atau password salah.");
                    return(View(model));
                }
                else
                {
                    EmployeeSessionModel esm = new EmployeeSessionModel();
                    esm.Name            = admin.Name;
                    esm.NIK             = admin.Loginname;
                    esm.Position        = "Administrator";
                    esm.EmployeeId      = admin.Id.ToString();
                    esm.Email           = admin.Email;
                    esm.isAdministrator = true;
                    return(RedirectToAction("Index", "Home"));
                }
            }
        }
コード例 #4
0
        public IActionResult SuperiorAssessment()
        {
            string ESMJson           = HttpContext.Session.GetString("ESM");
            EmployeeSessionModel ESM = JsonConvert.DeserializeObject <EmployeeSessionModel>(ESMJson);

            DepartmentRepository   deptRepo    = new DepartmentRepository();
            SubDeparmentRepository subDeptRepo = new SubDeparmentRepository();

            ViewBag.Department    = deptRepo.GetDepartments();
            ViewBag.SubDepartment = subDeptRepo.GetSubdepartments();

            return(View(ESM));
        }
コード例 #5
0
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            string ESMJson = HttpContext.Session.GetString("ESM");

            if (string.IsNullOrEmpty(ESMJson))
            {
                filterContext.Result = new RedirectToActionResult("Login", "Account", new { returnUrl = HttpContext.Request.Path + HttpContext.Request.QueryString });
                return;
            }
            EmployeeSessionModel ESM = JsonConvert.DeserializeObject <EmployeeSessionModel>(ESMJson);

            if (string.IsNullOrEmpty(ESM.EmployeeId))
            {
                filterContext.Result = new RedirectToActionResult("Login", "Account", new { returnUrl = HttpContext.Request.Path + HttpContext.Request.QueryString });
                return;
            }
            if (!ESM.isAdministrator)
            {
                ViewBag.Controller   = ControllerContext.RouteData.Values["Controller"];
                ViewBag.employeeName = ESM.Name;
                ViewBag.email        = ESM.Email;
                ViewBag.position     = ESM.Position + " " + ESM.Department + " " + ESM.SubDepartment;
                ViewBag.employeeId   = ESM.EmployeeId;
                ViewBag.level        = ESM.Level;
            }
            else
            {
                ViewBag.Controller      = ControllerContext.RouteData.Values["Controller"];
                ViewBag.employeeName    = ESM.Name;
                ViewBag.email           = ESM.Email;
                ViewBag.position        = ESM.Position;
                ViewBag.employeeId      = ESM.EmployeeId;
                ViewBag.isAdministrator = true;
            }
            base.OnActionExecuting(filterContext);
        }
コード例 #6
0
        public IActionResult IndividualAssessment(AssessmentModels model = null)
        {
            string ESMJson           = HttpContext.Session.GetString("ESM");
            EmployeeSessionModel ESM = JsonConvert.DeserializeObject <EmployeeSessionModel>(ESMJson);

            if (!string.IsNullOrEmpty(ESM.EmployeeId))
            {
                if (model.DocumentId != 0)
                {
                    model = this.InitModel(model.DocumentId);
                    model.BODescription = new List <string>();
                    AssessmentRepository assesmentRepo = new AssessmentRepository();
                    Performanceappraisal assessment    = assesmentRepo.GetPerfAppById(model.DocumentId);
                    foreach (var item in assessment.Businessobjective)
                    {
                        model.BODescription.Add(item.Description);
                        model.BOEmployeeScore.Add(item.Employeescore);
                        model.BOGoals.Add(item.Goalachievement);
                        model.BOWeight.Add(item.Weight);
                    }
                    foreach (var item in assessment.Globalbehavior)
                    {
                        model.GBDemonstatedBehavior.Add(item.Demonstratedbehavior);
                        model.GBEmployeeScore.Add(item.Employeescore);
                        model.GBExpectedBehavior.Add(item.Expectedbehavior);
                    }
                    model.BODescriptiveScore      = assessment.Bodescriptivescore;
                    model.BONumericalScore        = assessment.Bonumericscore;
                    model.GBNumericalScore        = assessment.Gbnumericscore;
                    model.GBDescriptiveScore      = assessment.Gbdescriptivescore;
                    model.CareerAspirationComment = assessment.Careeraspirationcomment;
                    foreach (var item in assessment.Developmentplan)
                    {
                        model.DPDevelopmentArea = item.Developmentarea;
                        model.DPMethods         = item.Methods;
                        model.DPPlan            = item.Plan;
                        model.DPStrengthArea    = item.Strengtharea;
                    }
                    model.EmployeeComment           = assessment.Employeecomment;
                    model.ManagerComment            = assessment.Managercomment;
                    model.MobilityStatusId          = (int)assessment.MobilityId;
                    model.MobilityStatusDesc        = assessment.Mobilitydesc;
                    model.OverallDescriptiveScore   = assessment.Overalldescriptivescore;
                    model.OverallNumericalScore     = assessment.Overallnumericscore;
                    model.SecondLevelManagerComment = assessment._2ndlvlmanagercomment;
                    model.ESM = ESM;
                }
                else
                {
                    model     = this.InitModel(0);
                    model.ESM = ESM;
                }
            }
            else
            {
                model     = this.InitModel(0);
                model.ESM = ESM;
            }

            DepartmentRepository   deptRepo    = new DepartmentRepository();
            SubDeparmentRepository subDeptRepo = new SubDeparmentRepository();

            ViewBag.departmentId    = ESM.DepartmentId;
            ViewBag.subdepartmentId = ESM.SubDeparmentId;
            ViewBag.Department      = deptRepo.GetDepartments();
            ViewBag.SubDepartment   = subDeptRepo.GetSubdepartments();

            return(View(model));
        }