Example #1
0
        public AdminClientProxy(hc.Plat.Common.Global.ClientProxyExType cpet)
        {
            //传输当前用户的信息;
            ApplicationContext.Current.UserID   = cpet.UserID;
            ApplicationContext.Current.WebIP    = cpet.IP_WebServer;
            ApplicationContext.Current.ClientIP = cpet.IP_Client;
            if (cpet.CurrentUser != null)
            {
                UserView userView = cpet.CurrentUser as UserView;
                if (userView != null)
                {
                    ApplicationContext.Current.UserName    = userView.UserName;
                    ApplicationContext.Current.CompanyId   = userView.CompanyId.ToString();
                    ApplicationContext.Current.CompanyName = userView.CompanyName;
                    ApplicationContext.Current.RoleType    = userView.RoleType.ToString();
                }
            }
            /*以下密码是用作在应用服务器中使用程序验证密码的作用*/
            string FilePath = AppDomain.CurrentDomain.BaseDirectory + "bin\\";
            string user     = "";
            string pass     = "";
            string msg      = DesTool.LoadCertUserPass(FilePath, out user, out pass);

            if (msg != "")
            {
                throw new Exception(msg);
            }
            ClientCredentials.UserName.UserName = user;
            ClientCredentials.UserName.Password = pass;
            /*OK*/
        }
        public BusinessClientProxy(hc.Plat.Common.Global.ClientProxyExType cpet)
        {
            //传输当前用户的信息;
            ApplicationContext.Current.UserID   = cpet.UserID;
            ApplicationContext.Current.WebIP    = cpet.IP_WebServer;
            ApplicationContext.Current.ClientIP = cpet.IP_Client;


            /*以下密码是用作在应用服务器中使用程序验证密码的作用*/
            string FilePath = AppDomain.CurrentDomain.BaseDirectory + "bin\\";
            string user     = "";
            string pass     = "";
            string msg      = DesTool.LoadCertUserPass(FilePath, out user, out pass);

            if (msg != "")
            {
                throw new Exception(msg);
            }
            ClientCredentials.UserName.UserName = user;
            ClientCredentials.UserName.Password = pass;
            /*OK*/
        }