コード例 #1
0
ファイル: Core.cs プロジェクト: cmqd/coflows-quant
        public Boolean Login(string key)
        {
            _token   = null;
            _session = null;

            _code = key;

            LogOnResult logonRes = GetObject <LogOnResult>("account/login", new { Code = key });

            if (logonRes == null || string.IsNullOrEmpty(logonRes.token))
            {
                return(false);
            }

            DateTime date    = DateTime.Now;
            string   timeKey = date.Date + "/" + date.Hour;

            _lastUpdate = timeKey;

            _token   = logonRes.token;
            _session = logonRes.Session;

            QuantApp.Kernel.User.ContextUser = logonRes.User;

            return(true);
        }
コード例 #2
0
ファイル: Core.cs プロジェクト: cmqd/coflows-quant
        public Boolean Login(string username, string password, string file = null)
        {
            _username = username;
            _password = password;


            LogOnResult logonRes = GetObject <LogOnResult>("account/login", new { Username = username, Password = password });

            if (logonRes == null || string.IsNullOrEmpty(logonRes.token))
            {
                return(false);
            }

            DateTime date    = DateTime.Now;
            string   timeKey = date.Date + "/" + date.Hour;

            _lastUpdate = timeKey;

            _token   = logonRes.token;
            _code    = logonRes.Secret;
            _session = logonRes.Session;

            if (file != null)
            {
                System.IO.File.WriteAllText(file, logonRes.Secret);
            }

            QuantApp.Kernel.User.ContextUser = logonRes.User;

            return(true);
        }