protected void oCharSelect_CharacterChanged(object sender, EventArgs e) { oCharSelect.LoadInfo(); if (oCharSelect.CharacterInfo != null) { if (oCharSelect.CharacterID.HasValue) { Classes.cUser UserInfo = new Classes.cUser(_UserName, "PasswordNotNeeded"); UserInfo.LastLoggedInCampaign = oCharSelect.CharacterInfo.CampaignID; UserInfo.LastLoggedInCharacter = oCharSelect.CharacterID.Value; UserInfo.LastLoggedInMyCharOrCamp = (oCharSelect.WhichSelected == controls.CharacterSelect.Selected.MyCharacters ? "M" : "C"); UserInfo.Save(); Session["PlaceCharacterID"] = oCharSelect.CharacterID.Value; if ((oCharSelect.WhichSelected == controls.CharacterSelect.Selected.MyCharacters) && (oCharSelect.CharacterInfo.CharacterType != 1)) { Session["CharPlaceReadOnly"] = "Y"; } else { Session.Remove("CharPlaceReadOnly"); } } else { Session.Remove("PlaceCharacterID"); } // _Reload = true; } }
protected void oCharSelect_CharacterChanged(object sender, EventArgs e) { oCharSelect.LoadInfo(); if (oCharSelect.CharacterID.HasValue) { Session["CharSkillCharacterID"] = oCharSelect.CharacterID.Value; Session["ReloadCharacter"] = "Y"; if ((oCharSelect.WhichSelected == controls.CharacterSelect.Selected.MyCharacters) && (oCharSelect.CharacterInfo.CharacterType != 1)) { divExcl.Visible = false; Session["CharSkillReadOnly"] = "Y"; btnSave.Enabled = false; btnSave.CssClass = "btn-default"; btnSave.Style["background-color"] = "grey"; lblSpacer.Text = "<br>"; } else { divExcl.Visible = true; Session["CharSkillReadOnly"] = "N"; btnSave.Enabled = true; btnSave.Style["background-color"] = null; btnSave.CssClass = "StandardButton"; lblSpacer.Text = "<br><br>"; } Classes.cUser UserInfo = new Classes.cUser(Session["UserName"].ToString(), "PasswordNotNeeded"); UserInfo.LastLoggedInCampaign = oCharSelect.CharacterInfo.CampaignID; UserInfo.LastLoggedInCharacter = oCharSelect.CharacterID.Value; UserInfo.LastLoggedInMyCharOrCamp = (oCharSelect.WhichSelected == controls.CharacterSelect.Selected.MyCharacters ? "M" : "C"); UserInfo.Save(); } }
protected void Page_Load(object sender, EventArgs e) { MethodBase lmth = MethodBase.GetCurrentMethod(); string lsRoutineName = lmth.DeclaringType + "." + lmth.Name; if (!IsPostBack) { Classes.cUser Demography = new Classes.cUser(Master.UserName, "Password", Session.SessionID); Classes.cPlayer PLDemography = new Classes.cPlayer(Master.UserID, Master.UserName); List <Classes.cPhone> MobilePhone = Demography.UserPhones.Where(x => x.PhoneType == "Mobile").ToList(); if (MobilePhone.Count > 0) { List <Classes.cPhone> ValidText = MobilePhone.Where(x => !String.IsNullOrEmpty(x.Provider)).ToList(); if (ValidText.Count > 0) { hidMobileNumber.Value = "Texts will be sent to " + MobilePhone[0].AreaCode + MobilePhone[0].PhoneNumber + ", Provider: " + MobilePhone[0].Provider; } else { hidMobileNumber.Value = "Cannot send texts because the mobile phone provider is not filled in."; } } else { hidMobileNumber.Value = "Cannot send texts because the mobile phone number is not filled in."; } hidEMail.Value = "EMails will be sent to " + Demography.PrimaryEmailAddress.EmailAddress; hidPlayerProfileID.Value = PLDemography.PlayerProfileID.ToString(); } }
private void SendSubmittedEmail(string sHistory, Classes.cCharacterHistory cHist) { try { Classes.cUser User = new Classes.cUser(Master.UserName, "PasswordNotNeeded", Session.SessionID); string sSubject = cHist.CampaignName + " character history from " + cHist.PlayerName + " - " + cHist.CharacterAKA; string sBody = (string.IsNullOrEmpty(User.NickName) ? User.FirstName : User.NickName) + " " + User.LastName + " has submitted a character history for " + cHist.CharacterAKA + ".<br><br>" + sHistory; if (hidNotificationEMail.Value.Length > 0) { Classes.cEmailMessageService cEMS = new Classes.cEmailMessageService(); cEMS.SendMail(sSubject, sBody, cHist.NotificationEMail, "", "", "CharacterHistory", Master.UserName); } //Classes.cSendNotifications SendNot = new Classes.cSendNotifications(); //SendNot.SubjectText = sSubject; //SendNot.EMailBody = sBody; //SendNot.NotifyType = Classes.cNotificationTypes.HISTORYSUBMIT; //SendNot.SendNotification(Master.UserID, Master.UserName); } catch (Exception ex) { // Write the exception to error log and then throw it again... Classes.ErrorAtServer lobjError = new Classes.ErrorAtServer(); lobjError.ProcessError(ex, "CharacterEdit.aspx.SendSubmittedEmail", "", Session.SessionID); } }
// private Classes.LogWriter oLogWriter = new LogWriter(); protected void Page_Load(object sender, EventArgs e) { MethodBase lmth = MethodBase.GetCurrentMethod(); string lsRoutineName = lmth.DeclaringType + "." + lmth.Name; if (!IsPostBack) { _UserInfo = null; } // oLogWriter.AddLogMessage("Starting up CharacterSelect", lsRoutineName, "", Session.SessionID); if (Session["UserID"] != null) { int.TryParse(Session["UserID"].ToString(), out _UserID); } if (Session["UserName"] != null) { _UserName = Session["UserName"].ToString(); } if (_UserInfo == null) { // oLogWriter.AddLogMessage("About to load user in Page Load routine.", lsRoutineName, "", Session.SessionID); _UserInfo = new cUser(_UserName, "PasswordNotNeeded", Session.SessionID); // oLogWriter.AddLogMessage("Done loading user in Page_Load routine.", lsRoutineName, "", Session.SessionID); } if ((Session["CampaignsToEdit"] == null) || (Session["MyCharacters"] == null)) { _CharacterID = UserInfo.LastLoggedInCharacter; _SkillSetID = UserInfo.LastLoggedInSkillSetID; _CampaignID = UserInfo.LastLoggedInCampaign; if (UserInfo.LastLoggedInMyCharOrCamp == "C") { WhichSelected = Selected.CampaignCharacters; Session["CharCampaignCampaignID"] = UserInfo.LastLoggedInCampaign; Session["CharCampaignCharID"] = UserInfo.LastLoggedInCharacter; Session["CharCampaignSkillSetID"] = UserInfo.LastLoggedInSkillSetID; Session["CharacterSelectGroup"] = "Campaigns"; } else { WhichSelected = Selected.MyCharacters; Session["CharSkillSetID"] = UserInfo.LastLoggedInSkillSetID; Session["CharCharacterID"] = UserInfo.LastLoggedInCharacter; Session["CharCampaignID"] = UserInfo.LastLoggedInCampaign; Session["CharacterSelectGroup"] = "Characters"; } } // oLogWriter.AddLogMessage("Done loading CharacterSelect", lsRoutineName, "", Session.SessionID); }
protected void MasterPage_CampaignChanged(object sender, EventArgs e) { string t = sender.GetType().ToString(); oCharSelect.Reset(); Classes.cUser user = new Classes.cUser(Master.UserName, "NOPASSWORD", Session.SessionID); if (user.LastLoggedInCharacter == -1) { Response.Redirect("/default.aspx"); } }
protected void oCharSelect_CharacterChanged(object sender, EventArgs e) { if (oCharSelect.CharacterInfo != null) { if (oCharSelect.CharacterID.HasValue) { Classes.cUser UserInfo = new Classes.cUser(_UserName, "PasswordNotNeeded"); UserInfo.LastLoggedInCampaign = oCharSelect.CharacterInfo.CampaignID; UserInfo.LastLoggedInCharacter = oCharSelect.CharacterID.Value; UserInfo.LastLoggedInMyCharOrCamp = (oCharSelect.WhichSelected == controls.CharacterSelect.Selected.MyCharacters ? "M" : "C"); UserInfo.Save(); } } }
protected void ddlCharacterSelector_SelectedIndexChanged(object sender, EventArgs e) { oCharSelect.LoadInfo(); if (oCharSelect.CharacterInfo != null) { if (oCharSelect.CharacterID.HasValue) { Classes.cUser UserInfo = new Classes.cUser(Session["UserName"].ToString(), "PasswordNotNeeded"); UserInfo.LastLoggedInCampaign = oCharSelect.CharacterInfo.CampaignID; UserInfo.LastLoggedInCharacter = oCharSelect.CharacterID.Value; UserInfo.LastLoggedInMyCharOrCamp = (oCharSelect.WhichSelected == controls.CharacterSelect.Selected.MyCharacters ? "M" : "C"); UserInfo.Save(); } _Reload = true; } }
protected void oCharSelect_CharacterChanged(object sender, EventArgs e) { oCharSelect.LoadInfo(); if (oCharSelect.CharacterInfo != null) { if (oCharSelect.CharacterID.HasValue) { Classes.cUser UserInfo = new Classes.cUser(Master.UserName, "PasswordNotNeeded", Session.SessionID); UserInfo.LastLoggedInCampaign = oCharSelect.CampaignID.Value; UserInfo.LastLoggedInCharacter = oCharSelect.CharacterID.Value; UserInfo.LastLoggedInSkillSetID = oCharSelect.SkillSetID.Value; UserInfo.LastLoggedInMyCharOrCamp = (oCharSelect.WhichSelected == LarpPortal.Controls.CharacterSelect.Selected.MyCharacters ? "M" : "C"); UserInfo.Save(); } } }
protected void oCharSelect_CharacterChanged(object sender, EventArgs e) { oCharSelect.LoadInfo(); if (oCharSelect.CharacterInfo != null) { if (oCharSelect.CharacterID.HasValue) { Classes.cUser UserInfo = new Classes.cUser(_UserName, "PasswordNotNeeded"); UserInfo.LastLoggedInCampaign = oCharSelect.CharacterInfo.CampaignID; UserInfo.LastLoggedInCharacter = oCharSelect.CharacterID.Value; UserInfo.LastLoggedInMyCharOrCamp = (oCharSelect.WhichSelected == controls.CharacterSelect.Selected.MyCharacters ? "M" : "C"); UserInfo.Save(); } mvAddingRelationship.SetActiveView(vwNewRelateButton); _Reload = true; } }
protected void btnSendMessage_Click(object sender, EventArgs e) { SortedList sParams = new SortedList(); sParams.Add("@UserID", Session["UserID"].ToString()); sParams.Add("@CharacterID", hidCharacterID.Value); sParams.Add("@ClearHistorySubmitted", true); Classes.cUtilities.PerformNonQuery("uspInsUpdCHCharacters", sParams, "LARPortal", Session["UserName"].ToString()); Session["UpdateHistoryMessage"] = "alert('The character history has been sent back to the user.');"; Classes.cUser User = new Classes.cUser(Session["UserName"].ToString(), "PasswordNotNeeded"); string sSubject = "Character history for " + hidCharacterAKA.Value + " needs revision"; Classes.cEmailMessageService cEMS = new Classes.cEmailMessageService(); cEMS.SendMail(sSubject, ckHistory.Text, hidEmail.Value, "", hidNotificationEMail.Value, "CharacterHistory", Session["Username"].ToString()); Response.Redirect("ApprovalList.aspx", true); }
protected void Page_Load(object sender, EventArgs e) { MethodBase lmth = MethodBase.GetCurrentMethod(); string lsRoutineName = lmth.DeclaringType + "." + lmth.Name; if (Session["Username"] != null) { _UserName = Session["Username"].ToString(); } if (Session["UserID"] != null) { int.TryParse(Session["UserID"].ToString(), out _UserID); } if (!IsPostBack) { lblMessage.Text = ""; cUser Demography = new Classes.cUser(_UserName, "Password"); cPlayer PLDemography = new Classes.cPlayer(_UserID, _UserName); List <cPhone> MobilePhone = Demography.UserPhones.Where(x => x.PhoneType == "Mobile").ToList(); if (MobilePhone.Count > 0) { List <cPhone> ValidText = MobilePhone.Where(x => x.Provider != "").ToList(); if (ValidText.Count > 0) { hidMobileNumber.Value = "Texts will be sent to " + MobilePhone[0].AreaCode + MobilePhone[0].PhoneNumber + ", Provider: " + MobilePhone[0].Provider; } else { hidMobileNumber.Value = "Cannot send texts because the mobile phone provider is not filled in."; } } else { hidMobileNumber.Value = "Cannot send texts because the mobile phone number is not filled in."; } hidEMail.Value = "EMails will be sent to " + Demography.PrimaryEmailAddress.EmailAddress; hidPlayerProfileID.Value = PLDemography.PlayerProfileID.ToString(); } }
protected void Page_PreRender(object sender, EventArgs e) { if (!IsPostBack) { Classes.cUser Demography = new Classes.cUser(Master.UserName, "Password", Session.SessionID); Classes.cPlayer PLDemography = new Classes.cPlayer(Master.UserID, Master.UserName); Classes.cLogin UserLoggedIn = new Classes.cLogin(); UserLoggedIn.ValidateUserForPasswordReset(Master.UserName, Demography.PrimaryEmailAddress.EmailAddress, Demography.LastName); hidOrigPassword.Value = UserLoggedIn.Password; tbAnswer1.Text = UserLoggedIn.SecurityAnswer1; tbAnswer2.Text = UserLoggedIn.SecurityAnswer2; tbAnswer3.Text = UserLoggedIn.SecurityAnswer3; tbQuestion1.Text = UserLoggedIn.SecurityQuestion1; tbQuestion2.Text = UserLoggedIn.SecurityQuestion2; tbQuestion3.Text = UserLoggedIn.SecurityQuestion3; } }
public void LoadAndSetCharacter() { MethodBase lmth = MethodBase.GetCurrentMethod(); string lsRoutineName = lmth.DeclaringType + "." + lmth.Name; WhichSelected = Selected.NotSpecified; if ((Session ["CampaignsToEdit"] == null) || (Session ["MyCharacters"] == null)) { if (_UserInfo == null) { _UserInfo = new cUser(_UserName, "PasswordNotNeeded", Session.SessionID); } // oLogWriter.AddLogMessage("Done loading user.", lsRoutineName, "", Session.SessionID); _CharacterInfo = new cCharacter(); _CharacterInfo.LoadCharacterBySkillSetID(UserInfo.LastLoggedInSkillSetID); _SkillSetID = UserInfo.LastLoggedInSkillSetID; _CharacterID = _CharacterInfo.CharacterID; _CampaignID = _CharacterInfo.CampaignID; Session["CharSelectSetID"] = UserInfo.LastLoggedInCharacter; if (UserInfo.LastLoggedInMyCharOrCamp == "C") { WhichSelected = Selected.CampaignCharacters; Session["CharCampaignSkillSetID"] = _UserInfo.LastLoggedInSkillSetID; Session["CharCampaignCharID"] = _CharacterInfo.CharacterID; Session["CharCampaignCampaignID"] = _CharacterInfo.CampaignID; Session ["CharacterSelectGroup"] = "Campaigns"; } else { WhichSelected = Selected.MyCharacters; Session["CharSkillSetID"] = UserInfo.LastLoggedInSkillSetID; Session["CharCharacterID"] = _CharacterInfo.CharacterID; Session["CharCampaignID"] = _CharacterInfo.CampaignID; } } }
protected void ddlCampCharSelector_SelectedIndexChanged(object sender, EventArgs e) { Session["CharacterSelectGroup"] = "Campaigns"; int iSkillSetID; if (int.TryParse(ddlCampCharSelector.SelectedValue, out iSkillSetID)) { if (iSkillSetID < 0) { Response.Redirect("~/Character/CharAdd.aspx", true); } WhichSelected = Selected.CampaignCharacters; _CharacterInfo = new cCharacter(); _CharacterInfo.LoadCharacterBySkillSetID(iSkillSetID); _SkillSetID = iSkillSetID; _CharacterID = _CharacterInfo.CharacterID; _CampaignID = _CharacterInfo.CampaignID; Session["CharCampaignSkillSetID"] = iSkillSetID; Session["CharCampaignCharID"] = _CharacterInfo.CharacterID; Session["CharCampaignCampaignID"] = _CharacterInfo.CampaignID; Classes.cUser UserInfo = new Classes.cUser(_UserName, "PasswordNotNeeded", Session.SessionID); UserInfo.LastLoggedInCampaign = _CampaignID.Value; UserInfo.LastLoggedInCharacter = _CharacterID.Value; UserInfo.LastLoggedInSkillSetID = _SkillSetID.Value; UserInfo.LastLoggedInMyCharOrCamp = "C"; UserInfo.Save(); // _CharacterInfo.LoadCharacterBySkillSetID(_SkillSetID.Value); if (this.CharacterChanged != null) { CharacterChanged(this, e); } } else { _CharacterID = null; } }
public void Reset() { if (Session["CharCampaignCampaignID"] != null) { Session.Remove("CharCampaignCampaignID"); } if (Session["CharCampaignCharID"] != null) { Session.Remove("CharCampaignCharID"); } if (Session["CharCampaignSkillSetID"] != null) { Session.Remove("CharCampaignSkillSetID"); } if (Session["CharacterSelectGroup"] != null) { Session.Remove("CharacterSelectGroup"); } if (Session["CharSkillSetID"] != null) { Session.Remove("CharSkillSetID"); } if (Session["CharCharID"] != null) { Session.Remove("CharCharID"); } if (Session["CharCampaignID"] != null) { Session.Remove("CharCampaignID"); } if (Session["MyCharacters"] != null) { Session.Remove("MyCharacters"); } if (Session["CampaignsToEdit"] != null) { Session.Remove("CampaignsToEdit"); } _UserInfo = null; }
private void SendSubmittedEmail(string sHistory, Classes.cCharacterHistory cHist) { try { if (hidNotificationEMail.Value.Length > 0) { Classes.cUser User = new Classes.cUser(Session["UserName"].ToString(), "PasswordNotNeeded"); string sSubject = cHist.CampaignName + " character history from " + cHist.PlayerName + " - " + cHist.CharacterAKA; string sBody = (string.IsNullOrEmpty(User.NickName) ? User.FirstName : User.NickName) + " " + User.LastName + " has submitted a character history for " + cHist.CharacterAKA + ".<br><br>" + sHistory; Classes.cEmailMessageService cEMS = new Classes.cEmailMessageService(); cEMS.SendMail(sSubject, sBody, cHist.NotificationEMail, "", "", "CharacterHistory", Session["Username"].ToString()); } } catch (Exception ex) { // Write the exception to error log and then throw it again... Classes.ErrorAtServer lobjError = new Classes.ErrorAtServer(); lobjError.ProcessError(ex, "CharacterEdit.aspx.SendSubmittedEmail", "", Session.SessionID); } }
protected void btnSave_Click(object sender, EventArgs e) { divErrorPasswords.Visible = false; divErrorQuestion1.Visible = false; divErrorQuestion2.Visible = false; divErrorQuestion3.Visible = false; if ((!hidOrigPassword.Value.Equals(tbOrigPassword.Text)) && (tbOrigPassword.Text.Length > 0)) { lblErrorPasswords.Text = "The original password is incorrect."; divErrorPasswords.Visible = true; return; } if ((tbOrigPassword.Text.Length == 0) && ((tbPassword.Text.Length > 0) || (tbPasswordConfirm.Text.Length > 0))) { lblErrorPasswords.Text = "If you want to change your password you must enter the original password."; divErrorPasswords.Visible = true; return; } if (!tbPassword.Text.Equals(tbPasswordConfirm.Text)) { lblErrorPasswords.Text = "The new passwords must be the same."; divErrorPasswords.Visible = true; return; } Classes.cUser Demography = new Classes.cUser(Master.UserName, "Password", Session.SessionID); Classes.cPlayer PLDemography = new Classes.cPlayer(Master.UserID, Master.UserName); Classes.cLogin UserLoggedIn = new Classes.cLogin(); //this needs to be done in order to show security questions as per ForgotPassword existing logic UserLoggedIn.ValidateUserForPasswordReset(Master.UserName, Demography.PrimaryEmailAddress.EmailAddress, Demography.LastName); //Validate password if (!string.IsNullOrWhiteSpace(tbPassword.Text)) { UserLoggedIn.ValidateNewPassword(tbPassword.Text); if (UserLoggedIn.PasswordValidation == 0) { lblErrorPasswords.Text = UserLoggedIn.PasswordFailMessage; divErrorQuestion1.Visible = true; return; } } if ((string.IsNullOrWhiteSpace(tbQuestion1.Text)) || (string.IsNullOrWhiteSpace(tbAnswer1.Text))) { lblErrorQuestion1.Text = "Question 1 and Answer 1 are required."; divErrorQuestion1.Visible = true; tbQuestion1.Focus(); return; } //If question entered and answer not entered if (!string.IsNullOrWhiteSpace(tbQuestion2.Text) && string.IsNullOrWhiteSpace(tbAnswer2.Text)) { lblErrorQuestion2.Text = "If you enter question 2 you must enter the answer also."; lblErrorQuestion2.Focus(); divErrorQuestion2.Visible = true; return; } if (string.IsNullOrWhiteSpace(tbQuestion2.Text) && !string.IsNullOrWhiteSpace(tbAnswer2.Text)) { lblErrorQuestion2.Text = "If you enter answer 2 you must enter the question also."; lblErrorQuestion2.Focus(); divErrorQuestion2.Visible = true; return; } //If question entered and answer not entered if (!string.IsNullOrWhiteSpace(tbQuestion3.Text) && string.IsNullOrWhiteSpace(tbAnswer3.Text)) { lblErrorQuestion3.Text = "If you enter question 3 you must enter the answer also."; lblErrorQuestion3.Focus(); divErrorQuestion3.Visible = true; return; } if (string.IsNullOrWhiteSpace(tbQuestion3.Text) && !string.IsNullOrWhiteSpace(tbAnswer3.Text)) { lblErrorQuestion3.Text = "If you enter answer 3 you must enter the question also."; lblErrorQuestion3.Focus(); divErrorQuestion3.Visible = true; return; } //Make sure that questions and answers do not repeat UserLoggedIn.UpdateQAandPassword( UserLoggedIn.UserSecurityID, Master.UserID, tbQuestion1.Text, "1", tbQuestion2.Text, "1", tbQuestion3.Text, "1", tbAnswer1.Text, "1", tbAnswer2.Text, "1", tbAnswer3.Text, "1", string.IsNullOrWhiteSpace(tbPassword.Text) ? UserLoggedIn.Password : tbPassword.Text); lblErrorPasswords.Text = "Changes saved successfully."; }
protected void btnSave_Click(object sender, EventArgs e) { int iTemp; oCharSelect.LoadInfo(); if ((oCharSelect.SkillSetID.HasValue) && (oCharSelect.CharacterInfo != null)) { int i = 0; string sHiddenSkillList = ""; foreach (GridViewRow row in gvHiddenSkillAccess.Rows) { if (row.RowType == DataControlRowType.DataRow) { CheckBox cbxHasSkill = (row.Cells[1].FindControl("cbxHasSkill") as CheckBox); HiddenField hidHadOriginally = (row.Cells[2].FindControl("hidHadOriginally") as HiddenField); HiddenField hidCampaignSkillNodeID = (row.Cells[2].FindControl("hidCampaignSkillNodeID") as HiddenField); HiddenField hidSkillName = (row.Cells[2].FindControl("hidSkillName") as HiddenField); if ((cbxHasSkill != null) && (hidHadOriginally != null) && (hidCampaignSkillNodeID != null)) { bool bHasOriginally = false; if (hidHadOriginally.Value == "1") { bHasOriginally = true; } if (bHasOriginally != cbxHasSkill.Checked) { if (cbxHasSkill.Checked) { // Since the value has changed, and it's checked, it means we need to add the value; int iCampaignSkillNodeID; if (int.TryParse(hidCampaignSkillNodeID.Value, out iCampaignSkillNodeID)) { SortedList sParams = new SortedList(); sParams.Add("@UserID", Master.UserID); sParams.Add("@CampaignSkillsStandardID", iCampaignSkillNodeID); sParams.Add("@SkillSetID", oCharSelect.SkillSetID); sParams.Add("@Comments", "Skill added by " + Master.UserName); sParams.Add("@CharacterID", oCharSelect.CharacterID); Classes.cUtilities.PerformNonQuery("uspInsUpdCHCampaignSkillAccess", sParams, "LARPortal", Master.UserName); if (hidSkillName != null) { sHiddenSkillList += hidSkillName.Value + "<br>"; } } } else { // Since the value has changed, and it's not checked, it means we need to delete the value; HiddenField hidCampaignSkillAccessID = (row.Cells[2].FindControl("hidCampaignSkillAccessID") as HiddenField); if (hidCampaignSkillAccessID != null) { int iCampaignSkillAccessID; if (int.TryParse(hidCampaignSkillAccessID.Value, out iCampaignSkillAccessID)) { SortedList sParams = new SortedList(); sParams.Add("@CampaignSkillAccessID", iCampaignSkillAccessID); sParams.Add("@UserName", Master.UserName); sParams.Add("@UserID", Master.UserID); Classes.cUtilities.PerformNonQuery("uspDelCHCampaignSkillAccess", sParams, "LARPortal", Master.UserName); } } } } } } i++; } // If there were any hidden skills given to the character, send them an email. if ((sHiddenSkillList.Length > 0) && (oCharSelect.CharacterInfo.CharacterEmail.ToString().Length > 0)) { string sSubject = "LARP Portal Notification - " + Master.CampaignName + " staff has given you access to a hidden skill."; string sBody = "The staff of " + Master.CampaignName + " has given your character " + oCharSelect.CharacterInfo.AKA + " access to the following skill(s):<br>" + "<br>" + sHiddenSkillList; Classes.cUser User = new Classes.cUser(Master.UserName, "PasswordNotNeeded", Session.SessionID); Classes.cEmailMessageService cEMS = new Classes.cEmailMessageService(); cEMS.SendMail(sSubject, sBody, oCharSelect.CharacterInfo.CharacterEmail, "", User.PrimaryEmailAddress.EmailAddress, "CharInfo - Hidden Skills", Master.UserName); } if ((tbAKA.Text.Length == 0) && (tbFirstName.Text.Length == 0)) { // JBradshaw 7/11/2016 Request #1286 Must have at least first name or last name. lblmodalError.Text = "You must fill in at least the first name or the character AKA."; ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openError();", true); return; } Classes.cCharacter cChar = new Classes.cCharacter(); cChar.LoadCharacterBySkillSetID(oCharSelect.SkillSetID.Value); if (ulFile.HasFile) { try { // string sUser = Session["LoginName"].ToString(); Classes.cPicture NewPicture = new Classes.cPicture(); NewPicture.PictureType = Classes.cPicture.PictureTypes.Profile; NewPicture.CreateNewPictureRecord(Master.UserName); string sExtension = Path.GetExtension(ulFile.FileName); NewPicture.PictureFileName = "CP" + NewPicture.PictureID.ToString("D10") + sExtension; NewPicture.CharacterID = oCharSelect.CharacterID.Value; string LocalName = NewPicture.PictureLocalName; if (!Directory.Exists(Path.GetDirectoryName(NewPicture.PictureLocalName))) { Directory.CreateDirectory(Path.GetDirectoryName(NewPicture.PictureLocalName)); } ulFile.SaveAs(NewPicture.PictureLocalName); NewPicture.Save(Master.UserName); cChar.ProfilePicture = NewPicture; // ViewState["UserIDPicture"] = NewPicture; ViewState.Remove("PictureDeleted"); imgCharacterPicture.ImageUrl = NewPicture.PictureURL; imgCharacterPicture.Visible = true; // btnClearPicture.Visible = true; } catch //(Exception ex) { // lblMessage.Text = ex.Message + "<br>" + ex.StackTrace; } } cChar.FirstName = tbFirstName.Text; cChar.MiddleName = tbMiddleName.Text; cChar.LastName = tbLastName.Text; cChar.CurrentHome = tbBirthPlace.Text; cChar.AllowCharacterRebuildToDate = null; if (oCharSelect.WhichSelected == LarpPortal.Controls.CharacterSelect.Selected.CampaignCharacters) { cChar.CharacterStatusID = Convert.ToInt32(ddlStatus.SelectedValue); cChar.CharacterType = Convert.ToInt32(ddlCharType.SelectedValue); //if (ddlAllowRebuild.SelectedValue == "Y") //{ // tbRebuildToDate.Style["display"] = "inline"; // lblExpiresOn.Style["display"] = "inline"; // DateTime dtTemp; // if (DateTime.TryParse(tbRebuildToDate.Text, out dtTemp)) // cChar.AllowCharacterRebuildToDate = dtTemp; //} //else //{ // tbRebuildToDate.Style["display"] = "none"; // lblExpiresOn.Style["display"] = "none"; //} } if (ddlVisible.SelectedValue == "1") { cChar.VisibleToPCs = true; } else { cChar.VisibleToPCs = false; } cChar.AKA = tbAKA.Text; cChar.CurrentHome = tbHome.Text; cChar.WhereFrom = tbBirthPlace.Text; // If the drop down list is visible, it means they belong to multiple teams so we need to check it. if (ddlTeamList.Visible) { if (int.TryParse(ddlTeamList.SelectedValue, out iTemp)) { cChar.TeamID = iTemp; } } cChar.DateOfBirth = tbDOB.Text; if (ViewState["UserIDPicture"] != null) { cChar.ProfilePicture = ViewState["UserIDPicture"] as Classes.cPicture; if (ViewState["PictureDeleted"] != null) { cChar.ProfilePicture.RecordStatus = Classes.RecordStatuses.Delete; } } else { cChar.ProfilePicture = null; } if (ddlRace.SelectedIndex > -1) { cChar.Race = new Classes.cRace(); int.TryParse(ddlRace.SelectedValue, out iTemp); cChar.Race.CampaignRaceID = iTemp; } if (ddlAllowRebuild.SelectedValue == "Y") { DateTime dtTemp; if (DateTime.TryParse(tbRebuildToDate.Text, out dtTemp)) { cChar.AllowCharacterRebuildToDate = dtTemp; } } else { cChar.AllowCharacterRebuildToDate = new DateTime(1900, 1, 1); } if (cChar.CharacterType != 1) // Means it's not a PC so we need to check who is the current actor. { var LastActor = cChar.Actors.OrderByDescending(x => x.StartDate).ToList(); if (LastActor == null) { cChar.CurrentUserID = Master.UserID; } else { if (LastActor.Count > 0) { cChar.CurrentUserID = LastActor[0].UserID; } } } cChar.StaffComments = tbStaffComments.Text; cChar.SaveCharacter(Master.UserName, Master.UserID); // JBradshaw 7/11/2016 Request #1286 Changed over to bootstrap popup. lblmodalMessage.Text = "Character " + cChar.AKA + " has been saved."; ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openMessage();", true); } }
protected void Page_PreRender(object sender, EventArgs e) { if (_RELOAD) { MethodBase lmth = MethodBase.GetCurrentMethod(); string lsRoutineName = lmth.DeclaringType + "." + lmth.Name; _dsHistory = new DataSet(); double dCPEarned = 0.0; if (Request.QueryString["CharacterID"] != null) { hidCharacterID.Value = Request.QueryString["CharacterID"]; } else { Response.Redirect("ApprovalList.aspx", true); } Classes.cUser UserInfo = new Classes.cUser(_UserName, "NOPASSWORD"); if (UserInfo.NickName.Length > 0) { hidAuthorName.Value = UserInfo.NickName + " " + UserInfo.LastName; } else { hidAuthorName.Value = UserInfo.FirstName + " " + UserInfo.LastName; } SortedList sParams = new SortedList(); sParams.Add("@CharacterID", hidCharacterID.Value); int iCharacterID = 0; int iUserID = 0; _dsHistory = Classes.cUtilities.LoadDataSet("uspGetCharacterHistory", sParams, "LARPortal", Session["UserName"].ToString(), lsRoutineName); string sCharacterInfo = ""; if (_dsHistory.Tables[CHARHISTORY].Rows.Count > 0) { DataRow drHistory = _dsHistory.Tables[CHARHISTORY].Rows[0]; sCharacterInfo = "<b>Character: </b> " + drHistory["CharacterAKA"].ToString(); int.TryParse(drHistory["CharacterID"].ToString(), out iCharacterID); int.TryParse(drHistory["CampaignPlayerID"].ToString(), out iUserID); hidCampaignName.Value = drHistory["CampaignName"].ToString(); hidNotificationEMail.Value = drHistory["CharacterHistoryNotificationEmail"].ToString(); if (hidNotificationEMail.Value.Length == 0) { hidNotificationEMail.Value = "*****@*****.**"; } hidEmail.Value = drHistory["EmailAddress"].ToString(); int iCampaignPlayerID = 0; if (int.TryParse(drHistory["CampaignPlayerID"].ToString(), out iCampaignPlayerID)) { hidCampaignPlayerID.Value = iCampaignPlayerID.ToString(); } int.TryParse(drHistory["CharacterID"].ToString(), out iCharacterID); hidCharacterAKA.Value = drHistory["CharacterAKA"].ToString(); imgPicture.ImageUrl = "/img/BlankProfile.png"; // Default it to this so if it is not set it will display the blank profile picture. hidCharacterID.Value = iCharacterID.ToString(); hidCampaignID.Value = drHistory["CampaignID"].ToString(); lblHistory.Text = drHistory["CharacterHistory"].ToString().Replace("<ul>", @"<ul style=""list-style-type: disc;"">").Replace("<li>", @"<li style=""margin-left: 15px;"">"); ckHistory.Text = "Staff has reopened the character history for " + hidCharacterAKA.Value + " for revisions. Please make changes and resubmit the history.<br><br>" + "Thank you<br>" + drHistory["CampaignName"].ToString() + " staff<br><br>" + drHistory["CharacterHistory"].ToString(); lblCharacterInfo.Text = sCharacterInfo; lblPlayedBy.Text = ""; string sPlayerInfo = "<b>Played by: </b> " + drHistory["PlayerName"].ToString() + " <a href='mailto:" + drHistory["EMailAddress"].ToString().Replace(@"""", @"""""") + "?Subject=Character History for " + drHistory["CharacterAKA"].ToString().Replace("'", "''") + "' class='LinkUnderline' style='text-decoration: underline; color: blue;'>" + drHistory["EMailAddress"].ToString() + "</a>"; lblPlayedBy.Text = sPlayerInfo; btnDone.Visible = false; btnApprove.Visible = true; if (drHistory["DateHistoryApproved"] != DBNull.Value) { double.TryParse(drHistory["CPAwarded"].ToString(), out dCPEarned); //btnApprove.Text = "Done"; //btnApprove.CommandName = "Done"; DateTime dtTemp; if (DateTime.TryParse(drHistory["DateHistoryApproved"].ToString(), out dtTemp)) { lblEditMessage.Visible = true; lblEditMessage.Text = "This history was approved on " + dtTemp.ToShortDateString() + " and cannot be edited."; TextBoxEnabled = false; btnCancel.Visible = false; btnReject.Visible = false; btnDone.Visible = true; btnApprove.Visible = false; } } else if (drHistory["DateHistorySubmitted"] != DBNull.Value) { btnApprove.Text = "Approve"; btnApprove.CommandName = "Approve"; btnReject.Visible = true; DateTime dtTemp; divQuestions.Attributes.Add("style", "max-height: 400px; overflow-y: auto; margin-right: 10px;"); double.TryParse(drHistory["CPEarn"].ToString(), out dCPEarned); if (DateTime.TryParse(drHistory["DateHistorySubmitted"].ToString(), out dtTemp)) { lblEditMessage.Visible = true; lblEditMessage.Text = "This history was submitted on " + dtTemp.ToShortDateString(); TextBoxEnabled = false; hidSubmitDate.Value = dtTemp.ToShortDateString(); } } } tbCPAwarded.Text = dCPEarned.ToString("0.0"); if (_dsHistory.Tables[ADDENDUMS] != null) { //DataTable dtAddendums = new DataTable(); //DataView dvAddendum = new DataView(_dsHistory.Tables[ADDENDUMS], "", "DateAdded desc", DataViewRowState.CurrentRows); //rptAddendum.DataSource = dvAddendum; //rptAddendum.DataBind(); DataTable dtDispAdd = new DataTable(); dtDispAdd.Columns.Add("AddendumID", typeof(string)); dtDispAdd.Columns.Add("Title", typeof(string)); dtDispAdd.Columns.Add("Addendum", typeof(string)); dtDispAdd.Columns.Add("DateAdded", typeof(DateTime)); foreach (DataRow dRow in _dsHistory.Tables[ADDENDUMS].Rows) { DateTime dtTemp; DateTime.TryParse(dRow["DateAdded"].ToString(), out dtTemp); DataRow dNewRow = dtDispAdd.NewRow(); dNewRow["AddendumID"] = dRow["CharacterHistoryAddendumID"].ToString(); dNewRow["Title"] = "Addendum added " + dtTemp.ToString(); dNewRow["Addendum"] = dRow["Addendum"]; dNewRow["DateAdded"] = dtTemp; dtDispAdd.Rows.Add(dNewRow); } DataView dvDispAdd = new DataView(dtDispAdd, "", "DateAdded desc", DataViewRowState.CurrentRows); rptAddendum.DataSource = dvDispAdd; rptAddendum.DataBind(); } if (_dsHistory.Tables[STAFFCOMMENTS] != null) { DataView dvStaffComments = new DataView(_dsHistory.Tables[STAFFCOMMENTS], "", "DateAdded desc", DataViewRowState.CurrentRows); dlComments.DataSource = dvStaffComments; dlComments.DataBind(); } } }
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 Page_PreRender(object sender, EventArgs e) { if (!IsPostBack) { DataSet dsQuestions = new DataSet(); double dCPEarned = 0.0; if (Request.QueryString["RegistrationID"] != null) { hidRegistrationID.Value = Request.QueryString["RegistrationID"]; } else { Response.Redirect("PELApprovalList.aspx", true); } Classes.cUser UserInfo = new Classes.cUser(_UserName, "NOPASSWORD"); if (UserInfo.NickName.Length > 0) { hidAuthorName.Value = UserInfo.NickName + " " + UserInfo.LastName; } else { hidAuthorName.Value = UserInfo.FirstName + " " + UserInfo.LastName; } SortedList sParams = new SortedList(); sParams.Add("@RegistrationID", hidRegistrationID.Value); int iCharacterID = 0; int iUserID = 0; dsQuestions = Classes.cUtilities.LoadDataSet("uspGetPELQuestionsAndAnswers", sParams, "LARPortal", Session["UserName"].ToString(), "PELEdit.Page_PreRender"); DataTable dtQuestions = dsQuestions.Tables[0]; string sEventInfo = ""; if (dtQuestions.Rows.Count > 0) { sEventInfo = "<b>Event: </b> " + dtQuestions.Rows[0]["EventDescription"].ToString(); hidEventDesc.Value = dtQuestions.Rows[0]["EventDescription"].ToString(); hidEventID.Value = dtQuestions.Rows[0]["EventID"].ToString(); DateTime dtEventDate; if (DateTime.TryParse(dtQuestions.Rows[0]["EventStartDate"].ToString(), out dtEventDate)) { sEventInfo += " <b>Event Date: </b> " + dtEventDate.ToShortDateString(); hidEventDate.Value = dtEventDate.ToShortDateString(); } int.TryParse(dtQuestions.Rows[0]["CharacterID"].ToString(), out iCharacterID); int.TryParse(dtQuestions.Rows[0]["UserID"].ToString(), out iUserID); sEventInfo += " <b>Player: </b> "; if (dtQuestions.Rows[0]["NickName"].ToString() != "") { sEventInfo += dtQuestions.Rows[0]["NickName"].ToString(); hidPlayerName.Value = dtQuestions.Rows[0]["NickName"].ToString(); } else { sEventInfo += dtQuestions.Rows[0]["FirstName"].ToString() + " " + dtQuestions.Rows[0]["LastName"].ToString(); hidPlayerName.Value = dtQuestions.Rows[0]["FirstName"].ToString() + " " + dtQuestions.Rows[0]["LastName"].ToString(); } hidPELNotificationEMail.Value = dtQuestions.Rows[0]["PELNotificationEMail"].ToString(); if (hidPELNotificationEMail.Value.Length == 0) { hidPELNotificationEMail.Value = "[email protected],[email protected]"; } int iCampaignPlayerID = 0; if (int.TryParse(dtQuestions.Rows[0]["CampaignPlayerID"].ToString(), out iCampaignPlayerID)) { hidCampaignPlayerID.Value = iCampaignPlayerID.ToString(); } int.TryParse(dtQuestions.Rows[0]["CharacterID"].ToString(), out iCharacterID); if (iCharacterID != 0) { Classes.cCharacter cChar = new Classes.cCharacter(); cChar.LoadCharacter(iCharacterID); sEventInfo += " <b>Character: </b> " + dtQuestions.Rows[0]["CharacterAKA"].ToString(); hidCharacterAKA.Value = dtQuestions.Rows[0]["CharacterAKA"].ToString(); imgPicture.ImageUrl = "/img/BlankProfile.png"; // Default it to this so if it is not set it will display the blank profile picture. if (cChar.ProfilePicture != null) { if (!string.IsNullOrEmpty(cChar.ProfilePicture.PictureURL)) { imgPicture.ImageUrl = cChar.ProfilePicture.PictureURL; } } imgPicture.Attributes["onerror"] = "this.src='~/img/BlankProfile.png';"; hidCharacterID.Value = iCharacterID.ToString(); hidCampaignID.Value = cChar.CampaignID.ToString(); } else { Classes.cPlayer PLDemography = null; string uName = ""; if (!string.IsNullOrEmpty(Session["Username"].ToString())) { uName = Session["Username"].ToString(); } PLDemography = new Classes.cPlayer(iUserID, uName); imgPicture.ImageUrl = "/img/BlankProfile.png"; // Default it to this so if it is not set it will display the blank profile picture. if (!string.IsNullOrEmpty(PLDemography.UserPhoto)) { imgPicture.ImageUrl = PLDemography.UserPhoto; } imgPicture.Attributes["onerror"] = "this.src='~/img/BlankProfile.png';"; } lblEventInfo.Text = sEventInfo; int iTemp; if (int.TryParse(dtQuestions.Rows[0]["PELID"].ToString(), out iTemp)) { hidPELID.Value = iTemp.ToString(); } if (dtQuestions.Rows[0]["PELDateApproved"] != DBNull.Value) { double.TryParse(dtQuestions.Rows[0]["CPAwarded"].ToString(), out dCPEarned); //btnSave.Text = "Done"; //btnSave.CommandName = "Done"; DateTime dtTemp; if (DateTime.TryParse(dtQuestions.Rows[0]["PELDateApproved"].ToString(), out dtTemp)) { lblEditMessage.Visible = true; lblEditMessage.Text = "<br>This PEL was approved on " + dtTemp.ToShortDateString() + "."; TextBoxEnabled = false; //btnCancel.Visible = false; } } else if (dtQuestions.Rows[0]["PELDateSubmitted"] != DBNull.Value) { //btnSave.Text = "Approve"; //btnSave.CommandName = "Approve"; DateTime dtTemp; divQuestions.Attributes.Add("style", "max-height: 400px; overflow-y: auto; margin-right: 10px;"); double.TryParse(dtQuestions.Rows[0]["CPEarn"].ToString(), out dCPEarned); int iCampaignCPOpportunityDefaultID = 0; if (int.TryParse(dtQuestions.Rows[0]["CampaignCPOpportunityDefaultID"].ToString(), out iCampaignCPOpportunityDefaultID)) { hidCampaignCPOpportunityDefaultID.Value = iCampaignCPOpportunityDefaultID.ToString(); } int iReasonID = 0; if (int.TryParse(dtQuestions.Rows[0]["ReasonID"].ToString(), out iReasonID)) { hidReasonID.Value = iReasonID.ToString(); } if (DateTime.TryParse(dtQuestions.Rows[0]["PELDateSubmitted"].ToString(), out dtTemp)) { lblEditMessage.Visible = true; lblEditMessage.Text = "<br>This PEL was submitted on " + dtTemp.ToShortDateString(); TextBoxEnabled = false; hidSubmitDate.Value = dtTemp.ToShortDateString(); } } } foreach (DataRow dRow in dtQuestions.Rows) { dRow["Answer"] = dRow["Answer"].ToString().Replace("\n", "<br>"); } DataView dvQuestions = new DataView(dtQuestions, "", "SortOrder", DataViewRowState.CurrentRows); rptQuestions.DataSource = dvQuestions; rptQuestions.DataBind(); if (dsQuestions.Tables[1] != null) { DataTable dtNewAddendum = new DataTable(); dtNewAddendum.Columns.Add("Title", typeof(string)); dtNewAddendum.Columns.Add("Addendum", typeof(string)); DataView dvAddendum = new DataView(dsQuestions.Tables[1], "", "DateAdded desc", DataViewRowState.CurrentRows); foreach (DataRowView dAdd in dvAddendum) { DataRow dNewRow = dtNewAddendum.NewRow(); DateTime dtDate; dNewRow["Title"] = "Addendum "; if (DateTime.TryParse(dAdd["DateAdded"].ToString(), out dtDate)) { dNewRow["Title"] += dtDate.ToString("MM/dd/yyyy hh:mm:ss tt"); } dNewRow["Addendum"] = dAdd["Addendum"].ToString(); dtNewAddendum.Rows.Add(dNewRow); } rptAddendum.DataSource = dtNewAddendum; rptAddendum.DataBind(); } } }
protected void btnSkillSetSave_Click(object sender, EventArgs e) { MethodBase lmth = MethodBase.GetCurrentMethod(); string lsRoutineName = lmth.DeclaringType + "." + lmth.Name; oCharSelect.Reset(); SortedList sParams = new SortedList(); sParams.Add("@CharacterSkillSetID", ddlSkillSetCharacter.SelectedValue); DataTable dtSkillSets = Classes.cUtilities.LoadDataTable("uspGetCharacterSkillSets", sParams, "LARPortal", Master.UserName, lsRoutineName + ".uspGetCharacterSkillSets"); string sFilter = "CharacterSkillSetTypeID = " + ddlNewSkillSetType.SelectedValue + " and AllowMultiples = 0"; DataView dvSkillSets = new DataView(dtSkillSets, sFilter, "", DataViewRowState.CurrentRows); if (dvSkillSets.Count > 0) { //Response.Redirect("CharInfo.aspx", true); string sCampaign = dvSkillSets[0]["CampaignName"].ToString(); lblmodalMessage.Text = "The campaign " + sCampaign + " does not allow multiple skill sets of type " + dvSkillSets[0]["SkillSetTypeDescription"].ToString() + ". Please change the type and try to save again."; lblMessage.Text = lblmodalMessage.Text; oCharSelect.Reset(); ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openMessage();", true); //ResetScreen(); return; } sFilter = string.Format("SkillSetName = '{0}'", tbNewSkillSetName.Text); dvSkillSets = new DataView(dtSkillSets, sFilter, "", DataViewRowState.CurrentRows); if (dvSkillSets.Count > 0) { lblmodalMessage.Text = "There is already a skill set with the name " + tbNewSkillSetName.Text + ". Please change the name and try to save again."; lblMessage.Text = lblmodalMessage.Text; oCharSelect.Reset(); ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openMessage();", true); ResetScreen(); return; } sParams = new SortedList(); sParams.Add("@SkillSetName", tbNewSkillSetName.Text); sParams.Add("@OriginalSkillSetID", ddlSkillSetCharacter.SelectedValue); sParams.Add("@SkillSetTypeID", ddlNewSkillSetType.SelectedValue); DataSet dsResults = new DataSet(); dsResults = Classes.cUtilities.LoadDataSet("uspAddSkillSet", sParams, "LARPortal", Master.UserName, lsRoutineName); if (dsResults.Tables.Count > 0) { if (dsResults.Tables[0].Rows.Count > 0) { DataRow dNewRow = dsResults.Tables[0].Rows[0]; int iCampaignID; int iCharacterID; int iSkillSetID; Classes.cUser UserInfo = new Classes.cUser(Master.UserName, "Password", Session.SessionID); if ((int.TryParse(dNewRow["CampaignID"].ToString(), out iCampaignID)) && (int.TryParse(dNewRow["CharacterID"].ToString(), out iCharacterID)) && (int.TryParse(dNewRow["CharacterSkillSetID"].ToString(), out iSkillSetID))) { UserInfo.LastLoggedInCampaign = iCampaignID; UserInfo.LastLoggedInCharacter = iCharacterID; UserInfo.LastLoggedInSkillSetID = iSkillSetID; } UserInfo.Save(); //Response.Redirect("CharInfo.aspx", true); //tbNewSkillSetName.Text = ""; oCharSelect.Reset(); lblCharAdded.Text = "The character skill set has been created."; oCharSelect.Reset(); ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop2", "openCharAdd();", true); return; //lblMessage.Text = "The character skill set has been created."; //lblmodalMessage.Visible = true; //lblmodalMessage.Text = "The character skill set has been created."; //ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openMessage();", true); //ResetScreen(); //_Reload = true; } } }
protected void btnSave_Click(object sender, EventArgs e) { MethodBase lmth = MethodBase.GetCurrentMethod(); string lsRoutineName = lmth.DeclaringType + "." + lmth.Name; if (tbCharacterName.Text.Trim().Length > 0) { // Reset the user control so it will load the characters the next time it's used. oCharSelect.Reset(); SortedList sParam = new SortedList(); sParam.Add("@CampaignID", ddlUserCampaigns.SelectedValue); sParam.Add("@CharacterAKA", tbCharacterName.Text.Trim()); sParam.Add("@RoleAlignmentID", ddlCharacterType.SelectedValue); sParam.Add("@UserID", Master.UserID); if (ddlCharacterType.SelectedValue != "1") // Non PC Character. { sParam.Add("@CurrentUserID", ddlPlayer.SelectedValue); } sParam.Add("@SkillSetTypeID", ddlNewCharSkillSetType.SelectedValue); sParam.Add("@SkillSetName", tbNewCharSkillSetName.Text); DataTable dtCharInfo = new DataTable(); dtCharInfo = Classes.cUtilities.LoadDataTable("uspInsCreateNewCharacter", sParam, "LARPortal", Master.UserName, lsRoutineName); if (dtCharInfo.Rows.Count > 0) { if (ddlCharacterType.SelectedValue == "1") { string sCharId = dtCharInfo.Rows[0]["CharacterID"].ToString(); int iCharID; int iCampaignID; if ((int.TryParse(sCharId, out iCharID)) && (int.TryParse(ddlUserCampaigns.SelectedValue, out iCampaignID))) { Classes.cUser UserInfo = new Classes.cUser(Master.UserName, "Password", Session.SessionID); UserInfo.LastLoggedInCharacter = iCharID; UserInfo.LastLoggedInCampaign = iCampaignID; UserInfo.Save(); } oCharSelect.Reset(); //Response.Redirect("CharInfo.aspx", true); //_Reload = true; lblCharAdded.Text = "The character has been created."; ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop2", "openCharAdd();", true); return; //lblMessage.Text = "The character has been created."; //lblmodalMessage.Text = "The character has been created."; //ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openMessage();", true); //ResetScreen(); } else { //Response.Redirect("CharInfo.aspx", true); //tbCharacterName.Text = ""; //ddlPlayer.SelectedIndex = 0; //lblMessage.Text = "The character has been created."; //lblmodalMessage.Text = "The character has been created."; //ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openMessage();", true); lblCharAdded.Text = "The character has been created."; oCharSelect.Reset(); ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop2", "openCharAdd();", true); //_Reload = true; ResetScreen(); return; } } else { lblmodalMessage.Text = "There a problem saving the character. The technical staff has been contacted."; ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openMessage();", true); } } }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["CharacterID"] != null) { Classes.cCharacter cChar = new Classes.cCharacter(); int iCharID = 0; if (int.TryParse(Request.QueryString["CharacterID"], out iCharID)) { cChar.LoadCharacter(iCharID); lblCharName.Text = cChar.AKA + " - " + cChar.CampaignName; lblAKA.Text = cChar.AKA; lblFullName.Text = cChar.FirstName; if (cChar.MiddleName.Trim().Length > 0) { lblFullName.Text += " " + cChar.MiddleName; } if (cChar.LastName.Trim().Length > 0) { lblFullName.Text += " " + cChar.LastName; } lblFullName.Text.Trim(); lblRace.Text = cChar.Race.FullRaceName; lblOrigin.Text = cChar.WhereFrom; lblPlayerName.Text = ""; DataTable dtCharacterSkills = new DataTable(); SortedList sParams = new SortedList(); sParams.Add("@CharacterID", cChar.CharacterID); MethodBase lmth = MethodBase.GetCurrentMethod(); string lsRoutineName = lmth.DeclaringType + "." + lmth.Name; dtCharacterSkills = Classes.cUtilities.LoadDataTable("uspGetCharCardSkills", sParams, "LARPortal", Session["UserName"].ToString(), lsRoutineName); if (dtCharacterSkills.Columns["FullDescription"] == null) { dtCharacterSkills.Columns.Add(new DataColumn("FullDescription", typeof(string))); } Classes.cSkillPool skDefault = cChar.SkillPools.Find(x => x.DefaultPool == true); object oCPSpent; double dCPSpent; oCPSpent = dtCharacterSkills.Compute("sum(cpcostpaid)", "CampaignSkillPoolID = " + skDefault.PoolID.ToString()); double.TryParse(oCPSpent.ToString(), out dCPSpent); TableRow dTotalRow = new TableRow(); TableCell dcCell = new TableCell(); dcCell.CssClass = "TableLabel"; dcCell.Text = "Total CP:"; dTotalRow.Cells.Add(dcCell); dcCell = new TableCell(); dcCell.Text = cChar.TotalCP.ToString("0.00"); dTotalRow.Cells.Add(dcCell); dcCell = new TableCell(); dcCell.CssClass = "TableLabel"; dcCell.Text = "Total Spent:"; dTotalRow.Cells.Add(dcCell); dcCell = new TableCell(); dcCell.Text = dCPSpent.ToString("0.00"); dTotalRow.Cells.Add(dcCell); dcCell = new TableCell(); dcCell.CssClass = "TableLabel"; dcCell.Text = "Total Avail:"; dTotalRow.Cells.Add(dcCell); dcCell = new TableCell(); dcCell.Text = (cChar.TotalCP - dCPSpent).ToString("0.00"); dTotalRow.Cells.Add(dcCell); tblCharInfo.Rows.Add(dTotalRow); List <Classes.cSkillPool> skNotDefault = cChar.SkillPools.FindAll(x => x.DefaultPool == false).OrderBy(x => x.PoolDescription).ToList(); foreach (Classes.cSkillPool PoolNotDefault in skNotDefault) { oCPSpent = dtCharacterSkills.Compute("sum(cpcostpaid)", "CampaignSkillPoolID = " + PoolNotDefault.PoolID.ToString()); double.TryParse(oCPSpent.ToString(), out dCPSpent); double TotalPoints = cChar.SkillPools.Find(x => x.PoolID == PoolNotDefault.PoolID).TotalPoints; dTotalRow = new TableRow(); dTotalRow.ForeColor = System.Drawing.Color.FromName(PoolNotDefault.PoolDisplayColor); dcCell = new TableCell(); dcCell.CssClass = "TableLabel"; dcCell.Text = PoolNotDefault.PoolDescription + " Points:"; dTotalRow.Cells.Add(dcCell); dcCell = new TableCell(); dcCell.Text = TotalPoints.ToString("0.00"); dTotalRow.Cells.Add(dcCell); dcCell = new TableCell(); dcCell.CssClass = "TableLabel"; dcCell.Text = "Total Spent:"; dTotalRow.Cells.Add(dcCell); dcCell = new TableCell(); dcCell.Text = dCPSpent.ToString("0.00"); dTotalRow.Cells.Add(dcCell); dcCell = new TableCell(); dcCell.CssClass = "TableLabel"; dcCell.Text = "Total Avail:"; dTotalRow.Cells.Add(dcCell); dcCell = new TableCell(); dcCell.Text = (TotalPoints - dCPSpent).ToString("0.00"); dTotalRow.Cells.Add(dcCell); tblCharInfo.Rows.Add(dTotalRow); } double CPCost; double CPSpent = 0.0; foreach (DataRow dSkillRow in dtCharacterSkills.Rows) { if (double.TryParse(dSkillRow["CPCostPaid"].ToString(), out CPCost)) { CPSpent += CPCost; } string FullDesc = ""; bool bDisplay; if (bool.TryParse(dSkillRow["CardDisplayDescription"].ToString(), out bDisplay)) { if (bDisplay) { if (dSkillRow["SkillCardDescription"].ToString().Trim().Length > 0) { FullDesc += dSkillRow["SkillCardDescription"].ToString().Trim() + "; "; } } } if (dSkillRow["PlayerDescription"].ToString().Trim().Length > 0) { FullDesc += dSkillRow["PlayerDescription"].ToString().Trim() + "; "; } if (bool.TryParse(dSkillRow["CardDisplayIncant"].ToString(), out bDisplay)) { if (bDisplay) { if (dSkillRow["SkillIncant"].ToString().Trim().Length > 0) { FullDesc += "<i>" + dSkillRow["SkillIncant"].ToString().Trim() + "</i>; "; } } } if (dSkillRow["PlayerIncant"].ToString().Trim().Length > 0) { FullDesc += "<b><i>" + dSkillRow["PlayerIncant"].ToString().Trim() + "</b></i>"; } FullDesc = FullDesc.Trim(); if (FullDesc.EndsWith(";")) { FullDesc = FullDesc.Substring(0, FullDesc.Length - 1); } dSkillRow["FullDescription"] = FullDesc; } Dictionary <string, string> NonCost = new Dictionary <string, string>(); foreach (Classes.cDescriptor Desc in cChar.Descriptors) { if (NonCost.ContainsKey(Desc.CharacterDescriptor)) { NonCost[Desc.CharacterDescriptor] += Desc.DescriptorValue + ", "; } else { NonCost.Add(Desc.CharacterDescriptor, Desc.DescriptorValue + ", "); } } foreach (string KeyValue in NonCost.Keys.ToList()) { if (NonCost[KeyValue].EndsWith(", ")) { NonCost[KeyValue] = NonCost[KeyValue].Substring(0, NonCost[KeyValue].Length - 2); } } gvSkills.DataSource = dtCharacterSkills; gvSkills.DataBind(); gvNonCost.DataSource = NonCost; gvNonCost.DataBind(); Classes.cUser User = new Classes.cUser(Session["Username"].ToString(), "PasswordNotNeeded"); lblPlayerName.Text = User.FirstName + " " + User.MiddleName + " " + User.LastName; } } }
protected void Page_PreRender(object sender, EventArgs e) { MethodBase lmth = MethodBase.GetCurrentMethod(); string lsRoutineName = lmth.DeclaringType + "." + lmth.Name; // oLogWriter.AddLogMessage("Starting up CharacterSelect.PreRender", lsRoutineName, "", Session.SessionID); SortedList slParameters = new SortedList(); DataTable dtCampaignsToEdit = new DataTable(); DataTable dtMyCharacters = new DataTable(); WhichSelected = Selected.NotSpecified; if ((Session["CampaignsToEdit"] == null) || (Session["MyCharacters"] == null)) { if (_UserInfo == null) { _UserInfo = new cUser(_UserName, "PasswordNotNeeded", Session.SessionID); } // oLogWriter.AddLogMessage("Done loading user.", lsRoutineName, "", Session.SessionID); // Session["CharCharacterID"] = UserInfo.LastLoggedInCharacter; if (UserInfo.LastLoggedInMyCharOrCamp == "C") { WhichSelected = Selected.CampaignCharacters; Session["CharCampaignCampaignID"] = UserInfo.LastLoggedInCampaign; Session["CharCampaignCharID"] = UserInfo.LastLoggedInCharacter; Session["CharCampaignSkillSetID"] = UserInfo.LastLoggedInSkillSetID; Session["CharacterSelectGroup"] = "Campaigns"; } else { WhichSelected = Selected.MyCharacters; Session["CharSkillSetID"] = UserInfo.LastLoggedInSkillSetID; Session["CharCharacterID"] = UserInfo.LastLoggedInCharacter; Session["CharCampaignID"] = UserInfo.LastLoggedInCampaign; Session["CharacterSelectGroup"] = "Characters"; } } if (Session["CampaignsToEdit"] == null) { slParameters.Add("@UserID", _UserID); // oLogWriter.AddLogMessage("About to run uspGetPrivCampaignCharacterEdit.", lsRoutineName, "", Session.SessionID); DataTable dtFullCampaignsToEdit = LarpPortal.Classes.cUtilities.LoadDataTable("uspGetPrivCampaignCharacterEdit", slParameters, "LARPortal", _UserName, lsRoutineName + ".uspGetPrivCampaignCharacterEdit"); // oLogWriter.AddLogMessage("Done running uspGetPrivCampaignCharacterEdit.", lsRoutineName, "", Session.SessionID); dtCampaignsToEdit = new DataView(dtFullCampaignsToEdit, "", "CampaignName", DataViewRowState.CurrentRows).ToTable(true, "CampaignID", "CampaignName"); Session["CampaignsToEdit"] = dtCampaignsToEdit; if (dtCampaignsToEdit.Rows.Count == 0) { WhichSelected = Selected.MyCharacters; } //else //{ // Session["CampaignsToEdit"] = dtCampaignsToEdit; //} } else { dtCampaignsToEdit = Session["CampaignsToEdit"] as DataTable; } if (Session["MyCharacters"] == null) { slParameters = new SortedList(); slParameters.Add("@intUserID", Session["UserID"].ToString()); // oLogWriter.AddLogMessage("About to run uspGetCharacterIDsByUserID", lsRoutineName, "", Session.SessionID); DataTable dtCharacters = LarpPortal.Classes.cUtilities.LoadDataTable("uspGetCharacterIDsByUserID", slParameters, "LARPortal", _UserName, lsRoutineName + ".uspGetCharacterIDsByUserID"); // oLogWriter.AddLogMessage("Done running uspGetCharacterIDsByUserID", lsRoutineName, "", Session.SessionID); // If the person has no characters force it to charadd. if (dtCharacters.Rows.Count == 0) { if (!HttpContext.Current.Request.Url.AbsoluteUri.ToUpper().Contains("CHARADD.ASPX")) { Response.Redirect("~/Character/CharAdd.aspx", true); } else { return; } } dtMyCharacters = new DataView(dtCharacters, "", "DisplayName", DataViewRowState.CurrentRows).ToTable(true, "DisplayName", "CharacterID", "CharacterSkillSetID"); Session["MyCharacters"] = dtMyCharacters; } else { dtMyCharacters = Session["MyCharacters"] as DataTable; } if (dtCampaignsToEdit.Rows.Count == 0) { ddlCampaigns.Visible = false; rbCampaignCharacters.Visible = false; rbMyCharacters.Visible = false; lblNoCharacters.Visible = false; } else { DataView dvCampaigns = new DataView(dtCampaignsToEdit, "", "CampaignName", DataViewRowState.CurrentRows); ddlCampaigns.DataSource = dvCampaigns; ddlCampaigns.DataTextField = "CampaignName"; ddlCampaigns.DataValueField = "CampaignID"; ddlCampaigns.DataBind(); } if (WhichSelected == Selected.NotSpecified) { if (Session["CharacterSelectGroup"] != null) { if (Session["CharacterSelectGroup"].ToString() == "Campaigns") { WhichSelected = Selected.CampaignCharacters; } else if (Session["CharacterSelectGroup"].ToString() == "Characters") { WhichSelected = Selected.MyCharacters; } } } if ((dtMyCharacters.Rows.Count >= 1) && (dtCampaignsToEdit.Rows.Count >= 1)) { rbMyCharacters.Visible = true; rbCampaignCharacters.Visible = true; } else { rbMyCharacters.Visible = false; rbCampaignCharacters.Visible = false; } _CharacterID = null; // oLogWriter.AddLogMessage("About to run which selected.", lsRoutineName, "", Session.SessionID); if (WhichSelected == Selected.MyCharacters) { rbMyCharacters.Checked = true; DataView dvCharacters = new DataView(dtMyCharacters, "", "DisplayName", DataViewRowState.CurrentRows); ddlCharacterSelector.DataSource = dvCharacters; ddlCharacterSelector.DataTextField = "DisplayName"; ddlCharacterSelector.DataValueField = "CharacterSkillSetID"; ddlCharacterSelector.DataBind(); ddlCharacterSelector.Visible = true; ddlCampCharSelector.Visible = false; lblSelectedCampaign.Visible = false; rbMyCharacters.Checked = true; ddlCharacterSelector.ClearSelection(); if (Session["CharSkillSetID"] != null) { int iCharSkillSetID; if (int.TryParse(Session["CharSkillSetID"].ToString(), out iCharSkillSetID)) { foreach (ListItem liItem in ddlCharacterSelector.Items) { if (liItem.Value == iCharSkillSetID.ToString()) { ddlCharacterSelector.ClearSelection(); liItem.Selected = true; } } } } if (ddlCharacterSelector.SelectedIndex < 0) { ddlCharacterSelector.Items[0].Selected = true; } int iSkillSetID; if (int.TryParse(ddlCharacterSelector.SelectedValue, out iSkillSetID)) { if (iSkillSetID == 0) { _CharacterID = null; _CharacterInfo = null; _SkillSetID = null; Session.Remove("CharSkillSetID"); Session.Remove("CharCharacterID"); Session.Remove("CharCampaignID"); } else { _SkillSetID = iSkillSetID; _CharacterInfo.LoadCharacterBySkillSetID(iSkillSetID); _CharacterID = _CharacterInfo.CharacterID; _CampaignID = _CharacterInfo.CampaignID; lblSelectedCampaign.Visible = true; lblSelectedCampaign.Text = _CharacterInfo.CampaignName; ddlCampaigns.Visible = false; Session["CharSkillSetID"] = iSkillSetID; Session["CharCharacterID"] = _CharacterInfo.CharacterID; Session["CharCampaignID"] = _CharacterInfo.CampaignID; Session["CurrentChar"] = _CharacterInfo; } } // oLogWriter.AddLogMessage("Done with MyCharacters", lsRoutineName, "", Session.SessionID); } else if (WhichSelected == Selected.CampaignCharacters) { // oLogWriter.AddLogMessage("About to load campaign characters.", lsRoutineName, "", Session.SessionID); LoadCampaignCharacters(); // oLogWriter.AddLogMessage("Done loading campaign characters.", lsRoutineName, "", Session.SessionID); } if (!IsPostBack) { if (this.CharacterChanged != null) { // oLogWriter.AddLogMessage("About to call CharacterChanged", lsRoutineName, "", Session.SessionID); this.CharacterChanged(this, e); // oLogWriter.AddLogMessage("Done calling CharacterChanged", lsRoutineName, "", Session.SessionID); } } }
protected void btnApprove_Click(object sender, EventArgs e) { int iCharacterID = -1; int iTemp; if (int.TryParse(hidCharacterID.Value, out iTemp)) { iCharacterID = iTemp; } Classes.cCharacter cChar = new Classes.cCharacter(); cChar.LoadCharacter(iCharacterID); SortedList sParams = new SortedList(); sParams.Add("@UserID", Session["UserID"].ToString()); sParams.Add("@CharacterID", iCharacterID); sParams.Add("@DateHistoryApproved", DateTime.Now); Classes.cUtilities.PerformNonQuery("uspInsUpdCHCharacters", sParams, "LARPortal", Session["UserName"].ToString()); Session["UpdateHistoryMessage"] = "alert('The character history has been approved.');"; Classes.cPoints Points = new Classes.cPoints(); int UserID = 0; int CampaignPlayerID = 0; int CharacterID = 0; int CampaignCPOpportunityDefaultID = 0; int CampaignID = 0; double CPAwarded = 0.0; int.TryParse(Session["UserID"].ToString(), out UserID); int.TryParse(hidCampaignPlayerID.Value, out CampaignPlayerID); int.TryParse(hidCharacterID.Value, out CharacterID); int.TryParse(hidCampaignCPOpportunityDefaultID.Value, out CampaignCPOpportunityDefaultID); int.TryParse(hidCampaignID.Value, out CampaignID); double.TryParse(tbCPAwarded.Text, out CPAwarded); DateTime dtDateSubmitted; if (!DateTime.TryParse(hidSubmitDate.Value, out dtDateSubmitted)) { dtDateSubmitted = DateTime.Now; } Classes.cUser User = new Classes.cUser(Session["UserName"].ToString(), "PasswordNotNeeded"); string sSubject = "Character history for " + hidCharacterAKA.Value + " had been approved."; string sBody = hidCampaignName.Value + " staff has approved the character history for " + hidCharacterAKA.Value + "<br><br>" + "You have been awarded " + CPAwarded.ToString() + " CP."; //"<br><br>Character History:<br><br>" + ckHistory.Text; string sEmailToSendTo = hidEmail.Value; Classes.cEmailMessageService cEMS = new Classes.cEmailMessageService(); cEMS.SendMail(sSubject, sBody, sEmailToSendTo, "", "", "CharacterHistory", Session["Username"].ToString()); //Classes.cSendNotifications SendNot = new Classes.cSendNotifications(); //SendNot.SubjectText = sSubject; //SendNot.EMailBody = sBody; //SendNot.NotifyType = Classes.cNotificationTypes.HISTORYAPPROVE; //SendNot.SendNotification(cChar.CurrentUserID, _UserName); Points.AssignHistoryPoints(UserID, CampaignPlayerID, CharacterID, CampaignCPOpportunityDefaultID, CampaignID, CPAwarded, dtDateSubmitted); Response.Redirect("ApprovalList.aspx", true); }
public void LoadInfo() { MethodBase lmth = MethodBase.GetCurrentMethod(); string lsRoutineName = lmth.DeclaringType + "." + lmth.Name; WhichSelected = Selected.NotSpecified; if (UserInfo != null) { if (UserInfo.LastLoggedInSkillSetID == 0) { UserInfo.LastLoggedInCampaign = 0; UserInfo.LastLoggedInCharacter = 0; UserInfo.LastLoggedInMyCharOrCamp = ""; } } // oLogWriter.AddLogMessage("About to check for session variables.", lsRoutineName, "", Session.SessionID); if (Session["CurrentChar"] != null) { _CharacterInfo = Session["CurrentChar"] as cCharacter; } if ((Session["CampaignsToEdit"] == null) || (Session["MyCharacters"] == null)) { if (_UserInfo == null) { _UserInfo = new cUser(_UserName, "PasswordNotNeeded", Session.SessionID); } if (UserInfo.LastLoggedInMyCharOrCamp == "C") { WhichSelected = Selected.CampaignCharacters; if (UserInfo.LastLoggedInSkillSetID != 0) { Session["CharCampaignCampaignID"] = UserInfo.LastLoggedInCampaign; Session["CharCampaignCharID"] = UserInfo.LastLoggedInCharacter; Session["CharCampaignSkillSetID"] = UserInfo.LastLoggedInSkillSetID; } else { Session.Remove("CharCampaignCampaignID"); Session.Remove("CharCampaignCharID"); Session.Remove("CharCampaignSkillSetID"); } Session["CharacterSelectGroup"] = "Campaigns"; } else { WhichSelected = Selected.MyCharacters; if (UserInfo.LastLoggedInSkillSetID != 0) { Session["CharSkillSetID"] = UserInfo.LastLoggedInSkillSetID; Session["CharCharacterID"] = UserInfo.LastLoggedInCharacter; Session["CharCampaignID"] = UserInfo.LastLoggedInCampaign; } else { Session.Remove("CharSkillSetID"); Session.Remove("CharCharacterID"); Session.Remove("CharCampaignID"); } Session["CharacterSelectGroup"] = "Characters"; } // oLogWriter.AddLogMessage("Done loading user.", lsRoutineName, "", Session.SessionID); } if (Session["CharacterSelectGroup"] != null) { if (Session["CharacterSelectGroup"].ToString() == "Campaigns") { WhichSelected = Selected.CampaignCharacters; } else if (Session["CharacterSelectGroup"].ToString() == "Characters") { WhichSelected = Selected.MyCharacters; } } int iCampaignID = 0; // This is a fake out. If it's not defined we define it as a non valid value so it will fall through to the bottom. if (Session["CharacterSelectGroup"] == null) { Session["CharacterSelectGroup"] = "PlaceHolder"; } int iCampSkillSetID = 0; int iCharSkillSetID = 0; _CharacterID = null; if ((WhichSelected == Selected.MyCharacters) && (Session["CharSkillSetID"] != null)) { if (int.TryParse(Session["CharSkillSetID"].ToString(), out iCharSkillSetID)) { if (iCharSkillSetID != 0) { _SkillSetID = iCharSkillSetID; // _CharacterID = iCharID; _CharacterInfo.LoadCharacterBySkillSetID(iCharSkillSetID); _CharacterID = _CharacterInfo.CharacterID; _CampaignID = _CharacterInfo.CampaignID; Session["CharSkillSetID"] = iCharSkillSetID; Session["CharCharacterID"] = _CharacterInfo.CharacterID; Session["CharCampaignID"] = _CharacterInfo.CampaignID; return; } } } if ((WhichSelected == Selected.CampaignCharacters) && (Session["CharCampaignSkillSetID"] != null)) { if (int.TryParse(Session["CharCampaignSkillSetID"].ToString(), out iCampSkillSetID)) { if (iCampSkillSetID != 0) { _CharacterInfo.LoadCharacterBySkillSetID(iCampSkillSetID); _CharacterID = _CharacterInfo.CharacterID; _CampaignID = _CharacterInfo.CampaignID; _SkillSetID = iCampSkillSetID; Session["CharCampaignSkillSetID"] = iCampSkillSetID; Session["CharCampaignCharacterID"] = _CharacterInfo.CharacterID; Session["CharCampaignCampaignID"] = _CharacterInfo.CampaignID; return; } } } // oLogWriter.AddLogMessage("About to run uspGetPrivCampaignCharacterEdit", lsRoutineName, "", Session.SessionID); SortedList slParameters = new SortedList(); slParameters.Add("@UserID", _UserID); DataTable dtCampaignsToEdit = LarpPortal.Classes.cUtilities.LoadDataTable("uspGetPrivCampaignCharacterEdit", slParameters, "LARPortal", _UserName, lsRoutineName + ".uspGetPrivCampaignCharacterEdit"); // oLogWriter.AddLogMessage("Done running uspGetPrivCampaignCharacterEdit", lsRoutineName, "", Session.SessionID); if (dtCampaignsToEdit.Rows.Count > 0) { DataView dvCampaignsToEdit = new DataView(dtCampaignsToEdit, "", "CampaignName", DataViewRowState.CurrentRows); if (int.TryParse(dvCampaignsToEdit[0]["CampaignID"].ToString(), out iCampaignID)) { // oLogWriter.AddLogMessage("About to run uspGetCampaignCharactersAll", lsRoutineName, "", Session.SessionID); slParameters = new SortedList(); slParameters.Add("@CampaignID", iCampaignID); DataTable dtCampChars = Classes.cUtilities.LoadDataTable("uspGetCampaignCharactersAll", slParameters, "LARPortal", _UserName, lsRoutineName + ".uspGetCampaignCharactersAll"); // oLogWriter.AddLogMessage("Done running uspGetCampaignCharactersAll", lsRoutineName, "", Session.SessionID); DataView dvCampChars = new DataView(dtCampChars, "", "DisplayName", DataViewRowState.CurrentRows); if (dtCampChars.Rows.Count > 0) { int.TryParse(dvCampChars[0]["CharacterSkillSetID"].ToString(), out iCampSkillSetID); } } } // Now get all characters for user. slParameters = new SortedList(); slParameters.Add("@intUserID", _UserID); // oLogWriter.AddLogMessage("About to run uspGetCharacterIDsByUserID", lsRoutineName, "", Session.SessionID); DataTable dtCharacters = LarpPortal.Classes.cUtilities.LoadDataTable("uspGetCharacterIDsByUserID", slParameters, "LARPortal", _UserName, lsRoutineName + ".uspGetCharacterIDsByUserID"); // oLogWriter.AddLogMessage("Done running uspGetCharacterIDsByUserID", lsRoutineName, "", Session.SessionID); if (dtCharacters.Rows.Count > 0) { DataView dvCharacters = new DataView(dtCharacters, "", "DisplayName", DataViewRowState.CurrentRows); int.TryParse(dvCharacters[0]["CharacterSkillSetID"].ToString(), out iCharSkillSetID); } if ((iCharSkillSetID != 0) && ((WhichSelected == Selected.MyCharacters) || (WhichSelected == Selected.NotSpecified))) { // oLogWriter.AddLogMessage("About to load character in MyCharacters", lsRoutineName, "", Session.SessionID); _CharacterInfo.LoadCharacterBySkillSetID(iCharSkillSetID); // oLogWriter.AddLogMessage("Done loading character in MyCharacters", lsRoutineName, "", Session.SessionID); _CharacterID = _CharacterInfo.CharacterID; _CampaignID = _CharacterInfo.CampaignID; _SkillSetID = iCharSkillSetID; WhichSelected = Selected.MyCharacters; Session["CharacterSelectGroup"] = "Characters"; Session["CharCharacterID"] = _CharacterInfo.CharacterID; Session["CharSkillSetID"] = iCharSkillSetID; Session["CharCampaignID"] = _CharacterInfo.CampaignID; ddlCampCharSelector.Visible = false; ddlCharacterSelector.Visible = true; return; } if (((iCampSkillSetID != 0) && (iCampaignID != 0)) && ((WhichSelected == Selected.CampaignCharacters) || (WhichSelected == Selected.NotSpecified))) { // oLogWriter.AddLogMessage("About to load character in CampaignCharacters", lsRoutineName, "", Session.SessionID); _CharacterInfo.LoadCharacterBySkillSetID(iCampSkillSetID); // oLogWriter.AddLogMessage("Done loading character in CampaignCharacters", lsRoutineName, "", Session.SessionID); WhichSelected = Selected.CampaignCharacters; Session["CharacterSelectGroup"] = "Campaigns"; Session["CharCampaignSkillSetID"] = iCampSkillSetID; Session["CharCampaignCharacterID"] = _CharacterInfo.CharacterID; Session["CharCampaignCampaignID"] = _CharacterInfo.CampaignID; _SkillSetID = iCampSkillSetID; _CharacterID = _CharacterInfo.CharacterID; _CampaignID = _CharacterInfo.CampaignID; ddlCampCharSelector.Visible = true; ddlCharacterSelector.Visible = false; return; } // If we got this far - there are nocharacters to select. ddlCharacterSelector.Visible = false; ddlCampCharSelector.Visible = false; }
protected void Page_PreRender(object sender, EventArgs e) { if (!IsPostBack) { Classes.cUser User = new Classes.cUser(Master.UserName, "PasswordNotNeeded", Session.SessionID); } else { } Classes.cCampaignBase CampaignBase = new Classes.cCampaignBase(Master.CampaignID, Master.UserName, Master.UserID); lblCampaignName.Text = CampaignBase.CampaignName; DateTime?dtStartDate = CampaignBase.StartDate; lblStarted.Text = string.Format("{0:MMM d, yyyy}", dtStartDate); DateTime?dtExpEndDate = CampaignBase.ProjectedEndDate; lblExpectedEnd.Text = string.Format("{0:MMM d, yyyy}", dtExpEndDate); lblNumEvents.Text = CampaignBase.ActualNumberOfEvents.ToString(); lblGameSystem.Text = CampaignBase.GameSystemName; lblGenres.Text = CampaignBase.GenreList; lblStyle.Text = CampaignBase.StyleDescription; lblTechLevel.Text = CampaignBase.TechLevelList; lblSize.Text = CampaignBase.CampaignSizeRange; lblAvgNumEvents.Text = CampaignBase.ProjectedNumberOfEvents.ToString(); DataTable dtContacts = new DataTable(); dtContacts.Columns.Add("Label", typeof(string)); dtContacts.Columns.Add("URL", typeof(string)); dtContacts.Columns.Add("URLLabel", typeof(string)); dtContacts.Columns.Add("EMail", typeof(string)); dtContacts.Columns.Add("EMailLabel", typeof(string)); DataRow NewRow = dtContacts.NewRow(); NewRow["Label"] = "Campaign Info"; if (!string.IsNullOrEmpty(CampaignBase.URL)) { NewRow["URL"] = CampaignBase.URL; NewRow["URLLabel"] = "Campaign URL"; } if ((CampaignBase.ShowCampaignInfoEmail) && (!string.IsNullOrEmpty(CampaignBase.InfoRequestEmail))) { NewRow["EMail"] = CampaignBase.InfoRequestEmail; NewRow["EMailLabel"] = "Information EMail"; } dtContacts.Rows.Add(NewRow); NewRow = dtContacts.NewRow(); NewRow["Label"] = "Character"; if (!string.IsNullOrEmpty(CampaignBase.CharacterGeneratorURL)) { NewRow["URL"] = CampaignBase.CharacterGeneratorURL; NewRow["URLLabel"] = "Character URL"; } if ((CampaignBase.ShowCharacterNotificationEmail) && (!string.IsNullOrEmpty(CampaignBase.CharacterNotificationEMail))) { NewRow["EMail"] = CampaignBase.CharacterNotificationEMail; NewRow["EMailLabel"] = "CharacterEMail"; } dtContacts.Rows.Add(NewRow); NewRow = dtContacts.NewRow(); NewRow["Label"] = "Character History"; if (!string.IsNullOrEmpty(CampaignBase.CharacterHistoryURL)) { NewRow["URL"] = CampaignBase.CharacterHistoryURL; NewRow["URLLabel"] = "Character History URL"; } if ((CampaignBase.ShowCharacterHistoryEmail) && (!string.IsNullOrEmpty(CampaignBase.CharacterHistoryNotificationEmail))) { NewRow["EMail"] = CampaignBase.CharacterHistoryNotificationEmail; NewRow["EmailLabel"] = "Character History EMail"; } dtContacts.Rows.Add(NewRow); NewRow = dtContacts.NewRow(); NewRow["Label"] = "Info Skills"; if (!string.IsNullOrEmpty(CampaignBase.InfoSkillURL)) { NewRow["URL"] = CampaignBase.InfoSkillURL; NewRow["URLLabel"] = "Info Skills"; } if ((CampaignBase.ShowCampaignInfoEmail) && (!string.IsNullOrEmpty(CampaignBase.InfoSkillEMail))) { NewRow["EMail"] = CampaignBase.InfoSkillEMail; NewRow["EMailLabel"] = "Info Skills EMail"; } dtContacts.Rows.Add(NewRow); NewRow = dtContacts.NewRow(); NewRow["Label"] = "Production Skills"; if (!string.IsNullOrEmpty(CampaignBase.ProductionSkillURL)) { NewRow["URL"] = CampaignBase.ProductionSkillURL; NewRow["URLLabel"] = "Production Skills URL"; } if ((CampaignBase.ShowProductionSkillEmail) && (!string.IsNullOrEmpty(CampaignBase.ProductionSkillEMail))) { NewRow["EMail"] = CampaignBase.ProductionSkillEMail; NewRow["EMailLabel"] = "Production Skills EMail"; } dtContacts.Rows.Add(NewRow); NewRow = dtContacts.NewRow(); NewRow["Label"] = "PEL"; if (!string.IsNullOrEmpty(CampaignBase.PELSubmissionURL)) { NewRow["URL"] = CampaignBase.PELSubmissionURL; NewRow["URLLabel"] = "PEL URL"; } if ((CampaignBase.ShowPELNotificationEmail) && (!string.IsNullOrEmpty(CampaignBase.PELNotificationEMail))) { NewRow["EMail"] = CampaignBase.PELNotificationEMail; NewRow["EMailLabel"] = "PEL EMail"; } dtContacts.Rows.Add(NewRow); NewRow = dtContacts.NewRow(); NewRow["Label"] = "Points"; NewRow["URL"] = ""; NewRow["URLLabel"] = ""; if ((CampaignBase.ShowCPNotificationEmail) && (!string.IsNullOrEmpty(CampaignBase.CPNotificationEmail))) { NewRow["EMail"] = CampaignBase.CPNotificationEmail; NewRow["EMailLabel"] = "Points EMail"; } dtContacts.Rows.Add(NewRow); NewRow = dtContacts.NewRow(); NewRow["Label"] = "Sign-up"; if (!string.IsNullOrEmpty(CampaignBase.JoinURL)) { NewRow["URL"] = CampaignBase.JoinURL; NewRow["URLLabel"] = "Sign-up URL"; } if ((CampaignBase.ShowJoinRequestEmail) && (!string.IsNullOrEmpty(CampaignBase.JoinRequestEmail))) { NewRow["EMail"] = CampaignBase.JoinRequestEmail; NewRow["EMailLabel"] = "Sign-up EMail"; } dtContacts.Rows.Add(NewRow); NewRow = dtContacts.NewRow(); NewRow["Label"] = "Registration"; if (!string.IsNullOrEmpty(CampaignBase.RegistrationURL)) { NewRow["URL"] = CampaignBase.RegistrationURL; NewRow["URLLabel"] = "Registration URL"; } if ((CampaignBase.ShowRegistrationNotificationEmail) && (!string.IsNullOrEmpty(CampaignBase.RegistrationNotificationEmail))) { NewRow["EMail"] = CampaignBase.RegistrationNotificationEmail; NewRow["EMailLabel"] = "Registration EMail"; } dtContacts.Rows.Add(NewRow); gvContactInfo.DataSource = dtContacts; gvContactInfo.DataBind(); lblHeaderCampaignName.Text = " - " + Master.CampaignName; //string c1 = CampaignBase.URL; //CampaignGMURL //string c2 = ""; //string c4 = ""; //string c6 = ""; //string c8 = ""; //string c10 = ""; //string c12 = ""; //string c14 = ""; //string c16 = ""; //string c18 = ""; //if (CampaignBase.ShowCampaignInfoEmail == true) //{ // c2 = CampaignBase.InfoRequestEmail; //CampgaignGMEmail //} //string c3 = CampaignBase.CharacterGeneratorURL; //CharacterURL //if (CampaignBase.ShowCharacterNotificationEmail == true) //{ // c4 = CampaignBase.CharacterNotificationEMail; //CharacterEmail //} //string c5 = CampaignBase.CharacterHistoryURL; //CharHistoryURl //if (CampaignBase.ShowCharacterHistoryEmail == true) //{ // c6 = CampaignBase.CharacterHistoryNotificationEmail; //CharHistoryEmail //} //string c7 = CampaignBase.InfoSkillURL; //InfoSkillsURL //if (CampaignBase.ShowInfoSkillEmail == true) //{ // c8 = CampaignBase.InfoSkillEMail; //InfoSkillsEmail //} //string c9 = CampaignBase.ProductionSkillURL; //ProdSkillsURL //if (CampaignBase.ShowProductionSkillEmail == true) //{ // c10 = CampaignBase.ProductionSkillEMail; //ProdSkillsEmail //} //string c11 = CampaignBase.PELSubmissionURL; //PELURL //if (CampaignBase.ShowPELNotificationEmail == true) //{ // c12 = CampaignBase.PELNotificationEMail; //PELEmail //} //string c13 = ""; //if (CampaignBase.ShowCPNotificationEmail == true) //{ // c14 = CampaignBase.CPNotificationEmail; //} //string c15 = CampaignBase.JoinURL; //if (CampaignBase.ShowJoinRequestEmail == true) //{ // c16 = CampaignBase.JoinRequestEmail; //} //string c17 = CampaignBase.RegistrationURL; //if (CampaignBase.ShowRegistrationNotificationEmail == true) //{ // c18 = CampaignBase.RegistrationNotificationEmail; //} // Registration Notification Email //BuildContacts(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18); CampaignDescription.Text = CampaignBase.WebPageDescription.Replace("\n", "<br>"); lblMembershipFee.Text = CampaignBase.MembershipFee.ToString() + " " + CampaignBase.MembershipFeeFrequency; lblMinimumAge.Text = CampaignBase.MinimumAge.ToString(); lblSupervisedAge.Text = CampaignBase.MinimumAgeWithSupervision.ToString(); lblWaiver1.Text = "Waiver source TBD"; //TODO-Rick-2 Find the two (or more) waivers - may have to allow for even more lblWaiver2.Text = "Waiver source 2 TBD"; lblConsent.Text = "Consent TBD"; //TODO-Rick-3 Find out where the consent is stored (what is consent anyway?) }
protected void Page_PreRender(object sender, EventArgs e) { MethodBase lmth = MethodBase.GetCurrentMethod(); string lsRoutineName = lmth.DeclaringType + "." + lmth.Name; Classes.cUser Demography = null; Classes.cPlayer PLDemography = null; Demography = new Classes.cUser(Master.UserName, "Password", Session.SessionID); PLDemography = new Classes.cPlayer(Master.UserID, Master.UserName); if (!IsPostBack) { string gen = PLDemography.GenderStandared.ToUpper(); string othergen = PLDemography.GenderOther; string pict = PLDemography.UserPhoto; if (PLDemography.HasPicture) { imgPlayerImage.ImageUrl = PLDemography.Picture.PictureURL; ViewState["UserIDPicture"] = PLDemography.Picture.PictureID; } else { if (PLDemography.UserPhoto.Length > 0) { imgPlayerImage.ImageUrl = PLDemography.UserPhoto; ViewState.Remove("UserIDPicture"); } else { imgPlayerImage.ImageUrl = "http://placehold.it/150x150"; ViewState.Remove("UserIDPicture"); } } string emergencyContactPhone = string.Empty; if (PLDemography.EmergencyContactPhone != null) { emergencyContactPhone = PLDemography.EmergencyContactPhone; Int32 iPhone; if (Int32.TryParse(emergencyContactPhone.Replace("(", "").Replace(")", "").Replace("-", ""), out iPhone)) { emergencyContactPhone = iPhone.ToString("(###)###-####"); } } tbFirstName.Text = Demography.FirstName; tbMiddleName.Text = Demography.MiddleName; tbLastName.Text = Demography.LastName; tbGenderOther.Style.Add("visibility", "hidden"); tbGenderOther.Text = othergen; if (gen.Length > 0) { if ("MFO".Contains(gen)) { ddlGender.SelectedValue = gen; } if (gen == "O") { tbGenderOther.Style.Add("visibility", "visible"); } } tbBDMM.Value = PLDemography.DateOfBirth.Month.ToString(); tbBDDD.Value = PLDemography.DateOfBirth.Day.ToString(); tbBDYYYY.Value = PLDemography.DateOfBirth.Year.ToString(); tbEmergencyName.Text = PLDemography.EmergencyContactName; tbEmergencyPhone.Text = emergencyContactPhone; tbUserName.Text = Master.UserName; tbNickName.Text = Demography.NickName; tbPenName.Text = PLDemography.AuthorName; tbForumName.Text = Demography.ForumUserName; ddlGender.Attributes.Add("onchange", "DisplaySexOther(this);"); } // lblErrorMessage1.Text = ""; // lblErrorMessage2.Text = ""; // btnSave1.Enabled = true; // btnSave2.Enabled = true; hidNumOfPhones.Value = Demography.UserPhones.Count.ToString(); gvPhoneNumbers.DataSource = Demography.UserPhones; gvPhoneNumbers.DataBind(); hidNumOfEMails.Value = Demography.UserEmails.Count.ToString(); gvEmails.DataSource = Demography.UserEmails; gvEmails.DataBind(); hidNumOfAddresses.Value = Demography.UserAddresses.Count.ToString(); gvAddresses.DataSource = Demography.UserAddresses; gvAddresses.DataBind(); //if (gvEmails.Rows.Count == 0) //{ // if (gvEmails.Rows.Count == 0) // lblErrorMessage1.Text += "* You must have at least one valid email address. "; // lblErrorMessage1.Text = lblErrorMessage1.Text.Trim(); // btnSave1.Enabled = false; //} //lblErrorMessage2.Text = lblErrorMessage1.Text; //btnSave2.Enabled = btnSave1.Enabled; }