public void UpdateUser() { if (!Users.Exists(this.API.SpeItems[5, 1])) { this.API.FoundErr = true; this.API.ErrMsg = "查询的用户不存在"; } else { this.API.PrepareData(true); if ((this.API.SpeItems[7, 1] != string.Empty) && !Regex.IsMatch(this.API.SpeItems[7, 1], @"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*")) { this.API.FoundErr = true; this.API.ErrMsg = "请输入正确的Email"; } else { UserInfo usersByUserName = Users.GetUsersByUserName(this.API.SpeItems[5, 1]); if (!string.IsNullOrEmpty(this.API.SpeItems[6, 1])) { usersByUserName.UserPassword = StringHelper.MD5(this.API.SpeItems[6, 1].ToLower()); } if (!string.IsNullOrEmpty(this.API.SpeItems[9, 1])) { usersByUserName.Answer = StringHelper.MD5(this.API.SpeItems[9, 1]); } if (!string.IsNullOrEmpty(this.API.SpeItems[8, 1])) { usersByUserName.Question = this.API.SpeItems[8, 1]; } if (!string.IsNullOrEmpty(this.API.SpeItems[0x1c, 1])) { usersByUserName.Status = (UserStatus)Enum.Parse(typeof(UserStatus), ApiData.ExchangStatus(this.API.SpeItems[0x1c, 1]).ToString()); } if (!string.IsNullOrEmpty(this.API.SpeItems[7, 1])) { usersByUserName.Email = this.API.SpeItems[7, 1]; } if (!string.IsNullOrEmpty(this.API.SpeItems[11, 1])) { usersByUserName.UserTrueName = this.API.SpeItems[11, 1]; } if (!string.IsNullOrEmpty(this.API.SpeItems[12, 1])) { usersByUserName.Sex = (UserSexType)Enum.Parse(typeof(UserSexType), ApiData.ExchangeGender(this.API.SpeItems[12, 1]).ToString()); } ContacterInfo contacterByUserName = Contacter.GetContacterByUserName(usersByUserName.UserName); if (!string.IsNullOrEmpty(this.API.SpeItems[11, 1])) { contacterByUserName.TrueName = usersByUserName.UserTrueName; } if (!string.IsNullOrEmpty(this.API.SpeItems[12, 1])) { contacterByUserName.Sex = usersByUserName.Sex; } if (!string.IsNullOrEmpty(this.API.SpeItems[7, 1])) { contacterByUserName.Email = usersByUserName.Email; } if (!string.IsNullOrEmpty(this.API.SpeItems[0x13, 1])) { contacterByUserName.ZipCode = this.API.SpeItems[0x13, 1]; } if (!string.IsNullOrEmpty(this.API.SpeItems[14, 1])) { contacterByUserName.QQ = this.API.SpeItems[14, 1]; } if (!string.IsNullOrEmpty(this.API.SpeItems[0x10, 1])) { contacterByUserName.Mobile = this.API.SpeItems[0x10, 1]; } if (!string.IsNullOrEmpty(this.API.SpeItems[15, 1])) { contacterByUserName.Msn = this.API.SpeItems[15, 1]; } if (!string.IsNullOrEmpty(this.API.SpeItems[20, 1])) { contacterByUserName.Homepage = this.API.SpeItems[20, 1]; } if (!string.IsNullOrEmpty(this.API.SpeItems[13, 1])) { contacterByUserName.Birthday = string.IsNullOrEmpty(this.API.SpeItems[13, 1]) ? null : new DateTime?(Convert.ToDateTime(this.API.SpeItems[13, 1])); } if (!string.IsNullOrEmpty(this.API.SpeItems[0x11, 1])) { contacterByUserName.OfficePhone = this.API.SpeItems[0x11, 1]; } if (!string.IsNullOrEmpty(this.API.SpeItems[0x12, 1])) { contacterByUserName.Address = this.API.SpeItems[0x12, 1]; } if (!Users.Update(usersByUserName, contacterByUserName)) { this.API.FoundErr = true; this.API.ErrMsg = "修改会员信息失败!!"; } } } }