private void ModifyClientInfo() { try { using (Database db = new MySqlDatabase()) { ClientInfo ci = db.GetClientInfo(Util.UserId); string lastName = ci.LastName; string firstName = ci.FirstName; string addressLine1 = ci.AddressLine1; string addressLine2 = ci.AddressLine2; string zipcode = ci.ZipCode; string city = ci.City; string state = ci.State; string country = ci.Country; string language = ci.Language; string telephone = ci.Telephone; string cellular = ci.Cellular; // Cellular.Text; string accountOwner = ci.AccountOwner; string bumaCode = BumaNo.Text.Trim(); string senaCode = SenaNo.Text.Trim(); string isrcCode = ISRC.Text.Trim(); string twitterId = ci.TwitterId.Trim(); string facebookId = ci.FacebookId.Trim(); string soundcloudId = ci.SoundCloudId.Trim(); string soniallId = ci.SoniallId.Trim(); string ownerKind = ci.OwnerKind; string referer = ci.Referer; char gender = ci.Gender; string stagename = ci.stagename; string companyname = ci.CompanyName; DateTime birthday = Convert.ToDateTime(ci.Birthdate); if (ci != null) referer = ci.Referer; db.RegisterClientInfo(lastName, firstName, addressLine1, addressLine2, zipcode, state, city, country, language, telephone, cellular, companyname, Util.UserId, accountOwner, bumaCode, senaCode, isrcCode, twitterId, facebookId, soundcloudId, soniallId, ownerKind, string.Empty, string.Empty, string.Empty, referer, gender, birthday, stagename); // Remove the user's identification certificate so a new one // can be registered. UserInfo ui = db.GetUser(Util.UserId); string userDocPath = db.GetUserDocumentPath(ui.UserId, Session["access"] as string); string identDocName = string.Format("ID{0:D10}.cer", ui.UserId); string identDocPath = Path.Combine(userDocPath, identDocName); if (File.Exists(identDocPath)) { string filePattern = string.Format("ID{0:D10}.*.cer", ui.UserId); string[] files = Directory.GetFiles(userDocPath, filePattern); int highIndex = -1; foreach (string file in files) { string filename = Path.GetFileName(file); if (filename != null) { string[] parts = filename.Split('.'); if (parts.Length == 3) { int index; if (int.TryParse(parts[1], out index)) { if (index > highIndex) highIndex = index; } } } } if (highIndex > -1) { ++highIndex; while (highIndex > 0) { string srcFilename = Path.Combine(userDocPath, string.Format("ID{0:D10}.{1}.cer", ui.UserId, highIndex - 1)); string tgtFilename = Path.Combine(userDocPath, string.Format("ID{0:D10}.{1}.cer", ui.UserId, highIndex)); File.Move(srcFilename, tgtFilename); --highIndex; } } string newDocName = string.Format("ID{0:D10}.0.cer", ui.UserId); string newDocPath = Path.Combine(userDocPath, newDocName); if (File.Exists(newDocPath)) File.Delete(newDocPath); string newPdfPath = Path.ChangeExtension(newDocPath, ".pdf"); if (File.Exists(newPdfPath)) File.Delete(newPdfPath); string identPdfPath = Path.ChangeExtension(identDocPath, ".pdf"); File.Move(identDocPath, newDocPath); if (File.Exists(identPdfPath)) File.Move(identPdfPath, newPdfPath); //File.Delete(identDocPath); //Added by Nagesh decimal percentComplete = DetermineCompletion(userDocPath, ui, ci); if (percentComplete < 100) { Response.Redirect("Profile.aspx"); } else { Response.Redirect("Thankyou.aspx"); } //Added by Nagesh } } } catch (Exception ex) { Logger.Instance.Write(LogLevel.Error, ex, "MemberEdit<Exception> on ModifyUserButtonClick"); } Response.Redirect("~/Member/ProfilePrint.aspx", false); }
/// <summary> /// Handler for the ModifyUserButton click event /// </summary> /// <param name="sender">the control that sent this event</param> /// <param name="e">the arguments associated with the click</param> public void ModifyUserButtonClick(Object sender, ImageClickEventArgs e) { try { string lastName = LastName.Text; string firstName = FirstName.Text; string addressLine1 = AddressLine1.Text; string addressLine2 = AddressLine2.Text; string zipcode = Zipcode.Text; string city = City.Text; string state = State.Text; string country = string.Empty; if (Country.SelectedIndex > -1) country = Country.Items[Country.SelectedIndex].Text; string language = string.Empty; language = Language.SelectedIndex > -1 ? Language.Items[Language.SelectedIndex].Text : LanguageIndex.Value; string telephone = Telephone.Text; string cellular = string.Empty; // Cellular.Text; string accountOwner = AccountOwner.Text; string bumaCode = BumaID.Text; string senaCode = SenaCode.Text; string isrcCode = IsrcCode.Text; string twitterId = TwitterID.Text; string facebookId = FacebookID.Text; string soundcloudId = SoundCloudID.Text; string soniallId = SoniallID.Text; string ownerKind = string.Empty; //string emailReceipt = EmailForReceipt.Text; //string referer = Referer.Text; string referer = string.Empty; char gender = Convert.ToChar(Gender.SelectedItem.Value); DateTime birthday = Convert.ToDateTime("Birthday.Text"); //if (!DateTime.TryParse(Birthday.Text, culture, DateTimeStyles.AssumeLocal, out birthday)) // birthday = new DateTime(1, 1, 1, 0, 0, 0); if (OwnerKind.SelectedIndex > -1) ownerKind = OwnerKind.Items[OwnerKind.SelectedIndex].Text; using (Database db = new MySqlDatabase()) { ClientInfo ci = db.GetClientInfo(Util.UserId); if (ci != null) referer = ci.Referer; db.RegisterClientInfo(lastName, firstName, addressLine1, addressLine2, zipcode, state, city, country, language, telephone, cellular, Convert.ToString(ViewState["CompanyName"]), Util.UserId, accountOwner, bumaCode, senaCode, isrcCode, twitterId, facebookId, soundcloudId, soniallId, ownerKind, string.Empty, string.Empty, Convert.ToString(ViewState["EmailReceipt"]), referer, gender, birthday, Convert.ToString(ViewState["StageName"])); // Remove the user's identification certificate so a new one // can be registered. UserInfo ui = db.GetUser(Util.UserId); string userDocPath = db.GetUserDocumentPath(ui.UserId, Session["access"] as string); string identDocName = string.Format("ID{0:D10}.cer", ui.UserId); string identDocPath = Path.Combine(userDocPath, identDocName); if (File.Exists(identDocPath)) { string filePattern = string.Format("ID{0:D10}.*.cer", ui.UserId); string[] files = Directory.GetFiles(userDocPath, filePattern); int highIndex = -1; foreach (string file in files) { string filename = Path.GetFileName(file); if (filename != null) { string[] parts = filename.Split('.'); if (parts.Length == 3) { int index; if (int.TryParse(parts[1], out index)) { if (index > highIndex) highIndex = index; } } } } if (highIndex > -1) { ++highIndex; while (highIndex > 0) { string srcFilename = Path.Combine(userDocPath, string.Format("ID{0:D10}.{1}.cer", ui.UserId, highIndex - 1)); string tgtFilename = Path.Combine(userDocPath, string.Format("ID{0:D10}.{1}.cer", ui.UserId, highIndex)); File.Move(srcFilename, tgtFilename); --highIndex; } } string newDocName = string.Format("ID{0:D10}.0.cer", ui.UserId); string newDocPath = Path.Combine(userDocPath, newDocName); if (File.Exists(newDocPath)) File.Delete(newDocPath); string newPdfPath = Path.ChangeExtension(newDocPath, ".pdf"); if (File.Exists(newPdfPath)) File.Delete(newPdfPath); string identPdfPath = Path.ChangeExtension(identDocPath, ".pdf"); File.Move(identDocPath, newDocPath); if (File.Exists(identPdfPath)) File.Move(identPdfPath, newPdfPath); //File.Delete(identDocPath); } } } catch (Exception ex) { Logger.Instance.Write(LogLevel.Error, ex, "MemberEdit<Exception> on ModifyUserButtonClick"); } Response.Redirect("~/Member/AccountOverview.aspx", false); }
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); } } }
/// <summary> /// Save Facebook data to the database /// </summary> /// <param name="me">Me info</param> /// <param name="accessToken">Access token</param> /// <param name="expires">Experiation of the access token</param> public void Persist(Me me, string accessToken, DateTime expires) { if (_clientInfo == null) GetUser(); using (Database db = new MySqlDatabase()) { db.UpdateSocialCredential(_clientInfo.ClientId, SocialConnector.Facebook, "facebookid", me.Id); db.UpdateSocialCredential(_clientInfo.ClientId, SocialConnector.Facebook, "accesstoken", accessToken); db.UpdateSocialCredential(_clientInfo.ClientId, SocialConnector.Facebook, "accesstokenexpires", expires.ToString("o")); string facebookId = me.Name; _clientInfo.FacebookId = facebookId; db.RegisterClientInfo( _clientInfo.LastName, _clientInfo.FirstName, _clientInfo.AddressLine1, _clientInfo.AddressLine2, _clientInfo.ZipCode, _clientInfo.State, _clientInfo.City, _clientInfo.Country, _clientInfo.Language, _clientInfo.Telephone, _clientInfo.Cellular, _clientInfo.CompanyName, _clientInfo.UserId, _clientInfo.AccountOwner, _clientInfo.BumaCode, _clientInfo.SenaCode, _clientInfo.IsrcCode, _clientInfo.TwitterId, _clientInfo.FacebookId, _clientInfo.SoundCloudId, _clientInfo.SoniallId, _clientInfo.OwnerKind, _clientInfo.CreditCardNr, _clientInfo.CreditCardCvv, _clientInfo.EmailReceipt, _clientInfo.Referer, _clientInfo.Gender, _clientInfo.Birthdate, _clientInfo.stagename); } }
public void Persist( OAuthTokenResponse me, string oauth_token, string oauth_verifier) { if (_clientInfo == null) GetUser(); using (Database db = new MySqlDatabase()) { ClientInfo ci = db.GetClientInfo(Util.UserId); db.UpdateSocialCredential(ci.ClientId, SocialConnector.Twitter, "twitterid", Convert.ToString(me.UserId)); db.UpdateSocialCredential(ci.ClientId, SocialConnector.Twitter, "oauthtoken", oauth_token); db.UpdateSocialCredential(ci.ClientId, SocialConnector.Twitter, "oauthverifier", oauth_verifier); _clientInfo.TwitterId = me.ScreenName; db.RegisterClientInfo( _clientInfo.LastName, _clientInfo.FirstName, _clientInfo.AddressLine1, _clientInfo.AddressLine2, _clientInfo.ZipCode, _clientInfo.State, _clientInfo.City, _clientInfo.Country, _clientInfo.Language, _clientInfo.Telephone, _clientInfo.Cellular, _clientInfo.CompanyName, _clientInfo.UserId, _clientInfo.AccountOwner, _clientInfo.BumaCode, _clientInfo.SenaCode, _clientInfo.IsrcCode, _clientInfo.TwitterId, _clientInfo.FacebookId, _clientInfo.SoundCloudId, _clientInfo.SoniallId, _clientInfo.OwnerKind, _clientInfo.CreditCardNr, _clientInfo.CreditCardCvv, _clientInfo.EmailReceipt, _clientInfo.Referer, _clientInfo.Gender, _clientInfo.Birthdate, _clientInfo.stagename); } }