private void ShowInfo(int UserID) { UFB.BLL.UsersManager bll = new UFB.BLL.UsersManager(); UFB.Model.Users model = bll.GetModel(UserID); this.lblUserID.Text = model.UserID.ToString(); this.lbluserName.Text = model.userName; this.lblpassword.Text = model.password; this.lblgender.Text = model.gender; this.lblbirthDate.Text = model.birthDate.ToString(); }
public void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (this.txtuserName.Text.Trim().Length == 0) { strErr += "userName不能为空!\\n"; } if (this.txtpassword.Text.Trim().Length == 0) { strErr += "password不能为空!\\n"; } if (this.txtgender.Text.Trim().Length == 0) { strErr += "gender不能为空!\\n"; } if (!PageValidate.IsDateTime(txtbirthDate.Text)) { strErr += "birthDate格式错误!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int UserID = int.Parse(this.lblUserID.Text); string userName = this.txtuserName.Text; string password = this.txtpassword.Text; string gender = this.txtgender.Text; DateTime birthDate = DateTime.Parse(this.txtbirthDate.Text); UFB.Model.Users model = new UFB.Model.Users(); model.UserID = UserID; model.userName = userName; model.password = password; model.gender = gender; model.birthDate = birthDate; UFB.BLL.UsersManager bll = new UFB.BLL.UsersManager(); bll.Update(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx"); }