protected void BtnEdit_Click1(object sender, EventArgs e) { for (int i = 0; i <= GridViewUsers.Rows.Count - 1; i++) { CheckBox cbox = (CheckBox)GridViewUsers.Rows[i].FindControl("CheckBoxs"); if (cbox.Checked == true) { string userID = GridViewUsers.DataKeys[i].Value.ToString(); User user = new User(); CTUserInfo userinfo = new CTUserInfo(); userinfo = user.GetUserInfoByUserID(userID).First(); //tbUserId.Text = userID; //string userName = GridViewUsers.Rows[i].Cells[2].Text.ToString(); //tbUserName.Text = userName; //string UserRealName = GridViewUsers.Rows[i].Cells[3].Text.ToString(); //tbUserRealName.Text = UserRealName; //string userage = GridViewUsers.Rows[i].Cells[4].Text.ToString(); //tbUserAge.Text = userage; //string usersex = GridViewUsers.Rows[i].Cells[5].Text.ToString(); //tbUserSex.Text = usersex; //string userAddress = GridViewUsers.Rows[i].Cells[6].Text.ToString(); //tbUserAddress.Text = userAddress; //string userEmail = GridViewUsers.Rows[i].Cells[7].Text.ToString(); //tbUserEmail.Text = userEmail; tbUserId.Text = userID; tbUserName.Text = userinfo.UserName; tbUserRealName.Text = userinfo.UserRealName; tbUserAge.Text = userinfo.UserAge.ToString(); tbUserSex.Text = userinfo.UserSex; tbUserAddress.Text =userinfo.UserAddress; tbUserEmail.Text = userinfo.UserEmail; tbUserWeiBo.Text = userinfo.UserWeiBo; tbUserQQNumber.Text = userinfo.UserQQNum; tbUserLevel.Text = userinfo.UserLevel; tbUserUserInfo.Text = userinfo.UserInfo; tbUserComplaintNumber.Text = userinfo.ComplainNum.ToString(); tbPortrait.Text = userinfo.Portrait; tbRoldID.Text = userinfo.RoldID; tbLastLoginTime.Text = userinfo.LastLoginTime; tbLoginTimes.Text = userinfo.LoginTimes.ToString(); tbModifyTime.Text = userinfo.ModifyTime; tbCreateTime.Text = userinfo.CreateTime; tbIsUsed.Text = userinfo.IsUsed.ToString(); } } }
protected void BtnRegister_Click(object sender, EventArgs e) { string username = tb_UserName.Text.Trim().ToString(); string pass = tb_Pass.Text.Trim().ToString(); string passConfirm = tb_PassConfirm.Text.Trim().ToString(); string email = tb_Email.Text.Trim().ToString(); int age = int.Parse(tb_Age.Text.Trim().ToString()); User user = new User(); CTUserInfo userInfo = new CTUserInfo(username, pass,"","", age, "", email, "", "", "", "", 0); int insertStatus= user.InsertUserInfo(userInfo); if (insertStatus == 1) { //CUtilities.SendMail("petcareweb", "*****@*****.**", "aaa", "aaa"); Response.Write("<script>alert('注册成功!')</script>"); } else { Response.Write("<script>alert('注册失败!')</script>"); } }
//插入用户信息 public int InsertUserInfo(CTUserInfo userinfo) { return dal.InsertUser(userinfo); }
protected void Btn_Click(object sender, EventArgs e) { string name = tbUserName.Text.Trim().ToString(); string address = tbUserAddress.Text.Trim().ToString(); string email = tbUserEmail.Text.Trim().ToString(); int age = int.Parse(tbUserAge.Text.Trim().ToString()); string realname = tbUserRealName.Text.Trim().ToString(); string sex = tbUserSex.Text.Trim().ToString(); int complaintNumb = int.Parse(tbUserComplaintNumber.Text.Trim().ToString()); string qqNumb = tbUserQQNumber.Text.Trim().ToString(); string phoneNumb = tbUserPhoneNumber.Text.Trim().ToString(); string userInfo = tbUserUserInfo.Text.Trim().ToString(); CTUserInfo userinfo = new CTUserInfo(); userinfo.UserName = name; userinfo.UserAddress = address; userinfo.UserEmail = email; userinfo.UserAge = age; userinfo.UserPass = ""; userinfo.UserRealName = realname; userinfo.UserSex = sex; userinfo.ComplainNum = complaintNumb; userinfo.UserQQNum = qqNumb; userinfo.UserInfo = userInfo; userinfo.UserPhoneNumber = phoneNumb; PetCare.BLL.User user = new User(); int insertStatus= user.InsertUserInfo(userinfo); if (insertStatus > 0) { } LoadUser(); }
//编辑用户信息 public int EditUserInfo(string UserID, CTUserInfo userInfo) { return dal.EditUserInfo(UserID,userInfo); }