protected void Page_Load(object sender, EventArgs e) { if (Request.Params["pid"] != null) { long productId; if (!long.TryParse(Request.Params["pid"], out productId)) productId = 0; Session["quotation.pid"] = productId; } using (Database db = new MySqlDatabase()) { UserInfo ui = db.GetUser(Util.UserId); ClientInfo ci = db.GetClientInfo(Util.UserId); DataSet ds = db.GetRegister(Util.UserId); int protectedTracks = ds.Tables[0].Rows.Count; LoggedOnTitle.Text = Resources.Resource.LoggedOnTitle; LoggedOnUserName.Text = string.Format("<span><b>{0}</b></span>", ci.FirstName); // ci.GetFullName()); CreditsLiteral.Text = string.Format(Resources.Resource.spnCredits, Util.GetUserCredits(Util.UserId)); ProtectedLiteral.Text = string.Format(Resources.Resource.spnProtected, protectedTracks); string userDocPath = db.GetUserDocumentPath(ui.UserId, Session["access"] as string); decimal percentComplete = DetermineCompletion(userDocPath, ui, ci); CompletedLiteral.Text = string.Empty; if (percentComplete < 100) CompletedLiteral.Text = string.Format(Resources.Resource.PercentComplete, percentComplete / 100m); ClickToLinkLiteral.Visible = (CompletedLiteral.Text != string.Empty); } }
protected void Page_Load(object sender, EventArgs e) { try { IncludePage(AccountOverviewInc, Resources.Resource.incMemberHome); IncludePage(RhosMovementInc, Resources.Resource.incRhosMovement2); using (Database db = new MySqlDatabase()) { UserInfo ui = db.GetUser(Util.UserId); ClientInfo ci = db.GetClientInfo(Util.UserId); DataSet ds = db.GetRegister(Util.UserId); int protectedTracks = ds.Tables[0].Rows.Count; LoggedOnTitle.Text = Resources.Resource.LoggedOnTitle; LoggedOnUserName.Text = string.Format("<span><b>{0}</b></span>", ci.FirstName); //ci.GetFullName()); CreditsLiteral.Text = string.Format(Resources.Resource.spnCredits, Util.GetUserCredits(Util.UserId)); ProtectedLiteral.Text = string.Format(Resources.Resource.spnProtected, protectedTracks); string userDocPath = db.GetUserDocumentPath(ui.UserId, Session["access"] as string); decimal percentComplete = DetermineCompletion(userDocPath, ui, ci); Session["percentComplete"] = percentComplete; CompletedLiteral.Text = string.Empty; if (percentComplete < 100) CompletedLiteral.Text = string.Format(Resources.Resource.PercentComplete, percentComplete / 100m); ClickToLinkLiteral.Visible = (CompletedLiteral.Text != string.Empty); } FillAccountInformation(); int couponEntry = 0; if (Session["coupon.entry"] != null) couponEntry = (int)Session["coupon.entry"]; if (!IsPostBack) { using (Database db = new MySqlDatabase()) { int violationState = db.GetUserWhmcsClientId(Util.UserId); if (violationState == 1) couponEntry = 3; } } } catch (Exception ex) { Logger.Instance.Write(LogLevel.Error, ex, "AccountOverView<Exception>"); } }
/// <summary> /// Fill the control with account information /// </summary> private void FillAccountInformation() { using (Database db = new MySqlDatabase()) { UserInfo ui = db.GetUser(Util.UserId); ClientInfo ci = db.GetClientInfo(Util.UserId); Name.Text = ci.FirstName + " " + ci.LastName; StageName.Text = ci.stagename; CompanyName.Text = ci.CompanyName; if (ci.Gender == 'm' || ci.Gender == 'M') Gender.Text = "Male"; else if (ci.Gender == 'f' || ci.Gender == 'F') Gender.Text = "Female"; DOB.Text = Convert.ToString(ci.Birthdate).Split(' ')[0]; Address.Text = ci.AddressLine1 + System.Environment.NewLine + ci.AddressLine2; Pincode.Text = ci.ZipCode; City.Text = ci.City; State.Text = ci.State; Country.Text = ci.Country; Number.Text = ci.Telephone; BumaNo.Text = ci.BumaCode; SenaNo.Text = ci.SenaCode; ISRC.Text = ci.IsrcCode; if (!string.IsNullOrEmpty(ci.TwitterId)) { lblTwitter.Text = "CONNECTED AS"; TwitterIdLabel.Text = ci.TwitterId; TwitterIdLabel.Visible = true; twitterdiv.Visible = true; RemoveTwitter.Visible = true; linkTwitter.Enabled = false; } else { lblTwitter.Text = "CONNECT"; TwitterIdLabel.Visible = false; RemoveTwitter.Visible = false; twitterdiv.Visible = false; linkTwitter.Enabled = true; } if (!string.IsNullOrEmpty(ci.FacebookId)) { lblFacebook.Text = "CONNECTED AS"; FacebookIdLabel.Text = ci.FacebookId; FacebookIdLabel.Visible = true; facebookdiv.Visible = true; RemoveFacebook.Visible = true; linkFacebook.Enabled = false; } else { lblFacebook.Text = "CONNECT"; facebookdiv.Visible = false; FacebookIdLabel.Visible = false; RemoveFacebook.Visible = false; linkFacebook.Enabled = true; } if (!string.IsNullOrEmpty(ci.SoundCloudId)) { lblsoundcloud.Text = "CONNECTED AS"; SoundCloudLabel.Text = ci.SoundCloudId; SoundCloudLabel.Visible = true; soundclouddiv.Visible = true; RemoveSoundCloud.Visible = true; linkSoundCloud.Enabled = false; } else { lblsoundcloud.Text = "CONNECT"; soundclouddiv.Visible = false; SoundCloudLabel.Visible = false; RemoveSoundCloud.Visible = false; linkSoundCloud.Enabled = true; } OwnerKind.Text = ci.OwnerKind; Email.Text = ui.Email; 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); // Assume the button will need to be visible, if not so we will discover afterwards if (File.Exists(identDocPath)) { IdentityCertificate.Text = Path.GetFileName(identDocPath); DownloadIdent.Visible = true; //DownloadIdent.NavigateUrl = string.Format("~/DownloadHandler.ashx?file='{0}'", Server.MapPath(identDocPath)); DownloadIdent.Attributes.Add("onclick", "InitializeRequest('" + identDocPath.Replace("\\", "/") + "');"); } else { // credential document has been marked as 'old' due to changed information // of the client and no new credential file has been uploaded identDocName = string.Format("ID{0:D10}.0.cer", ui.UserId); identDocPath = Path.Combine(userDocPath, identDocName); if (File.Exists(identDocPath)) { IdentityCertificate.Text = Path.GetFileName(identDocPath); DownloadIdent.Visible = true; //DownloadIdent.NavigateUrl = string.Format("~/DownloadHandler.ashx?file='{0}'", Server.MapPath(identDocPath)); DownloadIdent.Attributes.Add("onclick", "InitializeRequest('" + identDocPath.Replace("\\", "/") + "');"); } } } }
protected void AccountOverview_Click(object sender, EventArgs e) { using (Database db = new MySqlDatabase()) { UserInfo ui = db.GetUser(Util.UserId); ClientInfo ci = db.GetClientInfo(Util.UserId); string password = Session["access"] as string; string uploadPath = db.GetUserDocumentPath(Util.UserId, password); //GenerateAccountOverView( // Server.MapPath(Path.Combine(uploadPath, "/Temporaryfiles/AccInfo_" + ui.UserId + "_" + ci.FirstName + "_" + ci.LastName + ".pdf")), // HttpContext.Current.Server.MapPath(Resources.Resource.AccountOverViewTemplate), // ci, ui); using (StreamReader reader = new StreamReader(Server.MapPath("~") + "/HtmlTemplates/accountoverview_template_en_form.html")) { String htmlText = reader.ReadToEnd(); HtmlToPdf(Server.MapPath(Path.Combine(uploadPath, "/Temporaryfiles/AccInfo_" + ui.UserId + "_" + ci.FirstName + "_" + ci.LastName + ".pdf")), htmlText, ci, ui); } } }
protected void SubmitButton_Command(object sender, CommandEventArgs e) { InitializeWithDefaultValues(); Page.Validate("TrackProtectValidation"); bool atleastOneTaggingSelected = false; if (ViewState["Genre1"] != null && atleastOneTaggingSelected == false) atleastOneTaggingSelected = true; else if (ViewState["Genre2"] != null && atleastOneTaggingSelected == false) atleastOneTaggingSelected = true; else if (ViewState["Genre3"] != null && atleastOneTaggingSelected == false) atleastOneTaggingSelected = true; else if (ViewState["SubGenre1"] != null && atleastOneTaggingSelected == false) atleastOneTaggingSelected = true; else if (ViewState["SubGenre2"] != null && atleastOneTaggingSelected == false) atleastOneTaggingSelected = true; else if (ViewState["SubGenre3"] != null && atleastOneTaggingSelected == false) atleastOneTaggingSelected = true; else if (ViewState["SoundTag1"] != null && atleastOneTaggingSelected == false) atleastOneTaggingSelected = true; else if (ViewState["SoundTag2"] != null && atleastOneTaggingSelected == false) atleastOneTaggingSelected = true; else if (ViewState["SoundTag3"] != null && atleastOneTaggingSelected == false) atleastOneTaggingSelected = true; if (!FileUpload1.HasFile) { CustomValidationShow(Resources.Resource.SelectMp3File); } else if (FileUpload1.FileContent.Length > 12582912) { CustomValidationShow(Resources.Resource.FileSizeExceed); } else if (atleastOneTaggingSelected == false) { CustomValidationShow(Resources.Resource.SelectOneTag); } else if (Session["soundCloudAccessToken"] == null && (cbxSendToFacebook.Checked == true || cbxSendToTwitter.Checked == true)) { CustomValidationShow(Resources.Resource.SoundCloudCredRequired); } else if (cbxSendToSoundCloud.Checked == false && (cbxSendToFacebook.Checked == true || cbxSendToTwitter.Checked == true)) { CustomValidationShow(Resources.Resource.SelectSoundcloud); } if (Page.IsValid) { bool failed = false; long managedUserId = 0; if (Session["managed.userid"] != null) managedUserId = Convert.ToInt64(Session["managed.userid"]); if (!FileUpload1.HasFile) { // No file for the first option, need one to proceed or need a check to indicate // only songtext and sheet music will be registered. Response.Redirect(string.Format("~/Member/ErrorPage.aspx?title={0}&message={1}&returnurl={2}", Resources.Resource.FirstFileRequiredTitle, Resources.Resource.FirstFileRequiredMessage, Uri.EscapeDataString(Request.RawUrl)), false); } long registerId = 0; string trackName = TrackNameText.Text; string doc1 = string.Empty, doc2 = string.Empty, doc3 = string.Empty; string uploadPath = string.Empty; using (Database db = new MySqlDatabase()) { UserInfo ui = db.GetUser(Util.UserId); uploadPath = db.GetUserDocumentPath(managedUserId); string isrcCode = string.Empty; if (!string.IsNullOrEmpty(IsrcHandle.Text) && !string.IsNullOrEmpty(IsrcPostfix.Text)) isrcCode = IsrcHandle.Text + "-" + IsrcPostfix.Text; if (!failed && FileUpload1.HasFile) { doc1 = FileUpload1.FileName; try { FileUpload1.SaveAs(Path.Combine(uploadPath, Path.GetFileName(doc1))); StatusInfo1.Text = string.Format(Resources.Resource.FileStoreSuccess, Path.GetFileName(doc1)); } catch (Exception) { StatusInfo1.Text = string.Format(Resources.Resource.FileStoreFailed, Path.GetFileName(doc1)); failed = true; } } if (!failed && FileUpload2.HasFile) { doc2 = FileUpload2.FileName; try { FileUpload2.SaveAs(Path.Combine(uploadPath, Path.GetFileName(doc2))); StatusInfo2.Text = string.Format(Resources.Resource.FileStoreSuccess, Path.GetFileName(doc2)); } catch (Exception) { StatusInfo2.Text = string.Format(Resources.Resource.FileStoreFailed, Path.GetFileName(doc2)); failed = true; } } if (!failed && FileUpload3.HasFile) { doc3 = FileUpload3.FileName; try { FileUpload3.SaveAs(Path.Combine(uploadPath, Path.GetFileName(doc3))); StatusInfo3.Text = string.Format(Resources.Resource.FileStoreSuccess, Path.GetFileName(doc3)); } catch (Exception) { StatusInfo3.Text = string.Format(Resources.Resource.FileStoreFailed, Path.GetFileName(doc3)); failed = true; } } if (!failed) { // Continue registration string f1 = string.Empty, f2 = string.Empty, f3 = string.Empty; if (!string.IsNullOrEmpty(doc1)) f1 = Path.Combine(uploadPath, Path.GetFileName(doc1)); if (!string.IsNullOrEmpty(doc2)) f2 = Path.Combine(uploadPath, Path.GetFileName(doc2)); if (!string.IsNullOrEmpty(doc3)) f3 = Path.Combine(uploadPath, Path.GetFileName(doc3)); // Get the cooperating artists to add to the certificate CoopArtistList coopArtists = new CoopArtistList(); foreach (DataRow row in CoArtistsTable.Rows) { string name = Convert.ToString(row[0]); string role = Convert.ToString(row[1]); coopArtists.Add(new CoopArtist(name, role)); } string certfilename = CreateCertificate(managedUserId, f1, f2, f3, isrcCode, trackName, coopArtists); //long registerId = db.CreateRegistry(managedUserId, certfilename, f1); registerId = db.CreateRegistry(Util.UserId, managedUserId, certfilename, f1, trackName.Trim(), isrcCode, (Genre1.SelectedItem.Text == "--Select--" ? "" : Genre1.SelectedItem.Text), (Genre2.SelectedItem.Text == "--Select--" ? "" : Genre2.SelectedItem.Text), (Genre3.SelectedItem.Text == "--Select--" ? "" : Genre3.SelectedItem.Text), (SubGenre1.SelectedItem.Text == "--Select--" ? "" : SubGenre1.SelectedItem.Text), (SubGenre2.SelectedItem.Text == "--Select--" ? "" : SubGenre2.SelectedItem.Text), (SubGenre3.SelectedItem.Text == "--Select--" ? "" : SubGenre3.SelectedItem.Text), (Tag1.SelectedItem.Text == "--Select--" ? "" : Tag1.SelectedItem.Text), (Tag2.SelectedItem.Text == "--Select--" ? "" : Tag2.SelectedItem.Text), (Tag3.SelectedItem.Text == "--Select--" ? "" : Tag3.SelectedItem.Text), StageNameText.Text.Trim()); if (registerId > 0) { if (!failed && !string.IsNullOrEmpty(f1)) failed = (RegisterDoc(registerId, f1) == 0); if (!failed && !string.IsNullOrEmpty(f2)) failed = (RegisterDoc(registerId, f2) == 0); if (!failed && !string.IsNullOrEmpty(f3)) failed = (RegisterDoc(registerId, f3) == 0); if (!failed && CoArtistsTable.Rows.Count > 0) { foreach (DataRow row in CoArtistsTable.Rows) { string name = Convert.ToString(row[0]); string role = Convert.ToString(row[1]); long clientId = Convert.ToInt64(row[2]); string id = clientId.ToString(); RegisterCoArtist(registerId, name, id, role); } } if (!failed) { StatusInfo4.Text = Resources.Resource.RegistrationSuccessful; db.DecrementCredits(Util.UserId); db.AddCreditHistory(Util.UserId, 0L, 1, 0); string certdocfile = Path.ChangeExtension(certfilename, ".pdf"); Util.SendRegistration(Convert.ToInt64(Session["managed.userid"]), uploadPath, trackName, certfilename, certdocfile); } else { StatusInfo4.Text = Resources.Resource.RegistrationFailed; } } else { // Registration failed StatusInfo4.Text = Resources.Resource.RegistrationFailed; } } else { if (!string.IsNullOrEmpty(doc1)) DeleteFile(Path.Combine(uploadPath, Path.GetFileName(doc1))); if (!string.IsNullOrEmpty(doc2)) DeleteFile(Path.Combine(uploadPath, Path.GetFileName(doc2))); if (!string.IsNullOrEmpty(doc3)) DeleteFile(Path.Combine(uploadPath, Path.GetFileName(doc3))); } } if (failed == false) { Session["TrackProtected"] = true; if (cbxSendToSoundCloud.Checked == false) Session["SoundCloud.Response"] = "Deactive"; else if (cbxSendToSoundCloud.Checked && !File.Exists(Path.Combine(uploadPath, doc1))) Session["SoundCloud.Response"] = "Error"; else if (cbxSendToSoundCloud.Checked && File.Exists(Path.Combine(uploadPath, doc1))) Session["SoundCloud.Response"] = Publish.SoundCloudPublish(Convert.ToString(Session["soundCloudAccessToken"]), Path.Combine(uploadPath, doc1), trackName + System.Environment.NewLine + SoundCloudMsg.Text.Trim()); if (Session["SoundCloud.Response"] != null) { if (!Convert.ToString(Session["SoundCloud.Response"]).Contains("Deactive") && !Convert.ToString(Session["SoundCloud.Response"]).Contains("Error")) { string shortUrl = BitlyApi.GetShortUrl(ConfigurationManager.AppSettings["SiteNavigationLink"] + "/idlookup.aspx?TrackID=" + EncryptionClass.Encrypt(Convert.ToString(registerId))); string stream_url = string.Empty; try { var obj = JsonConvert.DeserializeObject<Dictionary<string, object>>(Convert.ToString(Session["SoundCloud.Response"])); stream_url = Convert.ToString(obj["permalink_url"]) + "/" + Convert.ToString(obj["secret_token"]); } catch { } #region Facebook if (cbxSendToFacebook.Checked == false) Session["Facebook.Response"] = "Deactive"; else if (cbxSendToFacebook.Checked) { String messageToPost = string.Empty; messageToPost += FacebookMsg.Text.Trim() + System.Environment.NewLine + System.Environment.NewLine; messageToPost += "Trackname : " + TrackNameText.Text.Trim() + System.Environment.NewLine; messageToPost += "Trackprotect ID : " + shortUrl + System.Environment.NewLine; //messageToPost += "Protected by: " + ConfigurationManager.AppSettings["SiteNavigationLink"] + System.Environment.NewLine; if (cbxSendToGenreCommunityPage.Checked == false) Session["FacebookGenre.Response"] = "Deactive"; else if (cbxSendToGenreCommunityPage.Checked) Session["FacebookGenre.Response"] = postToFacebook(messageToPost, stream_url, Convert.ToString(ViewState["GenrePageToken"]), Convert.ToString(ViewState["GenrePageID"])); if (cbxSendToSubGenreCommunityPage.Checked == false) Session["FacebookSubGenre.Response"] = "Deactive"; else if (cbxSendToSubGenreCommunityPage.Checked) Session["FacebookSubGenre.Response"] = postToFacebook(messageToPost, stream_url, Convert.ToString(ViewState["SubGenrePageToken"]), Convert.ToString(ViewState["SubGenrePageID"])); if (cbxShareToUserWall.Checked == false) Session["Facebook.Response"] = "Deactive"; else if (cbxShareToUserWall.Checked) Session["Facebook.Response"] = postToFacebook(messageToPost, stream_url, Convert.ToString(Session["FBACC"]), Convert.ToString(Session["FBID"])); if (cbxShareToFriends.Checked == false) Session["ShareToFriends"] = "Deactive"; else if (cbxShareToFriends.Checked) { IList<string> friendList = getFriendIDs(); foreach (var friendId in friendList) Session["ShareToFriends"] = postToFacebook(messageToPost, stream_url, Convert.ToString(Session["FBACC"]), friendId); } if (cbxShareToPages.Checked == false) Session["ShareToPages"] = "Deactive"; else if (cbxShareToPages.Checked) { Dictionary<string, string> pageList = getPageIDs(); foreach (var pageId in pageList) Session["ShareToPages"] = postToFacebook(messageToPost, stream_url, pageId.Value, pageId.Key); } if (cbxShareToMyWall.Checked == false) Session["FacebookOwnPage.Response"] = "Deactive"; else if (cbxShareToMyWall.Checked) Session["FacebookOwnPage.Response"] = postToFacebook(messageToPost, stream_url, Convert.ToString(Session["FBOwnACC"]), Convert.ToString(Session["FBOwnID"])); if (cbxShareToOwnFriends.Checked == false) Session["ShareToOwnFriends"] = "Deactive"; else if (cbxShareToOwnFriends.Checked) { IList<string> friendList = getOwnFriendIDs(); foreach (var friendId in friendList) Session["ShareToOwnFriends"] = postToFacebook(messageToPost, stream_url, Convert.ToString(Session["FBOwnACC"]), friendId); } if (cbxShareToOwnPages.Checked == false) Session["ShareToOwnPages"] = "Deactive"; else if (cbxShareToOwnPages.Checked) { Dictionary<string, string> pageList = getOwnPageIDs(); foreach (var pageId in pageList) Session["ShareToOwnPages"] = postToFacebook(messageToPost, stream_url, pageId.Value, pageId.Key); } } #endregion #region Twitter if (cbxSendToTwitter.Checked == false) Session["Twitter.Response"] = "Deactive"; else if (cbxSendToTwitter.Checked) Session["Twitter.Response"] = tweetToTwitter(shortUrl, stream_url); #endregion } } } else Session["TrackProtected"] = false; string continueUrl = "~/Member/UploadConfirmation.aspx?id=" + Convert.ToInt64(Session["managed.userid"]); if (HttpContext.Current.Session["ReturnUrl"] != null) continueUrl = HttpContext.Current.Session["ReturnUrl"] as string; Response.Redirect(continueUrl, false); } if (cbxSendToFacebook.Checked) divFBSharing.Attributes.Add("style", "display:block"); else divFBSharing.Attributes.Add("style", "display:none"); }
private void UpdateUserStatusPanel() { UserInfo ui = null; ClientInfo ci = null; string userDocPath = null; using (Database db = new MySqlDatabase()) { db.ResetUserWhmcsClientd(Util.UserId); ui = db.GetUser(Util.UserId); ci = db.GetClientInfo(Util.UserId); DataSet ds = db.GetRegister(Util.UserId); int protectedTracks = ds.Tables[0].Rows.Count; LoggedOnTitle.Text = Resources.Resource.LoggedOnTitle; LoggedOnUserName.Text = string.Format("<span><b>{0}</b></span>", ci.GetFullName()); CreditsLiteral.Text = string.Format(Resources.Resource.spnCredits, Util.GetUserCredits(Util.UserId)); ProtectedLiteral.Text = string.Format(Resources.Resource.spnProtected, protectedTracks); userDocPath = db.GetUserDocumentPath(ui.UserId, Session["access"] as string); } int vcl = 0, ecl = 0; Util.GetUserClearanceLevels(Util.UserId, out vcl, out ecl); decimal percentComplete = DetermineCompletion(userDocPath, ui, ci); CompletedLiteral.Text = string.Empty; if (percentComplete < 100) CompletedLiteral.Text = string.Format(Resources.Resource.PercentComplete, percentComplete / 100m); ClickToLinkLiteral.Visible = (CompletedLiteral.Text != string.Empty); }
protected void Page_Load(object sender, EventArgs e) { Session["bodyid"] = "user-home"; bool couponEntryState = true; UserInfo ui = null; ClientInfo ci = null; string userDocPath = null; using (Database db = new MySqlDatabase()) { db.ResetUserWhmcsClientd(Util.UserId); ui = db.GetUser(Util.UserId); ci = db.GetClientInfo(Util.UserId); DataSet ds = db.GetRegister(Util.UserId); int protectedTracks = ds.Tables[0].Rows.Count; LoggedOnTitle.Text = Resources.Resource.LoggedOnTitle; LoggedOnUserName.Text = string.Format("<span><b>{0}</b></span>", ci.FirstName); //ci.GetFullName()); //CreditsLiteral.Text = string.Format(Resources.Resource.spnCredits, Util.GetUserCredits(Util.UserId)); CreditsLiteral.Text = Convert.ToString(Util.GetUserCredits(Util.UserId)); //ProtectedLiteral.Text = string.Format(Resources.Resource.spnProtected, protectedTracks); ProtectedLiteral.Text = Convert.ToString(protectedTracks); couponEntryState = (db.GetUserWhmcsClientId(Util.UserId) == 0); userDocPath = db.GetUserDocumentPath(ui.UserId, Session["access"] as string); } int vcl = 0, ecl = 0; Util.GetUserClearanceLevels(Util.UserId, out vcl, out ecl); //divManagedArtists.Visible = (vcl >= 100 || ecl >= 100); // managedArtist.Visible = (vcl >= 100 || ecl >= 100); fieldsMissing = false; decimal percentComplete = DetermineCompletion(userDocPath, ui, ci); ////Added by Nagesh to redirect user to complete profile page. //if (ui.IsActive == 0) // Response.Redirect("~/FirstLogon.aspx?userId=" + ui.UserId); StringBuilder sb = new StringBuilder(); if (string.IsNullOrEmpty(ci.GetFullName())) AddLine(sb, Resources.Resource.NoName); if (string.IsNullOrEmpty(ci.AddressLine1)) AddLine(sb, Resources.Resource.NoAddress); if (string.IsNullOrEmpty(ci.City)) AddLine(sb, Resources.Resource.NoResidence); if (string.IsNullOrEmpty(ci.OwnerKind)) AddLine(sb, Resources.Resource.NoOwnerKind); if (string.IsNullOrEmpty(ci.TwitterId)) AddLine(sb, Resources.Resource.NoTwitterId); if (string.IsNullOrEmpty(ci.FacebookId)) AddLine(sb, Resources.Resource.NoFacebookId); if (string.IsNullOrEmpty(ci.SenaCode)) AddLine(sb, Resources.Resource.NoSenaCode); if (string.IsNullOrEmpty(ci.IsrcCode)) AddLine(sb, Resources.Resource.NoIsrcCode); string identDocName = string.Format("ID{0:D10}.cer", ui.UserId); string identDocPath = Path.Combine(userDocPath, identDocName); //if (!File.Exists(Server.MapPath(Request.ApplicationPath + identDocPath))) if (!File.Exists(identDocPath)) AddLine(sb, Resources.Resource.NoCredentials); if (fieldsMissing) AddLine(sb, Resources.Resource.ClickToEdit); //MissingInfoPanel.Text = sb.ToString(); //MissingInfoDiv.Visible = fieldsMissing; Session["percentComplete"] = percentComplete; CompletedLiteral.Text = string.Empty; if (percentComplete < 100) CompletedLiteral.Text = string.Format(Resources.Resource.PercentComplete, percentComplete / 100m); divAccPerCompleted.Visible = ClickToLinkLiteral.Visible = (CompletedLiteral.Text != string.Empty); //CouponCodeEdit.Enabled = couponEntryState; //CouponCodeGo.Enabled = couponEntryState; //------- Highlight the selected lang button ------- ! if (Convert.ToString(Session["culture"]).Contains("nl")) { ClientScript.RegisterStartupScript(this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "ctl00_HeadLoginView_LanguageNL" + "');", true); ClientScript.RegisterStartupScript(this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "ctl00_HeadLoginView_LanguageUS" + "');", true); } else { ClientScript.RegisterStartupScript(this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "ctl00_HeadLoginView_LanguageUS" + "');", true); ClientScript.RegisterStartupScript(this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "ctl00_HeadLoginView_LanguageNL" + "');", true); } ClientScript.RegisterStartupScript(this.GetType(), "HighLightMenu", "HighLightMenu('" + "Menu1" + "');", true); }
protected void UploadCredentialsButton_Command(object sender, CommandEventArgs e) { long userid = Util.UserId; if (userid <= 0) { Logger.Instance.Write(LogLevel.Warning, "No user-id known, out of context page access"); return; } string statusInfo1 = string.Empty; string statusInfo2 = string.Empty; using (Database db = new MySqlDatabase()) { string password = Session["access"] as string; string uploadPath = db.GetUserDocumentPath(userid, password); string doc1 = string.Empty, doc2 = string.Empty; bool failed = false; if (!failed && UploadFile1.HasFile) { doc1 = UploadFile1.FileName; try { UploadFile1.SaveAs(Path.Combine(uploadPath, Path.GetFileName(doc1))); statusInfo1 = string.Format("O{0}", Path.GetFileName(doc1)); //statusInfo1 = string.Format(Resources.Resource.FileStoreSuccess, Path.GetFileName(doc1)); } catch (Exception) { statusInfo1 = string.Format("E{0}", Path.GetFileName(doc1)); //statusInfo1 = string.Format(Resources.Resource.FileStoreFailed, Path.GetFileName(doc1)); failed = true; } } if (!failed && UploadFile2.HasFile) { doc2 = UploadFile2.FileName; try { UploadFile2.SaveAs(Path.Combine(uploadPath, Path.GetFileName(doc2))); statusInfo2 = string.Format("O{0}", Path.GetFileName(doc2)); //statusInfo2 = string.Format(Resources.Resource.FileStoreSuccess, Path.GetFileName(doc2)); } catch (Exception) { statusInfo2 = string.Format("E{0}", Path.GetFileName(doc2)); //statusInfo2 = string.Format(Resources.Resource.FileStoreFailed, Path.GetFileName(doc2)); failed = true; } } string er1 = Uri.EscapeDataString(statusInfo1); string er2 = Uri.EscapeDataString(statusInfo2); string res = "OK"; if (!failed) { string f1 = string.Empty, f2 = string.Empty; if (!string.IsNullOrEmpty(doc1)) f1 = Path.Combine(uploadPath, Path.GetFileName(doc1)); if (!string.IsNullOrEmpty(doc2)) f2 = Path.Combine(uploadPath, Path.GetFileName(doc2)); string cerfilename = CreateCertificate(userid, password, f1, f2, null); } else { res = "ERR"; } Response.Redirect(string.Format("~/Member/UploadCredentialResult.aspx?res={0}&t1={1}&t2={2}", res, er1, er2), false); } }
protected void AccountOverview_Click(object sender, EventArgs e) { using (Database db = new MySqlDatabase()) { UserInfo ui = db.GetUser(Util.UserId); ClientInfo ci = db.GetClientInfo(Util.UserId); string password = Session["access"] as string; string uploadPath = db.GetUserDocumentPath(Util.UserId, password); GenerateAccountOverView( Server.MapPath(Path.Combine(uploadPath, "/Temporaryfiles/AccInfo_" + ui.UserId + "_" + ci.FirstName + "_" + ci.LastName + ".pdf")), HttpContext.Current.Server.MapPath(Resources.Resource.AccountOverViewTemplate), ci, ui); } }
/// <summary> /// Handler for the Page_Load event of this page /// </summary> /// <param name="sender">the sender of this event</param> /// <param name="e">the arguments associated with this event</param> protected void Page_Load(object sender, EventArgs e) { try { IncludePage(MemberHomeInc, Resources.Resource.incMemberHome); IncludePage(RhosMovementInc, Resources.Resource.incRhosMovement2); using (Database db = new MySqlDatabase()) { UserInfo ui = db.GetUser(Util.UserId); ClientInfo ci = db.GetClientInfo(Util.UserId); DataSet ds = db.GetRegister(Util.UserId); int protectedTracks = ds.Tables[0].Rows.Count; LoggedOnTitle.Text = Resources.Resource.LoggedOnTitle; LoggedOnUserName.Text = string.Format("<span><b>{0}</b></span>", ci.GetFullName()); CreditsLiteral.Text = string.Format(Resources.Resource.spnCredits, Util.GetUserCredits(Util.UserId)); ProtectedLiteral.Text = string.Format(Resources.Resource.spnProtected, protectedTracks); string userDocPath = db.GetUserDocumentPath(ui.UserId, Session["access"] as string); decimal percentComplete = DetermineCompletion(userDocPath, ui, ci); Session["percentComplete"] = percentComplete; CompletedLiteral.Text = string.Empty; if (percentComplete < 100) CompletedLiteral.Text = string.Format(Resources.Resource.PercentComplete, percentComplete / 100m); ClickToLinkLiteral.Visible = (CompletedLiteral.Text != string.Empty); } if (!IsPostBack) { FillAccountInformation(); Language.Attributes["onchange"] = string.Format("storeSelection({0}, {1});", Language.ClientID, LanguageIndex.ClientID); TriggerCountryOnChange(Language.ClientID, LanguageIndex.ClientID, _countrySelectedIndex); //Birthday.MaxDate = DateTime.Now; } } catch (Exception ex) { Logger.Instance.Write(LogLevel.Error, ex, "MemberEdit<Exception>"); } }
/// <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); }
//public void RegistrationGrid_RowDataBound(object sender, GridViewRowEventArgs e) //{ // if (e.Row.RowType == DataControlRowType.DataRow) // { // DataRowView dataItem = e.Row.DataItem as DataRowView; // string txtCer = dataItem[1] as string; // string txtDoc = Path.ChangeExtension(txtCer, ".pdf"); // string navUrlCer = GetUserFilepath(txtCer); // string navUrlDoc = GetUserFilepath(txtDoc); // /* // ImageButton btn = e.Row.Cells[4].FindControl("downloadButton") as ImageButton; // btn.CommandArgument = navUrl; // */ // HyperLink hl = e.Row.Cells[0].FindControl("downloadButton") as HyperLink; // if (!string.IsNullOrEmpty(navUrlCer) && File.Exists(navUrlCer)) // { // //hl.Text = Path.GetFileNameWithoutExtension(txtCer); // hl.ImageUrl = "~/Images/certificates-icon.png"; // hl.NavigateUrl = string.Format("~/DownloadHandler.ashx?file='{0}'", navUrlCer); // } // else // { // hl.Text = Resources.Resource.NoFile; // hl.NavigateUrl = string.Empty; // } // hl = e.Row.Cells[0].FindControl("downloadDocument") as HyperLink; // if (!string.IsNullOrEmpty(navUrlDoc) && File.Exists(navUrlDoc)) // { // //hl.Text = Path.GetFileNameWithoutExtension(txtDoc); // hl.ImageUrl = "~/Images/pdf-icon.png"; // hl.NavigateUrl = string.Format("~/DownloadHandler.ashx?file='{0}'", navUrlDoc); // } // else // { // hl.Text = Resources.Resource.NoFile; // hl.NavigateUrl = string.Empty; // } // } //} public string GetUserFilepath(string filename) { long userid = Util.UserId; string pwd = string.Empty; if (HttpContext.Current.Session["access"] != null) pwd = HttpContext.Current.Session["access"] as string; string repositoryPath = null; using (Database db = new MySqlDatabase()) { repositoryPath = db.GetUserDocumentPath(userid, pwd); } string ret = Path.Combine(repositoryPath, filename); if (File.Exists(ret)) return ret; return string.Empty; }
protected void Accept_Click(object sender, EventArgs e) { Page.Validate("FileUploadValidate"); if (Page.IsValid) { long userid = Util.UserId; if (userid <= 0) { Logger.Instance.Write(LogLevel.Warning, "No user-id known, out of context page access"); return; } string statusInfo1 = string.Empty; string statusInfo2 = string.Empty; using (Database db = new MySqlDatabase()) { string password = Session["access"] as string; string uploadPath = string.Empty; uploadPath = db.GetUserDocumentPath(userid, password); uploadPath = uploadPath.Replace("\\", "/"); string doc1 = string.Empty, doc2 = string.Empty; bool failed = false; if (!failed && UploadFile1.HasFile) { doc1 = UploadFile1.FileName; try { UploadFile1.SaveAs(Path.Combine(uploadPath, Path.GetFileName(doc1))); statusInfo1 = string.Format("O{0}", Path.GetFileName(doc1)); //statusInfo1 = string.Format(Resources.Resource.FileStoreSuccess, Path.GetFileName(doc1)); } catch (Exception) { statusInfo1 = string.Format("E{0}", Path.GetFileName(doc1)); //statusInfo1 = string.Format(Resources.Resource.FileStoreFailed, Path.GetFileName(doc1)); failed = true; } } //if (!failed && UploadFile2.HasFile) //{ // doc2 = UploadFile2.FileName; // try // { // UploadFile2.SaveAs(Path.Combine(uploadPath, Path.GetFileName(doc2))); // statusInfo2 = string.Format("O{0}", Path.GetFileName(doc2)); // //statusInfo2 = string.Format(Resources.Resource.FileStoreSuccess, Path.GetFileName(doc2)); // } // catch (Exception) // { // statusInfo2 = string.Format("E{0}", Path.GetFileName(doc2)); // //statusInfo2 = string.Format(Resources.Resource.FileStoreFailed, Path.GetFileName(doc2)); // failed = true; // } //} string er1 = Uri.EscapeDataString(statusInfo1); string er2 = Uri.EscapeDataString(statusInfo2); string res = "OK"; if (!failed) { string f1 = string.Empty, f2 = string.Empty; if (!string.IsNullOrEmpty(doc1)) f1 = Path.Combine(uploadPath, Path.GetFileName(doc1)); if (!string.IsNullOrEmpty(doc2)) f2 = Path.Combine(uploadPath, Path.GetFileName(doc2)); string cerfilename = CreateCertificate(userid, password, f1, f2, null); } else { res = "ERR"; } ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('" + "The upload of your credentials was successful." + "');", true); //Added by Nagesh UserInfo ui = null; ClientInfo ci = null; string userDocPath = null; ui = db.GetUser(Util.UserId); ci = db.GetClientInfo(Util.UserId); userDocPath = db.GetUserDocumentPath(ui.UserId, Session["access"] as string); decimal percentComplete = DetermineCompletion(userDocPath, ui, ci); if (percentComplete < 100) { Response.Redirect("Profile.aspx"); } else { Response.Redirect("Thankyou.aspx"); } //Added by Nagesh } //Response.Redirect("Profile.aspx"); } }
private void FillAccountInformation() { try { const string spanFormat = "<span class=\"accountData\">{0}</span>"; using (Database db = new MySqlDatabase()) { UserInfo ui = db.GetUser(Util.UserId); ClientInfo ci = db.GetClientInfo(Util.UserId); CultureInfo cultureInfo = CultureInfo.CurrentCulture; CountryInfo countryInfo = Util.GetCountryInfo(ci.Country); if (countryInfo != null) //cultureInfo = new CultureInfo(countryInfo.CultureName); cultureInfo = new CultureInfo(cultureInfo.LCID); string name = ci.GetFullName(); if (!string.IsNullOrEmpty(ci.AccountOwner)) name = ci.AccountOwner; string subTypeName = "???"; string[] productNames = db.GetProductNames(); int subType = ui.SubscriptionType; if (subType > 0) --subType; if (subType > -1 && subType < productNames.Length) subTypeName = productNames[subType]; ButtonEditAccount.NavigateUrl = "~/Member/MemberEdit.aspx?mode=edit&pid=" + ui.SubscriptionType; AccountNameLabel.Text = string.Format(spanFormat, ci.GetFullName()); string gender = string.Empty; switch (ci.Gender) { case 'F': gender = Resources.Resource.Female; break; case 'M': gender = Resources.Resource.Male; break; } Gender.Text = gender; Birthdate.Text = ci.Birthdate.ToString("dd-MM-yyyy"); StringBuilder sb = new StringBuilder(); sb.Append(ci.AddressLine1); if (!string.IsNullOrEmpty(ci.AddressLine2)) { sb.Append("<br/>"); sb.Append(ci.AddressLine2); } sb.Append("<br/>"); sb.Append(ci.ZipCode); sb.Append(" "); sb.Append(ci.City); sb.Append(", "); sb.Append(ci.State); sb.Append("<br/>"); sb.Append(ci.Country); Address.Text = string.Format(spanFormat, sb.ToString()); Telephone.Text = string.Format(spanFormat, ci.Telephone); MemberSinceLabel.Text = string.Format(spanFormat, ui.MemberSince.Date.ToString("D", cultureInfo)); EmailLabel.Text = string.Format(spanFormat, ui.Email); IamLabel.Text = string.Format(spanFormat, ci.OwnerKind); BumaCodeLabel.Text = string.Format(spanFormat, ci.BumaCode); TwitterIdLabel.Text = string.Format(spanFormat, ci.TwitterId); FacebookIdLabel.Text = string.Format(spanFormat, ci.FacebookId); SoundCloudLabel.Text = string.Format(spanFormat, ci.SoundCloudId); SoniallIdLabel.Text = string.Format(spanFormat, ci.SoniallId); SenaCodeLabel.Text = string.Format(spanFormat, ci.SenaCode); IsrcCodeLabel.Text = string.Format(spanFormat, ci.IsrcCode); //CreditLiteral.Text = string.Format(spanFormat, ui.Credits); 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); // Assume the button will need to be visible, if not so we will discover afterwards UploadCredentialsButton.Visible = true; if (File.Exists(identDocPath)) { IdentityCertificate.Text = Path.GetFileName(identDocPath); DownloadIdent.Visible = true; DownloadIdent.NavigateUrl = string.Format("~/DownloadHandler.ashx?file='{0}'", identDocPath); UploadCredentialsButton.Visible = false; } else { // credential document has been marked as 'old' due to changed information // of the client and no new credential file has been uploaded identDocName = string.Format("ID{0:D10}.0.cer", ui.UserId); identDocPath = Path.Combine(userDocPath, identDocName); if (File.Exists(identDocPath)) { IdentityCertificate.Text = Path.GetFileName(identDocPath); DownloadIdent.Visible = true; DownloadIdent.NavigateUrl = string.Format("~/DownloadHandler.ashx?file='{0}'", identDocPath); } } } } catch (Exception ex) { Logger.Instance.Write(LogLevel.Error, ex, "AccountOverView<Exception> FillAccountInformation()"); } }
private void UserInformation() { using (Database db = new MySqlDatabase()) { UserInfo ui = db.GetUser(Util.UserId); ClientInfo ci = db.GetClientInfo(Util.UserId); DataSet ds = db.GetRegister(Util.UserId); int protectedTracks = ds.Tables[0].Rows.Count; LoggedOnTitle.Text = Resources.Resource.LoggedOnTitle; LoggedOnUserName.Text = string.Format("<span><b>{0}</b></span>", ci.FirstName); // ci.GetFullName()); CreditsLiteral.Text = Convert.ToString(Util.GetUserCredits(Util.UserId)); ProtectedLiteral.Text = Convert.ToString(protectedTracks); MemberSince.Text = Convert.ToString(ui.MemberSince); string userDocPath = db.GetUserDocumentPath(ui.UserId, Session["access"] as string); decimal percentComplete = DetermineCompletion(userDocPath, ui, ci); Session["percentComplete"] = percentComplete; CompletedLiteral.Text = string.Empty; if (percentComplete < 100) CompletedLiteral.Text = string.Format(Resources.Resource.PercentComplete, percentComplete / 100m); divAccPerCompleted.Visible = ClickToLinkLiteral.Visible = (CompletedLiteral.Text != string.Empty); } }
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); }
//public void RegistrationGrid_RowDataBound(object sender, GridViewRowEventArgs e) //{ // if (e.Row.RowType == DataControlRowType.DataRow) // { // DataRowView dataItem = e.Row.DataItem as DataRowView; // string txtCer = dataItem[1] as string; // string txtDoc = Path.ChangeExtension(txtCer, ".pdf"); // long managedUserId = (long)Session["managed.userid"]; // string navUrlCer = GetUserFilepath(managedUserId, txtCer); // string navUrlDoc = GetUserFilepath(managedUserId, txtDoc); // /* // ImageButton btn = e.Row.Cells[4].FindControl("downloadButton") as ImageButton; // btn.CommandArgument = navUrl; // */ // HyperLink hl = e.Row.Cells[3].FindControl("downloadButton") as HyperLink; // if (!string.IsNullOrEmpty(navUrlCer) && File.Exists(Server.MapPath(navUrlCer))) // { // hl.Text = Path.GetFileNameWithoutExtension(txtCer); // hl.NavigateUrl = string.Format("~/DownloadHandler.ashx?file='{0}'", Server.MapPath(navUrlCer)); // } // else // { // hl.Text = Resources.Resource.NoFile; // hl.NavigateUrl = string.Empty; // } // hl = e.Row.Cells[4].FindControl("downloadDocument") as HyperLink; // if (!string.IsNullOrEmpty(navUrlDoc) && File.Exists(Server.MapPath(navUrlDoc))) // { // hl.Text = Path.GetFileNameWithoutExtension(txtDoc); // hl.NavigateUrl = string.Format("~/DownloadHandler.ashx?file='{0}'", Server.MapPath(navUrlDoc)); // } // else // { // hl.Text = Resources.Resource.NoFile; // hl.NavigateUrl = string.Empty; // } // } //} public string GetUserFilepath(string filename, long userId) { //long userid = Util.UserId; string repositoryPath = null; using (Database db = new MySqlDatabase()) { repositoryPath = db.GetUserDocumentPath(userId); } string ret = Path.Combine(repositoryPath, filename); if (File.Exists(ret)) return ret; return string.Empty; }
protected void Page_Load(object sender, EventArgs e) { Session["bodyid"] = "credits"; IncludePage(FinancialEditInc, Resources.Resource.incFinancialOverview); IncludePage(RhosMovementInc, Resources.Resource.incRhosMovement2); using (Database db = new MySqlDatabase()) { UserInfo ui = db.GetUser(Util.UserId); ClientInfo ci = db.GetClientInfo(Util.UserId); DataSet ds = db.GetRegister(Util.UserId); int protectedTracks = ds.Tables[0].Rows.Count; LoggedOnTitle.Text = Resources.Resource.LoggedOnTitle; LoggedOnUserName.Text = string.Format("<span><b>{0}</b></span>", ci.FirstName);// ci.GetFullName()); CreditsLiteral.Text = Util.GetUserCredits(Util.UserId).ToString(); ProtectedLiteral.Text = protectedTracks.ToString(); decimal percentComplete = 0m; if (Session["percentComplete"] != null) percentComplete = Convert.ToDecimal(Session["percentComplete"]); CompletedLiteral.Text = string.Empty; if (percentComplete < 100) CompletedLiteral.Text = string.Format(Resources.Resource.PercentComplete, percentComplete / 100m); divAccPerCompleted.Visible = ClickToLinkLiteral.Visible = (CompletedLiteral.Text != string.Empty); } if (!IsPostBack) { if (Session["culture"] != null) _culture = Session["culture"] as string; long userId = Util.UserId; string passwd = Session["access"] as string; List<CreditHistory> creditHistory = null; using (Database db = new MySqlDatabase()) { _userDocumentPath = db.GetUserDocumentPath(userId, passwd); creditHistory = db.GetCreditHistory(userId); } dlMyTracks.DataSource = creditHistory; dlMyTracks.DataBind(); //Transactions transactions = Util.GetTransactions(Util.UserId); AddHeaders(FinancialOverviewTable); //foreach (Transaction transaction in transactions) //{ // AddTransaction(FinancialOverviewTable, transaction); //} foreach (CreditHistory ch in creditHistory) { AddCreditHistory(FinancialOverviewTable, ch); } AddFooters(FinancialOverviewTable); } //------- Highlight the selected lang button ------- ! if (Convert.ToString(Session["culture"]).Contains("nl")) { ClientScript.RegisterStartupScript(this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "ctl00_HeadLoginView_LanguageNL" + "');", true); ClientScript.RegisterStartupScript(this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "ctl00_HeadLoginView_LanguageUS" + "');", true); } else { ClientScript.RegisterStartupScript(this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "ctl00_HeadLoginView_LanguageUS" + "');", true); ClientScript.RegisterStartupScript(this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "ctl00_HeadLoginView_LanguageNL" + "');", true); } }