Exemple #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);
        }
Exemple #2
0
        public int GetDefaultContactId(int customerId)
        {
            // Default Contact Section
            OrderBoxDomainsLib.APIKit.Properties.Url = ServiceUrl;
            // init contact api
            OrderBoxDomainsLib.DomContact contact = new OrderBoxDomainsLib.DomContact();
            // check whether a contact is already exists
            Hashtable ctHash = contact.listNames(Username, Password, RESELLER_ROLE, SERVICE_LANGUAGE,
                                                 ParentId, customerId);

            // throws an exception
            if (!ctHash.ContainsKey("1"))
            {
                throw new Exception("Couldn't find default contact for the specified account");
            }
            // gets contact info
            Hashtable infoHash = (Hashtable)ctHash["1"];

            // return result
            return(Convert.ToInt32(infoHash[CONTACT_ID]));
        }
		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;
		}
		public int GetDefaultContactId(int customerId)
		{
			// Default Contact Section
			OrderBoxDomainsLib.APIKit.Properties.Url = ServiceUrl;
			// init contact api
			OrderBoxDomainsLib.DomContact contact = new OrderBoxDomainsLib.DomContact();
			// check whether a contact is already exists
			Hashtable ctHash = contact.listNames(Username, Password, RESELLER_ROLE, SERVICE_LANGUAGE,
				ParentId, customerId);
			// throws an exception
			if (!ctHash.ContainsKey("1"))
				throw new Exception("Couldn't find default contact for the specified account");
			// gets contact info
			Hashtable infoHash = (Hashtable)ctHash["1"];
			// return result
			return Convert.ToInt32(infoHash[CONTACT_ID]);
		}