Beispiel #1
0
 public string getUserlogoURL(object id)
 {
     string URL;
     UserBLL usbll = new UserBLL();
     int userid = (Int32)id;
     User u = new User();
     u = usbll.findUserByUserId(userid);
        if ( u.sex.Trim()=="男")
     {
        URL = "upload/logoimg/logoimgdf1.png";
     }
        else
        {
        URL = "upload/logoimg/logoimgdf2.png";
        }
     return URL;
 }
Beispiel #2
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            //验证登陆
            string txtName = txtUserName.Text;
            string txtPwd = txtUserPwd.Text;
            if (txtName == null || txtName.Trim().Equals(""))
            {
                labInfo.Text = "友情提示:用户名不能为空";
                return;
            }
            if (txtPwd == null || txtPwd.Trim().Length < 6)
            {
                labInfo.Text = "友情提示:密码长度不能小于6位";
                return;
            }

            UserBLL userbll = new UserBLL();
            User u = userbll.Login(txtName, txtPwd);

            if (u == null)
            {
                labInfo.Text = "友情提示:用户名或密码错误";
            }
            else
            {
                //Loginmark
                LoginMarksBLL lmb = new LoginMarksBLL();
                LoginMarks lm = new LoginMarks();
                lm.userId = u.userId;
                lm.userName = u.userName;
                lm.loginTime = DateTime.Now;
                if (lmb.save(lm))
                {
                    Session["user"] = u;
                     Response.Redirect("MainForm.aspx");
                }

            }
        }
Beispiel #3
0
        protected void btnRegister_Click(object sender, EventArgs e)
        {
            //验证登陆
            string txtuserName = userName.Text;
            string txtPwd = pwd.Value;
            string txtemail = email.Value;
            string txtpwords = pwords.Value;
            string txtsex = "";
            bool flag = true;
            if (txtuserName == null || txtuserName.Trim().Equals("") || txtPwd.Trim().Length < 6 || txtPwd.Trim().Length >40)
            {
                flag = false;
                labInfo.Text = "友情提示:用户名输入不正确";
                return;
            }
            if (txtPwd == null || txtPwd.Trim().Length < 6 || txtPwd.Trim().Length >12)
            {
                flag = false;
                labInfo.Text = "友情提示:密码输入不正确";
                return;
            }
            if (!(txtPwd==pwd2.Value))
            {
                flag = false;
                labInfo.Text = "友情提示:二次密码输入不正确";
                return;
            }
            if (txtemail == null ||  txtuserName.Trim().Equals(""))
            {
                flag = false;
                labInfo.Text = "友情提示:email输入不正确";
                return;
            }
            if (radsexNv.Checked == true)
            {
                txtsex = "女";
            }
            if (radsexNan.Checked == true)
            {
                txtsex = "男";
            }
            if (txtsex=="")
            {
                flag = false;
                labInfo.Text = "友情提示:请选择性别";
            }
            if (!radRead.Checked==true)
            {
                flag = false;
                labInfo.Text = "友情提示:请阅读淮师校园微博规范";
            }
            if ( flag)
            {
                //插入一个user,返回登录页面
                userbll = new UserBLL();
                User u = new User();
                u.userName = txtuserName;
                u.pwd = txtPwd;
                u.email = txtemail;
                u.sex = txtsex;
                u.personalwords = txtpwords;
                if (userbll.save(u))
                {
                    Response.Redirect("RegisterSuccess.html");
                }

            }
        }