Ejemplo n.º 1
0
		public StaffDetail CreateStaffDetail(Staff staff, IPersistenceContext context)
		{
			PersonNameAssembler assembler = new PersonNameAssembler();
			StaffGroupAssembler groupAssembler = new StaffGroupAssembler();
			EmailAddressAssembler emailAssembler = new EmailAddressAssembler();
			TelephoneNumberAssembler telephoneAssembler = new TelephoneNumberAssembler();
			AddressAssembler addressAssembler = new AddressAssembler();

			return new StaffDetail(
				staff.GetRef(),
				staff.Id,
				EnumUtils.GetEnumValueInfo(staff.Type),
				assembler.CreatePersonNameDetail(staff.Name),
				EnumUtils.GetEnumValueInfo(staff.Sex, context),
				staff.Title,
				staff.LicenseNumber,
				staff.BillingNumber,
				CollectionUtils.Map<TelephoneNumber, TelephoneDetail>(
					staff.TelephoneNumbers,
					delegate(TelephoneNumber tn) { return telephoneAssembler.CreateTelephoneDetail(tn, context); }),
				CollectionUtils.Map<Address, AddressDetail>(
					staff.Addresses,
					delegate(Address a) { return addressAssembler.CreateAddressDetail(a, context); }),
				CollectionUtils.Map<EmailAddress, EmailAddressDetail>(
					staff.EmailAddresses,
					delegate(EmailAddress ea) { return emailAssembler.CreateEmailAddressDetail(ea, context); }),
				CollectionUtils.Map<StaffGroup, StaffGroupSummary>(
					staff.Groups,
					delegate(StaffGroup group) { return groupAssembler.CreateSummary(group); }),
				ExtendedPropertyUtils.Copy(staff.ExtendedProperties),
				staff.Deactivated,
				staff.UserName);
		}
Ejemplo n.º 2
0
		public StaffSummary CreateStaffSummary(Staff staff, IPersistenceContext context)
		{
			if (staff == null)
				return null;

			return new StaffSummary(staff.GetRef(), staff.Id,
				EnumUtils.GetEnumValueInfo(staff.Type),
				new PersonNameAssembler().CreatePersonNameDetail(staff.Name),
				staff.Deactivated);
		}