Exemplo n.º 1
0
        //public void SaveUserToTurboTick(TurnKeyBrokerSignUpDataContext dataContext, RegistrationInfo info)
        //{
        //    if (dataContext == null)
        //        dataContext = new TurnKeyBrokerSignUpDataContext();

        //    var _account = (from s in dataContext.tb_accounts
        //                        //  where s.email_address == info.EmailAddress
        //                    where s.account_id == info.AccountId
        //                      && s.active == true
        //                    select s).FirstOrDefault();

        //    if (_account != null)
        //    {
        //        tb_address address = GetAddress(dataContext, info.AccountId, "Permanent");

        //        string state = string.Empty;
        //        if (address.country_id == 1)
        //        {
        //            var states = (from s in dataContext.tb_states
        //                          where s.state_id == int.Parse(address.state)
        //                          && s.active == true
        //                          select s).FirstOrDefault();
        //            if (states != null)
        //                state = states.state_initial;
        //        }
        //        else
        //        {
        //            state = address.state;
        //        }


        //        string valid = "";
        //        string managerUsername = System.Configuration.ConfigurationManager.AppSettings["TurboTickDemoManagerUsername"].ToString();
        //        string managerPassword = System.Configuration.ConfigurationManager.AppSettings["TurboTickDemoManagerPassword"].ToString();

        //        valid = SingleSignOnLib.SingleSignOnOverHttp.RequestManagerLogin(managerUsername, managerPassword, SingleSignOnClien.Web.Common.TurboTickSingleSignOn);

        //        if (valid.ToLower().Equals("yes"))
        //        {
        //            SingleSignOnLib.SingleSignOnUser newUser = new SingleSignOnLib.SingleSignOnUser();
        //            SingleSignOnLib.SingleSignOnAccount account = new SingleSignOnLib.SingleSignOnAccount();
        //            newUser.DisableUser = "******";
        //            newUser.Email = _account.email_address;
        //            newUser.Firstname = address.first_name;
        //            newUser.Lastname = address.last_name;
        //            newUser.Password = _account.password;//SingleSignOnLib.SHA.EncryptSHA256(_account.password);
        //            newUser.Phone = address.work_phone;
        //            newUser.DisableUser = "******";
        //            newUser.WebEdition = "true";
        //            newUser.DesktopEdition = "true";
        //            newUser.IsUpdate = false;
        //            newUser.Username = _account.customer_id;
        //            account.Account = _account.customer_id;
        //            account.City = address.city;
        //            account.FirstName = address.first_name;
        //            account.LastName = address.last_name;
        //            account.Address = address.address_1;
        //            account.BPMultiplier = int.Parse(System.Configuration.ConfigurationManager.AppSettings["txtBPMultiplier"].ToString());
        //            account.MarginBuyingPower = decimal.Parse(System.Configuration.ConfigurationManager.AppSettings["txtBuyingPower"].ToString());
        //            account.MasterAccount = "XXXXXXXX";
        //            account.MaximumOrderSize = int.Parse(System.Configuration.ConfigurationManager.AppSettings["txtAccMaxOrderSize"].ToString());
        //            account.OptionsTrading = "true";
        //            account.RoutingCommisionType = System.Configuration.ConfigurationManager.AppSettings["txtAccRoutingComissionTypes"].ToString();
        //            account.State = state;
        //            account.TradingSuspended = "false";

        //            account.Zip = address.zipcode;
        //            newUser.Account = account;
        //            newUser.MobileEdition = "true";
        //            newUser.WebEditionPro = "true";
        //            account.Equity = 0;
        //            account.NightBuyingPower = 0;
        //            if (SingleSignOnLib.SingleSignOnOverHttp.SendNewSingleSignOnUser(SingleSignOnClien.Web.Common.TurboTickSingleSignOn + "?usercreation=1&managerName=" + System.Configuration.ConfigurationManager.AppSettings["TurboTickDemoManagerUsername"].ToString(), System.Configuration.ConfigurationManager.AppSettings["TurboTickDemoManagerUsername"].ToString(), newUser).Equals("success"))
        //            {
        //                _account.turbo_tick_log = string.Format("User '{0}' with account '{1}' was created. Operation succeeded!", newUser.Username, account.Account);
        //                dataContext.SubmitChanges();
        //            }
        //            else
        //            {
        //                _account.turbo_tick_log = "Operation failed! Please retry the operation";
        //                dataContext.SubmitChanges();
        //            }


        //        }
        //    }

        //}

        public void SaveUserToPortal(TurnKeyBrokerSignUpDataContext dataContext, RegistrationInfo info, string StoreURI)

        {
            if (dataContext == null)
            {
                dataContext = new TurnKeyBrokerSignUpDataContext();
            }

            var account = (from s in dataContext.tb_accounts
                           // where s.email_address == info.EmailAddress
                           where s.account_id == info.AccountId

                           && s.active == true
                           select s).FirstOrDefault();

            if (account != null)
            {
                tb_address address = GetAddress(dataContext, info.AccountId, "Permanent");
                string     tradeZeroApplicationId = dataContext.aspnet_Applications.Where(a => a.ApplicationName == "tradezero").FirstOrDefault().ApplicationId.ToString();

                if (!string.IsNullOrEmpty(tradeZeroApplicationId))
                {
                    using (System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["TradeZeroSQLProvider"].ConnectionString))
                    {
                        string strUserCreateUser = "******" + tradeZeroApplicationId + "','" + account.customer_id + "',0,'" + DateTime.Now.Date.ToString("yyyy-MM-dd HH:mm:ss") + "','" + Guid.NewGuid() + "'";
                        conn.Open();
                        System.Data.SqlClient.SqlCommand command = new System.Data.SqlClient.SqlCommand();
                        command.CommandType = System.Data.CommandType.Text;
                        command.Connection  = conn;
                        command.CommandText = strUserCreateUser;
                        command.ExecuteNonQuery();

                        Guid   guidNewUserId = dataContext.aspnet_Users.Where(u => u.UserName == account.customer_id).FirstOrDefault().UserId;
                        string newUserID     = guidNewUserId.ToString();

                        store_base sb      = dataContext.store_bases.Where(_sb => _sb.name == StoreURI).FirstOrDefault();
                        int        storeId = 1;
                        if (sb != null)
                        {
                            storeId = sb.storeId;
                        }

                        var _aspNetUser = dataContext.aspnet_Users.Where(a => a.UserId == guidNewUserId).FirstOrDefault();
                        if (_aspNetUser != null)
                        {
                            _aspNetUser.storeId = storeId;
                            dataContext.SubmitChanges();
                        }

                        var emailAddress = account.email_address.Replace("@", "_" + account.customer_id + "@");
                        if (!string.IsNullOrEmpty(newUserID))
                        {
                            string strMembershipCreateUser = "******" + account.customer_id + "','" + account.password + "','1234','" + emailAddress + "',NULL,NULL,1,'" + DateTime.Now.Date.ToString("yyyy-MM-dd HH:mm:ss") + "','" + DateTime.Now.Date.ToString("yyyy-MM-dd HH:mm:ss") + "',1,0,'" + newUserID + "'";
                            command.CommandText = strMembershipCreateUser;
                            command.Connection  = conn;
                            command.CommandType = System.Data.CommandType.Text;
                            command.ExecuteNonQuery();
                        }
                        command.Dispose();
                        conn.Close();
                    }
                }
            }
        }
Exemplo n.º 2
0
        public bool SaveAddress(TurnKeyBrokerSignUpDataContext dataContext, RegistrationInfo info, string type, string title, string first_name, string last_name, string middle_name, string suffix, string address_1, string address_2,
                                string city, int stateId, string otherState, string zipCode, int countryId, bool is_address_last_one_year, int martial_status_id, string work_phone, string num_dependents, bool isCoApplicant, string business_tel, string fax, bool isDebug)
        {
            try
            {
                int update = 0;
                if (dataContext == null)
                {
                    dataContext = new TurnKeyBrokerSignUpDataContext();
                }
                var accTypeId  = GetAddressType(dataContext, type);
                var tb_address = dataContext.tb_addresses.Where(t => t.account_id == info.AccountId && t.address_type_id == accTypeId).FirstOrDefault();

                tb_address address;
                if (tb_address != null)
                {
                    if (info.AccountType == 2)
                    {
                        if (isCoApplicant == true)
                        {
                            address = new tb_address();
                        }
                        else
                        {
                            address = tb_address;
                            update  = 1;
                        }
                    }
                    else
                    {
                        address = tb_address;
                        update  = 1;
                    }
                }
                else
                {
                    address = new tb_address();
                }
                address.account_id         = info.AccountId;
                address.address_type_id    = accTypeId;
                address.title              = title;
                address.first_name         = first_name;
                address.last_name          = last_name;
                address.middle_name        = middle_name;
                address.suffix             = suffix;
                address.address_1          = address_1;
                address.address_2          = address_2;
                address.city               = city;
                address.business_telephone = business_tel;
                address.fax = fax;
                if (countryId == 1)
                {
                    address.state = stateId.ToString();
                }
                else
                {
                    address.state = otherState;
                }

                address.zipcode    = zipCode;
                address.country_id = countryId;
                address.is_address_last_one_year = is_address_last_one_year;
                address.martial_status_id        = martial_status_id;
                address.work_phone     = work_phone;
                address.num_dependents = num_dependents;
                address.email_address  = info.EmailAddress;
                address.date_created   = DateTime.Now;
                address.is_coapplicant = isCoApplicant;
                if (update == 0)
                {
                    dataContext.tb_addresses.InsertOnSubmit(address);
                    dataContext.SubmitChanges();
                }
                else
                {
                    if (!isDebug)
                    {
                        dataContext.SubmitChanges();
                    }
                    //dataContext.SubmitChanges();
                }


                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Exemplo n.º 3
0
        public void SaveEmploymentDetails(TurnKeyBrokerSignUpDataContext dataContext, RegistrationInfo info, int address_id, int employmentStatus, string employmentStatusOther, string jobTitle, string jobOccupation, string employerName, string yearsWithEmployer, bool isCoApplicant, bool isDebug)
        {
            if (dataContext == null)
            {
                dataContext = new TurnKeyBrokerSignUpDataContext();
            }
            int update = 0;
            tb_employementstatus employment_status;
            var tb_employeestatus = dataContext.tb_employementstatus.Where(t => t.account_id == info.AccountId).FirstOrDefault();

            if (tb_employeestatus != null)
            {
                if (isCoApplicant == true)
                {
                    employment_status = new tb_employementstatus();
                    employment_status.is_coapplicant = false;
                }
                else
                {
                    update            = 1;
                    employment_status = tb_employeestatus;
                    employment_status.is_coapplicant = isCoApplicant;
                }
            }
            else
            {
                employment_status = new tb_employementstatus();
            }

            employment_status.account_id               = info.AccountId;
            employment_status.business_address_id      = address_id;
            employment_status.employment_status_id     = employmentStatus;
            employment_status.employement_status_other = employmentStatusOther;
            employment_status.job_title             = jobTitle;
            employment_status.occupation            = jobOccupation;
            employment_status.employer              = employerName;
            employment_status.years_with_employment = yearsWithEmployer;

            if (update == 0)
            {
                dataContext.tb_employementstatus.InsertOnSubmit(employment_status);
            }

            if (!isDebug)
            {
                dataContext.SubmitChanges();
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// This method will send reset password email
        /// </summary>
        /// <param name="dataContext"></param>
        /// <param name="acc"></param>
        /// <returns></returns>
        public int SendResetPasswordEmail(TurnKeyBrokerSignUpDataContext dataContext, RegistrationInfo info)  //tb_account acc
        {
            var activeStore = dataContext.store_bases.FirstOrDefault(t => t.storeId == 1);
            int msgId       = 1;

            if (dataContext == null)
            {
                dataContext = new TurnKeyBrokerSignUpDataContext();
            }
            try
            {
                emailTemplate em = dataContext.emailTemplates.Where(e => e.storeId == activeStore.storeId && e.templateName == "NEWACCOUNT").FirstOrDefault();
                //var accountLst = dataContext.tb_accounts.Where(a => a.storeURI == regModel.activeStore.uri && a.email_address == acc.email_address && (a.Completed.HasValue && a.Completed.Value)).ToList();
                var accountLst = dataContext.tb_accounts.Where(a => a.storeURI == activeStore.uri && a.account_id == info.AccountId && (a.Completed.HasValue && a.Completed.Value)).ToList();
                foreach (var account in accountLst)
                {
                    var addresses      = dataContext.tb_addresses.Where(add => add.account_id == account.account_id);
                    var primaryAddress = addresses.Where(add => add.address_type_id == 1).FirstOrDefault();

                    if (em != null && account != null && addresses != null && primaryAddress != null)
                    {
                        string emailSubject = "Tradezero password reset (Customer Id=" + account.customer_id + ")";
                        string emailBody    = em.emailBody;

                        string firmAddress = string.Empty;
                        var    url         = ConfigurationManager.AppSettings["WebURL"].ToString();
                        firmAddress = string.IsNullOrEmpty(activeStore.address1) ? string.Empty : activeStore.address1 + "<br/>";
                        firmAddress = firmAddress + (string.IsNullOrEmpty(activeStore.address2) ? string.Empty : activeStore.address2 + "<br/>");
                        firmAddress = firmAddress + (string.IsNullOrEmpty(activeStore.city) ? string.Empty : activeStore.city + " ");
                        firmAddress = firmAddress + (string.IsNullOrEmpty(activeStore.state) ? string.Empty : activeStore.state + " ");
                        firmAddress = firmAddress + (string.IsNullOrEmpty(activeStore.zipcode) ? string.Empty : activeStore.zipcode + " ");

                        emailBody = string.Format("Hi {0},", primaryAddress.first_name);
                        emailBody = emailBody + "<br/>Your username: "******"<br/>";
                        emailBody = emailBody + "<br/><br/>Someone recently requested a password change for your tradezero account. If this was you, you can set a new password ";
                        emailBody = emailBody + string.Format("<a href='{0}{1}' > here. </a>", url, "Home/ResetPassword?AccId=" + HttpUtility.HtmlEncode(primaryAddress.account_id.ToString()) + "");
                        emailBody = emailBody + "<br/><br/>If you don't want to change your password or didn't request this, just ignore and delete this message";

                        emailBody = emailBody + "<br/><br/>To keep your account secure, please don't forward this email to anyone.";
                        emailBody = emailBody + "<br/><br/>Thanks!";
                        int    EmailLogID = TurnKeyBrokerSignUp.WebUI.Services.EmailHelper.AddToEmailQueue(activeStore.uri, em.fromName, em.fromEmail, primaryAddress.first_name + " " + primaryAddress.last_name, account.email_address, em.ccEmail, em.bccEmail, emailSubject, emailBody);
                        string message    = TurnKeyBrokerSignUp.WebUI.Services.EmailHelper.SendEmail(em.fromName, em.fromEmail, primaryAddress.first_name + " " + primaryAddress.last_name, account.email_address, em.ccEmail, em.bccEmail, emailSubject, emailBody, em.isHtml);
                        if (!message.ToLower().Contains("ok"))
                        {
                            msgId = 0;
                        }
                        if (EmailLogID > 0)
                        {
                            TurnKeyBrokerSignUp.WebUI.Services.EmailHelper.UpdateEmailQueueStatus(EmailLogID, message.Trim().ToUpper().Equals("OK"), message);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Elmah.ErrorLog.GetDefault(System.Web.HttpContext.Current).Log(new Elmah.Error(ex, System.Web.HttpContext.Current));
            }
            return(msgId);
        }
Exemplo n.º 5
0
        public void SendThankYouEmail1(TurnKeyBrokerSignUpDataContext dataContext, RegistrationInfo info)
        {
            var activeStore = dataContext.store_bases.FirstOrDefault(t => t.storeId == 1);
            // tb_account account = dataContext.store_bases.Where(a => a.storeURI == uri && a.account_id == info.AccountId).FirstOrDefault();
            string uri = "TradeZero";

            if (dataContext == null)
            {
                dataContext = new TurnKeyBrokerSignUpDataContext();
            }
            string        email_id = "";
            emailTemplate em;
            string        fullName = string.Empty;
            tb_account    account  = dataContext.tb_accounts.Where(a => a.storeURI == activeStore.uri && a.account_id == info.AccountId).FirstOrDefault();//regModel.activeStore.uri

            if (account.trading_type == "Bitcoin")
            {
                em = dataContext.emailTemplates.Where(e => e.storeId == activeStore.storeId && e.templateName == "New Bitcoin Account").FirstOrDefault();//regModel.activeStore.storeId
            }
            else
            {
                em = dataContext.emailTemplates.Where(e => e.storeId == activeStore.storeId && e.templateName == "NEWACCOUNT").FirstOrDefault();//regModel.activeStore.storeId
            }
            var        addresses = dataContext.tb_addresses.Where(add => add.account_id == account.account_id);
            tb_address primaryAddress;

            if (account.account_type_id == 3)
            {
                primaryAddress = addresses.Where(add => add.address_type_id == 1 && add.is_coapplicant == true).FirstOrDefault();
                email_id       = account.email_address;
            }
            else
            {
                primaryAddress = addresses.Where(add => add.address_type_id == 1).FirstOrDefault();
                email_id       = account.email_address;
            }
            if (em != null && account != null && addresses != null && primaryAddress != null)
            {
                int templateID = em.emailTemplateId;

                string emailSubject = em.emailSubject;
                string emailBody    = em.emailBody;

                string firmAddress = string.Empty;

                firmAddress = string.IsNullOrEmpty(activeStore.address1) ? string.Empty : activeStore.address1 + "<br/>";
                firmAddress = firmAddress + (string.IsNullOrEmpty(activeStore.city) ? string.Empty : activeStore.city + " ");
                firmAddress = firmAddress + (string.IsNullOrEmpty(activeStore.state) ? string.Empty : activeStore.state + " ");
                firmAddress = firmAddress + (string.IsNullOrEmpty(activeStore.zipcode) ? string.Empty : activeStore.zipcode + " ");

                emailBody = emailBody.Replace("[FNAME]", primaryAddress.first_name);
                emailBody = emailBody.Replace("[LNAME]", primaryAddress.last_name);
                emailBody = emailBody.Replace("[FIRM]", activeStore.storeDisplayName);
                emailBody = emailBody.Replace("[ACCOUNT]", account.customer_id);
                emailBody = emailBody.Replace("[FIRM ADDRESS]", firmAddress);
                emailBody = emailBody.Replace("[FIRM CUSTOMER SERVICE NUMBER]", (string.IsNullOrEmpty(activeStore.contactPhone) ? "" : activeStore.contactPhone));

                int    EmailLogID = TurnKeyBrokerSignUp.WebUI.Services.EmailHelper.AddToEmailQueue(activeStore.uri, em.fromName, em.fromEmail, primaryAddress.first_name + " " + primaryAddress.last_name, email_id, em.ccEmail, em.bccEmail, emailSubject, emailBody);
                string message    = TurnKeyBrokerSignUp.WebUI.Services.EmailHelper.SendEmail(em.fromName, em.fromEmail, primaryAddress.first_name + " " + primaryAddress.last_name, email_id, em.ccEmail, em.bccEmail, emailSubject, emailBody, em.isHtml);

                if (EmailLogID > 0)
                {
                    TurnKeyBrokerSignUp.WebUI.Services.EmailHelper.UpdateEmailQueueStatus(EmailLogID, message.Trim().ToUpper().Equals("OK"), message);
                }
            }
        }
Exemplo n.º 6
0
        /// This method will create user in trade reporting api
        /// <param name="affiliateType"></param>
        /// <param name="ipAddress"></param>
        /// </summary>
        /// <returns>bool</returns>
        public void SaveToExternalService(TurnKeyBrokerSignUpDataContext dataContext, RegistrationInfo info)
        {
            var activeStore = dataContext.store_bases.FirstOrDefault(t => t.storeId == 1);

            if (dataContext == null)
            {
                dataContext = new TurnKeyBrokerSignUpDataContext();
            }
            var account = (from s in dataContext.tb_accounts
                           where s.account_id == info.AccountId &&
                           s.active == true
                           select s).FirstOrDefault();

            if (account != null)
            {
                var configTradingServiceURL = (from s in dataContext.tb_settings
                                               where s.key == "ServiceTradingServiceURL" &&
                                               s.active == true &&
                                               s.storeId == 1
                                               select s).FirstOrDefault();

                var configTradingServiceUsername = (from s in dataContext.tb_settings
                                                    where s.key == "ServiceTradingUsername" &&
                                                    s.active == true &&
                                                    s.storeId == 1
                                                    select s).FirstOrDefault();
                var configTradingServicePassword = (from s in dataContext.tb_settings
                                                    where s.key == "ServiceTradingPassword" &&
                                                    s.storeId == 1 &&
                                                    s.active == true
                                                    select s).FirstOrDefault();
                var configTradingServiceAccount = (from s in dataContext.tb_settings
                                                   where s.key == "ServiceTradingAccount" &&
                                                   s.storeId == 1 &&
                                                   s.active == true
                                                   select s).FirstOrDefault();

                if (configTradingServiceUsername != null && configTradingServicePassword != null && configTradingServiceAccount != null && configTradingServiceURL != null)
                {
                    try
                    {
                        System.ServiceModel.EndpointAddress ea      = new System.ServiceModel.EndpointAddress(configTradingServiceURL.value);
                        TradingService.TRServiceSoapClient  service = new TradingService.TRServiceSoapClient("TRServiceSoap", ea);

                        string _userCountry = string.Empty;
                        string _firstname   = string.Empty;
                        string _lastname    = string.Empty;

                        string token         = service.TRLogin(configTradingServiceUsername.value, configTradingServicePassword.value);
                        int    accountExists = service.TRAccountExist(token, account.customer_id);
                        if (accountExists == 0)
                        {
                            // tb_address address = objSignupHelper.GetAddress(dataContext, info.AccountId, "Permanent");
                            var updateAcc = dataContext.tb_addresses.FirstOrDefault(t => t.account_id == info.AccountId);
                            //if (info.AccountType == 3)
                            //{
                            //    var _add = (from a in dataContext.tb_addresses where a.account_id == info.AccountId select a).ToList();
                            //    _firstname = _add[1].first_name;
                            //    _lastname = _add[1].last_name;
                            //    var country = (from s in dataContext.tb_countries
                            //                   where s.country_id == _add[1].country_id
                            //                   && s.active == true
                            //                   select s).FirstOrDefault();
                            //    _userCountry = country.country;
                            //}
                            //else
                            //{
                            //    var country = (from s in dataContext.tb_countries
                            //                   where s.country_id == address.country_id
                            //                   && s.active == true
                            //                   select s).FirstOrDefault();
                            //    _firstname = address.first_name;
                            //    _lastname = address.last_name;
                            //    _userCountry = country.country;
                            //}


                            //string state = string.Empty;
                            //if (address.country_id == 1)
                            //{
                            //    var states = (from s in dataContext.tb_states
                            //                  where s.state_id == int.Parse(address.state)
                            //                  && s.active == true
                            //                  select s).FirstOrDefault();
                            //    if (states != null)
                            //        state = states.state_initial;
                            //}
                            //else
                            //{
                            //    state = address.state;
                            //}



                            //if (_userCountry != null)
                            //{

                            string accountOpen = "";

                            //If registration type is tradezero then no cookie creation
                            if (account.Affiliate_Type == "TradeZero")
                            {
                                accountOpen = service.TROpenAccount(token, account.customer_id, updateAcc.first_name + " " + updateAcc.last_name, string.Empty, string.Empty, string.Empty,
                                                                    string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, account.email_address, account.password);
                                //  updateAcc.city, updateAcc.state, updateAcc.zipcode, updateAcc.country_id.ToString(), updateAcc.work_phone, string.Empty, account.email_address, account.password);
                            }
                            ////If registration type is other then check cookie existance
                            //else
                            //{
                            //    if (account.Affiliate_Type == "livestream")
                            //    {

                            //        accountOpen = service.TROpenAccountAffiliate(token, account.customer_id, _firstname + " " + _lastname, address.address_1, address.address_2, string.Empty,
                            //                       address.city, state, address.zipcode, _userCountry, address.work_phone, string.Empty, account.email_address, account.password, "LiveStream");

                            //        //Remove respective cookie immediatly
                            //        ReadandDeleteCookie(account.Affiliate_Type, objSignupHelper.getvisitorip());

                            //    }
                            //    else if (account.Affiliate_Type == "tradingschools")
                            //    {

                            //        accountOpen = service.TROpenAccountAffiliate(token, account.customer_id, _firstname + " " + _lastname, address.address_1, address.address_2, string.Empty,
                            //                                                                  address.city, state, address.zipcode, _userCountry, address.work_phone, string.Empty, account.email_address, account.password, "TradingSchool");


                            //        //Remove respective cookie immediatly
                            //        ReadandDeleteCookie(account.Affiliate_Type, objSignupHelper.getvisitorip());
                            //    }
                            //    else if (account.Affiliate_Type == "stocktrad3rblog")
                            //    {

                            //        accountOpen = service.TROpenAccountAffiliate(token, account.customer_id, _firstname + " " + _lastname, address.address_1, address.address_2, string.Empty,
                            //                                                            address.city, state, address.zipcode, _userCountry, address.work_phone, string.Empty, account.email_address, account.password, "StockTrad3r");

                            //        //Remove respective cookie immediatly
                            //        ReadandDeleteCookie(account.Affiliate_Type, objSignupHelper.getvisitorip());
                            //    }
                            //    else if (account.Affiliate_Type == "munozinvestments")
                            //    {

                            //        accountOpen = service.TROpenAccountAffiliate(token, account.customer_id, _firstname + " " + _lastname, address.address_1, address.address_2, string.Empty,
                            //                                                            address.city, state, address.zipcode, _userCountry, address.work_phone, string.Empty, account.email_address, account.password, "MunozInvestments");
                            //        //Remove respective cookie immediatly
                            //        ReadandDeleteCookie(account.Affiliate_Type, objSignupHelper.getvisitorip());
                            //    }
                            //    else if (account.Affiliate_Type == "stockpro")
                            //    {

                            //        accountOpen = service.TROpenAccountAffiliate(token, account.customer_id, _firstname + " " + _lastname, address.address_1, address.address_2, string.Empty,
                            //                                                            address.city, state, address.zipcode, _userCountry, address.work_phone, string.Empty, account.email_address, account.password, "StockPro");

                            //        //Remove respective cookie immediatly
                            //        ReadandDeleteCookie(account.Affiliate_Type, objSignupHelper.getvisitorip());
                            //    }
                            //    else if (account.Affiliate_Type == "generaltrade")
                            //    {

                            //        accountOpen = service.TROpenAccountAffiliate(token, account.customer_id, _firstname + " " + _lastname, address.address_1, address.address_2, string.Empty,
                            //                                                            address.city, state, address.zipcode, _userCountry, address.work_phone, string.Empty, account.email_address, account.password, "GeneralTrade");

                            //        //Remove respective cookie immediatly
                            //        ReadandDeleteCookie(account.Affiliate_Type, objSignupHelper.getvisitorip());
                            //    }
                            //    else if (account.Affiliate_Type == "ascendtrading")
                            //    {

                            //        accountOpen = service.TROpenAccountAffiliate(token, account.customer_id, _firstname + " " + _lastname, address.address_1, address.address_2, string.Empty,
                            //                                                            address.city, state, address.zipcode, _userCountry, address.work_phone, string.Empty, account.email_address, account.password, "Ascend");

                            //        //Remove respective cookie immediatly
                            //        ReadandDeleteCookie(account.Affiliate_Type, objSignupHelper.getvisitorip());
                            //    }
                            //    else if (account.Affiliate_Type == "tkltrading")
                            //    {

                            //        accountOpen = service.TROpenAccountAffiliate(token, account.customer_id, _firstname + " " + _lastname, address.address_1, address.address_2, string.Empty,
                            //                                                            address.city, state, address.zipcode, _userCountry, address.work_phone, string.Empty, account.email_address, account.password, "tkltrading");

                            //        //Remove respective cookie immediatly
                            //        ReadandDeleteCookie(account.Affiliate_Type, objSignupHelper.getvisitorip());
                            //    }
                            //    else if (account.Affiliate_Type == "stockspy")
                            //    {

                            //        accountOpen = service.TROpenAccountAffiliate(token, account.customer_id, _firstname + " " + _lastname, address.address_1, address.address_2, string.Empty,
                            //                                                            address.city, state, address.zipcode, _userCountry, address.work_phone, string.Empty, account.email_address, account.password, "stockspy");

                            //        //Remove respective cookie immediatly
                            //        ReadandDeleteCookie(account.Affiliate_Type, objSignupHelper.getvisitorip());
                            //    }

                            //    else if (account.Affiliate_Type == "smartfinance")
                            //    {
                            //        accountOpen = service.TROpenAccountAffiliate(token, account.customer_id, _firstname + " " + _lastname, address.address_1, address.address_2, string.Empty,
                            //                                                             address.city, state, address.zipcode, _userCountry, address.work_phone, string.Empty, account.email_address, account.password, "smartfinance");

                            //        //Remove respective cookie immediatly
                            //        ReadandDeleteCookie(account.Affiliate_Type, objSignupHelper.getvisitorip());
                            //    }

                            //    //curso trader
                            //    else if (account.Affiliate_Type == "cursotrader")
                            //    {
                            //        accountOpen = service.TROpenAccountAffiliate(token, account.customer_id, _firstname + " " + _lastname, address.address_1, address.address_2, string.Empty,
                            //                                                             address.city, state, address.zipcode, _userCountry, address.work_phone, string.Empty, account.email_address, account.password, "cursotrader");

                            //        //Remove respective cookie immediatly
                            //        ReadandDeleteCookie(account.Affiliate_Type, objSignupHelper.getvisitorip());
                            //    }
                            //    else if (account.Affiliate_Type == "blueinvesting")
                            //    {
                            //        accountOpen = service.TROpenAccountAffiliate(token, account.customer_id, _firstname + " " + _lastname, address.address_1, address.address_2, string.Empty,
                            //                                                             address.city, state, address.zipcode, _userCountry, address.work_phone, string.Empty, account.email_address, account.password, "blueinvest");

                            //        //Remove respective cookie immediatly
                            //        ReadandDeleteCookie(account.Affiliate_Type, objSignupHelper.getvisitorip());
                            //    }
                            //    else if (account.Affiliate_Type == "traderssky")
                            //    {
                            //        accountOpen = service.TROpenAccountAffiliate(token, account.customer_id, _firstname + " " + _lastname, address.address_1, address.address_2, string.Empty,
                            //                                                             address.city, state, address.zipcode, _userCountry, address.work_phone, string.Empty, account.email_address, account.password, "traderssky");

                            //        //Remove respective cookie immediatly
                            //        ReadandDeleteCookie(account.Affiliate_Type, objSignupHelper.getvisitorip());
                            //    }
                            //    else if (account.Affiliate_Type == "bubbashow")
                            //    {

                            //        accountOpen = service.TROpenAccountAffiliate(token, account.customer_id, _firstname + " " + _lastname, address.address_1, address.address_2, string.Empty,
                            //                                                                  address.city, state, address.zipcode, _userCountry, address.work_phone, string.Empty, account.email_address, account.password, "bubbashow");


                            //        //Remove respective cookie immediatly
                            //        ReadandDeleteCookie(account.Affiliate_Type, objSignupHelper.getvisitorip());
                            //    }
                            //    else if (account.Affiliate_Type == "warrior")
                            //    {

                            //        accountOpen = service.TROpenAccountAffiliate(token, account.customer_id, _firstname + " " + _lastname, address.address_1, address.address_2, string.Empty,
                            //                                                            address.city, state, address.zipcode, _userCountry, address.work_phone, string.Empty, account.email_address, account.password, "warrior");

                            //        //Remove respective cookie immediatly
                            //        ReadandDeleteCookie(account.Affiliate_Type, objSignupHelper.getvisitorip());
                            //    }
                            //    else if (account.Affiliate_Type == "mexicobolsas")
                            //    {

                            //        accountOpen = service.TROpenAccountAffiliate(token, account.customer_id, _firstname + " " + _lastname, address.address_1, address.address_2, string.Empty,
                            //                                                            address.city, state, address.zipcode, _userCountry, address.work_phone, string.Empty, account.email_address, account.password, "mexicobolsas");

                            //        //Remove respective cookie immediatly
                            //        ReadandDeleteCookie(account.Affiliate_Type, objSignupHelper.getvisitorip());
                            // }
                            //}
                            if (!string.IsNullOrEmpty(accountOpen))
                            {
                                account.account_id_service = accountOpen;
                                if (!isDebug)
                                {
                                    dataContext.SubmitChanges();
                                }
                            }
                            else
                            {
                                account.account_id_service = "ERROR";
                                if (!isDebug)
                                {
                                    dataContext.SubmitChanges();
                                }
                            }
                        }
                        //  }
                    }
                    catch (Exception ex)
                    {
                        using (StreamWriter outfile = new StreamWriter(System.Configuration.ConfigurationManager.AppSettings["LogFilePath"].ToString(), true))
                        {
                            outfile.Write(ex.Message + Environment.NewLine);
                            outfile.Write(ex.InnerException + Environment.NewLine);
                            outfile.Write(ex.Source + Environment.NewLine);
                        }

                        account.account_id_service = "ERROR CONNECTING";
                        if (!isDebug)
                        {
                            dataContext.SubmitChanges();
                        }
                    }
                }
            }
        }