Exemplo n.º 1
0
        public int CreateCustomerAccount(ContractAccount accountInfo)
        {
            // setup url
            OrderBoxCoreLib.APIKit.Properties.Url = ServiceUrl;
            // init customer api
            OrderBoxCoreLib.Customer customer = new OrderBoxCoreLib.Customer();
            // create customer account if it doesn't exist
            int customerId = customer.addCustomer(Username, Password, RESELLER_ROLE, SERVICE_LANGUAGE,
                                                  ParentId, accountInfo[ContractAccount.EMAIL], accountInfo[ContractAccount.PASSWORD],
                                                  String.Concat(accountInfo[ContractAccount.FIRST_NAME], " ", accountInfo[ContractAccount.LAST_NAME]),
                                                  GetCompanyName(accountInfo[ContractAccount.COMPANY_NAME]), GetAddress(accountInfo[ContractAccount.ADDRESS]),
                                                  GetAddress(null), GetAddress(null), accountInfo[ContractAccount.CITY], accountInfo[ContractAccount.STATE],
                                                  accountInfo[ContractAccount.COUNTRY], accountInfo[ContractAccount.ZIP],
                                                  GetDialingAreaCode(accountInfo[ContractAccount.PHONE_NUMBER]),
                                                  GetDialingNumber(accountInfo[ContractAccount.PHONE_NUMBER]), String.Empty, String.Empty,
                                                  GetDialingAreaCode(accountInfo[ContractAccount.FAX_NUMBER]),
                                                  GetDialingNumber(accountInfo[ContractAccount.FAX_NUMBER]), "en");

            // setup url
            OrderBoxDomainsLib.APIKit.Properties.Url = ServiceUrl;
            // init contact api
            OrderBoxDomainsLib.DomContact contact = new OrderBoxDomainsLib.DomContact();
            // create default contact
            int defaultContactId = contact.addDefaultContact(Username, Password, RESELLER_ROLE, SERVICE_LANGUAGE,
                                                             ParentId, customerId);

            // return result
            return(customerId);
        }
Exemplo n.º 2
0
        public int GetCustomerAccountId(string emailAddress)
        {
            // check email address
            if (String.IsNullOrEmpty(emailAddress))
            {
                throw new ArgumentNullException("emailAddress");
            }
            // create a customer
            OrderBoxCoreLib.APIKit.Properties.Url = ServiceUrl;
            // init customer api
            OrderBoxCoreLib.Customer customer = new OrderBoxCoreLib.Customer();
            // check does the user is already Directi customer
            int customerId = customer.getCustomerId(Username, Password, RESELLER_ROLE, SERVICE_LANGUAGE,
                                                    ParentId, emailAddress);

            // throws an exception
            if (customerId <= 0)
            {
                throw new Exception("Couldn't find customer with the specified email: " + emailAddress);
            }
            //
            return(customerId);
        }
Exemplo n.º 3
0
        public bool CheckSubAccountExists(string emailAddress)
        {
            if (String.IsNullOrEmpty(emailAddress))
            {
                throw new ArgumentNullException("emailAddress");
            }

            // check sub account exists
            OrderBoxCoreLib.APIKit.Properties.Url = ServiceUrl;
            // create an instance
            OrderBoxCoreLib.Customer customer = new OrderBoxCoreLib.Customer();
            // search a user by email address
            Hashtable srchResults = customer.list(Username, Password, RESELLER_ROLE, SERVICE_LANGUAGE,
                                                  ParentId, null, null, emailAddress, null, null, null, null, null, null, null, null, null, 10, 1, null);

            // check search result
            if (Convert.ToInt32(srchResults[RECORDS_ON_PAGE]) > 0 &&
                Convert.ToInt32(srchResults[RECORDS_IN_DB]) > 0)
            {
                return(true);
            }
            // customer account not found
            return(false);
        }
Exemplo n.º 4
0
		public int CreateCustomerAccount(ContractAccount accountInfo)
		{
			// setup url
			OrderBoxCoreLib.APIKit.Properties.Url = ServiceUrl;
			// init customer api
			OrderBoxCoreLib.Customer customer = new OrderBoxCoreLib.Customer();
			// create customer account if it doesn't exist
			int customerId = customer.addCustomer(Username, Password, RESELLER_ROLE, SERVICE_LANGUAGE,
                ParentId, accountInfo[ContractAccount.EMAIL], accountInfo[ContractAccount.PASSWORD],
                String.Concat(accountInfo[ContractAccount.FIRST_NAME], " ", accountInfo[ContractAccount.LAST_NAME]),
                GetCompanyName(accountInfo[ContractAccount.COMPANY_NAME]), GetAddress(accountInfo[ContractAccount.ADDRESS]),
                GetAddress(null), GetAddress(null), accountInfo[ContractAccount.CITY], accountInfo[ContractAccount.STATE],
                accountInfo[ContractAccount.COUNTRY], accountInfo[ContractAccount.ZIP],
                GetDialingAreaCode(accountInfo[ContractAccount.PHONE_NUMBER]),
                GetDialingNumber(accountInfo[ContractAccount.PHONE_NUMBER]), String.Empty, String.Empty,
                GetDialingAreaCode(accountInfo[ContractAccount.FAX_NUMBER]),
                GetDialingNumber(accountInfo[ContractAccount.FAX_NUMBER]), "en");
			// setup url
			OrderBoxDomainsLib.APIKit.Properties.Url = ServiceUrl;
			// init contact api
			OrderBoxDomainsLib.DomContact contact = new OrderBoxDomainsLib.DomContact();
			// create default contact
			int defaultContactId = contact.addDefaultContact(Username, Password, RESELLER_ROLE, SERVICE_LANGUAGE,
				ParentId, customerId);
			// return result
			return customerId;
		}
Exemplo n.º 5
0
		public int GetCustomerAccountId(string emailAddress)
		{
			// check email address
			if (String.IsNullOrEmpty(emailAddress))
				throw new ArgumentNullException("emailAddress");
			// create a customer
			OrderBoxCoreLib.APIKit.Properties.Url = ServiceUrl;
			// init customer api
			OrderBoxCoreLib.Customer customer = new OrderBoxCoreLib.Customer();
			// check does the user is already Directi customer
			int customerId = customer.getCustomerId(Username, Password, RESELLER_ROLE, SERVICE_LANGUAGE,
				ParentId, emailAddress);
			// throws an exception
			if (customerId <= 0)
				throw new Exception("Couldn't find customer with the specified email: " + emailAddress);
			//
			return customerId;
		}
Exemplo n.º 6
0
		public bool CheckSubAccountExists(string emailAddress)
		{
			if (String.IsNullOrEmpty(emailAddress))
				throw new ArgumentNullException("emailAddress");

			// check sub account exists
			OrderBoxCoreLib.APIKit.Properties.Url = ServiceUrl;
			// create an instance
			OrderBoxCoreLib.Customer customer = new OrderBoxCoreLib.Customer();
			// search a user by email address
			Hashtable srchResults = customer.list(Username, Password, RESELLER_ROLE, SERVICE_LANGUAGE,
				ParentId, null, null, emailAddress, null, null, null, null, null, null, null, null, null, 10, 1, null);
			// check search result
			if (Convert.ToInt32(srchResults[RECORDS_ON_PAGE]) > 0 &&
				Convert.ToInt32(srchResults[RECORDS_IN_DB]) > 0)
				return true;
			// customer account not found
			return false;
		}