Beispiel #1
0
        /// <summary>
        /// user login ,used in manual login
        /// </summary>
        /// <param name="logid"></param>
        /// <param name="psw"></param>
        /// <returns></returns>
        public dynamic Login(string logid, string psw)
        {
            string  err   = string.Empty;
            var     ar    = Utilities.RequestManager.RequestByRest(string.Format(LocalData.RemoteUrls["login"], logid, psw), "", Utilities.RequestManager.MethodType.GET, "text/json", Encoding.UTF8, out err);
            dynamic outar = Newtonsoft.Json.JsonConvert.DeserializeObject(ar);

            if (outar != null && outar.Instance == 1)
            {
                Token     = outar.Info;
                _loginID  = logid;
                _password = psw;
                LocalData.SaveLoginInfo(new { name = _userName, loginid = _loginID, psw = psw });
                UserProfile = new UserProfile(logid);
            }
            else
            {
                Utils.SysController.GetInstance().OnSysChangeChanged(new Utils.SysChangeEventArgs()
                {
                    SystemCommand = SysEventCMD.Error,
                    Desc          = err,
                    Title         = "Login Erorr"
                });
            }
            return(outar);
        }
        public void SaveConfigVal(ConfigItem it, object obj)
        {
            string configkey = "";

            switch (it)
            {
            case ConfigItem.RememberMe:
                configkey = "rememberme";
                break;

            default:
                break;
            }
            LocalData.SaveConfigByKey(configkey, obj.ToString(), Utils.SysController.GetInstance().MySelf.LoginID);
        }
Beispiel #3
0
        /// <summary>
        /// create a account
        /// </summary>
        /// <param name="logid"></param>
        /// <param name="psw"></param>
        /// <returns></returns>
        public dynamic Create(string logid, string psw)
        {
            dynamic body   = new { sLoginID = logid, sPsw = psw, dCreateTime = DateTime.Now };
            var     jsData = Newtonsoft.Json.JsonConvert.SerializeObject(body);
            string  err    = string.Empty;
            var     ar     = Utilities.RequestManager.RequestByRest(LocalData.RemoteUrls["signup"], jsData, Utilities.RequestManager.MethodType.POST, "text/json", Encoding.UTF8, out err);
            dynamic outar  = Newtonsoft.Json.JsonConvert.DeserializeObject(ar);

            if (outar.Instance == 1)
            {
                Token     = outar.Info;
                _loginID  = logid;
                _password = psw;
                LocalData.SaveLoginInfo(new { name = _userName, loginid = _loginID, psw = psw });
                //  UserProfile = new Config(logid);
            }
            return(outar);
        }