예제 #1
0
        public ActionResult Rest()
        {
            string method = CECRequest.GetQueryString("method").ToLower();

            #region == 获得Cookie名称 ==
            if (method == "getkeynameincookies")
            {
                ILoginAdapter la = new LoginAdapter();
                return(Content(la.CookieName));
            }
            #endregion

            #region == 获得Cookie值 明文 ==
            if (method == "getvalueincookies")
            {
                string        encryptCookieValue = CECRequest.GetQueryString("Password");
                ILoginAdapter la    = new LoginAdapter();
                string[]      value = la.GetCookieValue(encryptCookieValue).Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
                if (value.Length > 5)
                {
                    return(Content(value[1])); //用户名
                }
            }
            #endregion

            return(Content(string.Empty));
        }
예제 #2
0
 public GameProcessSystem(IGameSetting gameSetting, ISceneSystem sceneSystem, IUIController uiController, LoginAdapter loginAdapter)
 {
     this.gameSetting  = gameSetting;
     this.sceneSystem  = sceneSystem;
     this.uiController = uiController;
     this.loginAdapter = loginAdapter;
     context           = new GameProcessContext();
 }
예제 #3
0
        public void Logout()
        {
            ILoginAdapter login = new LoginAdapter();

            login.LoginOut();

            Response.Redirect("/");
            Response.End();
        }
예제 #4
0
        public void SetUp()
        {
            IAppLogger <Car> appLoger                 = new LoginAdapter <Car>();
            var dbContext                             = new Moq.Mock <CarDbContext>();
            IRepository <Car>      carRepository      = new EfRepostiory <Car>(dbContext.Object);
            IAsyncRepository <Car> carRepositoryAsync = new EfRepostiory <Car>(dbContext.Object);

            _CarRepository = new CarRepository(carRepositoryAsync, carRepository, appLoger);
        }
예제 #5
0
        public PlantEngContext()
        {
            ILoginAdapter login = new LoginAdapter();

            if (login.IsClientLogin())
            {
                LoginUserInfo = login.GetLoginedUserInfo();
            }
        }
예제 #6
0
        private void _Login(MemberInfo userInfo)
        {
            ILoginAdapter login = new LoginAdapter();

            login.WriteLoginCookie(new LoginUserInfo()
            {
                Email    = userInfo.Email,
                UserId   = userInfo.Id,
                RoleId   = (int)userInfo.Type,
                UserName = userInfo.UserName,
                Password = userInfo.Password
            });
        }
예제 #7
0
 protected override void Dispose(bool disposing)
 {
     if (this.disposed)
     {
         return;
     }
     if (!disposing)
     {
         return;
     }
     this.adapter?.Dispose();
     this.adapter = null;
     base.Dispose(true);
 }
예제 #8
0
 public LoginRepository(IProgressConnection connection)
 {
     this.loginAdapter = new LoginAdapter(connection);
 }
예제 #9
0
 public HomeController()
 {
     _loginAdapter = new LoginAdapter();
     _loginMapper  = new LoginMapper();
 }
예제 #10
0
 public CUILogin(UIContainer container, IUIBaseContext baseContext, LoginAdapter loginAdapter) : base(container, baseContext)
 {
     this.loginAdapter = loginAdapter;
 }
예제 #11
0
 public LoginRepository(IProgressConnection connection)
 {
     this.adapter = new LoginAdapter(connection);
     this.Cono    = this.adapter.Cono;
     this.OnCreated();
 }
예제 #12
0
 public LoginService()
 {
     loginAdapter = new LoginAdapter();
 }
예제 #13
0
        public ActionResult Rest(FormCollection fc)
        {
            string method = CECRequest.GetQueryString("method").ToLower();

            #region == 登录 ==
            if (method == "login")
            {
                string userName  = CECRequest.GetFormString("username");
                string password  = CECRequest.GetFormString("password");
                string returnUrl = CECRequest.GetQueryString("url");

                var userInfo = MemberService.Get(userName);
                if (userInfo.Id > 0 && userInfo.Password == password)
                {
                    //写登录Cookie
                    ILoginAdapter la = new LoginAdapter();
                    la.WriteLoginCookie(new LoginUserInfo()
                    {
                        Email    = userInfo.Email,
                        UserId   = userInfo.Id,
                        RoleId   = (int)userInfo.Type,
                        UserName = userInfo.UserName,
                        Password = userInfo.Password
                    });
                }
                else
                {
                    return(Content("<script type=\"text/javascript\">alert(\"用户名或密码错误,请重新输入!\");location.href = location.href;</script>"));
                }
                if (!string.IsNullOrEmpty(returnUrl))
                {
                    return(Redirect(returnUrl));
                }
            }
            #endregion

            #region == 登出 ==
            if (method == "logout")
            {
                string        returnUrl = CECRequest.GetQueryString("url");
                ILoginAdapter la        = new LoginAdapter();
                if (la.IsClientLogin())
                {
                    la.LoginOut();
                }
                if (!string.IsNullOrEmpty(returnUrl))
                {
                    return(Redirect(returnUrl));
                }
            }
            #endregion

            #region == 是否在线 ==
            if (method == "isolineuser")
            {
                var userName   = CECRequest.GetFormString("UserName");
                var userPwd    = CECRequest.GetFormString("PassWord");
                var memberInfo = MemberService.Get(userName);

                if (memberInfo.Id > 0 && memberInfo.Password == userPwd)
                {
                    return(Content("true"));
                }
                return(Content("false"));
            }
            #endregion

            #region == 获取用户信息 ==
            if (method == "getuserinfo")
            {
                StringBuilder sb         = new StringBuilder();
                var           userName   = CECRequest.GetFormString("UserName");
                var           memberInfo = MemberService.Get(userName);
                if (memberInfo.Id > 0)
                {
                    sb.Append("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
                    sb.Append("<root>");
                    sb.AppendFormat("<Email>{0}</Email>", memberInfo.Email);
                    sb.AppendFormat("<MobilePhone>{0}</MobilePhone>", memberInfo.Mobile);
                    sb.AppendFormat("<Realname>{0}</Realname>", memberInfo.RealName);
                    sb.Append("</root>");
                }
                return(Content(sb.ToString()));
            }
            #endregion

            return(Content(string.Empty));
        }
예제 #14
0
 public LoginLogic()
 {
     this.LoginData = new LoginAdapter();
     this.usuario   = new Usuario();
 }