protected void BtnDelete_Click1(object sender, EventArgs e)
 {
     string deleteID = TextBox2.Text.Trim().ToString();
     PetCare.BLL.User user = new User();
     user.DeleteUserInfo(deleteID);
     LoadUser();
 }
Exemple #2
0
        protected void BtnLogin_Click(object sender, EventArgs e)
        {
            string userName = tbUserName.Text.Trim().ToString();
            string userPass = tbPassword.Text.Trim().ToString();
            User user = new User();
            int validateStatus = user.ValidateUserLogin(userName, userPass);
            if (validateStatus > 0)
            {

                if (isUserSession)
                {
                    System.Web.HttpContext.Current.Session["UserName"] = userName;
                    Response.Redirect("ManagementIndex.aspx");
                }
                else
                {
                    System.Web.HttpContext.Current.Response.Cookies["UserName"].Value = null;
                    Response.Write("<script>alert('登录成功!')</script>");
                }
            }
            else
            {

                if (isUserSession)
                {
                    System.Web.HttpContext.Current.Session["UserName"] = null;
                    Response.Write("<script>alert('登录失败!')</script>");
                }
                else
                {
                    System.Web.HttpContext.Current.Response.Cookies["UserName"].Value = null;
                    Response.Write("<script>alert('登录失败!')</script>");
                }
            }
        }
 private void LoadUser()
 {
     User user = new User();
     List<CTUserInfo> list = new List<CTUserInfo>();
     list = user.GetAllUserList();
     DropDownList2.DataSource = list;
     DropDownList2.DataTextField = "UserName";
     DropDownList2.DataValueField = "UserID";
     DropDownList2.DataBind();
 }
 private void LoadUser()
 {
     List<CTUserInfo> userList = new List<CTUserInfo>();
     User user = new User();
     userList = user.GetAllUserList();
     ddlUser.DataSource = userList;
     ddlUser.DataTextField = "UserName";
     ddlUser.DataValueField = "UserID";
     ddlUser.DataBind();
 }
        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>");
            }
        }
 private void LoadUser()
 {
     List<CTUserInfo> userList = new List<CTUserInfo>();
     PetCare.BLL.User user = new User();
     userList = user.GetAllUserList();
     GridViewUsers.DataSource = userList;
     GridViewUsers.DataKeyNames =new string[]{ "UserID"};
     GridViewUsers.DataBind();
 }
        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();
        }
 protected void BtnSearch_Click(object sender, EventArgs e)
 {
     string userID = TextBox1.Text.Trim().ToString();
     List<CTUserInfo> userList = new List<CTUserInfo>();
     PetCare.BLL.User user = new User();
     userList = user.GetUserInfoByUserID(userID);
     GridViewUsers.DataSource = userList;
     GridViewUsers.DataBind();
 }