コード例 #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);
                }
            }
        }
コード例 #2
0
 public static EmsService.employeeInfoDTO ToEmployeeDto(this EmsService.GetEmployeeAccountResponse source)
 {
     return(Mapper.Map <EmsService.GetEmployeeAccountResponse, EmsService.employeeInfoDTO>(source));
 }