Exemplo n.º 1
0
        public Boolean addRow(SystemManage systemManage)
        {
            try
            {
                ICustomsCMS server = XmlRpcInstance.getInstance();
                Usercheck usercheck = new Usercheck();
                usercheck.idcard = systemManage.IdCard;
                usercheck.password = systemManage.Password;
                usercheck.realname = systemManage.Name;
                usercheck.username = systemManage.UserName;
                usercheck.rolename = systemManage.Type.ToString();

                DBRPCResponse dBRPCResponse = server.AddUser(usercheck);
                return true;
            }
            catch (Exception ex)
            {
                throw new Exception("错误:" + ex.Message);
            }
        }
Exemplo n.º 2
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);
            }
        }