void RegisterClientInfoUsingFBCredentials(string firstName, string lastName, string email, string pwd) { long userid = Util.UserId; if (userid == 0) { // Oops, something went wrong, report it and bail out return; } CultureInfo culture = new CultureInfo("nl-NL"); if (Session["culture"] != null) culture = Session["culture"] as CultureInfo; using (Database db = new MySqlDatabase()) { string lastname = lastName; string firstname = firstName; string addressline1 = string.Empty; //GetStringFromWizardTextBox("AddressLine1"); string addressline2 = string.Empty; //GetStringFromWizardTextBox("AddressLine2"); string zipcode = string.Empty; //GetStringFromWizardTextBox("Zipcode"); string state = string.Empty; //GetStringFromWizardTextBox("State"); string city = string.Empty; //GetStringFromWizardTextBox("City"); string country = string.Empty; string language = string.Empty; //GetStringFromWizardDropDown("Language"); if (string.IsNullOrEmpty(language)) { language = LanguageIndex.Value; } language = string.Empty; string telephone = string.Empty; //GetStringFromWizardTextBox("Telephone"); string cellular = string.Empty; //GetStringFromWizardTextBox("Cellular"); string companyname = string.Empty; string accountowner = string.Empty; string bumacode = string.Empty; string senacode = string.Empty; //GetStringFromWizardTextBox("SenaCode"); string isrccode = string.Empty; //GetStringFromWizardTextBox("IsrcCode"); string twitterid = string.Empty; //GetStringFromWizardTextBox("TwitterID"); string facebookid = string.Empty; //GetStringFromWizardTextBox("FacebookID"); string soundcloudid = string.Empty; string soniallid = string.Empty; //GetStringFromWizardTextBox("SoniallID"); string ownerkind = string.Empty; string creditcardnr = string.Empty; string creditcardcvv = string.Empty; string emailforreceipt = email; string referer = string.Empty; // GetStringFromWizardTextBox("Referer"); //string activationCode = GetStringFromWizardTextBox("ActivationCode"); char gender = '\0'; //string bday = GetStringFromWizardTextBox("Birthday"); string bday = string.Empty; //GetValueFromWizardWebDateChooser("Birthday"); string stagename = string.Empty; DateTime birthday = new DateTime(1, 1, 1, 0, 0, 0); //if (!DateTime.TryParse(bday, culture, DateTimeStyles.AssumeLocal, out birthday)) // birthday = new DateTime(1, 1, 1, 0, 0, 0); long clientid = db.RegisterClientInfo( lastname, firstname, addressline1, addressline2, zipcode, state, city, country, language, telephone, cellular, companyname, userid, accountowner, bumacode, senacode, isrccode, twitterid, facebookid, soundcloudid, soniallid, ownerkind, creditcardnr, creditcardcvv, emailforreceipt, referer, gender, birthday, stagename); if (clientid == 0) { Literal ErrorMessage = RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("ErrorMessage") as Literal; if (ErrorMessage != null) ErrorMessage.Text = Resources.Resource.CouldntRegister; } else { UserInfo ui = db.GetUser(userid); ClientInfo ci = db.GetClientInfo(userid); // When a user comes from an confirmation and used a different mail adres which was given in confirmation // then the confirmation mail must be updated to keep the link. -Lambert 2012-12-1 Guid confirmationid; if (!string.IsNullOrEmpty(Request.Params["id"]) && Guid.TryParse(Request.Params["id"], out confirmationid)) { int tp; if (!int.TryParse(Request.Params["tp"], out tp)) tp = 0; db.UpdateConfirmation(confirmationid, ui.Email); ConfirmationResult res = Confirmation.ProcessConfirmation(Request.Params["id"], tp); switch (res) { case ConfirmationResult.Success: break; case ConfirmationResult.UserUnknown: break; case ConfirmationResult.ConfirmationFailed: //ResultLabel.Text = Resources.Resource.Rejected; break; } } // Ok, all is set and registered, now send an e-mail to the newly registered user StringBuilder body = new StringBuilder(); using (TextReader rdr = new StreamReader(Server.MapPath(Resources.Resource.SignUpAuthenticationBody))) { string fname = ci.FirstName; string text = rdr.ReadToEnd(); Session.Remove("register.pwd"); text = text.Replace("{%EmailHeaderLogo%}", ConfigurationManager.AppSettings["EmailHeaderLogo"]); text = text.Replace("{%EmailmailToLink%}", ConfigurationManager.AppSettings["EmailmailToLink"]); text = text.Replace("{%SiteNavigationLink%}", ConfigurationManager.AppSettings["SiteNavigationLink"]); text = text.Replace("{%EmailFooterLogo%}", ConfigurationManager.AppSettings["EmailFooterLogo"]); text = text.Replace("{%EmailFBlink%}", ConfigurationManager.AppSettings["EmailFBlink"]); text = text.Replace("{%EmailFBLogo%}", ConfigurationManager.AppSettings["EmailFBLogo"]); text = text.Replace("{%EmailTwitterLink%}", ConfigurationManager.AppSettings["EmailTwitterLink"]); text = text.Replace("{%EmailTwitterLogo%}", ConfigurationManager.AppSettings["EmailTwitterLogo"]); text = text.Replace("{%EmailSoundCloudLink%}", ConfigurationManager.AppSettings["EmailSoundCloudLink"]); text = text.Replace("{%EmailSoundCloudLogo%}", ConfigurationManager.AppSettings["EmailSoundCloudLogo"]); text = text.Replace("{%firstname%}", ci.FirstName); text = text.Replace("{%email%}", ui.Email); text = text.Replace("{%password%}", Convert.ToString(ViewState["pwd"])); //string link = "<a href=\"http://test.trackprotect.com/FirstLogon.aspx?userId=\"" + Util.UserId + "&email=" + ui.Email + "&password="******"\"> Click Here </a>"; string key = EncryptionClass.Encrypt(pwd).Replace(" ", "%20"); string clickherelink = "<a href=\"" + ConfigurationManager.AppSettings["SignUpLink"] + Util.UserId + "&key=" + key + "&mode=1" + "\"> Click Here </a>"; text = text.Replace("{%clickherelink%}", clickherelink); string detailedlink = ConfigurationManager.AppSettings["SignUpLink"] + Util.UserId + "&key=" + key + "&mode=1"; text = text.Replace("{%detailedlink%}", detailedlink); body.Append(text); } Util.SendEmail(new string[] { ui.Email }, "*****@*****.**", Resources.Resource.SignUpEmailSubject, body.ToString(), null, 0); } } }