/// <summary>
        /// 方法:添加用户操作
        /// </summary>
        /// <param name="cus">操作对象</param>
        /// <returns>返回受影响行数</returns>
        public int InsterRegist(Model.CustomerMusic cus)
        {
            //if (!new Rule.Testexist().TestInsert(cus.Phone))
            //    return -3;

            return(new DAL.CustomerDaL().InsterRegist(cus));
        }
Beispiel #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["Logins"] != null)
     {
         Model.CustomerMusic xw = (Model.CustomerMusic)Session["Logins"];
         name.Text       = xw.UserName;
         phone.Text      = "登录账户:" + xw.Phone;
         email.Text      = "电子邮箱:" + xw.Email;
         last.Text       = "最近登录:" + xw.LastLoginTime;
         Image1.ImageUrl = "../images/gradeimg/" + xw.RankName + ".jpg";
     }
     else
     {
         Response.Redirect("login.aspx");
     }
 }
    protected void BtnRegister_Click(object sender, EventArgs e)
    {
        Model.CustomerMusic cus = new Model.CustomerMusic();
        cus.UserName = username.Text;
        cus.UserPwd  = Dbhelper.Encryption(Pwd.Text);
        cus.Phone    = phone.Text;
        cus.Email    = E_mail.Text;
        cus.Birthday = Birth.Text;

        if (radSex.Checked == true)
        {
            cus.Sex = "男";
        }
        else if (radSex.Checked == false)
        {
            cus.Sex = "女";
        }

        int count = new BLL.CustomerBLL().InsterRegist(cus);

        switch (count)
        {
        case -3:
            Showerror.Text = "用户已经存在!";
            break;

        case -2:
            Showerror.Text = "数据库连接失败!";
            break;

        case -1:
            Showerror.Text = "数据操作失败!";
            break;

        case 0:
            Showerror.Text = "注册失败,检查数据!";
            break;

        default:
            Response.Write("注册成功");
            Response.Redirect("login.aspx");
            break;
        }
    }
    protected void Btnlogin_Click(object sender, EventArgs e)
    {
        string phone = txtLongin.Text;
        string pwd   = txtpwd.Text;

        Model.CustomerMusic cs = new Model.CustomerMusic();
        cs = new BLL.CustomerBLL().SelectLogin(phone, pwd);
        if (cs.Phone == "0")
        {
            loginerror.Text = cs.UserPwd;
        }
        else
        {
            loginerror.Text   = "登录成功!";
            Session["Logins"] = cs;
            int xw = new BLL.CustomerBLL().UpdateCustomerID(cs.ID);
            Response.Redirect("Mymusic.aspx");
        }
    }