public static CheckDomainResult CheckDomain(int resellerId, string domain, string tld)
        {
            //
            CheckDomainResult result = new CheckDomainResult();

            //
            try
            {
                //
                TopLevelDomain rslTld = GetResellerTopLevelDomain(resellerId, tld);
                //
                if (rslTld != null && !rslTld.WhoisEnabled)
                {
                    //
                    result.Succeed = true;
                    //
                    result.ResultCode = 0;
                    //
                    return(result);
                }

                //
                WhoisResult wResult = WhoisLookup.Query(domain, tld);
                // query error
                if (!wResult.Success)
                {
                    //
                    result.ErrorMessage = wResult.ErrorMessage;
                    //
                    result.Succeed = false;
                    //
                    result.ResultCode = CheckDomainResult.QUERY_ERROR;
                    //
                    return(result);
                }

                // whois record found
                if (wResult.RecordFound)
                {
                    //
                    result.ResultCode = CheckDomainResult.DOMAIN_BUSY;
                    //
                    result.Succeed = true;
                    //
                    return(result);
                }

                // whois record not found - domain is available for purchase
                result.Succeed = true;
                //
                result.ResultCode = 0;
            }
            catch (Exception ex)
            {
                //
                result.ErrorMessage = ex.StackTrace;
                //
                result.Succeed = false;
                //
                result.ResultCode = CheckDomainResult.UNSPECIFIED_ERROR;
            }
            //
            return(result);
        }
예제 #2
0
		public static CheckDomainResult CheckDomain(int resellerId, string domain, string tld)
		{
			//
			CheckDomainResult result = new CheckDomainResult();
			//
			try
			{
				//
				TopLevelDomain rslTld = GetResellerTopLevelDomain(resellerId, tld);
				//
				if (rslTld != null && !rslTld.WhoisEnabled)
				{
					//
					result.Succeed = true;
					//
					result.ResultCode = 0;
					//
					return result;
				}

				// 
				WhoisResult wResult = WhoisLookup.Query(domain, tld);
				// query error
				if (!wResult.Success)
				{
					//
					result.ErrorMessage = wResult.ErrorMessage;
					//
					result.Succeed = false;
					//
					result.ResultCode = CheckDomainResult.QUERY_ERROR;
					//
					return result;
				}

				// whois record found
				if (wResult.RecordFound)
				{
					//
					result.ResultCode = CheckDomainResult.DOMAIN_BUSY;
					//
					result.Succeed = true;
					//
					return result;
				}

				// whois record not found - domain is available for purchase
				result.Succeed = true;
				//
				result.ResultCode = 0;
			}
			catch (Exception ex)
			{
				//
				result.ErrorMessage = ex.StackTrace;
				//
				result.Succeed = false;
				//
				result.ResultCode = CheckDomainResult.UNSPECIFIED_ERROR;
			}
			//
			return result;
		}