public void LoadContractAccount(ContractAccount account)
 {
     txtAddress.Text = account[ContractAccount.ADDRESS];
     //
     txtCity.Text = account[ContractAccount.CITY];
     //
     txtCompany.Text = account[ContractAccount.COMPANY_NAME];
     //
     EnsureCountriesLoaded();
     //
     ecUtils.SelectListItem(ddlCountry, account[ContractAccount.COUNTRY]);
     //
     EnsureCountryStatesLoad();
     //
     if (ddlCountryStates.Items.Count > 0)
     {
         ecUtils.SelectListItem(ddlCountryStates, account[ContractAccount.STATE]);
     }
     else
     {
         txtCountryState.Text = account[ContractAccount.STATE];
     }
     //
     txtEmail.Text = account[ContractAccount.EMAIL];
     //
     txtPhoneNumber.Text = account[ContractAccount.PHONE_NUMBER];
     //
     txtFaxNumber.Text = account[ContractAccount.FAX_NUMBER];
     //
     txtFirstName.Text = account[ContractAccount.FIRST_NAME];
     //
     txtLastName.Text = account[ContractAccount.LAST_NAME];
     //
     txtPostalCode.Text = account[ContractAccount.ZIP];
 }
        public bool SaveContractAccount()
        {
            ContractAccount account = null;

            //
            if (!Page.User.Identity.IsAuthenticated)
            {
                //
                string username = txtUsername.Text.Trim();
                //
                if (StorefrontHelper.UsernameExists(username))
                {
                    HostModule.ShowResultMessage(BusinessErrorCodes.ERROR_USER_ALREADY_EXISTS);
                    return(false);
                }
                //
                string state = (txtCountryState.Visible) ? txtCountryState.Text.Trim() : ddlCountryStates.SelectedValue;
                //
                account = ecUtils.GetContractAccountFromInput(username, txtPassword.Text, txtFirstName.Text.Trim(),
                                                              txtLastName.Text.Trim(), txtEmail.Text.Trim(), txtCompany.Text.Trim(), txtAddress.Text.Trim(),
                                                              txtCity.Text.Trim(), ddlCountry.SelectedValue, state, txtPostalCode.Text.Trim(), txtPhoneNumber.Text.Trim(),
                                                              txtFaxNumber.Text.Trim(), txtInstantMsngr.Text.Trim(), ddlMailFormat.SelectedValue);
            }
            else
            {
                account = ecUtils.GetContractAccountFromUserInfo(WSP.PanelSecurity.EffectiveUser);
            }
            //
            ViewState[VIEWSTATE_KEY] = account;
            //
            return(true);
        }
Esempio n. 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Step #1: Disable "On Behalf Of" feature if that the case
            if (PanelSecurity.LoggedUserId != PanelSecurity.SelectedUserId)
            {
                DisablePageFunctionality();
                ShowWarningMessage("WORK_ON_BEHALF_DISABLED");
                return;
            }

            // Step #2: Create customer contract if necessary
            if (!StorehouseHelper.CheckCustomerContractExists())
            {
                ContractAccount accountSettings = ecUtils.GetContractAccountFromUserInfo(PanelSecurity.SelectedUser);
                GenericResult   result          = StorefrontHelper.AddContract(PanelSecurity.SelectedUser.OwnerId, accountSettings);
                // Show error message
                if (!result.Succeed)
                {
                    DisablePageFunctionality();
                    ShowResultMessage(result.GetProperty <int>("ResultCode"));
                    return;
                }
            }

            // Step #3: Load customer contract
            myContract = StorehouseHelper.GetCustomerContract(PanelSecurity.SelectedUserId);

            // Step #4: Bind payment profile
            if (!IsPostBack)
            {
                BindPaymentProfile();
            }
        }
        public override bool Update(TransactionManager transactionManager, ContractAccount entity)
        {
            SqlDatabase database = new SqlDatabase(this._connectionString);
            DbCommand   command  = StoredProcedureProvider.GetCommandWrapper(database, "dbo.ContractAccount_Update", this._useStoredProcedure);

            database.AddInParameter(command, "@ContractAccountCode", DbType.AnsiString, entity.ContractAccountCode);
            database.AddInParameter(command, "@OriginalContractAccountCode", DbType.AnsiString, entity.OriginalContractAccountCode);
            database.AddInParameter(command, "@ContractAccountID", DbType.AnsiString, entity.ContractAccountID);
            database.AddInParameter(command, "@ContractCode", DbType.AnsiString, entity.ContractCode);
            database.AddInParameter(command, "@Reason", DbType.AnsiString, entity.Reason);
            database.AddInParameter(command, "@Status", DbType.Int32, entity.Status.HasValue ? ((object)entity.Status) : ((object)DBNull.Value));
            database.AddInParameter(command, "@CreateDate", DbType.DateTime, entity.CreateDate.HasValue ? ((object)entity.CreateDate) : ((object)DBNull.Value));
            database.AddInParameter(command, "@CreatePerson", DbType.AnsiString, entity.CreatePerson);
            database.AddInParameter(command, "@ContractChangeCode", DbType.AnsiString, entity.ContractChangeCode);
            int num = 0;

            if (transactionManager != null)
            {
                num = Utility.ExecuteNonQuery(transactionManager, command);
            }
            else
            {
                num = Utility.ExecuteNonQuery(database, command);
            }
            if (DataRepository.Provider.EnableEntityTracking)
            {
                EntityManager.StopTracking(entity.EntityTrackingKey);
            }
            entity.OriginalContractAccountCode = entity.ContractAccountCode;
            entity.AcceptChanges();
            return(Convert.ToBoolean(num));
        }
Esempio n. 5
0
        public void RenewDomain(DomainNameSvc domainSvc, ContractAccount accountInfo, string[] nameServers)
        {
            string domainName = GetDomainName(domainSvc.Fqdn);
            string domainTld  = GetDomainTLD(domainSvc.Fqdn);

            AddParam("Command", "Extend");

            AddParam("SLD1", domainName);
            AddParam("TLD1", domainTld);

            AddParam("NumYears", domainSvc.PeriodLength.ToString());

            EnomResult enomResult = new EnomResult(
                ExecuteCommand()
                );

            // throws an exception
            if (!enomResult.Succeed)
            {
                RaiseRegistrarException(enomResult);
            }

            // something wrong was happend we should throw an exception
            if (enomResult["RRPCode"] != "200")
            {
                throw new Exception(
                          "Reason Code: " + enomResult["RRPCode"] + "; Description: " + enomResult["RRPText"]
                          );
            }

            domainSvc["OrderID"] = enomResult["OrderID"];
        }
Esempio n. 6
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);
        }
Esempio n. 7
0
 private void LoadPaymentControl()
 {
     try
     {
         // load payment method control
         Control ctlMethod = LoadControl("PaymentMethods/" + ecPanelRequest.PaymentMethod + "_Payment.ascx");
         //
         ctlMethod.ID = CTL_PAYMENT_FORM;
         //
         IPaymentMethod methodObj = (IPaymentMethod)ctlMethod;
         //
         PaymentMethod method = StorefrontHelper.GetContractPaymentMethod(ecPanelRequest.ContractId,
                                                                          ecPanelRequest.PaymentMethod);
         //
         ContractAccount account = StorefrontHelper.GetContractAccount(ecPanelRequest.ContractId);
         //
         methodObj.LoadContractAccount(account);
         //
         methodObj.CheckSupportedItems(method.SupportedItems);
         //
         btnComplete.Visible = !method.Interactive;
         //
         btnProceed.Visible = method.Interactive;
         //
         phPaymentMethod.Controls.Add(ctlMethod);
     }
     catch (Exception ex)
     {
         ShowErrorMessage("LOAD_PAYMENT_CTL", ex);
         //
         DisableActionCtls();
     }
 }
Esempio n. 8
0
        public void RenewDomain(DomainNameSvc domainSvc, ContractAccount accountInfo, string[] nameServers)
        {
            int customerId = GetCustomerAccountId(accountInfo[ContractAccount.EMAIL]);

            // setup service url
            OrderBoxDomainsLib.APIKit.Properties.Url = ServiceUrl;
            // init domain order api
            OrderBoxDomainsLib.DomOrder domOrder = new OrderBoxDomainsLib.DomOrder();

            // Get all domain name registration details
            Hashtable domainDetails = domOrder.getDetailsByDomain(Username, Password, RESELLER_ROLE,
                                                                  SERVICE_LANGUAGE, ParentId, domainSvc.Fqdn, new ArrayList {
                "All"
            });

            // fill parameters hashtable
            Hashtable domainHash = new Hashtable
            {
                {
                    domainSvc.Fqdn,
                    new Hashtable
                    {
                        { ENTITY_ID, domainDetails[ENTITY_ID] },
                        { NO_OF_YEARS, domainSvc.PeriodLength.ToString() },
                        { EXPIRY_DATE, domainDetails[ENDTIME] }
                    }
                }
            };

            // Send renewal request to the registrar
            Hashtable orderResult = domOrder.renewDomain(Username, Password, RESELLER_ROLE,
                                                         SERVICE_LANGUAGE, ParentId, domainHash, NO_INVOICE);

            // switch to the nested data bunch of the result received
            orderResult = (Hashtable)orderResult[domainSvc.Fqdn];

            // check returned status
            switch ((String)orderResult[STATUS])
            {
            case "error":                     // error
                throw new Exception(Convert.ToString(orderResult[ERROR]));

            case "Failed":                     // error
                throw new Exception(Convert.ToString(orderResult[ACTION_STATUS_DESC]));

            case "Success":                     // success
            case "InvoicePaid":                 // success
                // we are success so copy order number
                domainSvc[EAQID]     = Convert.ToString(orderResult[EAQID]);
                domainSvc[ENTITY_ID] = Convert.ToString(orderResult[ENTITY_ID]);
                break;
            }
        }
Esempio n. 9
0
        public static ContractAccount GetContractAccountFromUserInfo(UserInfo user)
        {
            string mailFormat = user.HtmlMail ? "HTML" : "Text";
            //
            ContractAccount account = GetContractAccountFromInput(user.Username, null, user.FirstName, user.LastName,
                                                                  user.Email, user.CompanyName, user.Address, user.City, user.Country, user.State, user.Zip,
                                                                  user.PrimaryPhone, user.Fax, user.InstantMessenger, mailFormat);

            //
            account[ContractAccount.CUSTOMER_ID] = Convert.ToString(user.UserId);
            //
            return(account);
        }
 public void LoadContractAccount(ContractAccount account)
 {
     litAddress.Text     = account[ContractAccount.ADDRESS];
     litCity.Text        = account[ContractAccount.CITY];
     ltrCompany.Text     = account[ContractAccount.COMPANY_NAME];
     litCountry.Text     = account[ContractAccount.COUNTRY];
     litEmail.Text       = account[ContractAccount.EMAIL];
     litFaxNumber.Text   = account[ContractAccount.FAX_NUMBER];
     litFirstName.Text   = account[ContractAccount.FIRST_NAME];
     litLastName.Text    = account[ContractAccount.LAST_NAME];
     litPhoneNumber.Text = account[ContractAccount.PHONE_NUMBER];
     litPostalCode.Text  = account[ContractAccount.ZIP];
     litState.Text       = account[ContractAccount.STATE];
 }
Esempio n. 11
0
        public static ContractAccount CreateContractAccount(string contractAccountContractAccountCode, string contractAccountContractAccountID, string contractAccountContractCode, string contractAccountReason, int?contractAccountStatus, DateTime?contractAccountCreateDate, string contractAccountCreatePerson, string contractAccountContractChangeCode)
        {
            ContractAccount account = new ContractAccount();

            account.ContractAccountCode = contractAccountContractAccountCode;
            account.ContractAccountID   = contractAccountContractAccountID;
            account.ContractCode        = contractAccountContractCode;
            account.Reason             = contractAccountReason;
            account.Status             = contractAccountStatus;
            account.CreateDate         = contractAccountCreateDate;
            account.CreatePerson       = contractAccountCreatePerson;
            account.ContractChangeCode = contractAccountContractChangeCode;
            return(account);
        }
Esempio n. 12
0
        public virtual ContractAccount Copy()
        {
            ContractAccount account = new ContractAccount();

            account.ContractAccountCode         = this.ContractAccountCode;
            account.OriginalContractAccountCode = this.OriginalContractAccountCode;
            account.ContractAccountID           = this.ContractAccountID;
            account.ContractCode       = this.ContractCode;
            account.Reason             = this.Reason;
            account.Status             = this.Status;
            account.CreateDate         = this.CreateDate;
            account.CreatePerson       = this.CreatePerson;
            account.ContractChangeCode = this.ContractChangeCode;
            account.AcceptChanges();
            return(account);
        }
Esempio n. 13
0
        public int AddCustomerContact(int customerId, string contactType, ContractAccount accountInfo, Hashtable extraInfo)
        {
            // setup url
            OrderBoxCoreLib.APIKit.Properties.Url = ServiceUrl;
            // init customer api
            OrderBoxDomainsLib.DomContact contact = new DomContact();
            // create customer account if it doesn't exist
            int contactId = contact.addContact(Username, Password, RESELLER_ROLE, SERVICE_LANGUAGE,
                                               ParentId, String.Concat(accountInfo[ContractAccount.FIRST_NAME], " ", accountInfo[ContractAccount.LAST_NAME]),
                                               accountInfo[ContractAccount.COMPANY_NAME], accountInfo[ContractAccount.EMAIL],
                                               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]),
                                               GetDialingAreaCode(accountInfo[ContractAccount.FAX_NUMBER]),
                                               GetDialingNumber(accountInfo[ContractAccount.FAX_NUMBER]), customerId, contactType, extraInfo);

            //
            return(contactId);
        }
Esempio n. 14
0
        public static ContractAccount GetContractAccountFromInput(string username, string password, string firstName,
                                                                  string lastName, string email, string companyName, string address, string city, string country, string state,
                                                                  string zip, string phoneNumber, string faxNumber, string instantMessenger, string mailFormat)
        {
            ContractAccount account = new ContractAccount();

            account[ContractAccount.USERNAME]          = username;
            account[ContractAccount.PASSWORD]          = password;
            account[ContractAccount.FIRST_NAME]        = firstName;
            account[ContractAccount.LAST_NAME]         = lastName;
            account[ContractAccount.EMAIL]             = email;
            account[ContractAccount.COMPANY_NAME]      = companyName;
            account[ContractAccount.ADDRESS]           = address;
            account[ContractAccount.CITY]              = city;
            account[ContractAccount.COUNTRY]           = country;
            account[ContractAccount.STATE]             = state;
            account[ContractAccount.ZIP]               = zip;
            account[ContractAccount.PHONE_NUMBER]      = phoneNumber;
            account[ContractAccount.FAX_NUMBER]        = faxNumber;
            account[ContractAccount.INSTANT_MESSENGER] = instantMessenger;
            account[ContractAccount.MAIL_FORMAT]       = mailFormat;
            //
            return(account);
        }
Esempio n. 15
0
 public static GenericResult AddContract(ContractAccount accountSettings)
 {
     return(EC.Services.Storefront.AddContract(ecPanelRequest.ResellerId, accountSettings));
 }
Esempio n. 16
0
        public static GenericResult AddContract(int resellerId, ContractAccount accountSettings)
        {
            try
            {
                ES.SecurityContext.SetThreadPrincipal(resellerId);
                //
                ES.TaskManager.StartTask(SystemTasks.SOURCE_ECOMMERCE, SystemTasks.TASK_ADD_CONTRACT);
                //
                GenericResult result = new GenericResult();
				//
				int customerId = -1;
				int contractStatus = (int)ContractStatus.Pending;
				//
				if (accountSettings.PropertyExists(ContractAccount.CUSTOMER_ID))
				{
					customerId = accountSettings.GetProperty<int>(ContractAccount.CUSTOMER_ID);
					//
					contractStatus = (int)ContractStatus.Active;
				}

				// Ensure customer not specified and then check requested username availability
				if (customerId == -1)
				{
					if (ES.UserController.UserExists(accountSettings[ContractAccount.USERNAME]))
					{
						result.Succeed = false;
						result.SetProperty("ResultCode", ES.BusinessErrorCodes.ERROR_USER_ALREADY_EXISTS);
						return result;
					}
					// EXIT
				}
				//
                string strNames = null;
				string strValues = null;
				//
				if (customerId == -1)
				{
					strNames = strValues = String.Empty;
					SecurityUtils.SerializeGenericProfile(ref strNames, ref strValues, accountSettings);
				}
                // emit the new contract
                string contractId = EcommerceProvider.AddContract(customerId, resellerId, accountSettings[ContractAccount.USERNAME],
					contractStatus, 0m, accountSettings[ContractAccount.FIRST_NAME], accountSettings[ContractAccount.LAST_NAME],
                    accountSettings[ContractAccount.EMAIL], accountSettings[ContractAccount.COMPANY_NAME],
                    strNames, strValues);
                //
                result.Succeed = true;
                result.SetProperty("ContractId", contractId);
                // Add contract object
                ES.TaskManager.TaskParameters[SystemTaskParams.PARAM_CONTRACT] = GetContract(contractId);
                //
                return result;
            }
            catch (Exception ex)
            {
                throw ES.TaskManager.WriteError(ex);
            }
            finally
            {
                ES.TaskManager.CompleteTask();
            }
        }
Esempio n. 17
0
        public static ContractAccount GetContractAccountSettings(string contractId, bool internally)
        {
            //
            ContractAccount account = new ContractAccount();
            //
            IDataReader dr = null;
            //
            try
            {
                int customerId = -1;
                dr = EcommerceProvider.GetContract(contractId);
                //
                if (dr.Read())
                {
                    string propertyNames = Convert.ToString(dr["PropertyNames"]);
                    string propertyValues = Convert.ToString(dr["PropertyValues"]);
                    if (dr["CustomerID"] != DBNull.Value)
                        customerId = Convert.ToInt32(dr["CustomerID"]);
                    else
                        SecurityUtils.DeserializeGenericProfile(propertyNames, propertyValues, account);
                }
                //
                if (customerId > -1)
                {
					ES.UserInfo userInfo = (internally) ? ES.UserController.GetUserInternally(customerId) : 
						ES.UserController.GetUser(customerId);
					//
					if (internally)
						account[ContractAccount.PASSWORD] = userInfo.Password;
					//
                    account[ContractAccount.USERNAME] = userInfo.Username;
                    account[ContractAccount.FIRST_NAME] = userInfo.FirstName;
                    account[ContractAccount.LAST_NAME] = userInfo.LastName;
                    account[ContractAccount.EMAIL] = userInfo.Email;
                    account[ContractAccount.COMPANY_NAME] = userInfo.CompanyName;
                    account[ContractAccount.COUNTRY] = userInfo.Country;
                    account[ContractAccount.CITY] = userInfo.City;
                    account[ContractAccount.ADDRESS] = userInfo.Address;
                    account[ContractAccount.FAX_NUMBER] = userInfo.Fax;
                    account[ContractAccount.INSTANT_MESSENGER] = userInfo.InstantMessenger;
                    account[ContractAccount.PHONE_NUMBER] = userInfo.PrimaryPhone;
                    account[ContractAccount.STATE] = userInfo.State;
                    account[ContractAccount.ZIP] = userInfo.Zip;
                    account[ContractAccount.MAIL_FORMAT] = userInfo.HtmlMail ? "HTML" : "PlainText";
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dr != null)
                    dr.Close();
            }
            //
            return account;
        }
Esempio n. 18
0
 public static GenericResult AddContract(int resellerId, ContractAccount accountSettings)
 {
     return(EC.Services.Storefront.AddContract(resellerId, accountSettings));
 }
Esempio n. 19
0
        public static GenericResult AddContract(int resellerId, ContractAccount accountSettings)
        {
            try
            {
                ES.SecurityContext.SetThreadPrincipal(resellerId);
                //
                ES.TaskManager.StartTask(SystemTasks.SOURCE_ECOMMERCE, SystemTasks.TASK_ADD_CONTRACT);
                //
                GenericResult result = new GenericResult();
                //
                int customerId     = -1;
                int contractStatus = (int)ContractStatus.Pending;
                //
                if (accountSettings.PropertyExists(ContractAccount.CUSTOMER_ID))
                {
                    customerId = accountSettings.GetProperty <int>(ContractAccount.CUSTOMER_ID);
                    //
                    contractStatus = (int)ContractStatus.Active;
                }

                // Ensure customer not specified and then check requested username availability
                if (customerId == -1)
                {
                    if (ES.UserController.UserExists(accountSettings[ContractAccount.USERNAME]))
                    {
                        result.Succeed = false;
                        result.SetProperty("ResultCode", ES.BusinessErrorCodes.ERROR_USER_ALREADY_EXISTS);
                        return(result);
                    }
                    // EXIT
                }
                //
                string strNames  = null;
                string strValues = null;
                //
                if (customerId == -1)
                {
                    strNames = strValues = String.Empty;
                    SecurityUtils.SerializeGenericProfile(ref strNames, ref strValues, accountSettings);
                }
                // emit the new contract
                string contractId = EcommerceProvider.AddContract(customerId, resellerId, accountSettings[ContractAccount.USERNAME],
                                                                  contractStatus, 0m, accountSettings[ContractAccount.FIRST_NAME], accountSettings[ContractAccount.LAST_NAME],
                                                                  accountSettings[ContractAccount.EMAIL], accountSettings[ContractAccount.COMPANY_NAME],
                                                                  strNames, strValues);
                //
                result.Succeed = true;
                result.SetProperty("ContractId", contractId);
                // Add contract object
                ES.TaskManager.TaskParameters[SystemTaskParams.PARAM_CONTRACT] = GetContract(contractId);
                //
                return(result);
            }
            catch (Exception ex)
            {
                throw ES.TaskManager.WriteError(ex);
            }
            finally
            {
                ES.TaskManager.CompleteTask();
            }
        }
Esempio n. 20
0
        public void RegisterDomain(DomainNameSvc domainSvc, ContractAccount accountInfo, string[] nameServers)
        {
            AddParam("Command", "Purchase");
            // as per Enom API reference this parameter use is recommended in production mode
            // as it uses a queued order peorcessing instead of real-time.
            AddParam("QueueOrder", "1");

            string domainName = GetDomainName(domainSvc.Fqdn);
            string domainTld  = GetDomainTLD(domainSvc.Fqdn);

            // add domain
            AddParam("SLD", domainName);
            AddParam("TLD", domainTld);
            AddParam("NumYears", domainSvc.PeriodLength.ToString());

            if (LiveMode && (nameServers != null && nameServers.Length > 0))
            {
                // load name servers
                for (int i = 0; i < nameServers.Length; i++)
                {
                    AddParam(String.Concat("NS", i + 1), nameServers[i].Trim());
                }
            }
            else
            {
                // use Enom's name servers
                AddParam("UseDNS", "default");
            }

            if (domainSvc.Fqdn.EndsWith(".uk"))
            {
                // special stub for org.uk and org.uk domains
                // org.uk and co.uk tlds should have at least 2 NS
                if (nameServers != null && nameServers.Length == 1)
                {
                    // we already have first ns added
                    // so push the second ns
                    AddParam("NS2", nameServers[0].Trim());
                }
                AddParam("registered_for", domainSvc["RegisteredFor"]);
                AddParam("uk_legal_type", domainSvc["UK_LegalType"]);
                AddParam("uk_reg_co_no", domainSvc["UK_CompanyIdNumber"]);
                AddParam("uk_reg_opt_out", domainSvc["HideWhoisInfo"]);
            }
            // us TLDs extensions
            else if (domainSvc.Fqdn.EndsWith(".us"))
            {
                AddParam("global_cc_us", accountInfo[ContractAccount.COUNTRY]);
                AddParam("us_nexus", domainSvc["NexusCategory"]);
                AddParam("us_purpose", domainSvc["ApplicationPurpose"]);
            }
            // eu TLDs extensions
            else if (domainSvc.Fqdn.EndsWith(".eu"))
            {
                AddParam("eu_whoispolicy", domainSvc["EU_WhoisPolicy"]);
                AddParam("eu_agreedelete", domainSvc["EU_AgreeDelete"]);
                AddParam("eu_adr_lang", domainSvc["EU_ADRLang"]);
                //
                AddParam("AdminOrganizationName", accountInfo[ContractAccount.COMPANY_NAME]);
                AddParam("AdminFirstName", accountInfo[ContractAccount.FIRST_NAME]);
                AddParam("AdminLastName", accountInfo[ContractAccount.LAST_NAME]);
                AddParam("AdminAddress1", accountInfo[ContractAccount.ADDRESS]);
                AddParam("AdminAddress2", accountInfo[ContractAccount.ADDRESS]);
                AddParam("AdminCity", accountInfo[ContractAccount.CITY]);
                AddParam("AdminStateProvinceChoice", "P");
                AddParam("AdminProvince", accountInfo[ContractAccount.STATE]);
                AddParam("AdminPostalCode", accountInfo[ContractAccount.ZIP]);
                AddParam("AdminCountry", accountInfo[ContractAccount.COUNTRY]);
                AddParam("AdminEmailAddress", accountInfo[ContractAccount.EMAIL]);
                AddParam("AdminPhone", accountInfo[ContractAccount.PHONE_NUMBER]);
                AddParam("AdminFax", accountInfo[ContractAccount.FAX_NUMBER]);
                AddParam("AdminJobTitle", "Administrator");
                AddParam("RegistrantJobTitle", "Registrant");
            }

            AddParam("UseCreditCard", "no");
            AddParam("RegistrantFirstName", accountInfo[ContractAccount.FIRST_NAME]);
            AddParam("RegistrantLastName", accountInfo[ContractAccount.LAST_NAME]);
            AddParam("RegistrantAddress1", accountInfo[ContractAccount.ADDRESS]);
            AddParam("RegistrantCity", accountInfo[ContractAccount.CITY]);
            AddParam("RegistrantEmailAddress", accountInfo[ContractAccount.EMAIL]);
            AddParam("RegistrantPhone", accountInfo[ContractAccount.PHONE_NUMBER]);
            AddParam("RegistrantCountry", accountInfo[ContractAccount.COUNTRY]);
            AddParam("RegistrantStateProvince", accountInfo[ContractAccount.STATE]);
            AddParam("RegistrantPostalCode", accountInfo[ContractAccount.ZIP]);

            //}

            // unlock registrar

            /*if (domainSvc["LockRegistrar"] == "0")
             *      AddParam("UnLockRegistrar", "1");*/

            // load contacts
            //AddCustomerContacts(contacts);

            // return enom result
            EnomResult enomResult = new EnomResult(
                ExecuteCommand()
                );

            // throws an exception
            if (!enomResult.Succeed)
            {
                RaiseRegistrarException(enomResult);
            }

            // if something wrong was happend then throws an exception
            if (enomResult["RRPCode"] != "200")
            {
                throw new Exception(
                          "Reason Code: " + enomResult["RRPCode"] + "; Description: " + enomResult["RRPText"]
                          );
            }
            // copy order if
            domainSvc["OrderID"] = enomResult["OrderID"];

            //PushDomainToSubAccount(args);
        }
Esempio n. 21
0
        public void RegisterDomain(DomainNameSvc domainSvc, ContractAccount accountInfo, string[] nameServers)
        {
            int customerId = 0;

            // 1. check customer exists
            if (CheckSubAccountExists(accountInfo[ContractAccount.EMAIL]))
            {
                customerId = GetCustomerAccountId(accountInfo[ContractAccount.EMAIL]);
            }
            else
            {
                customerId = CreateCustomerAccount(accountInfo);
            }

            // obtain default contact id
            int contactId = GetDefaultContactId(customerId);

            // check for demo mode if so then set demo-nameservers.
            if (!LiveMode)
            {
                nameServers = new string[] { "ns1.onlyfordemo.net", "ns2.onlyfordemo.net" }
            }
            ;

            // fill parameters hashtable
            Hashtable domainHash = new Hashtable();

            // copy domain name
            domainHash[domainSvc.Fqdn] = domainSvc.PeriodLength.ToString();
            // setup service url
            OrderBoxDomainsLib.APIKit.Properties.Url = ServiceUrl;
            // init domain order api
            OrderBoxDomainsLib.DomOrder domOrder = new OrderBoxDomainsLib.DomOrder();

            //
            int validateAttempts = 0;

VALIDATE_REGISTRATION:
            // validate params
            Hashtable valResult = domOrder.validateDomainRegistrationParams(Username, Password, RESELLER_ROLE, SERVICE_LANGUAGE,
                                                                            ParentId, domainHash, new ArrayList(nameServers), contactId, contactId, contactId,
                                                                            contactId, customerId, NO_INVOICE);

            // get domain name hashtable
            valResult = (Hashtable)valResult[domainSvc.Fqdn];
            // check validation status
            if ((String)valResult[STATUS] == "error")
            {
                // try to update extended contact fields and re-validate params
                if (validateAttempts == 0 && domainSvc.Fqdn.EndsWith(".us"))
                {
                    validateAttempts++;
                    //
                    OrderBoxDomainsLib.DomContactExt contactExt = new DomContactExt();
                    // fill extension hash
                    Hashtable exthash = new Hashtable();
                    Hashtable domus   = new Hashtable();
                    domus["nexusCategory"]      = domainSvc["NexusCategory"];
                    domus["applicationPurpose"] = domainSvc["ApplicationPurpose"];
                    exthash["domus"]            = domus;
                    // set default contact extensions
                    bool succeed = contactExt.setContactDetails(Username, Password, RESELLER_ROLE, SERVICE_LANGUAGE,
                                                                ParentId, contactId, exthash, "domus");
                    // check result
                    if (succeed)
                    {
                        goto VALIDATE_REGISTRATION;
                    }
                }
                //
                throw new Exception((String)valResult[ERROR]);
            }

            // register domain
            Hashtable orderResult = domOrder.addWithoutValidation(Username, Password, RESELLER_ROLE, SERVICE_LANGUAGE,
                                                                  ParentId, domainHash, new ArrayList(nameServers), contactId, contactId, contactId,
                                                                  contactId, customerId, NO_INVOICE);

            // switch to the nested data bunch
            orderResult = (Hashtable)orderResult[domainSvc.Fqdn];

            // check returned status
            switch ((String)orderResult[STATUS])
            {
            case "error":                     // error
                throw new Exception(Convert.ToString(orderResult[ERROR]));

            case "Failed":                     // error
                throw new Exception(Convert.ToString(orderResult[ACTION_STATUS_DESC]));

            case "Success":                     // success
            case "InvoicePaid":                 // success
                // we are success so copy order number
                domainSvc[EAQID]     = Convert.ToString(orderResult[EAQID]);
                domainSvc[ENTITY_ID] = Convert.ToString(orderResult[ENTITY_ID]);
                break;
            }
        }
Esempio n. 22
0
        public static ContractAccount GetContractAccountSettings(string contractId, bool internally)
        {
            //
            ContractAccount account = new ContractAccount();
            //
            IDataReader dr = null;

            //
            try
            {
                int customerId = -1;
                dr = EcommerceProvider.GetContract(contractId);
                //
                if (dr.Read())
                {
                    string propertyNames  = Convert.ToString(dr["PropertyNames"]);
                    string propertyValues = Convert.ToString(dr["PropertyValues"]);
                    if (dr["CustomerID"] != DBNull.Value)
                    {
                        customerId = Convert.ToInt32(dr["CustomerID"]);
                    }
                    else
                    {
                        SecurityUtils.DeserializeGenericProfile(propertyNames, propertyValues, account);
                    }
                }
                //
                if (customerId > -1)
                {
                    ES.UserInfo userInfo = (internally) ? ES.UserController.GetUserInternally(customerId) :
                                           ES.UserController.GetUser(customerId);
                    //
                    if (internally)
                    {
                        account[ContractAccount.PASSWORD] = userInfo.Password;
                    }
                    //
                    account[ContractAccount.USERNAME]          = userInfo.Username;
                    account[ContractAccount.FIRST_NAME]        = userInfo.FirstName;
                    account[ContractAccount.LAST_NAME]         = userInfo.LastName;
                    account[ContractAccount.EMAIL]             = userInfo.Email;
                    account[ContractAccount.COMPANY_NAME]      = userInfo.CompanyName;
                    account[ContractAccount.COUNTRY]           = userInfo.Country;
                    account[ContractAccount.CITY]              = userInfo.City;
                    account[ContractAccount.ADDRESS]           = userInfo.Address;
                    account[ContractAccount.FAX_NUMBER]        = userInfo.Fax;
                    account[ContractAccount.INSTANT_MESSENGER] = userInfo.InstantMessenger;
                    account[ContractAccount.PHONE_NUMBER]      = userInfo.PrimaryPhone;
                    account[ContractAccount.STATE]             = userInfo.State;
                    account[ContractAccount.ZIP]         = userInfo.Zip;
                    account[ContractAccount.MAIL_FORMAT] = userInfo.HtmlMail ? "HTML" : "PlainText";
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dr != null)
                {
                    dr.Close();
                }
            }
            //
            return(account);
        }
Esempio n. 23
0
 public void RenewDomain(DomainNameSvc domainSvc, ContractAccount accountInfo, string[] nameServers)
 {
     domainSvc["OrderID"] = DateTime.Now.ToString("yyyy-MM-dd") + "-" + domainSvc.Fqdn;
 }