コード例 #1
0
ファイル: User.cs プロジェクト: Allen-Zhou/AF
 public virtual UserDTO ReturnUserDTO()
 {
     UserDTO user = new UserDTO();
     user.ID = Guid.NewGuid();
     user.Code = "XT-001";
     user.Address = "SuiZ";
     user.Amount = decimal.Parse("121.00");
     user.Birthday = DateTime.Now;
     user.CreatedBy = "DS";
     user.CreatedOn = DateTime.Now;
     user.Disabled = false;
     user.Gender = true;
     user.Names = "ZS";
     user.NativePlace = "han";
     user.PostCode = "441309";
     user.Price = decimal.Parse("12.10");
     user.Quantity = decimal.Parse("10.00");
     user.SumTotal = 10;
     user.SysVersion = 1;
     user.Telphone = "131589461";
     user.UpdatedBy = "ZL";
     user.UpdatedOn = DateTime.Now;
     user.UserAddress = "UserSuiz";
     user.UserAmount = decimal.Parse("225.00");
     user.UserBirthday = DateTime.Now;
     user.UserCode = "UserXT-001";
     user.UserCreateBy = "UserDS";
     user.UserCreateOn = DateTime.Now;
     user.UserDisabled = true;
     user.UserGender = false;
     user.UserID = Guid.NewGuid(); ;
     user.UserName = "******";
     user.UserNativePlace = "Userhan";
     user.UserPostCode = "User441309";
     user.UserPrice = decimal.Parse("1.50");
     user.UserQuantity = decimal.Parse("150.00");
     user.UserSumTotal = 12;
     user.UserTelphone = "User131589461";
     user.UserUpdateBy = "UserZL";
     user.UserUpdateOn = DateTime.Now;
     return user;
 }
コード例 #2
0
ファイル: User.cs プロジェクト: Allen-Zhou/AF
        public virtual User TransitiontoBE(UserDTO dto)
        {
            Mapper.CreateMap<UserDTO, User>();

            User be = (User)Mapper.Map<UserDTO, User>(dto);

            return be;
        }
コード例 #3
0
ファイル: User.cs プロジェクト: Allen-Zhou/AF
 public virtual User ToBE(UserDTO dto)
 {
     User be = DTOConvert.ToBE<User>(dto);
     return be;
 }
コード例 #4
0
ファイル: UserDTO.cs プロジェクト: Allen-Zhou/AF
        public virtual UserDTO ToDTO(User user)
        {
            UserDTO dto = new UserDTO();

            dto.ID = user.ID;
            dto.Code = user.Code;
            dto.Address = user.Address;
            dto.Amount = user.Amount;
            dto.Birthday = user.Birthday;
            dto.CreatedBy = user.CreatedBy;
            dto.CreatedOn = user.CreatedOn;
            dto.Disabled = user.Disabled;
            dto.Gender = user.Gender;
            dto.Names = user.Names;
            dto.NativePlace = user.NativePlace;
            dto.PostCode = user.PostCode;
            dto.Price = user.Price;
            dto.Quantity = user.Quantity;
            dto.SumTotal = user.SumTotal;
            dto.SysVersion = user.SysVersion;
            dto.Telphone = user.Telphone;
            dto.UpdatedBy = user.UpdatedBy;
            dto.UpdatedOn = user.UpdatedOn;
            dto.UserAddress = user.UserAddress;
            dto.UserAmount = user.UserAmount;
            dto.UserBirthday = user.UserBirthday;
            dto.UserCode = user.UserCode;
            dto.UserCreateBy = user.UserCreateBy;
            dto.UserCreateOn = user.UserCreateOn;
            dto.UserDisabled = user.UserDisabled;
            dto.UserGender = user.UserGender;
            dto.UserID = user.UserID;
            dto.UserName = user.UserName;
            dto.UserNativePlace = user.UserNativePlace;
            dto.UserPostCode = user.UserPostCode;
            dto.UserPrice = user.UserPrice;
            dto.UserQuantity = user.UserQuantity;
            dto.UserSumTotal = user.UserSumTotal;
            dto.UserTelphone = user.UserTelphone;
            dto.UserUpdateBy = user.UserUpdateBy;
            dto.UserUpdateOn = user.UserUpdateOn;
            return dto;
        }
コード例 #5
0
ファイル: UserDTO.cs プロジェクト: Allen-Zhou/AF
        public virtual User ToBE(UserDTO dto)
        {
            User user = new User();

            user.ID = dto.ID;
            user.Code = dto.Code;
            user.Address = dto.Address;
            user.Amount = dto.Amount;
            user.Birthday = dto.Birthday;
            user.CreatedBy = dto.CreatedBy;
            user.CreatedOn = dto.CreatedOn;
            user.Disabled = dto.Disabled;
            user.Gender = dto.Gender;
            user.Names = dto.Names;
            user.NativePlace = dto.NativePlace;
            user.PostCode = dto.PostCode;
            user.Price = dto.Price;
            user.Quantity = dto.Quantity;
            user.SumTotal = dto.SumTotal;
            user.SysVersion = dto.SysVersion;
            user.Telphone = dto.Telphone;
            user.UpdatedBy = dto.UpdatedBy;
            user.UpdatedOn = dto.UpdatedOn;
            user.UserAddress = dto.UserAddress;
            user.UserAmount = dto.UserAmount;
            user.UserBirthday = dto.UserBirthday;
            user.UserCode = dto.UserCode;
            user.UserCreateBy = dto.UserCreateBy;
            user.UserCreateOn = dto.UserCreateOn;
            user.UserDisabled = dto.UserDisabled;
            user.UserGender = dto.UserGender;
            user.UserID = dto.UserID;
            user.UserName = dto.UserName;
            user.UserNativePlace = dto.UserNativePlace;
            user.UserPostCode = dto.UserPostCode;
            user.UserPrice = dto.UserPrice;
            user.UserQuantity = dto.UserQuantity;
            user.UserSumTotal = dto.UserSumTotal;
            user.UserTelphone = dto.UserTelphone;
            user.UserUpdateBy = dto.UserUpdateBy;
            user.UserUpdateOn = dto.UserUpdateOn;
            return user;
        }
コード例 #6
0
ファイル: UserTest.cs プロジェクト: Allen-Zhou/AF
 /// <summary>
 /// 转换多次TODTO通过一一赋值
 /// </summary>
 private void BatchDTOToDTOFromUserDTO()
 {
     for (int i = 0; i < ITERATION; i++)
     {
         User user = new User();
         User be = user.ReturnUser();
         UserDTO userDTO = new UserDTO();
         UserDTO dto = userDTO.ToDTO(be);
     }
 }