Ejemplo n.º 1
0
        public List <Dictionary <string, string> > GetUserZTree(String UserType = null)
        {
            MgoogpsWebClient mwc = new MgoogpsWebClient();

            mwc.RequestMethodType = "GET";
            mwc.RequestMethodName = "/service/getusers/?user=" + SessionOper.GetSessionUserID();

            String jsonStr = mwc.RequestSend();
            List <Dictionary <string, string> > zTreeList = Utils.ToList(jsonStr);

            return(zTreeList);
        }
Ejemplo n.º 2
0
        public bool WebSystemLogin_Bll(string loginName, string passWord, string loginType)
        {
            MgoogpsWebClient webClient = new MgoogpsWebClient();

            try
            {
                webClient.RequestMethodName  = "/account/login";
                webClient.RequestPostData    = Encoding.UTF8.GetBytes("loginName=" + loginName + "&passWord="******"application/x-www-form-urlencoded";
                string data = webClient.RequestSend();
                if (data.IndexOf("error") > 0)
                {
                    return(false);
                }
                else
                {
                    MG_DAL.LoginUserInfo        _loginUserInfo = new MG_DAL.LoginUserInfo();
                    Dictionary <string, object> d = (Dictionary <string, object>)Utils.ToObject(data);

                    Dictionary <string, object> loginUserDic = (Dictionary <string, object>)d["UserInfo"];

                    _loginUserInfo.ToKen   = d["Token"].toStringEmpty();
                    MgoogpsWebClient.ToKen = d["Token"].toStringEmpty();

                    _loginUserInfo.UserID    = loginUserDic["_id"].toStringEmpty();
                    _loginUserInfo.UserName  = loginUserDic["username"].toStringEmpty();
                    _loginUserInfo.Address   = loginUserDic["address"].toStringEmpty();
                    _loginUserInfo.EMail     = loginUserDic["email"].toStringEmpty();
                    _loginUserInfo.LoginTime = DateTime.Now;
                    _loginUserInfo.LoginType = LoginType.User;
                    SessionOper.SetSession(_loginUserInfo, SessionOper.SessionName);
                    return(true);
                }
            }
            catch (Exception ex)
            {
                Utils.log("登录出错:" + loginName + "," + passWord + " --异常信息:" + ex.Message + ",堆栈信息:" + ex.StackTrace);
                Utils.log(ex.Message + "-" + webClient.RequestUrl + "-" + webClient.RequestMethodName);
                //  throw new Exception(ex.Message+"-"+webClient.RequestUrl+"-" + webClient.RequestMethodName);
                throw ex;
            }
        }