Example #1
0
        ///<summary>
        /// 验证接入用户身份
        /// </summary>
        /// <param name="VerifyJson"></param>
        /// <returns></returns>
        public bool VerifyUser(string UserName, string PassWord)
        {
            UserRoleID myUser;
            //PassWord = FormsAuthentication.HashPasswordForStoringInConfigFile(PassWord, "MD5").ToLower();

            UserBusiness userBusiness = new UserBusiness();
            myUser = userBusiness.GetUserByUserName(UserName);
            if (myUser.PassWord == FormsAuthentication.HashPasswordForStoringInConfigFile(PassWord, "SHA1"))
            {

                return true;
            }
            else
            {
                return false;

            }
        }
Example #2
0
        public string UserRegister(string userData)
        {
            User user1 = new User();
            //执行反序列化 part:2
            JavaScriptSerializer jsonSerializer = new JavaScriptSerializer();
            UserRoleID Personne = jsonSerializer.Deserialize<UserRoleID>(userData);

            /////打包成json格式发送:part:3
            Result back = new Result();

            ////////////////////数据调用
            UserBusiness userbusiness = new UserBusiness();

            if (userbusiness.CheckDuplicatName(Personne.UserName) != 1)
            {
                Personne.PassWord = FormsAuthentication.HashPasswordForStoringInConfigFile(Personne.PassWord, "SHA1");
                back.RegisterMessage = userbusiness.RegisterNewUser(Personne);
            }
            else
            {
                back.RegisterMessage = 2;
            }
            return jsonSerializer.Serialize(back.RegisterMessage);
        }
Example #3
0
        public string UserLogin(string userData)
        {
            //声明变量
            UserRoleID myUser;
            //执行反序列化 part:2
            JavaScriptSerializer jsonSerializer = new JavaScriptSerializer();
            Userlogin _Personnel = jsonSerializer.Deserialize<Userlogin>(userData);

            /////打包成json格式发送:part:3
            Result back = new Result();

            ////////////////////数据调用
            UserBusiness userbusiness = new UserBusiness();
            myUser = userbusiness.GetUserByUserName(_Personnel.UserName);
            if (myUser != null && myUser.PassWord == FormsAuthentication.HashPasswordForStoringInConfigFile(_Personnel.Password, "SHA1"))
            {
                back.resutl = myUser.UserID.ToString();
                back.UserID = myUser.UserID;
                back.UserName = myUser.UserName;
                back.Ps = _Personnel.Password;
                back.UserType = myUser.UserType;
            }
            else
            {
                back.resutl = "0";

            }
            string loginMessage = jsonSerializer.Serialize(back);
            return loginMessage;
        }