//修改资料 protected void SubmitButton_Click(object sender, EventArgs e) { string userNickName = this.UserNickName.Text.Trim(); this.Label3.Text = ""; string userEmail = this.UserEmail.Text.Trim(); if (userEmail != "") { if (!ValidHelper.CheckEmail(userEmail)) { this.Label3.Text = "邮箱格式填写错误!"; return; } } string userPhone = this.UserPhone.Text.Trim(); if (userPhone != "") { if (!ValidHelper.CheckPhone(userPhone)) { this.Label6.Text = "手机号码填写错误!"; return; } } string userWorkDay = this.UserWorkDay.SelectedValue; string categoryRate = this.CategoryRate.Text.Trim(); if (!ValidHelper.CheckDouble(categoryRate)) { Utility.Alert(this, "预算率填写错误!"); return; } UserEntity user = UserAccess.GetUserById(userId); user.UserNickName = userNickName; user.UserEmail = userEmail; user.UserPhone = userPhone; user.UserWorkDay = userWorkDay; user.CategoryRate = Double.Parse(categoryRate); user.Synchronize = 1; bool success = UserAccess.UpdateUser(user); if (success) { Session["UserNickName"] = user.UserNickName; Session["UserWorkDay"] = user.UserWorkDay; Session["CategoryRate"] = user.CategoryRate; Utility.Alert(this, "修改成功。", "UserAdmin.aspx"); } else { Utility.Alert(this, "修改失败!"); } }
//修改资料 protected void SubmitButton_Click(object sender, EventArgs e) { string userNickName = this.UserNickName.Text.Trim(); string userEmail = this.UserEmail.Text.Trim(); string userPhone = this.UserPhone.Text.Trim(); string userWorkDay = this.UserWorkDay.SelectedValue; string categoryRate = this.CategoryRate.Text.Trim(); this.Label3.Text = ""; if (userEmail != "") { if (!ValidHelper.CheckEmail(userEmail)) { this.Label3.Text = "邮箱格式填写错误!"; return; } } if (userPhone != "") { if (!ValidHelper.CheckPhone(userPhone)) { this.Label6.Text = "手机号码填写错误!"; return; } } if (!ValidHelper.CheckNumber(categoryRate)) { Utility.Alert(this, "预算率填写错误!"); return; } int rateValue = Convert.ToInt32(categoryRate); if (rateValue > 100) { Utility.Alert(this, "预算率不能大于100!"); return; } user.UserNickName = userNickName; user.UserEmail = userEmail; user.UserPhone = userPhone; user.UserWorkDay = userWorkDay; user.CategoryRate = rateValue; user.Synchronize = 1; user.ModifyDate = DateTime.Now; bool success = bll.UpdateUser(user); if (success) { Session["UserNickName"] = user.UserNickName; Session["UserWorkDay"] = user.UserWorkDay; Session["CategoryRate"] = user.CategoryRate; Utility.Alert(this, "修改成功。", "UserAdmin.aspx#info"); } else { Utility.Alert(this, "修改失败!"); } }