Exemplo n.º 1
0
 /// <summary>
 /// 验证用户名和密码
 /// </summary>
 /// <param name="username">用户名</param>
 /// <param name="password">密码</param>
 /// <returns>验证是否正确</returns>
 public Boolean validateUserNameAndPassword(string username, string password)
 {
     try
     {
         ICustomsCMS server    = XmlRpcInstance.getInstance();
         Usercheck   usercheck = new Usercheck();
         usercheck.username = username;
         usercheck.password = password;
         UsercheckRPCResponse usercheckRPCResponse = server.checkUser(usercheck);
         if (usercheckRPCResponse.username != "")
         {
             currentUser.UserName = usercheckRPCResponse.username;
             currentUser.Rolename = usercheckRPCResponse.rolename;
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception ex)
     {
         throw new Exception("错误:" + ex.Message);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// 根据id和用户名查询符合条件的记录
        /// </summary>
        /// <param name="id">id</param>
        /// <param name="name">用户名</param>
        /// <returns></returns>
        public Boolean findRowByIdAndName(int id, string userName)
        {
            try
            {
                ICustomsCMS          server = XmlRpcInstance.getInstance();
                UsercheckRPCResponse usercheckRPCResponse = server.findUser(userName);
                if (usercheckRPCResponse.id != 0 && usercheckRPCResponse.id != id)
                {
                    return(true);
                }
                return(false);
            }
            catch (Exception ex)
            {
                throw new Exception("错误:" + ex.Message);
            }
            try
            {
                ICustomsCMS server = XmlRpcInstance.getInstance();

                UsercheckListRPCResponse response = server.findAllUserByUserid(userName, 1, 1);
                Usercheck[] titlelist             = response.listmodule;
            }
            catch (Exception ex)
            {
                throw new Exception("错误:" + ex.Message);
            }
        }