コード例 #1
0
        public EmployeeSkillsDTO GetOneEmployeeSkills(int Id)
        {
            EmployeeSkill     Record       = _unitOfWork.EmployeeSkillRepository.Get(x => x.Id == Id).FirstOrDefault();
            EmployeeSkillsDTO ReturnRecord = ResponseFormatters.EmployeeSkillResponseFormatter.EmplyeeSkillDbToDTO(Record);

            return(ReturnRecord);
        }
コード例 #2
0
        public static List <EmployeeSkillsDTO> EmplyoeeSkillDbListToDTOList(List <EmployeeSkill> ModelData)
        {
            List <EmployeeSkillsDTO> ReturnRecord = new List <EmployeeSkillsDTO>();

            foreach (EmployeeSkill Row in ModelData)
            {
                EmployeeSkillsDTO Record = new EmployeeSkillsDTO
                {
                    Id             = Row.Id,
                    EmpCode        = Row.EmpCode,
                    EmpSkillId     = Row.EmpSkillId,
                    EmpSkillPoint  = Row.EmpSkillPoint,
                    EmpSkillStatus = Row.EmpSkillStatus,
                    Employee       = new EmployeeDTO
                    {
                        EmpCode = Row.Employee.EmpCode,
                        EmpName = Row.Employee.EmpName,
                    },
                    Skill = new SkillDTO
                    {
                        SkillId   = Row.Skill.SkillId,
                        SkillName = Row.Skill.SkillName
                    }
                };
                ReturnRecord.Add(Record);
            }
            return(ReturnRecord);
        }
コード例 #3
0
        public void AddEmployeeSkills(EmployeeSkillsDTO Record)
        {
            EmployeeSkill ReturnRecord = EmployeeSkillRequestFormatter.EmployeeSkillDTOToDb(Record);

            ReturnRecord.EmpSkillStatus = true;
            _unitOfWork.EmployeeSkillRepository.Create(ReturnRecord);
        }
コード例 #4
0
        public void UpdateEmployeeSkill(EmployeeSkillsDTO Record)
        {
            EmployeeSkill ReturnRecord = EmployeeSkillRequestFormatter.EmployeeSkillDTOToDb(Record);

            ReturnRecord.EmpCode        = Record.EmpId;
            ReturnRecord.EmpSkillStatus = true;
            _unitOfWork.EmployeeSkillRepository.Update(ReturnRecord);
        }
コード例 #5
0
        public ActionResult Add(int Id)
        {
            ViewBag.SideBar = _moduleService.AdminEmployeeDetailsMenu(Id);
            EmployeeSkillsDTO Record = new EmployeeSkillsDTO();

            Record.SkillSelectlist = _EmployeeSkillService.GetSkillSelectList();
            Record.EmpId           = Id;
            return(View("../Employee/Skill/Add", Record));
        }
コード例 #6
0
        public static EmployeeSkill EmployeeSkillDTOToDb(EmployeeSkillsDTO ModelData)
        {
            EmployeeSkill Record = new EmployeeSkill
            {
                Id             = ModelData.Id,
                EmpCode        = ModelData.EmpCode,
                EmpSkillId     = ModelData.EmpSkillId,
                EmpSkillPoint  = ModelData.EmpSkillPoint,
                EmpSkillStatus = ModelData.EmpSkillStatus
            };

            return(Record);
        }
コード例 #7
0
        public ActionResult Update(int id)
        {
            EmployeeSkillsDTO Record = new EmployeeSkillsDTO();

            Record                 = _EmployeeSkillService.GetOneEmployeeSkills(id);
            Record.EmpId           = Record.EmpCode;
            Record.SkillSelectlist = _EmployeeSkillService.GetSkillSelectList();


            ViewBag.SideBar = _moduleService.AdminEmployeeDetailsMenu(Record.EmpId);

            return(View("../Employee/Skill/Update", Record));
        }
コード例 #8
0
        public ActionResult Delete(int id)
        {
            ViewBag.SideBar = _moduleService.AdminEmployeeDetailsMenu(id);
            EmployeeSkillsDTO Record = new EmployeeSkillsDTO();

            try
            {
                Record.EmpId = _EmployeeSkillService.GetEmpCode(id);
                _EmployeeSkillService.Delete(id);
                Session["Success"] = "Successfully Deleted Employee Skill";
            }
            catch (Exception Exception)
            {
                ViewBag.Error = Exception.Message;
            }
            return(RedirectToAction("Index", "Skill", new { id = Record.EmpId }));
        }
コード例 #9
0
 public ActionResult Update(EmployeeSkillsDTO Record)
 {
     Record.SkillSelectlist = _EmployeeSkillService.GetSkillSelectList();
     try
     {
         if (ModelState.IsValid)
         {
             _EmployeeSkillService.UpdateEmployeeSkill(Record);
             Session["Success"] = "Successfully Updated Employee Skill";
             return(RedirectToAction("Index", "Skill", new { id = Record.EmpId }));
         }
         else
         {
             ViewBag.Error = "Form Error";
         }
     }
     catch (Exception Exception)
     {
         ViewBag.Error = Exception.Message;
     }
     return(View("../Employee/Skill/Update", Record));
 }
コード例 #10
0
        public static EmployeeSkillsDTO EmplyeeSkillDbToDTO(EmployeeSkill ModelData)
        {
            EmployeeSkillsDTO Record = new EmployeeSkillsDTO
            {
                Id             = ModelData.Id,
                EmpCode        = ModelData.EmpCode,
                EmpSkillId     = ModelData.EmpSkillId,
                EmpSkillPoint  = ModelData.EmpSkillPoint,
                EmpSkillStatus = ModelData.EmpSkillStatus,
                Employee       = new EmployeeDTO
                {
                    EmpCode = ModelData.Employee.EmpCode,
                    EmpName = ModelData.Employee.EmpName,
                },
                Skill = new SkillDTO
                {
                    SkillId   = ModelData.Skill.SkillId,
                    SkillName = ModelData.Skill.SkillName
                }
            };

            return(Record);
        }