protected void btnAdd_Click(object sender, EventArgs e) { string strErr = ""; if (this.txtUserName.Text == "") { strErr += "UserName不能为空!\\n"; } if (this.txtUserEmail.Text == "") { strErr += "UserEmail不能为空!\\n"; } if (this.txtPassword.Text == "") { strErr += "Password不能为空!\\n"; } if (!PageValidate.IsDateTime(txtLastLoginTime.Text)) { strErr += "LastLoginTime不是时间格式!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } string UserName = this.txtUserName.Text; string UserEmail = this.txtUserEmail.Text; string Password = this.txtPassword.Text; DateTime LastLoginTime = DateTime.Parse(this.txtLastLoginTime.Text); NoName.NetShop.Model.UserModel model = new NoName.NetShop.Model.UserModel(); model.UserName = UserName; model.UserEmail = UserEmail; model.Password = Password; model.LastLoginTime = LastLoginTime; NoName.NetShop.BLL.UserModelBll bll = new NoName.NetShop.BLL.UserModelBll(); bll.Update(model); }
protected void btnAdd_Click(object sender, EventArgs e) { string strErr=""; if(this.txtUserName.Text =="") { strErr+="UserName����Ϊ�գ�\\n"; } if(this.txtUserEmail.Text =="") { strErr+="UserEmail����Ϊ�գ�\\n"; } if(this.txtPassword.Text =="") { strErr+="Password����Ϊ�գ�\\n"; } if(!PageValidate.IsDateTime(txtLastLoginTime.Text)) { strErr+="LastLoginTime����ʱ���ʽ��\\n"; } if(strErr!="") { MessageBox.Show(this,strErr); return; } string UserName=this.txtUserName.Text; string UserEmail=this.txtUserEmail.Text; string Password=this.txtPassword.Text; DateTime LastLoginTime=DateTime.Parse(this.txtLastLoginTime.Text); NoName.NetShop.Model.UserModel model=new NoName.NetShop.Model.UserModel(); model.UserName=UserName; model.UserEmail=UserEmail; model.Password=Password; model.LastLoginTime=LastLoginTime; NoName.NetShop.BLL.UserModelBll bll=new NoName.NetShop.BLL.UserModelBll(); bll.Update(model); }