本文整理汇总了C#中MySqlDatabase.GetUserDocumentPath方法的典型用法代码示例。如果您正苦于以下问题:C# MySqlDatabase.GetUserDocumentPath方法的具体用法?C# MySqlDatabase.GetUserDocumentPath怎么用?C# MySqlDatabase.GetUserDocumentPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MySqlDatabase
的用法示例。
在下文中一共展示了MySqlDatabase.GetUserDocumentPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Page_Load
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);
}
}
示例2: Page_Load
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>");
}
}
示例3: FillAccountInformation
/// <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
//.........这里部分代码省略.........
示例4: AccountOverview_Click
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);
}
}
}
示例5: SubmitButton_Command
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)));
//.........这里部分代码省略.........
示例6: UpdateUserStatusPanel
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);
}
示例7: Page_Load
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);
//.........这里部分代码省略.........
示例8: UploadCredentialsButton_Command
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);
}
}
示例9: AccountOverview_Click
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);
}
}
示例10: Page_Load
/// <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>");
}
}
示例11: ModifyUserButtonClick
/// <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))
{
//.........这里部分代码省略.........
示例12: GetUserFilepath
//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;
}
示例13: Accept_Click
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");
//.........这里部分代码省略.........
示例14: FillAccountInformation
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);
}
}
}
}
//.........这里部分代码省略.........
示例15: UserInformation
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);
}
}