Ejemplo n.º 1
0
    private void loadUser(string customer_id, string token)
    {
        try
        {
            //获取登录管理平台的用户信息
            AuthService AuthWebService = new AuthService();
            //设置地址
            AuthWebService.Url = ConfigurationManager.AppSettings["sso_url"].ToString() + "/AuthService.asmx";
            string str = AuthWebService.GetLoginUserInfo(token);

            cPos.Model.LoggingManager myLoggingManager = (cPos.Model.LoggingManager)cXMLService.Deserialize(str, typeof(cPos.Model.LoggingManager));

            //判断登录进来的用户是否存在,并且返回用户信息
            cPos.Service.cUserService userService    = new cUserService();
            LoggingSessionInfo        loggingSession = new LoggingSessionInfo();
            loggingSession.CurrentLoggingManager = myLoggingManager;
            if (!userService.IsExistUser(myLoggingManager))
            {
                this.lbErr.Text = "用户不存在,请与管理员联系";
                return;
            }
            cPos.Model.User.UserInfo login_user = userService.GetUserById(loggingSession, myLoggingManager.User_Id);
            loggingSession.CurrentUser = login_user;

            //SessionManager sm = new SessionManager();
            //sm.UserInfo = login_user;
            //sm.LoggingManager = myLoggingManager;
            //sm.loggingSessionInfo = loggingSession;

            this.Session["UserInfo"]           = login_user;
            this.Session["LoggingManager"]     = myLoggingManager;
            this.Session["loggingSessionInfo"] = loggingSession;

            //保存Cookie
            //HttpCookie cookie = new HttpCookie("DRP");
            //cookie.Values.Add("userid", login_user.User_Id);
            //cookie.Values.Add("username", login_user.User_Name);
            //cookie.Values.Add("languageid", ddlLanguage.SelectedItem.Value);
            //cookie.Expires = DateTime.Now.AddDays(7);
            //Response.AppendCookie(cookie);

            //清空密码
            login_user.User_Password = null;
            string go_url = "~/login/SelectRoleUnit.aspx?p=0";
            this.Response.Redirect(go_url);
        }
        catch (Exception ex)
        {
            PageLog.Current.Write(ex);
            lbErr.Text = "登录失败:" + ex.ToString();
        }
    }
Ejemplo n.º 2
0
    private void SetDexUserCertificate()
    {
        cUserService userService   = new cUserService();
        string       customer_code = "IOSDLB";

        cPos.Model.User.UserInfo userInfo = new cPos.Model.User.UserInfo();
        userInfo.User_Id       = "11111";
        userInfo.User_Password = "******";
        userInfo.User_Code     = "11";
        userInfo.customer_id   = "11111";

        //userService.SetDexUserCertificate(customer_code, userInfo);
    }