Exemplo n.º 1
0
        public void SignIn(SignInModel user)
        {
            SignInModule module = new SignInModule();

            m_user = module.GetUserBySignID(user);
            if (m_user == null)
            {
                throw new Exception("請輸入正確帳號或密碼");
            }
            if (m_user.UserAccount == "manager")
            {
                m_user.Role = UserRoleEnum.SUPERADMIN;
            }
            else if (m_user.UserAccount == "admin")
            {
                m_user.Role = UserRoleEnum.ADMIN;
            }
            else
            {
                m_user.Role = UserRoleEnum.USER;
            }
            Context.Session["UserInfo"] = m_user;
            //寫入登入紀錄
            //string ip = System.Web.HttpContext.Current.Request.UserHostAddress;
            //IpHistoryModule ipMdu = new IpHistoryModule();
            //ipMdu.WriteIp(ip, "manager");
            //ipMdu.Dispose();
        }
Exemplo n.º 2
0
        public void SignIn(SignInModel user)
        {
            SignInModule module = new SignInModule();

            m_user = module.GetUserBySignID(user);
            if (m_user == null)
            {
                throw new Exception("請輸入正確帳號或密碼");
            }
            if (m_user.UserAccountName == "manager")
            {
                m_user.Role = UserRoleEnum.ADMIN;
            }
            else
            {
                m_user.Role = UserRoleEnum.USER;
            }
            Context.Session["UserInfo"] = m_user;
        }