public BussinessDataModel CreateBusiness(BussinessDataModel businessDataModel) { if (businessDataModel != null) { BusinessDTO businessDTO = new BusinessDTO(); AddressDTO addressDTO = new AddressDTO(); PhoneDTO phoneDTO = new PhoneDTO(); EmailDTO emailDTO = new EmailDTO(); businessDTO = BussinessDataModelAssembler.ToBusinessDTO(businessDataModel); phoneDTO = BussinessDataModelAssembler.ToPhoneDTO(businessDataModel); emailDTO = BussinessDataModelAssembler.ToEmailDTO(businessDataModel); addressDTO = BussinessDataModelAssembler.ToAddressDTO(businessDataModel); if (businessDTO != null) { businessDTO = businessBL.Create(businessDTO); } if (phoneDTO != null) { phoneDTO = phonesBL.Create(phoneDTO); } if (emailDTO != null) { emailsBL.Create(emailDTO); } if (addressDTO != null) { addressBL.Create(addressDTO); } } return businessDataModel; }
public UserPhoneDTO(Int32 userPhoneID, Int32 userID, Int32 phoneID, Boolean isPrimary, UserDTO user, PhoneDTO phone) { this.UserPhoneID = userPhoneID; this.UserID = userID; this.PhoneID = phoneID; this.IsPrimary = isPrimary; this.User = user; this.Phone = phone; }
public PhoneDTO Create(PhoneDTO oPhoneDTO) { if (oPhoneDTO != null) { return PhoneAssembler.ToDTO(oPhoneRepo.CreatePhone(PhoneAssembler.ToEntity(oPhoneDTO))); } return null; }
public BusinessPhoneDTO(Int32 businessPhoneID, Int32 businessID, Int32 phoneID, Boolean isPrimary, BusinessDTO business, PhoneDTO phone) { this.BusinessPhoneID = businessPhoneID; this.BusinessID = businessID; this.PhoneID = phoneID; this.IsPrimary = isPrimary; this.Business = business; this.Phone = phone; }
public PhoneDTO Update(PhoneDTO oPhoneDTO) { PhoneDTO returnPhone = null; if (oPhoneDTO != null && oPhoneDTO.PhoneID > 0) { oPhoneRepo.UpdatePhone(PhoneAssembler.ToEntity(oPhoneDTO)); returnPhone = oPhoneDTO; } return returnPhone; }
public static BussinessDataModel ToDataModel(BusinessDTO bussinessDTO, AddressDTO primaryAddressDTO, PhoneDTO primaryPhoneDTO, EmailDTO primaryEmailDTO) { BussinessDataModel model = null; if (model != null) { model = new BussinessDataModel(); model.Abbreviation = bussinessDTO.Abbreviation; model.BusinessID = bussinessDTO.BusinessID; model.BusinessTypeID = bussinessDTO.BusinessTypeID; model.insdt = bussinessDTO.insdt; model.insuser = bussinessDTO.insuser; model.IsActive = bussinessDTO.IsActive; model.IsDeleted = bussinessDTO.IsDeleted; model.Name = bussinessDTO.Name; model.StartDate = bussinessDTO.StartDate; model.upddt = bussinessDTO.upddt; model.upduser = bussinessDTO.upduser; } if (primaryAddressDTO != null) { model.BusinessAddressAddressTypeID = primaryAddressDTO.AddressTypeID; model.BusinessAddressCity = primaryAddressDTO.City; model.BusinessAddressCountryID = primaryAddressDTO.CountryID; model.BusinessAddressID = primaryAddressDTO.AddressID; model.BusinessAddressLine1 = primaryAddressDTO.Line1; model.BusinessAddressLine2 = primaryAddressDTO.Line2; model.BusinessAddressLine3 = primaryAddressDTO.Line3; model.BusinessAddressState = primaryAddressDTO.State; model.BusinessAddressTitle = primaryAddressDTO.Title; model.BusinessAddressZipCode = primaryAddressDTO.ZipCode; } if (primaryPhoneDTO != null) { model.BusinessPhoneCountryID = primaryPhoneDTO.CountryID; model.BusinessPhoneExt = primaryPhoneDTO.Ext; model.BusinessPhoneID = primaryPhoneDTO.PhoneID; model.BusinessPhoneNumber = primaryPhoneDTO.Number; model.BusinessPhoneTypeID = primaryPhoneDTO.PhoneTypeID; } if (primaryEmailDTO != null) { model.BusinessEmailAddress = primaryEmailDTO.Address; model.BusinessEmailID = primaryEmailDTO.EmailID; model.BusinessEmailTypeID = primaryEmailDTO.EmailTypeID; } return model; }
/// <summary> /// Converts this instance of <see cref="Phone"/> to an instance of <see cref="PhoneDTO"/>. /// </summary> /// <param name="entity"><see cref="Phone"/> to convert.</param> public static PhoneDTO ToDTO(this Phone entity) { if (entity == null) return null; var dto = new PhoneDTO(); dto.PhoneID = entity.PhoneID; dto.CountryID = entity.CountryID; dto.Number = entity.Number; dto.Ext = entity.Ext; dto.PhoneTypeID = entity.PhoneTypeID; entity.OnDTO(dto); return dto; }
public UserDataModel CreateUser(UserDataModel userDataModel) { if (userDataModel != null) { UserDTO userDTO = new UserDTO(); UserAccountDTO userAccountDTO = new UserAccountDTO(); PhoneDTO oPhoneDTO = new PhoneDTO(); EmailDTO oEmailDTO = new EmailDTO(); AddressDTO oAddressDTO = new AddressDTO(); userDTO = UserDataModelAssembler.ToUserDTO(userDataModel); userAccountDTO = UserDataModelAssembler.ToUserAccountDTO(userDataModel); oPhoneDTO = UserDataModelAssembler.ToPhoneDTO(userDataModel); oEmailDTO = UserDataModelAssembler.ToEmailDTO(userDataModel); oAddressDTO = UserDataModelAssembler.ToAddressDTO(userDataModel); if (userDTO != null) { userDTO = usersBL.Create(userDTO); } if (userAccountDTO != null) { userAccountDTO = AccountBL.Create(userAccountDTO); } if (oPhoneDTO != null) { oPhoneDTO = oPhonesBL.Create(oPhoneDTO); } if (oEmailDTO != null) { oEmailsBL.Create(oEmailDTO); } if (oAddressDTO != null) { oAddressBL.Create(oAddressDTO); } } return userDataModel; }
public static PhoneDTO ToPhoneDTO(BussinessDataModel model) { PhoneDTO dto = new PhoneDTO(); if (model != null) { dto.CountryID = model.BusinessPhoneCountryID; dto.Ext = model.BusinessPhoneExt; dto.PhoneID = model.BusinessPhoneID; dto.Number = model.BusinessPhoneNumber; dto.PhoneTypeID = model.BusinessPhoneTypeID; } return dto; }
public static PhoneDTO ToPhoneDTO(UserDataModel datamodel) { PhoneDTO dto = new PhoneDTO(); if (datamodel != null) { dto.CountryID = datamodel.UserPhoneCountryID; dto.Ext = datamodel.UserPhoneExt; dto.Number = datamodel.UserPhoneNumber; dto.PhoneID = datamodel.UserPhoneID; dto.PhoneTypeID = datamodel.UserPhoneTypeID; } return dto; }
public static UserDataModel ToDataModel(UserDTO userDTO, UserAccountDTO accountDTO, AddressDTO addressDTO, PhoneDTO phoneDTO, EmailDTO emailDTO) { UserDataModel model = null; if (userDTO != null) { model = new UserDataModel { UserID = userDTO.UserID, UserName = userDTO.UserName, FirstName = userDTO.FirstName, MiddleName = userDTO.MiddleName, LastName = userDTO.LastName, DOB = userDTO.DOB, IsActive = userDTO.IsActive, IsDeleted = userDTO.IsDeleted, insuser = userDTO.insuser, insdt = userDTO.insdt, upduser = userDTO.upduser, upddt = userDTO.upddt }; if (accountDTO != null) { model.UserAccountID = accountDTO.UserAccountID; model.UserAccountinsdt = accountDTO.insdt; model.UserAccountinsuser = accountDTO.insuser; model.UserAccountIsActive = accountDTO.IsActive; model.UserAccountIsDeleted = accountDTO.IsDeleted; model.UserAccountPassword = accountDTO.Password; model.UserAccountupddt = accountDTO.upddt; model.UserAccountupduser = accountDTO.upduser; model.UserAccountUserName = accountDTO.UserName; } if (addressDTO != null) { model.UserAddressAddressTypeID = addressDTO.AddressTypeID; model.UserAddressCity = addressDTO.City; model.UserAddressCountryID = addressDTO.CountryID; model.UserAddressID = addressDTO.AddressID; model.UserAddressLine1 = addressDTO.Line1; model.UserAddressLine2 = addressDTO.Line2; model.UserAddressLine3 = addressDTO.Line3; model.UserAddressState = addressDTO.State; model.UserAddressTitle = addressDTO.Title; model.UserAddressZipCode = addressDTO.ZipCode; } if (phoneDTO != null) { model.UserPhoneCountryID = phoneDTO.CountryID; model.UserPhoneExt = phoneDTO.Ext; model.UserPhoneID = phoneDTO.PhoneID; model.UserPhoneNumber = phoneDTO.Number; model.UserPhoneTypeID = phoneDTO.PhoneTypeID; } if (emailDTO != null) { model.UserEmailAddress = emailDTO.Address; model.UserEmailID = emailDTO.EmailID; model.UserEmailTypeID = emailDTO.EmailTypeID; } } return model; }
/// <summary> /// Invoked when <see cref="ToDTO"/> operation is about to return. /// </summary> /// <param name="dto"><see cref="PhoneDTO"/> converted from <see cref="Phone"/>.</param> static partial void OnDTO(this Phone entity, PhoneDTO dto);
/// <summary> /// Invoked when <see cref="ToDTO"/> operation is about to return. /// </summary> /// <param name="dto"><see cref="PhoneDTO"/> converted from <see cref="Phone"/>.</param> static partial void OnDTO(this Phone entity, PhoneDTO dto) { if (entity != null && entity.TypeCode != null) dto.TypeCode = TypeCodeAssembler.ToDTO(entity.TypeCode); }
public static UserDataModel ToDataModel(UserDTO oUserDTO, AddressDTO oPrimaryAddressDTO, PhoneDTO oPrimaryPhoneDTO, EmailDTO oPrimaryEmailDTO) { UserDataModel oUserDataModel = null; if (oUserDTO != null) { oUserDataModel = new UserDataModel { UserID = oUserDTO.UserID, UserName = oUserDTO.UserName, FirstName = oUserDTO.FirstName, MiddleName = oUserDTO.MiddleName, LastName = oUserDTO.LastName, DOB = oUserDTO.DOB, IsActive = oUserDTO.IsActive, IsDeleted = oUserDTO.IsDeleted, insuser = oUserDTO.insuser, insdt = oUserDTO.insdt, upduser = oUserDTO.upduser, upddt = oUserDTO.upddt }; if (oPrimaryAddressDTO != null) { oUserDataModel.PrimayAddress_AddressID = oPrimaryAddressDTO.AddressID; oUserDataModel.PrimaryAddressTitle = oPrimaryAddressDTO.Title; oUserDataModel.PrimaryAddressLine1 = oPrimaryAddressDTO.Line1; oUserDataModel.PrimaryAddressLine2 = oPrimaryAddressDTO.Line2; oUserDataModel.PrimaryAddressLine3 = oPrimaryAddressDTO.Line3; oUserDataModel.PrimaryAddressCity = oPrimaryAddressDTO.City; oUserDataModel.PrimaryAddressState = oPrimaryAddressDTO.State; oUserDataModel.PrimaryAddressZipCode = oPrimaryAddressDTO.ZipCode; oUserDataModel.PrimaryAddressCountryID = oPrimaryAddressDTO.CountryID; oUserDataModel.PrimaryAddressCountryName = oPrimaryAddressDTO.Country.Name; oUserDataModel.PrimaryAddressCountryAbbreviation = oPrimaryAddressDTO.Country.Abbreviation; oUserDataModel.PrimaryAddressCountryCode = oPrimaryAddressDTO.Country.Code; oUserDataModel.PrimaryAddressCountryPhoneCode = oPrimaryAddressDTO.Country.PhoneCode; oUserDataModel.PrimaryAddressTypeID = oPrimaryAddressDTO.AddressTypeID; oUserDataModel.PrimaryAddressTypeName = oPrimaryAddressDTO.TypeCode.Name; oUserDataModel.PrimaryAddressTypeCode = oPrimaryAddressDTO.TypeCode.Code; oUserDataModel.PrimaryAddressTypeDescription = oPrimaryAddressDTO.TypeCode.Description; oUserDataModel.PrimaryAddressTypeClassTypeID = oPrimaryAddressDTO.TypeCode.ClassTypeID; } if (oPrimaryPhoneDTO != null) { oUserDataModel.PrimaryPhone_PhoneID = oPrimaryPhoneDTO.PhoneID; oUserDataModel.PrimaryPhoneNumber = oPrimaryPhoneDTO.Number; oUserDataModel.PrimaryPhoneExt = oPrimaryPhoneDTO.Ext; oUserDataModel.PrimaryPhoneTypeID = oPrimaryPhoneDTO.TypeCode.TypeCodeID; oUserDataModel.PrimaryPhoneTypeName = oPrimaryPhoneDTO.TypeCode.Name; oUserDataModel.PrimaryPhoneTypeCode = oPrimaryPhoneDTO.TypeCode.Code; oUserDataModel.PrimaryPhoneTypeDescription = oPrimaryPhoneDTO.TypeCode.Description; oUserDataModel.PrimaryPhoneTypeClassTypeID = oPrimaryPhoneDTO.TypeCode.ClassTypeID; } if (oPrimaryEmailDTO != null) { oUserDataModel.PrimaryEmail_EmailID = oPrimaryEmailDTO.EmailID; oUserDataModel.PrimaryEmailAddress = oPrimaryEmailDTO.Address; oUserDataModel.PrimaryEmailTypeID = oPrimaryPhoneDTO.TypeCode.TypeCodeID; oUserDataModel.PrimaryEmailTypeName = oPrimaryEmailDTO.TypeCode.Name; oUserDataModel.PrimaryEmailTypeCode = oPrimaryEmailDTO.TypeCode.Code; oUserDataModel.PrimaryEmailTypeDescription = oPrimaryEmailDTO.TypeCode.Description; oUserDataModel.PrimaryEmailTypeClassTypeID = oPrimaryEmailDTO.TypeCode.ClassTypeID; } } return oUserDataModel; }