Ejemplo n.º 1
0
 private static void RefreshMapperDataSource(cPos.Model.LoggingManager loggingManager)
 {
     if (loggingManager == null)
     {
         SessionManager sm = new SessionManager();
         if (sm.loggingSessionInfo != null && sm.loggingSessionInfo.CurrentLoggingManager != null)
         {
             if (sm.loggingSessionInfo.CurrentLoggingManager.Customer_Id != null)
             {
                 if (sm.loggingSessionInfo.CurrentLoggingManager.Customer_Id != CustomerID)
                 {
                     CustomerID = sm.loggingSessionInfo.CurrentLoggingManager.Customer_Id;
                     string customer_connection_str = sm.loggingSessionInfo.CurrentLoggingManager.Connection_String.ToString();
                     _mapper.DataSource.ConnectionString = customer_connection_str;
                 }
             }
         }
     }
     else
     {
         if (loggingManager.Customer_Id != CustomerID)
         {
             CustomerID = loggingManager.Customer_Id;
             string customer_connection_str = loggingManager.Connection_String;
             _mapper.DataSource.ConnectionString = customer_connection_str;
         }
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 根据客户标识,获取客户信息
        /// </summary>
        /// <param name="Customer_Id"></param>
        /// <returns></returns>
        public LoggingManager GetLoggingManager(string Customer_Id)
        {
            cPos.WebServices.AuthManagerWebServices.AuthService AuthWebService = new cPos.WebServices.AuthManagerWebServices.AuthService();
            AuthWebService.Url = System.Configuration.ConfigurationManager.AppSettings["sso_url"] + "/authservice.asmx";
            string str = AuthWebService.GetCustomerDBConnectionString(Customer_Id);

            cPos.Model.LoggingManager myLoggingManager = (cPos.Model.LoggingManager)cXMLService.Deserialize(str, typeof(cPos.Model.LoggingManager));
            myLoggingManager.Customer_Id = Customer_Id;
            return(myLoggingManager);
        }
Ejemplo n.º 3
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.º 4
0
        protected static void InitMapper(cPos.Model.LoggingManager loggingManager)
        {
            ConfigureHandler handler = new ConfigureHandler(Configure);
            DomSqlMapBuilder builder = new DomSqlMapBuilder();

            _mapper = builder.ConfigureAndWatch("Sql2010SqlMap.config", handler);

            if (loggingManager.Customer_Id != null)
            {
                CustomerID = loggingManager.Customer_Id;
                string customer_connection_str = loggingManager.Connection_String.ToString();
                _mapper.DataSource.ConnectionString = customer_connection_str;
            }
        }
Ejemplo n.º 5
0
 public static ISqlMapper Instance(cPos.Model.LoggingManager loggingManager)
 {
     if (_mapper == null)
     {
         lock (typeof(SqlMapper))
         {
             if (_mapper == null) // double-check
             {
                 InitMapper(loggingManager);
             }
         }
     }
     else
     {
         lock (typeof(SqlMapper))
         {
             RefreshMapperDataSource(loggingManager);
         }
     }
     return(_mapper);
 }
Ejemplo n.º 6
0
        /// <summary>
        /// 获取登录用户的具体信息
        /// </summary>
        /// <param name="cid">客户id</param>
        /// <param name="tid">令牌id</param>
        /// <returns></returns>
        public LoggingSessionInfo GetLoggingSessionInfo(string cid, string tid)
        {
            //获取登录管理平台的用户信息
            cPos.WebServices.AuthManagerWebServices.AuthService AuthWebService = new cPos.WebServices.AuthManagerWebServices.AuthService();
            AuthWebService.Url = ConfigurationManager.AppSettings["sso_url"].ToString() + "/AuthService.asmx";
            string str = AuthWebService.GetLoginUserInfo(tid);//"0b3b4d8b8caa4c71a7c201f53699afcc"

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

            //判断用户是否存在,并且返回用户信息
            cPos.Model.User.UserInfo  login_user  = new cPos.Model.User.UserInfo();
            cPos.Service.cUserService userService = new cUserService();

            cPos.Model.LoggingSessionInfo loggingSessionInfo1 = new LoggingSessionInfo();
            loggingSessionInfo1.CurrentLoggingManager = myLoggingManager;

            //获取用户信息
            if (userService.IsExistUser(myLoggingManager))
            {
                login_user = userService.GetUserById(loggingSessionInfo1, myLoggingManager.User_Id);
            }
            else
            {
                login_user.User_Id = "1";
            }

            cPos.Model.LoggingSessionInfo loggingSessionInfo = new LoggingSessionInfo();


            loggingSessionInfo.CurrentUser           = login_user;
            loggingSessionInfo.CurrentLoggingManager = myLoggingManager;

            cPos.Model.User.UserRoleInfo ur = new cPos.Model.User.UserRoleInfo();
            ur.RoleId = "7064243380E24B0BA24E4ADC4E03968B";
            ur.UnitId = "1";
            loggingSessionInfo.CurrentUserRole = ur;

            return(loggingSessionInfo);
        }