/// <summary> /// Create a new ProfilePhone /// </summary> /// <param name="profile"></param> /// <param name="phone"></param> /// <param name="phoneType"></param> /// <param name="createdBy"></param> /// <param name="dateTime1"></param> /// <param name="updatedBy"></param> /// <param name="updated"></param> /// <returns></returns> public static ProfilePhone CreateProfilePhone(Profile profile, Phone phone, PhoneType phoneType, string createdBy, DateTime created, string updatedBy, DateTime updated) { ProfilePhone profilePhone = new ProfilePhone { Created = created, CreatedBy = createdBy, Updated = updated, UpdatedBy = updatedBy, ProfileId = profile.ProfileId, PhoneId = phone.PhoneId, PhoneTypeId = phoneType.PhoneTypeId }; return(profilePhone); }
/// <summary> /// Create a New ProfilePhone /// </summary> /// <param name="profile"></param> /// <param name="phone"></param> /// <param name="phoneType"></param> /// <param name="createdBy"></param> /// <param name="created"></param> /// <param name="updatedBy"></param> /// <param name="updated"></param> /// <returns></returns> public static ProfilePhone CreateProfilePhone(Profile profile, Phone phone, PhoneType phoneType, string createdBy, DateTime created, string updatedBy, DateTime updated) { ProfilePhone objProfilePhone = new ProfilePhone(); //Set values for Address objProfilePhone.Created = created; objProfilePhone.CreatedBy = createdBy; objProfilePhone.Updated = updated; objProfilePhone.UpdatedBy = updatedBy; //Associate Profile for this Profile Phone objProfilePhone.ProfileId = profile.ProfileId; //Associate Phone for this Profile Phone objProfilePhone.PhoneId = phone.PhoneId; //Associate PhoneTye for this Profile Phone objProfilePhone.PhoneTypeId = phoneType.PhoneTypeId; return(objProfilePhone); }
/// <summary> /// Create a New ProfilePhone /// </summary> /// <param name="profile"></param> /// <param name="phone"></param> /// <param name="phoneType"></param> /// <param name="createdBy"></param> /// <param name="created"></param> /// <param name="updatedBy"></param> /// <param name="updated"></param> /// <returns></returns> public static ProfilePhone CreateProfilePhone(Profile profile, Phone phone, PhoneType phoneType, string createdBy, DateTime created, string updatedBy, DateTime updated) { ProfilePhone objProfilePhone = new ProfilePhone(); //Set values for Address objProfilePhone.Created = created; objProfilePhone.CreatedBy = createdBy; objProfilePhone.Updated = updated; objProfilePhone.UpdatedBy = updatedBy; //Associate Profile for this Profile Phone objProfilePhone.ProfileId = profile.ProfileId; //Associate Phone for this Profile Phone objProfilePhone.PhoneId = phone.PhoneId; //Associate PhoneTye for this Profile Phone objProfilePhone.PhoneTypeId = phoneType.PhoneTypeId; return objProfilePhone; }
/// <summary> /// Save Profile Phone /// </summary> /// <param name="profilePhone"></param> void SaveProfilePhone(ProfilePhone profilePhone) { var entityValidator = EntityValidatorFactory.CreateValidator(); if (entityValidator.IsValid(profilePhone))//if entity is valid save. { //add profile phone and commit changes _profilePhoneRepository.Add(profilePhone); _profilePhoneRepository.UnitOfWork.Commit(); } else // if not valid throw validation errors throw new ApplicationValidationErrorsException(entityValidator.GetInvalidMessages(profilePhone)); }
/// <summary> /// Delete profile phone /// </summary> /// <param name="profilePhone"></param> public void DeleteProfilePhone(ProfilePhone profilePhone) { var phone = _phoneRepository.Get(profilePhone.PhoneId); if (phone != null) //if phone exist { _profilePhoneRepository.Remove(profilePhone); //commit changes _profilePhoneRepository.UnitOfWork.Commit(); _phoneRepository.Remove(phone); //commit changes _phoneRepository.UnitOfWork.Commit(); } else //the customer not exist, cannot remove LoggerFactory.CreateLog().LogWarning(Messages.warning_CannotRemoveNonExistingProfile); }