using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Mall.Member
{
    public partial class Member_Login : System.Web.UI.Page
    {
        public string r_code = string.Empty;
        protected void Page_Load(object sender, EventArgs e)
        {

            MODEL.MMember model_member = new MODEL.MMember();
            Random rad = new Random();
             r_code = rad.Next(1000, 9999).ToString();
            //TempData["member_Login_r_code"] = r_code;
            if (Request["email"] != null)
            {
                model_member.UserName = Request["email"] == null ? "" : Request["email"].ToString();
                model_member.UserPwd = Request["pwd"] == null ? "" : Request["pwd"].ToString();
                //BMember bll_member = new BMember();
                BLL.Models.MemberModels models_member = new BLL.Models.MemberModels();
                if (models_member.CheckUser(model_member))
                {//bll_member.CheckUser(model_member.Email,model_member.UserPwd,"")){

                    Response.Cookies["MemberName"].Value = model_member.UserName;
                    Session["MemberName"] = model_member.UserName;
                    Response.Redirect("/default.aspx");
                    //return RedirectToAction("index", "index");


                }
                else
                {

                    //TempData["show_message"] = "用户名或密码错误，系统5秒钟后会自动返回登陆页面。";
                    //TempData["msg_script"] = " location.href='/Member/Member_Login'; ";
                    //TempData["msg_back"] = "location.href='/Member/Member_Login'; ";
                    Response.Redirect("/default.aspx");
                    //return RedirectToAction("ShowMessage", "Index");
                }

            }
            else
            {

               // return View();

            }
        }
    }
}