Esempio n. 1
0
        public IEmployee GetEmployeeAccount(string key, string value, out IList <CodeMessage> messages)
        {
            using (new OperationContextScope((IContextChannel)_emsEndPointClient.InnerChannel))
            {
                if (ServiceHeaders != null)
                {
                    OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = Utility.SetMessageProperty(ServiceHeaders);
                }

                EmsService.GetEmployeeAccountResponse response = _emsEndPointClient.getEmployeeAccount(new EmsService.getEmployeeAccountRequest()
                {
                    key = key, value = value
                });

                if (Helper.Utility.ResolveCodeMessage(response, out messages))
                {
                    IEmployee employee = Translator.EmployeeToEntity <Employee>(DataIntegrationMapper.ToEmployeeDto(response));

                    if (response.person != null)
                    {
                        employee.FirstName    = response.person.firstName;
                        employee.MiddleName   = response.person.middleName;
                        employee.LastName     = response.person.lastName;
                        employee.PersonId     = response.person.id.ToString();
                        employee.PersonObject = Translator.PersonToEntity(DataIntegrationMapper.ToAccountInfoDto(response.person));
                    }

                    if (response.careerlevel != null)
                    {
                        employee.CareerLevelId     = response.careerlevel.id.ToString();
                        employee.CareerLevelObject = Translator.CareerLevelToEntity(response.careerlevel);
                    }

                    if (response.job != null)
                    {
                        employee.JobId     = response.job.id.ToString();
                        employee.JobObject = Translator.JobToEntity(response.job);
                    }

                    return(employee);
                }
                else
                {
                    return(null);
                }
            }
        }
Esempio n. 2
0
        public IList <ICompetencyManager> GetAllCompetencyManager()
        {
            using (new OperationContextScope((IContextChannel)_emsEndPointClient.InnerChannel))
            {
                if (ServiceHeaders != null)
                {
                    OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = Utility.SetMessageProperty(ServiceHeaders);
                }

                EmsService.GetAllCompetencyManagerResponse response = _emsEndPointClient.getAllCompetencyManager(new EmsService.getAllCompetencyManagerRequest());

                IList <ICompetencyManager> listReturn = new List <ICompetencyManager>();
                foreach (EmsService.employeeInfoDTO item in response.list)
                {
                    ICompetencyManager manager = Translator.EmployeeToEntity <CompetencyManager>(item);

                    if (item.accountInfoDTO != null)
                    {
                        manager.PersonObject = Translator.PersonToEntity(DataIntegrationMapper.ToAccountInfoDto(item.accountInfoDTO));
                    }

                    if (item.careerLevel != null)
                    {
                        manager.CareerLevelObject = Translator.CareerLevelToEntity(item.careerLevel);
                    }

                    if (item.job != null)
                    {
                        manager.JobObject = Translator.JobToEntity(item.job);
                    }

                    listReturn.Add(manager);
                }

                return(listReturn);
            }
        }