public static Com.DataPack.DataRsp <string> getarea(string typecode, string pcode, string isall)
 {
     Com.DataPack.DataRsp <string> rsp = new Com.DataPack.DataRsp <string>();
     if (Com.Session.userid == null)
     {
         rsp.code = "expire";
         rsp.msg  = "页面已经过期,请重新登录";
     }
     else
     {
         try
         {
             string selp = "";
             if (isall == "1")
             {
                 rsp.data = Com.Public.GetDrpArea(Com.Public.SqlEncStr(typecode), Com.Public.SqlEncStr(pcode), ref selp, true);
             }
             else
             {
                 rsp.data = Com.Public.GetDrpArea(Com.Public.SqlEncStr(typecode), Com.Public.SqlEncStr(pcode), ref selp, false);
             }
         }
         catch (Exception ex)
         {
             rsp.code = "ExcepError";
             rsp.msg  = ex.Message;
         }
     }
     return(rsp);
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            appurl = System.Web.HttpUtility.UrlDecode(Request.Params["appuserapiurl"].ToString());
            string jsid    = Request.Params["sid"].ToString();
            string jstoken = Request.Params["token"].ToString();

            Com.SoureSession.jsid    = jsid;
            Com.SoureSession.jstoken = jstoken;
            Com.DataPack.DataRsp <Com.DataPack.UserInfo> rsp = Com.Public.UserFuncSoure(jsid, jstoken, appurl);
            if (rsp.code == "ERROR_TOKEN")
            {
                Response.Write("登录已失效!");
                Response.End();
            }
            else if (!IsPostBack)
            {
                userid = Com.SoureSession.Soureusertid;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string userid = Request.Params["userid"];
            string aurl   = Request.Params["appuserapiurl"];

            if (!string.IsNullOrEmpty(aurl))
            {
                appurl = System.Web.HttpUtility.UrlDecode(aurl);
            }
            if (string.IsNullOrEmpty(userid))//包含userid
            {
                string jsid    = Request.Params["sid"].ToString();
                string jstoken = Request.Params["token"].ToString();

                Com.SoureSession.jsid    = jsid;
                Com.SoureSession.jstoken = jstoken;
                Com.DataPack.DataRsp <Com.DataPack.UserInfo> rsp = Com.Public.UserFuncSoure(jsid, jstoken, appurl);
                if (rsp.code == "ERROR_TOKEN")
                {
                    Response.Write("登录已失效!");
                    Response.End();
                }
                else if (!IsPostBack)
                {
                    usertname = Com.SoureSession.Soureusertid;
                    username  = Com.SoureSession.Soureuserid;
                    usertid   = Com.SoureSession.Soureusertid;
                    schid     = Com.SoureSession.Soureschid;
                }
            }
            else
            {
                SchSystem.BLL.SchUserInfo   userbll   = new SchSystem.BLL.SchUserInfo();
                SchSystem.Model.SchUserInfo usermodel = userbll.GetModel(int.Parse(userid));
                if (usermodel != null)
                {
                    usertname = usermodel.UserTname;
                    username  = usermodel.UserName;
                    usertid   = usermodel.UserId.ToString();
                    schid     = usermodel.SchId.ToString();
                }
            }
        }
Exemplo n.º 4
0
        //用户信息
        public static Com.DataPack.DataRsp <Com.DataPack.UserInfo> UserFuncSoure(string jsid, string token, string appurl)
        {
            WebClient wbc = new WebClient();

            wbc.Encoding = Encoding.UTF8;
            wbc.Headers.Add("X-Requested-With", "XMLHttpRequest");
            wbc.Headers.Add("Cookie", "JSID=" + jsid + "; JSESSIONID=" + jsid + "; token=" + token);
            string thdstr = wbc.DownloadString(appurl);

            Com.DataPack.DataRsp <Com.DataPack.UserInfo> Rsp = new DataPack.DataRsp <DataPack.UserInfo>();
            if (thdstr != "ERROR_TOKEN")
            {
                WriteLog("user", "getuser", thdstr);
                Com.DataPack.UserInfo userinfo = JsonConvert.DeserializeObject <Com.DataPack.UserInfo>(thdstr);
                Rsp      = JsonConvert.DeserializeObject <Com.DataPack.DataRsp <Com.DataPack.UserInfo> >(thdstr);
                Rsp.data = userinfo;
                //设置Session信息
                if (userinfo.uid != "" && userinfo.schid != "")
                {
                    Com.SoureSession.Soureschid   = userinfo.schid;
                    Com.SoureSession.Soureuserid  = userinfo.uid;
                    Com.SoureSession.Soureusertid = userinfo.utid.ToString();
                    Com.SoureSession.Soureisadmin = userinfo.isadmin.ToString();
                    Com.SoureSession.Soureutname  = userinfo.utname;
                    //Com.SoureSession.Souredpts = userinfo.dpts;
                    //Com.SoureSession.Souresubs = userinfo.subs;
                    //Com.SoureSession.Soureclss = userinfo.clss;
                    Com.SoureSession.Souresex         = userinfo.sex.ToString();
                    Com.SoureSession.Soureschname     = userinfo.schname;
                    Com.SoureSession.Soureurolestrext = userinfo.urolestrext;
                    Com.SoureSession.Souresystype     = userinfo.isadmin.ToString();
                }
            }
            else
            {
                Rsp.code = "ERROR_TOKEN";
            }

            return(Rsp);
        }