protected void btnSaveComments_Click(object sender, EventArgs e) { Classes.cPlayer PlayerInfo = new Classes.cPlayer(Master.UserID, Master.UserName); PlayerInfo.LARPResumeComments = tbLARPResumeComments.Text; PlayerInfo.Save(); lblModalMessage.Text = "Your comments have been saved."; ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModalMessage();", true); }
protected void btnSaveProfile_Click(object sender, EventArgs e) { cUser Demography = new Classes.cUser(Master.UserName, "Password", Session.SessionID); cPlayer PLDemography = new Classes.cPlayer(Master.UserID, Master.UserName); Demography.FirstName = tbFirstName.Text.Trim(); Demography.MiddleName = tbMiddleName.Text.Trim(); Demography.LastName = tbLastName.Text.Trim(); Demography.NickName = tbNickName.Text; Demography.ForumUserName = tbForumName.Text.Trim(); PLDemography.EmergencyContactName = tbEmergencyName.Text.Trim(); PLDemography.EmergencyContactPhone = tbEmergencyPhone.Text.Trim(); if (ddlGender.SelectedIndex != -1) { PLDemography.GenderStandared = ddlGender.SelectedValue; } PLDemography.GenderOther = tbGenderOther.Text; if (string.IsNullOrWhiteSpace(tbUserName.Text)) //If left empty set back to original setting...They may not remember it.... { tbUserName.Text = Demography.LoginName; } // 1 - No duplicate usernames allowed Classes.cLogin Login = new Classes.cLogin(); Login.CheckForExistingUsername(tbUserName.Text); if (Login.MemberID != 0 && Login.MemberID != Demography.UserID) // UserID is taken { lblMessage.Text = "This username is already in use. Please select a different one."; ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true); tbUserName.Focus(); return; } else { Demography.LoginName = tbUserName.Text.Trim(); } DateTime dtDOB; if (DateTime.TryParse(tbBDMM.Value + "/" + tbBDDD.Value + "/" + tbBDYYYY.Value, out dtDOB)) { PLDemography.DateOfBirth = dtDOB; } else { lblMessage.Text = "Please enter a valid date"; ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true); tbBDMM.Focus(); return; } PLDemography.AuthorName = tbPenName.Text; Demography.ForumUserName = tbForumName.Text; PLDemography.EmergencyContactName = tbEmergencyName.Text; if (!cPhone.isValidPhoneNumber(tbEmergencyPhone.Text, 10)) { lblMessage.Text = cPhone.ErrorDescription; ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true); tbEmergencyPhone.Focus(); return; } else { PLDemography.EmergencyContactPhone = tbEmergencyPhone.Text; } PLDemography.PictureID = -1; if (ViewState["UserIDPicture"] != null) { int iTemp; if (int.TryParse(ViewState["UserIDPicture"].ToString(), out iTemp)) { PLDemography.PictureID = iTemp; } else { PLDemography.PictureID = -1; } //PLDemography.UserPhoto = Session["dem_Img_Url"].ToString(); //imgPlayerImage.ImageUrl = Session["dem_Img_Url"].ToString(); //Session["dem_Img_Url"] = ""; //Session.Remove("dem_Img_Id"); //Classes.cPicture NewPicture = new Classes.cPicture(); //int iPictureId =0; //if (Session["dem_Img_Id"] != null && Int32.TryParse(Session["dem_Img_Id"].ToString(), out iPictureId)) //{ // //This code will be enabled once the stored procedure is created // string userID = Session["UserID"].ToString(); // //NewPicture.Load(iPictureId, userID); // //NewPicture.PictureFileName = NewPicture.PictureFileName.Replace("_2", "_1"); // //NewPicture.Save(userID); // //Time to trash the old main picture with the picture in memory // //PLDemography.UserPhoto = NewPicture.PictureFileName; //} } else { PLDemography.PictureID = -1; } Demography.Save(); PLDemography.Save(); //Session["Username"] = Demography.LoginName; lblMessage.Text = "Changes saved successfully."; ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true); }
protected void btnSave_Click(object sender, EventArgs e) { cUser Demography = new Classes.cUser(_UserName, "Password"); cPlayer PLDemography = new Classes.cPlayer(_UserID, _UserName); if (!string.IsNullOrWhiteSpace(tbFirstName.Text)) { Demography.FirstName = tbFirstName.Text.Trim(); } Demography.MiddleName = tbMiddleInit.Text.Trim(); //I should be able to remove my middle initial if I want if (!string.IsNullOrWhiteSpace(tbLastName.Text)) { Demography.LastName = tbLastName.Text.Trim(); } if (ddlGender.SelectedIndex != -1) { PLDemography.GenderStandared = ddlGender.SelectedValue; } PLDemography.GenderOther = tbGenderOther.Text; //We shall trust this value since the select event clears the text when needed Demography.NickName = tbNickName.Text; if (string.IsNullOrWhiteSpace(tbUserName.Text)) //If left empty set back to original setting...They may not remember it.... { tbUserName.Text = Demography.LoginName; } // 1 - No duplicate usernames allowed Classes.cLogin Login = new Classes.cLogin(); Login.CheckForExistingUsername(tbUserName.Text); if (Login.MemberID != 0 && Login.MemberID != Demography.UserID) // UserID is taken { lblMessage.Text = "This username is already in use. Please select a different one."; ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true); tbUserName.Focus(); return; } else { Demography.LoginName = tbUserName.Text.Trim(); } DateTime dob; if (DateTime.TryParse(tbDOB.Text, out dob)) { PLDemography.DateOfBirth = dob; } else { lblMessage.Text = "Please enter a valid date"; ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true); tbDOB.Focus(); return; } PLDemography.AuthorName = tbPenName.Text; Demography.ForumUserName = tbForumName.Text; PLDemography.EmergencyContactName = tbEmergencyName.Text; // Using the inital records merge result with the new ones. //if (AddressesChangesValidate() == false) // return; //if (PhoneNumbersChangesValidate() == false) // return; //if (EmailsChangesValidate() == false) // return; if (!cPhone.isValidPhoneNumber(tbEmergencyPhone.Text, 10)) { lblMessage.Text = cPhone.ErrorDescription; ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true); tbEmergencyPhone.Focus(); return; } else { PLDemography.EmergencyContactPhone = tbEmergencyPhone.Text; } /* 3) handle picture update/add. */ //At this point all validation must have been done so it is time to merge lists // AddressesChangesUpdate(Demography); // PhonesChangesUpdate(Demography); // EmailsChangesUpdate(Demography); PLDemography.PictureID = -1; if (ViewState["UserIDPicture"] != null) { int iTemp; if (int.TryParse(ViewState["UserIDPicture"].ToString(), out iTemp)) { PLDemography.PictureID = iTemp; } else { PLDemography.PictureID = -1; } //PLDemography.UserPhoto = Session["dem_Img_Url"].ToString(); //imgPlayerImage.ImageUrl = Session["dem_Img_Url"].ToString(); //Session["dem_Img_Url"] = ""; //Session.Remove("dem_Img_Id"); //Classes.cPicture NewPicture = new Classes.cPicture(); //int iPictureId =0; //if (Session["dem_Img_Id"] != null && Int32.TryParse(Session["dem_Img_Id"].ToString(), out iPictureId)) //{ // //This code will be enabled once the stored procedure is created // string userID = Session["UserID"].ToString(); // //NewPicture.Load(iPictureId, userID); // //NewPicture.PictureFileName = NewPicture.PictureFileName.Replace("_2", "_1"); // //NewPicture.Save(userID); // //Time to trash the old main picture with the picture in memory // //PLDemography.UserPhoto = NewPicture.PictureFileName; //} } else { PLDemography.PictureID = -1; } Demography.Save(); PLDemography.Save(); Session["Username"] = Demography.LoginName; lblMessage.Text = "Changes saved successfully."; ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true); }