Ejemplo n.º 1
0
        /// <summary>
        /// 生成Xml文件
        /// </summary>
        /// <param name="loginInfo"></param>
        private void Create_Xml(List <UserInfo> loginInfo)
        {
            var tList = new List <UserInfo>();

            foreach (var item in loginInfo)
            {
                tList.Add(new UserInfo
                {
                    AutomaticLogon = item.AutomaticLogon,
                    RememberPwd    = item.RememberPwd,
                    UserName       = CryptInfoHelper.GetEncrypt(item.UserName),
                    UserPwd        = CryptInfoHelper.GetEncrypt(item.UserPwd),
                    Tid            = item.Tid
                });
            }
            XmlSerializer xmls = new XmlSerializer(tList.GetType());

            if (InfoFile.Exists)
            {
                InfoFile.Delete();
            }
            using (Stream s = InfoFile.OpenWrite())
            {
                xmls.Serialize(s, tList);
                //s.Close();
            }
        }
Ejemplo n.º 2
0
 public void ChangePassword(string oldpwd, string newpwd)
 {
     Execute(new UserChangePasswordRequest {
         Id     = DataFactory.Instance.GetCacheHashtable().Get(CacheHashkey.UserId),
         OldPwd = CryptInfoHelper.GetEncrypt(oldpwd),
         NewPwd = CryptInfoHelper.GetEncrypt(newpwd)
     });
 }
Ejemplo n.º 3
0
        public long Save(long id, string userName, string password)
        {
            var rsp = Execute(new UserSaveRequest {
                Id = id, UserName = userName, PassWord = CryptInfoHelper.GetEncrypt(password)
            });

            return(rsp.id);
        }
Ejemplo n.º 4
0
        public void Login(long tid, string userName, string password)
        {
            UserRequest request = new UserRequest();

            request.UserName = userName;
            request.PassWord = CryptInfoHelper.GetEncrypt(password);
            request.Tid      = tid;
            var rsp = Execute(request);

            DataFactory.Instance.GetCacheHashtable().Set(CacheHashkey.UserId, rsp.UserId);
            DataFactory.Instance.GetCacheHashtable().Set(CacheHashkey.UserName, rsp.UserName);
            DataFactory.Instance.GetCacheHashtable().Set(CacheHashkey.Token, rsp.Token);
        }