Exemple #1
0
        public ActionResult ValidLoginProcess(Models.LoginInfo li)
        {
            if (li.Phone == null)
            {
                return(RedirectToAction("Index", new { msg = "請輸入手機號碼" }));
            }
            if (li.PW == null)
            {
                return(RedirectToAction("Index", new { msg = "請輸入密碼" }));
            }

            DB.DB        mydb = new DB.DB();
            DB.ICustomer ic   = new DB.Impl_Customer(mydb.Connection);

            if (ic.CheckLogin(li.Phone, li.PW))
            {
                Session.Add("Login", li.Phone);
                Session.Add("LoginType", "c");

                // 取出User原先瀏覽的網頁
                HttpCookie hc = Request.Cookies["ReUrl"];
                if (hc == null)
                {
                    return(RedirectToAction("Index", "Home"));
                }
                else
                {
                    return(Redirect(hc.Value));
                }
            }
            else
            {
                return(RedirectToAction("Index", new { msg = "登入失敗!手機號碼或密碼有誤!" }));
            }
        }
 public bool CheckLI(string phone, string pw)
 {
     DB.DB        mydb = new DB.DB();
     DB.ICustomer ic   = new DB.Impl_Customer(mydb.Connection);
     return(ic.CheckLogin(phone, pw));
 }