Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
        public UserAddressDTO(Int32 userAddressID, Int32 userID, Int32 addressID, Boolean isPrimary, AddressDTO address, UserDTO user)
        {
			this.UserAddressID = userAddressID;
			this.UserID = userID;
			this.AddressID = addressID;
			this.IsPrimary = isPrimary;
			this.Address = address;
			this.User = user;
        }
Ejemplo n.º 3
0
        public BusinessAddressDTO(Int32 businessAddressID, Int32 businessID, Int32 addressID, Boolean isPrimary, AddressDTO address, BusinessDTO business)
        {
			this.BusinessAddressID = businessAddressID;
			this.BusinessID = businessID;
			this.AddressID = addressID;
			this.IsPrimary = isPrimary;
			this.Address = address;
			this.Business = business;
        }
Ejemplo n.º 4
0
        public AddressDTO Create(AddressDTO oAddressDTO)
        {
            if (oAddressDTO != null)
            {
                return AddressAssembler.ToDTO(oAddressRepo.CreateAddress(AddressAssembler.ToEntity(oAddressDTO)));
            }

            return null;
        }
        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;
        }
Ejemplo n.º 6
0
        public AddressDTO Update(AddressDTO oAddressDTO)
        {
            AddressDTO returnAddress = null;
            if (oAddressDTO != null && oAddressDTO.AddressID > 0)
            {
                oAddressRepo.UpdateAddress(AddressAssembler.ToEntity(oAddressDTO));
                returnAddress = oAddressDTO;
            }

            return returnAddress;
        }
        public static AddressDTO ToDTO(AddressDataModel datamodel)
        {
            AddressDTO dto = new AddressDTO();

            if (datamodel != null)
            {
                dto.AddressID = datamodel.AddressID;
                dto.Title = datamodel.Title;
                dto.Line1 = datamodel.Line1;
                dto.Line2 = datamodel.Line2;
                dto.Line3 = datamodel.Line3;
                dto.City = datamodel.City;
                dto.State = datamodel.State;
                dto.ZipCode = datamodel.ZipCode;
                dto.AddressTypeID = datamodel.AddressTypeID;
            }

            return dto;
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Converts this instance of <see cref="Address"/> to an instance of <see cref="AddressDTO"/>.
        /// </summary>
        /// <param name="entity"><see cref="Address"/> to convert.</param>
        public static AddressDTO ToDTO(this Address entity)
        {
            if (entity == null) return null;

            var dto = new AddressDTO();

            dto.AddressID = entity.AddressID;
            dto.Title = entity.Title;
            dto.Line1 = entity.Line1;
            dto.Line2 = entity.Line2;
            dto.Line3 = entity.Line3;
            dto.City = entity.City;
            dto.State = entity.State;
            dto.ZipCode = entity.ZipCode;
            dto.CountryID = entity.CountryID;
            dto.AddressTypeID = entity.AddressTypeID;

            entity.OnDTO(dto);

            return dto;
        }
Ejemplo n.º 9
0
        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 AddressDataModel ToDataModel(AddressDTO dto)
        {

            AddressDataModel datamodel = new AddressDataModel();

            if (dto != null)
            {
                datamodel.AddressID = dto.AddressID;
                datamodel.Title = dto.Title;
                datamodel.Line1 = dto.Line1;
                datamodel.Line2 = dto.Line2;
                datamodel.Line3 = dto.Line3;
                datamodel.City = dto.City;
                datamodel.State = dto.State;
                datamodel.ZipCode = dto.ZipCode;
                datamodel.AddressTypeID = dto.AddressTypeID;
            }
            if (dto.Country != null)
            {
                CountryDTO countrydto = dto.Country;
                datamodel.CountryID = countrydto.CountryID;
                datamodel.AddressCountryAbbreviation = countrydto.Abbreviation;
                datamodel.AddressCountryCode = countrydto.Code;
                datamodel.AddressCountryName = countrydto.Name;
                datamodel.AddressCountryPhoneCode = countrydto.PhoneCode;
            }

            if (dto.TypeCode != null)
            {
                TypeCodeDTO typecodedto = dto.TypeCode;
                datamodel.AddressTypeID = typecodedto.TypeCodeID;
                datamodel.AddressTypeCode = typecodedto.Code;
                datamodel.AddressTypeCodeClassTypeID = typecodedto.ClassTypeID;
                datamodel.AddressTypeCodeDescription = typecodedto.Description;
                datamodel.AddressTypeCodeName = typecodedto.Name;
                datamodel.AddressTypeCodeParentTypeCodeID = typecodedto.ParentTypeCodeID;
            }

            return datamodel;
        }
Ejemplo n.º 11
0
 /// <summary>
 /// Invoked when <see cref="ToDTO"/> operation is about to return.
 /// </summary>
 /// <param name="dto"><see cref="AddressDTO"/> converted from <see cref="Address"/>.</param>
 static partial void OnDTO(this Address entity, AddressDTO dto);
        public static AddressDTO ToAddressDTO(UserDataModel datamodel)
        {
            AddressDTO dto = new AddressDTO();
            if (datamodel != null)
            {
                dto.AddressID = datamodel.UserAddressID;
                dto.AddressTypeID = datamodel.UserAddressAddressTypeID;
                dto.City = datamodel.UserAddressCity;
                dto.CountryID = datamodel.UserAddressCountryID;
                dto.Line1 = datamodel.UserAddressLine1;
                dto.Line2 = datamodel.UserAddressLine2;
                dto.Line3 = datamodel.UserAddressLine3;
                dto.State = datamodel.UserAddressState;
                dto.Title = datamodel.UserAddressTitle;
                dto.ZipCode = datamodel.UserAddressZipCode;
            }

            return dto;
        }
Ejemplo n.º 13
0
        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;
        }
Ejemplo n.º 14
0
 /// <summary>
 /// Invoked when <see cref="ToDTO"/> operation is about to return.
 /// </summary>
 /// <param name="dto"><see cref="AddressDTO"/> converted from <see cref="Address"/>.</param>
 static partial void OnDTO(this Address entity, AddressDTO dto) {
     if (entity!= null && entity.TypeCode != null) {
         dto.TypeCode = TypeCodeAssembler.ToDTO(entity.TypeCode);
         dto.Country = CountryAssembler.ToDTO(entity.Country);
     }
 }
        public static AddressDTO ToAddressDTO(BussinessDataModel model)
        {

            AddressDTO dto = new AddressDTO();
            if (model != null)
            {
                dto.AddressTypeID = model.BusinessAddressAddressTypeID;
                dto.City = model.BusinessAddressCity;
                dto.CountryID = model.BusinessAddressCountryID;
                dto.AddressID = model.BusinessAddressID;
                dto.Line1 = model.BusinessAddressLine1;
                dto.Line2 = model.BusinessAddressLine2;
                dto.Line3 = model.BusinessAddressLine3;
                dto.State = model.BusinessAddressState;

                dto.Title = model.BusinessAddressTitle;
                dto.ZipCode = model.BusinessAddressZipCode;
            }

            return dto;
        }
Ejemplo n.º 16
0
 public AddressDataModel GetAddress(AddressDTO dto) {
     return AddressDataModelAssembler.ToDataModel(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;
        }