Ejemplo n.º 1
0
 public static PhoneDTO PhoneToPhoneDTO(Phone phone)
 {
     PhoneDTO objPhoneDTO = new PhoneDTO();
     if (phone != null)
     {
         objPhoneDTO.PhoneId = phone.PhoneId;
         objPhoneDTO.Number = phone.Number;
     }
     return objPhoneDTO;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Add new phone
        /// </summary>
        /// <param name="phoneDTO"></param>
        /// <param name="profile"></param>
        void SavePhone(PhoneDTO phoneDTO, Profile profile)
        {
            //if phoneDTO data is not valid
            if (phoneDTO == null)
                throw new ArgumentException(Messages.warning_CannotAddProfileWithNullInformation);

            //Create a new Phone entity
            var newPhone = PhoneFactory.CreatePhone(phoneDTO.Number, "Anand", DateTime.Now, "Anand", DateTime.Now);

            //Save new Phone
            newPhone = SavePhone(newPhone);

            var phoneType = _phoneTypeRepository.Get(phoneDTO.PhoneTypeId);

            //Create a new Profile Phone entity
            var newProfilePhone = ProfilePhoneFactory.CreateProfilePhone(profile, newPhone, phoneType, "Anand", DateTime.Now, "Anand", DateTime.Now);

            //Save new Profile Phone
            SaveProfilePhone(newProfilePhone);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Add new phone
        /// </summary>
        /// <param name="phoneDTO"></param>
        /// <param name="profile"></param>
        void SavePhone(PhoneDTO phoneDTO, Profile profile)
        {
            //if phoneDTO data is not valid
            if (phoneDTO == null)
                throw new ArgumentException(LocalizerFactory.CreateLocalizer().GetString("warning_CannotAddProfileWithNullInformation", typeof(ApplicationErrors)));

            //Create a new Phone entity
            var newPhone = PhoneFactory.CreatePhone(phoneDTO.Number, "Anand", DateTime.Now, "Anand", DateTime.Now);

            //Save new Phone
            newPhone = SavePhone(newPhone);

            var phoneType = _phoneTypeRepository.Get(phoneDTO.PhoneTypeId);

            //Create a new Profile Phone entity
            var newProfilePhone = ProfilePhoneFactory.CreateProfilePhone(profile, newPhone, phoneType, "Anand", DateTime.Now, "Anand", DateTime.Now);

            //Save new Profile Phone
            SaveProfilePhone(newProfilePhone);
        }