using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Models;
using LoveBLL;

namespace LoveWeb.Login
{
    public partial class register : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnRegister_Click(object sender, EventArgs e)
        {
            User user = new User();
            user.Username = txtRegiName.Text.Trim();
            user.Pwd = txtRegiPwd.Text.Trim();
            user.Lim = 2;
            user.Userimage = "~/images/userimage/" + FileUpload1.FileName;
            if (!UserManager.UserRegister(user))
            {
                Response.Write("<script>alert('用户名已被使用，请重新输入');this.location.href='register.aspx'</script>");
            }
            else
            {
                Response.Write("<script>alert('注册成功！为您跳转至登录页面..');this.location.href='login.aspx'</script>");
            }
        }
    }
}
