public static ProfileAddress ProfileAddress(Profile profile, Address address, AddressType addressType, string createdBy, DateTime created, string updatedBy, DateTime updated) { ProfileAddress profileAddress = new ProfileAddress { CreatedBy = createdBy, Created = created, UpdatedBy = updatedBy, Updated = updated, ProfileId = profile.ProfileId, AddressId = address.AddressId, AddressTypeId = addressType.AddressTypeId }; return(profileAddress); }
public static ProfileAddress ProfileAddress(Profile profile, Address address, AddressType addressType, string createdBy, DateTime created, string updatedBy, DateTime updated) { ProfileAddress objProfileAddress = new ProfileAddress(); //Set values for Address objProfileAddress.Created = created; objProfileAddress.CreatedBy = createdBy; objProfileAddress.Updated = updated; objProfileAddress.UpdatedBy = updatedBy; //Associate Profile for this Profile Phone objProfileAddress.ProfileId = profile.ProfileId; //Associate Address for this Profile Phone objProfileAddress.AddressId = address.AddressId; //Associate AddressTye for this Profile Phone objProfileAddress.AddressTypeId = addressType.AddressTypeId; return(objProfileAddress); }
public static ProfileAddress ProfileAddress(Profile profile, Address address, AddressType addressType, string createdBy, DateTime created, string updatedBy, DateTime updated) { ProfileAddress objProfileAddress = new ProfileAddress(); //Set values for Address objProfileAddress.Created = created; objProfileAddress.CreatedBy = createdBy; objProfileAddress.Updated = updated; objProfileAddress.UpdatedBy = updatedBy; //Associate Profile for this Profile Phone objProfileAddress.ProfileId = profile.ProfileId; //Associate Address for this Profile Phone objProfileAddress.AddressId = address.AddressId; //Associate AddressTye for this Profile Phone objProfileAddress.AddressTypeId = addressType.AddressTypeId; return objProfileAddress; }
/// <summary> /// Save Profile Address /// </summary> /// <param name="profileAddress"></param> void SaveProfileAddress(ProfileAddress profileAddress) { var entityValidator = EntityValidatorFactory.CreateValidator(); if (entityValidator.IsValid(profileAddress))//if entity is valid save. { //add profile address and commit changes _profileAddressRepository.Add(profileAddress); _profileAddressRepository.UnitOfWork.Commit(); } else // if not valid throw validation errors throw new ApplicationValidationErrorsException(entityValidator.GetInvalidMessages(profileAddress)); }
/// <summary> /// Delete profile address /// </summary> /// <param name="profileId"></param> public void DeleteProfileAddress(ProfileAddress profileAddress) { var address = _addressRepository.Get(profileAddress.AddressId); if (address != null) //if address exist { _profileAddressRepository.Remove(profileAddress); //commit changes _profileAddressRepository.UnitOfWork.Commit(); _addressRepository.Remove(address); //commit changes _addressRepository.UnitOfWork.Commit(); } else //the customer not exist, cannot remove LoggerFactory.CreateLog().LogWarning(Messages.warning_CannotRemoveNonExistingProfile); }