示例#1
0
        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();
            }
        }
示例#2
0
 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);
 }
示例#3
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            MethodBase lmth          = MethodBase.GetCurrentMethod();
            string     lsRoutineName = lmth.DeclaringType + "." + lmth.Name;

            //Session["ActiveLeftNav"] = "Demographics";

            if (!IsPostBack)
            {
                using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["LARPortal"].ConnectionString))
                {
                    conn.Open();
                    using (SqlCommand CmdStyle = new SqlCommand("select * from CMStyles where DateDeleted is null", conn))
                    {
                        SqlDataAdapter SDAStyle    = new SqlDataAdapter(CmdStyle);
                        DataTable      dtGameStyle = new DataTable();
                        SDAStyle.Fill(dtGameStyle);
                        ddlStyle.DataSource     = dtGameStyle;
                        ddlStyle.DataTextField  = "StyleName";
                        ddlStyle.DataValueField = "StyleID";
                        ddlStyle.DataBind();
                    }

                    using (SqlCommand CmdGenre = new SqlCommand("select * from CMGenres where DateDeleted is null", conn))
                    {
                        SqlDataAdapter SDAGenre = new SqlDataAdapter(CmdGenre);
                        DataTable      dtGenre  = new DataTable();
                        SDAGenre.Fill(dtGenre);
                        ddlGenre.DataSource     = dtGenre;
                        ddlGenre.DataTextField  = "GenreName";
                        ddlGenre.DataValueField = "GenreID";
                        ddlGenre.DataBind();
                    }

                    using (SqlCommand CmdRoleAlignment = new SqlCommand("select * from MDBRoleAlignments where DateDeleted is null", conn))
                    {
                        SqlDataAdapter SDARoles = new SqlDataAdapter(CmdRoleAlignment);
                        DataTable      dtRoles  = new DataTable();
                        SDARoles.Fill(dtRoles);
                        ddlRole.DataSource     = dtRoles;
                        ddlRole.DataTextField  = "Description";
                        ddlRole.DataValueField = "RoleAlignmentID";
                        ddlRole.DataBind();
                    }
                }
            }

            Classes.cPlayer PlayerInfo = new Classes.cPlayer(Master.UserID, Master.UserName);
            hidPlayerProfileID.Value = PlayerInfo.PlayerProfileID.ToString();

            var ResumeList = PlayerInfo.PlayerLARPResumes.OrderByDescending(x => x.StartDate);

            gvResumeItems.DataSource = ResumeList;
            gvResumeItems.DataBind();

            tbLARPResumeComments.Text = PlayerInfo.LARPResumeComments;
        }
        protected void Page_PreRender(object sender, EventArgs e)
        {
            MethodBase lmth          = MethodBase.GetCurrentMethod();
            string     lsRoutineName = lmth.DeclaringType + "." + lmth.Name;

            Classes.cPlayer PlayerInfo = new Classes.cPlayer(Master.UserID, Master.UserName);

            gvWaivers.DataSource = PlayerInfo.PlayerWaivers;
            gvWaivers.DataBind();

            string postBackControlName = Request.Params.Get("__EVENTTARGET");
            string eventArgument       = Request.Params.Get("__EVENTARGUMENT");

            _SelectedID = -1;

            if (postBackControlName != null)
            {
                if (postBackControlName.ToUpper().Contains("GVWAIVERS"))
                {
                    if (!int.TryParse(eventArgument, out _SelectedID))
                    {
                        _SelectedID = -1;
                    }
                }
            }

            if (_SelectedID == -1)
            {
                if (!int.TryParse(hidRowSelected.Value, out _SelectedID))
                {
                    _SelectedID = -1;
                }
            }

            if (gvWaivers.Rows.Count != 0)
            {
                if (_SelectedID != -1)
                {
                    LoadRecord(_SelectedID);
                }
                else
                {
                    if (!int.TryParse(hidRowSelected.Value, out _SelectedID))
                    {
                        _SelectedID = 0;
                    }
                    if (_SelectedID < gvWaivers.Rows.Count)
                    {
                        LoadRecord(_SelectedID);
                    }
                    else
                    {
                        LoadRecord(0);
                    }
                }
            }
        }
示例#5
0
        protected void btnAddComment_Click(object sender, EventArgs e)
        {
            pnlCommentSection.Visible = true;

            Classes.cPlayer PLDemography = new Classes.cPlayer(Master.UserID, Master.UserName);
            string          pict         = PLDemography.UserPhoto;

            imgPicture.Attributes ["onerror"] = "this.src='~/img/BlankProfile.png';";
            imgStaffPicture.ImageUrl          = pict;

            btnAddComment.Visible = false;
            _RELOAD = false;
        }
示例#6
0
        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();
            }
        }
示例#7
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            MethodBase lmth          = MethodBase.GetCurrentMethod();
            string     lsRoutineName = lmth.DeclaringType + "." + lmth.Name;

            if (!IsPostBack)
            {
            }

            Classes.cPlayer PlayerInfo = new Classes.cPlayer(Master.UserID, Master.UserName);
            hidPlayerProfileID.Value = PlayerInfo.PlayerProfileID.ToString();
            gvSkills.DataSource      = PlayerInfo.PlayerSkills;
            gvSkills.DataBind();

            gvAffiliations.DataSource = PlayerInfo.PlayerAffiliations;
            gvAffiliations.DataBind();

            //tbResumeComments.Text = PlayerInfo.ResumeComments;
            //tbLinkedInURL.Text = PlayerInfo.LinkedInURL;
        }
示例#8
0
        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;
            }
        }
示例#9
0
        protected void btnAddComment_Click(object sender, EventArgs e)
        {
            pnlCommentSection.Visible = true;
            string uName = "";
            int    uID   = 0;

            if (Session["Username"] != null)
            {
                uName = Session["Username"].ToString();
            }
            if (Session["UserID"] != null)
            {
                int.TryParse(Session["UserID"].ToString(), out uID);
            }

            Classes.cPlayer PLDemography = new Classes.cPlayer(uID, uName);
            string          pict         = PLDemography.UserPhoto;

            imgPicture.Attributes["onerror"] = "this.src='~/img/BlankProfile.png';";
            imgStaffPicture.ImageUrl         = pict;

            btnAddComment.Visible = false;
            _RELOAD = false;
        }
示例#10
0
        protected void rptAddendum_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            string i = e.CommandArgument.ToString();

            if (e.CommandName.ToUpper() == "ENTERCOMMENT")
            {
                Panel pnlNewCommentPanel = (Panel)e.Item.FindControl("pnlStaffCommentSection");
                if (pnlNewCommentPanel != null)
                {
                    pnlNewCommentPanel.Visible = true;
                    Image imgPlayerImage = (Image)e.Item.FindControl("imgStaffCommentProfilePicture");
                    if (imgPlayerImage != null)
                    {
                        string uName = "";
                        int    uID   = 0;

                        if (Session["Username"] != null)
                        {
                            uName = Session["Username"].ToString();
                        }
                        if (Session["UserID"] != null)
                        {
                            int.TryParse(Session["UserID"].ToString(), out uID);
                        }

                        Classes.cPlayer PLDemography = new Classes.cPlayer(uID, uName);
                        string          pict         = PLDemography.UserPhoto;
                        imgPicture.Attributes["onerror"] = "this.src='~/img/BlankProfile.png';";
                        imgPlayerImage.ImageUrl          = pict;
                    }

                    Button btnAddComment = (Button)e.Item.FindControl("btnAddStaffComment");
                    if (btnAddComment != null)
                    {
                        btnAddComment.Visible = false;
                    }
                    _RELOAD = false;
                }
            }
            else if (e.CommandName.ToUpper() == "ADDCOMMENT")
            {
                int iAddendumID;
                if (int.TryParse(e.CommandArgument.ToString(), out iAddendumID))
                {
                    TextBox tbNewComment = (TextBox)e.Item.FindControl("tbNewStaffCommentAddendum");
                    if (tbNewComment != null)
                    {
                        if (tbNewComment.Text.Length > 0)
                        {
                            SortedList sParams = new SortedList();
                            sParams.Add("@UserID", Session["UserID"]);
                            sParams.Add("@CharAddendumsStaffCommentID", "-1");
                            sParams.Add("@CharAddendumID", iAddendumID);
                            sParams.Add("@CommenterID", Session["UserID"]);
                            sParams.Add("@StaffComments", tbNewComment.Text.Trim());

                            MethodBase lmth          = MethodBase.GetCurrentMethod();
                            string     lsRoutineName = lmth.DeclaringType + "." + lmth.Name;

                            DataTable dtAddResponse = Classes.cUtilities.LoadDataTable("uspInsUpdCHCharacterHistoryAddendumsStaffComments", sParams, "LARPortal", Session["UserName"].ToString(), lsRoutineName);

                            DataList dlComments = e.Item.FindControl("dlStaffComments") as DataList;
                            GetAddendumComments(iAddendumID.ToString(), dtAddResponse, dlComments);
                            SendStaffAddendumCommentEMail(dtAddResponse);
                        }
                    }
                    Panel pnlCommentSection = (Panel)e.Item.FindControl("pnlStaffCommentSection");
                    if (pnlCommentSection != null)
                    {
                        pnlCommentSection.Visible = false;
                    }
                    Button btnAddComment = (Button)e.Item.FindControl("btnAddStaffComment");
                    if (btnAddComment != null)
                    {
                        btnAddComment.Visible = true;
                    }
                }
            }
            else if (e.CommandName.ToUpper() == "CANCELCOMMENT")
            {
                Panel pnlCommentSection = (Panel)e.Item.FindControl("pnlStaffCommentSection");
                if (pnlCommentSection != null)
                {
                    pnlCommentSection.Visible = false;
                }
                Button btnAddComment = (Button)e.Item.FindControl("btnAddStaffComment");
                if (btnAddComment != null)
                {
                    btnAddComment.Visible = true;
                }
            }
        }
示例#11
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            MethodBase lmth          = MethodBase.GetCurrentMethod();
            string     lsRoutineName = lmth.DeclaringType + "." + lmth.Name;

            if (!IsPostBack)
            {
                double dCPEarned        = 0.0;
                string sCampaignGoingTo = "";

                if (Request.QueryString["RegistrationID"] != null)
                {
                    hidRegistrationID.Value = Request.QueryString["RegistrationID"];
                }
                else
                {
                    Response.Redirect("PELApprovalList.aspx", true);
                }

                Classes.cUser UserInfo = new Classes.cUser(Master.UserName, "NOPASSWORD", Session.SessionID);
                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;

                DataSet dsQuestions = Classes.cUtilities.LoadDataSet("uspGetPELQuestionsAndAnswers", sParams, "LARPortal", Master.UserName, lsRoutineName);

                string sEventInfo = "";
                if (dsQuestions.Tables[0].Rows.Count > 0)
                {
                    sEventInfo = "<b>Event: </b> " + dsQuestions.Tables[0].Rows[0]["EventDescription"].ToString();

                    hidEventDesc.Value = dsQuestions.Tables[0].Rows[0]["EventDescription"].ToString();
                    hidEventID.Value   = dsQuestions.Tables[0].Rows[0]["EventID"].ToString();

                    DateTime dtEventDate;
                    if (DateTime.TryParse(dsQuestions.Tables[0].Rows[0]["EventStartDate"].ToString(), out dtEventDate))
                    {
                        sEventInfo        += "&nbsp;&nbsp;<b>Event Date: </b> " + dtEventDate.ToShortDateString();
                        hidEventDate.Value = dtEventDate.ToShortDateString();
                    }

                    int.TryParse(dsQuestions.Tables[0].Rows[0]["CharacterID"].ToString(), out iCharacterID);
                    int.TryParse(dsQuestions.Tables[0].Rows[0]["UserID"].ToString(), out iUserID);

                    sEventInfo += "<br><b>Player: </b> ";
                    if (String.IsNullOrEmpty(dsQuestions.Tables[0].Rows[0]["NickName"].ToString()))
                    {
                        sEventInfo         += dsQuestions.Tables[0].Rows[0]["NickName"].ToString() + " " + dsQuestions.Tables[0].Rows[0]["LastName"].ToString();
                        hidPlayerName.Value = dsQuestions.Tables[0].Rows[0]["NickName"].ToString();
                    }
                    else
                    {
                        sEventInfo         += dsQuestions.Tables[0].Rows[0]["FirstName"].ToString() + " " + dsQuestions.Tables[0].Rows[0]["LastName"].ToString();
                        hidPlayerName.Value = dsQuestions.Tables[0].Rows[0]["FirstName"].ToString() + " " + dsQuestions.Tables[0].Rows[0]["LastName"].ToString();
                    }

                    string sCharAKA = dsQuestions.Tables[0].Rows[0]["CharacterAKA"].ToString().Replace("'", "''");
                    if (sCharAKA.Length > 0)
                    {
                        sCharAKA = "PEL for " + sCharAKA;
                    }
                    else
                    {
                        sCharAKA = "PEL Comments";
                    }

                    sEventInfo += " " + " <a href='mailto:" + dsQuestions.Tables[0].Rows[0]["PlayerEMailAddress"].ToString().Replace(@"""", @"""""") +
                                  "?Subject=" + sCharAKA +
                                  "' class='LinkUnderline' style='text-decoration: underline; color: blue;'>" + dsQuestions.Tables[0].Rows[0]["PlayerEMailAddress"].ToString() + "</a>";

                    hidPELNotificationEMail.Value = dsQuestions.Tables[0].Rows[0]["PELNotificationEMail"].ToString();
                    if (hidPELNotificationEMail.Value.Length == 0)
                    {
                        hidPELNotificationEMail.Value = "*****@*****.**";
                    }

                    int iCampaignPlayerID = 0;
                    if (int.TryParse(dsQuestions.Tables[0].Rows[0]["CampaignPlayerID"].ToString(), out iCampaignPlayerID))
                    {
                        hidCampaignPlayerID.Value = iCampaignPlayerID.ToString();
                    }

                    int.TryParse(dsQuestions.Tables[0].Rows[0]["CharacterID"].ToString(), out iCharacterID);
                    if (iCharacterID != 0)
                    {
                        Classes.cCharacter cChar = new Classes.cCharacter();
                        cChar.LoadCharacterByCharacterID(iCharacterID);
                        sEventInfo           += "&nbsp;&nbsp;<b>Character: </b> " + dsQuestions.Tables[0].Rows[0]["CharacterAKA"].ToString();
                        hidCharacterAKA.Value = dsQuestions.Tables[0].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
                    {
                        string          path         = ResolveUrl(@"~/img/BlankProfile.png");
                        Classes.cPlayer PLDemography = null;
                        PLDemography = new Classes.cPlayer(Master.UserID, Master.UserName);

                        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(dsQuestions.Tables[0].Rows[0]["PELID"].ToString(), out iTemp))
                    {
                        hidPELID.Value = iTemp.ToString();
                    }
                    if (dsQuestions.Tables[0].Rows[0]["PELDateApproved"] != DBNull.Value)
                    {
                        double.TryParse(dsQuestions.Tables[0].Rows[0]["CPAwarded"].ToString(), out dCPEarned);
                        sCampaignGoingTo    = dsQuestions.Tables[0].Rows[0]["CPAwarded"].ToString();
                        btnSave.Text        = "Done";
                        btnSave.CommandName = "Done";
                        DateTime dtTemp;
                        if (DateTime.TryParse(dsQuestions.Tables[0].Rows[0]["PELDateApproved"].ToString(), out dtTemp))
                        {
                            lblEditMessage.Visible = true;
                            lblEditMessage.Text    = "<br>This PEL was approved on " + dtTemp.ToShortDateString() + " and cannot be edited.";
                            TextBoxEnabled         = false;
                            btnCancel.Visible      = false;
                        }
                    }
                    else if (dsQuestions.Tables[0].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(dsQuestions.Tables[0].Rows[0]["CPEarn"].ToString(), out dCPEarned);
                        dsQuestions.Tables[0].Rows[0]["CPAwarded"].ToString();
                        int iCampaignCPOpportunityDefaultID = 0;
                        if (int.TryParse(dsQuestions.Tables[0].Rows[0]["CampaignCPOpportunityDefaultID"].ToString(), out iCampaignCPOpportunityDefaultID))
                        {
                            hidCampaignCPOpportunityDefaultID.Value = iCampaignCPOpportunityDefaultID.ToString();
                        }
                        int iReasonID = 0;
                        if (int.TryParse(dsQuestions.Tables[0].Rows[0]["ReasonID"].ToString(), out iReasonID))
                        {
                            hidReasonID.Value = iReasonID.ToString();
                        }

                        if (DateTime.TryParse(dsQuestions.Tables[0].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();
                        }
                    }
                    if (hidPELID.Value.Length != 0)
                    {
                        // Load the comments for this PEL so we can display them in DataItemBound.
                        SortedList sParamsForComments = new SortedList();
                        sParamsForComments.Add("@PELID", hidPELID.Value);
                        _dtPELComments = Classes.cUtilities.LoadDataTable("uspGetPELStaffComments", sParamsForComments, "LARPortal", Master.UserName, lsRoutineName + ".uspGetPELStaffComments");
                    }
                }

                foreach (DataRow dRow in dsQuestions.Tables[0].Rows)
                {
                    dRow["Answer"] = dRow["Answer"].ToString().Replace("\n", "<br>");
                }

                tbCPAwarded.Text = dCPEarned.ToString("0.0");
                if (sCampaignGoingTo.Length > 0)
                {
                    lblCampaignTo.Text = " to " + sCampaignGoingTo;
                }
                DataView dvQuestions = new DataView(dsQuestions.Tables[0], "", "SortOrder", DataViewRowState.CurrentRows);
                rptQuestions.DataSource = dvQuestions;
                rptQuestions.DataBind();

                if (dsQuestions.Tables[2] != null)
                {
                    _dtAddendumComments = dsQuestions.Tables[2];
                }

                if (dsQuestions.Tables[1] != null)
                {
                    DataTable dtNewAddendum = new DataTable();
                    dtNewAddendum.Columns.Add("Title", typeof(string));
                    dtNewAddendum.Columns.Add("Addendum", typeof(string));
                    dtNewAddendum.Columns.Add("PELsAddendumID", 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/yyyyy hh:mm:ss tt");
                        }
                        dNewRow["Addendum"]       = dAdd["Addendum"].ToString();
                        dNewRow["PELsAddendumID"] = dAdd["PELsAddendumID"].ToString();
                        dtNewAddendum.Rows.Add(dNewRow);
                    }

                    rptAddendum.DataSource = dtNewAddendum;
                    rptAddendum.DataBind();
                }
            }
        }
        protected void Page_PreRender(object sender, EventArgs e)
        {
            MethodBase lmth          = MethodBase.GetCurrentMethod();
            string     lsRoutineName = lmth.DeclaringType + "." + lmth.Name;

            Classes.cPlayer PLPlayerInfo = new Classes.cPlayer(Master.UserID, Master.UserName);
            hidProfileID.Value = PLPlayerInfo.PlayerProfileID.ToString();

            DataTable InvItems = cUtilities.CreateDataTable(PLPlayerInfo.PlayerInventoryItems);

            if (InvItems.Columns["JavaScriptEdit"] == null)
            {
                InvItems.Columns.Add(new DataColumn("JavaScriptEdit", typeof(string)));
            }

            if (InvItems.Columns["JavaScriptDelete"] == null)
            {
                InvItems.Columns.Add(new DataColumn("JavaScriptDelete", typeof(string)));
            }

            if (InvItems.Columns["WillShareImage"] == null)
            {
                InvItems.Columns.Add(new DataColumn("WillShareImage", typeof(string)));
            }

            if (InvItems.Columns["DescWithImage"] == null)
            {
                InvItems.Columns.Add(new DataColumn("DescWithImage", typeof(string)));
            }

            foreach (DataRow dRow in InvItems.Rows)
            {
                string sImageURL = dRow["ImageURL"].ToString();
                if (sImageURL.StartsWith("~"))
                {
                    sImageURL = sImageURL.Substring(1);
                }

                dRow["JavaScriptEdit"] = string.Format("openItem({0}, \"{1}\", \"{2}\", \"{3}\", \"{4}\", \"{5}\", \"{6}\", \"{7}\", \"{8}\", \"{9}\", \"{10}\"); return false;",
                                                       dRow["PlayerInventoryID"].ToString(),
                                                       ReplaceQuotes(dRow["ItemName"]),
                                                       ReplaceQuotes(dRow["Description"]),
                                                       dRow["InventoryTypeID"].ToString(),
                                                       ReplaceQuotes(dRow["Quantity"]),
                                                       ReplaceQuotes(dRow["Size"]),
                                                       ReplaceQuotes(dRow["Location"]),
                                                       ReplaceQuotes(dRow["PowerNeeded"]),
                                                       ReplaceQuotes(dRow["WillShare"]),
                                                       ReplaceQuotes(dRow["PlayerComments"]),
                                                       ReplaceQuotes(sImageURL));

                dRow["JavaScriptDelete"] = string.Format("openItemDelete({0}, \"{1}\", \"{2}\", \"{3}\"); return false;",
                                                         dRow["PlayerInventoryID"].ToString(),
                                                         ReplaceQuotes(dRow["ItemName"]),
                                                         ReplaceQuotes(dRow["Description"]),
                                                         ReplaceQuotes(dRow["PlayerComments"]));


                bool bWillShare;
                if (bool.TryParse(dRow["WillShare"].ToString(), out bWillShare))
                {
                    if (bWillShare)
                    {
                        dRow["WillShareImage"] = @"<span class=""glyphicon glyphicon-ok"" style=""width: 20px;""></span>";
                    }
                    else
                    {
                        dRow["WillShareImage"] = @"<span class=""glyphicon glyphicon-unchecked"" style=""width: 20px; text-align: center;""></span>";
                    }
                }

                string sDescWithImage = @"<a data-toggle=""tooltip"" title=""<img src='";
                if (dRow["ImageURL"].ToString().StartsWith("~"))
                {
                    sDescWithImage += dRow["ImageURL"].ToString().Substring(1);
                }
                else
                {
                    sDescWithImage += dRow["ImageURL"].ToString();
                }

                sDescWithImage = sDescWithImage + @"' style='max-width: 400px;' />"">" +
                                 @"<span class=""glyphicon glyphicon-picture""></span></a>";

                dRow["DescWithImage"] = sDescWithImage;
            }

            gvInventory.DataSource = InvItems;
            gvInventory.DataBind();

            if (!IsPostBack)
            {
                SortedList sParams = new SortedList();
                DataTable  dtTypes = cUtilities.LoadDataTable("uspGetInventoryTypes", sParams, "LARPortal", Master.UserName, lsRoutineName);
                ddlType.DataTextField  = "InventoryTypeDescription";
                ddlType.DataValueField = "InventoryTypeID";
                ddlType.DataSource     = dtTypes;
                ddlType.DataBind();
            }
        }
示例#13
0
        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;
        }
示例#14
0
        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        += "&nbsp;&nbsp;<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 += "&nbsp;&nbsp;<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           += "&nbsp;&nbsp;<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();
                }
            }
        }
示例#15
0
        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);
        }
示例#16
0
        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.";
        }
示例#17
0
        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(_UserName, "Password");
            PLDemography = new Classes.cPlayer(_UserID, _UserName);

            if (!IsPostBack)
            {
                lblMessage.Text          = string.Empty;
                Session["ActiveLeftNav"] = "Demographics";

                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;
                if (Demography.MiddleName.Length > 1)
                {
                    tbMiddleInit.Text = Demography.MiddleName.Substring(0, 1);
                }
                else
                {
                    tbMiddleInit.Text = "";
                }
                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");
                    }
                }
                tbDOB.Text            = PLDemography.DateOfBirth.ToString("MM/dd/yyyy");
                tbEmergencyName.Text  = PLDemography.EmergencyContactName;
                tbEmergencyPhone.Text = emergencyContactPhone;
                tbUserName.Text       = _UserName;
                tbNickName.Text       = Demography.NickName;
                tbPenName.Text        = PLDemography.AuthorName;
                tbForumName.Text      = Demography.ForumUserName;

//                Session["dem_Addresses"] = Demography.UserAddresses;
//                Session["dem_Phones"] = Demography.UserPhones;
//                Session["dem_Emails"] = Demography.UserEmails;

//                BindAddresses();
//                BindPhoneNumbers();
//                BindEmails();

                ddlGender.Attributes.Add("onchange", "DisplaySexOther(this);");
            }

            lblErrorMessage1.Text = "";
            lblErrorMessage2.Text = "";
            btnSave1.Enabled      = true;
            btnSave2.Enabled      = true;

            // Now we check to make sure that there is a least a single record and that it's valid.
            //List<cAddress> AllAddresses = Session["dem_Addresses"] as List<cAddress>;
            //int iBadAddresses = AllAddresses.Count(x => !x.IsValid());

            //List<cEMail> AllEmail = Session["dem_Emails"] as List<cEMail>;
            //int iBadEmail = AllEmail.Count(x => !x.IsValid());

            //List<cPhone> AllPhone = Session["dem_Phones"] as List<cPhone>;
            //int iBadPhone = AllPhone.Count(x => !x.IsValid());

            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 (    //(iBadAddresses > 0) ||
                //(iBadEmail > 0) ||
                //(iBadPhone > 0) ||
                (gvEmails.Rows.Count == 0))
            {
                //if (iBadAddresses > 0)
                //    lblErrorMessage1.Text = "* At least one of your addresses is not valid. ";
                if (gvEmails.Rows.Count == 0)
                {
                    lblErrorMessage1.Text += "* You must have at least one valid email address. ";
                }
                //if (iBadEmail > 0)
                //    lblErrorMessage1.Text += "* At least one of your email addresses is not valid. ";
                //if (iBadPhone > 0)
                //    lblErrorMessage1.Text += "* At least one of your phone numbers is not valid. ";
                lblErrorMessage1.Text = lblErrorMessage1.Text.Trim();
                btnSave1.Enabled      = false;
            }

            lblErrorMessage2.Text = lblErrorMessage1.Text;
            btnSave2.Enabled      = btnSave1.Enabled;
        }
示例#18
0
        protected void rptQuestions_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            MethodBase lmth          = MethodBase.GetCurrentMethod();
            string     lsRoutineName = lmth.DeclaringType + "." + lmth.Name;

            string i = e.CommandArgument.ToString();

            if (e.CommandName.ToUpper() == "ENTERCOMMENT")
            {
                Panel pnlNewCommentPanel = (Panel)e.Item.FindControl("pnlCommentSection");
                if (pnlNewCommentPanel != null)
                {
                    pnlNewCommentPanel.Visible = true;
                    Image imgPlayerImage = (Image)e.Item.FindControl("imgProfilePicture");
                    if (imgPlayerImage != null)
                    {
                        //string uName = "";
                        //int uID = 0;

                        //if (Session["Username"] != null)
                        //    uName = Session["Username"].ToString();
                        //if (Session["UserID"] != null)
                        //    int.TryParse(Session["UserID"].ToString(), out uID);

                        Classes.cPlayer PLDemography = new Classes.cPlayer(Master.UserID, Master.UserName);
                        string          pict         = PLDemography.UserPhoto;
                        imgPicture.Attributes["onerror"] = "this.src='~/img/BlankProfile.png';";
                        if (String.IsNullOrEmpty(pict.Trim()))
                        {
                            imgPlayerImage.ImageUrl = "/img/BlankProfile.png";
                        }
                        else
                        {
                            imgPlayerImage.ImageUrl = pict;
                        }
                    }

                    Button btnAddComment = (Button)e.Item.FindControl("btnAddComment");
                    if (btnAddComment != null)
                    {
                        btnAddComment.Visible = false;
                    }
                }
            }
            else if (e.CommandName.ToUpper() == "ADDCOMMENT")
            {
                int iAnswerID;
                if (int.TryParse(e.CommandArgument.ToString(), out iAnswerID))
                {
                    TextBox tbNewComment = (TextBox)e.Item.FindControl("tbNewComment");
                    if (tbNewComment != null)
                    {
                        if (tbNewComment.Text.Length > 0)
                        {
                            SortedList sParams = new SortedList();
                            sParams.Add("@UserID", Master.UserID);
                            sParams.Add("@PELAnswerID", iAnswerID);
                            sParams.Add("@PELStaffCommentID", "-1");
                            sParams.Add("@CommenterID", Master.UserID);
                            sParams.Add("@StaffComments", tbNewComment.Text.Trim());

                            DataTable dtAddResponse = Classes.cUtilities.LoadDataTable("uspInsUpdCMPELStaffComments", sParams, "LARPortal", Master.UserName, lsRoutineName + ".uspInsUpdCMPELStaffComments");

                            SortedList sParamsForComments = new SortedList();
                            sParamsForComments.Add("@PELID", hidPELID.Value);
                            _dtPELComments = Classes.cUtilities.LoadDataTable("uspGetPELStaffComments", sParamsForComments, "LARPortal", Master.UserName, lsRoutineName + ".uspGetPELStaffComments");

                            DataList dlComments = e.Item.FindControl("dlComments") as DataList;
                            GetComments(iAnswerID.ToString(), dlComments);
                            SendStaffCommentEMail(_dtPELComments);
                        }
                    }
                    Panel pnlCommentSection = (Panel)e.Item.FindControl("pnlCommentSection");
                    if (pnlCommentSection != null)
                    {
                        pnlCommentSection.Visible = false;
                    }
                    Button btnAddComment = (Button)e.Item.FindControl("btnAddComment");
                    if (btnAddComment != null)
                    {
                        btnAddComment.Visible = true;
                    }
                }
            }
            else if (e.CommandName.ToUpper() == "CANCELCOMMENT")
            {
                Panel pnlCommentSection = (Panel)e.Item.FindControl("pnlCommentSection");
                if (pnlCommentSection != null)
                {
                    pnlCommentSection.Visible = false;
                }
                Button btnAddComment = (Button)e.Item.FindControl("btnAddComment");
                if (btnAddComment != null)
                {
                    btnAddComment.Visible = true;
                }
            }
        }
示例#19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            txtPassword.Attributes.Add("PlaceHolder", "Password");
            txtPassword2.Attributes.Add("PlaceHolder", "Password");
            txtSecurityQuestion1.Attributes.Add("PlaceHolder", "Enter your security question 1");
            txtSecurityAnswer1.Attributes.Add("PlaceHolder", "Enter your security answer 1");
            txtSecurityQuestion2.Attributes.Add("PlaceHolder", "Enter your security question 2");
            txtSecurityAnswer2.Attributes.Add("PlaceHolder", "Enter your security answer 2");
            txtSecurityQuestion3.Attributes.Add("PlaceHolder", "Enter your security question 3");
            txtSecurityAnswer3.Attributes.Add("PlaceHolder", "Enter your security answer 3");

            lblError.Text           = string.Empty;
            lblErrorQuestions.Text  = string.Empty;
            lblErrorQuestion2.Text  = string.Empty;
            lblErrorQuestion3.Text  = string.Empty;
            lblPasswordReqs.Text    = "<span class=" + "\"" + "glyphicon glyphicon-question-sign" + "\"" + "></span>";
            lblPasswordReqs.ToolTip = "LARP Portal login passwords must be at least 7 characters long and contain at least " +
                                      "1 uppercase letter, 1 lowercse letter, 1 number and 1 special character";

            if (Session["Username"] == null)
            {
                btnSave.Visible = false;
                return;
            }

            Session["ActiveLeftNav"] = "Security";
            uName = "";
            uID   = 0;
            if (Session["Username"] != null)
            {
                uName = Session["Username"].ToString();
            }
            if (Session["UserID"] != null)
            {
                uID = (Session["UserID"].ToString().ToInt32());
            }
            //This method is not loading my email so nothing works
            Demography   = new Classes.cUser(uName, "Password");
            PLDemography = new Classes.cPlayer(uID, uName);
            UserLoggedIn = new Classes.cLogin();
            //this needs to be done in order to show security questions as per ForgotPassword existing logic
            UserLoggedIn.ValidateUserForPasswordReset(uName, Demography.PrimaryEmailAddress.EmailAddress, Demography.LastName);

            if (IsPostBack == false)
            {
                txtUsername.Text  = uName;
                txtFirstName.Text = Demography.FirstName;
                if (Demography.MiddleName.Length > 0)
                {
                    txtMI.Text = Demography.MiddleName.Substring(0, 1);
                }
                txtLastName.Text = Demography.LastName;
                txtNickName.Text = Demography.NickName;


                if (string.IsNullOrWhiteSpace(Demography.PrimaryEmailAddress.EmailAddress))
                {
                    lblError.Text = "Primary email must be setup first";
                    return;
                }

                txtSecurityAnswer1.Text = UserLoggedIn.SecurityAnswer1;
                txtSecurityAnswer2.Text = UserLoggedIn.SecurityAnswer2;
                txtSecurityAnswer3.Text = UserLoggedIn.SecurityAnswer3;

                txtSecurityQuestion1.Text = UserLoggedIn.SecurityQuestion1;
                txtSecurityQuestion2.Text = UserLoggedIn.SecurityQuestion2;
                txtSecurityQuestion3.Text = UserLoggedIn.SecurityQuestion3;
            }
        }
示例#20
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (hidTextBoxEnabled.Value == "1")
            {
                TextBoxEnabled = true;
            }

            if (!IsPostBack)
            {
                DataSet dsQuestions = new DataSet();

                if (Request.QueryString["RegistrationID"] == null)
                {
                    Response.Redirect("PELList.aspx", true);
                }

                hidRegistrationID.Value = Request.QueryString["RegistrationID"];

                SortedList sParams = new SortedList();
                sParams.Add("@RegistrationID", hidRegistrationID.Value);

                dsQuestions = Classes.cUtilities.LoadDataSet("uspGetPELQuestionsAndAnswers", sParams, "LARPortal", Session["UserName"].ToString(), "PELEdit.Page_PreRender");

                int iCharacterID = 0;
                int iUserID      = 0;

                DataTable dtQuestions = dsQuestions.Tables[0];

                string sEventInfo = "";
                if (dtQuestions.Rows.Count > 0)
                {
                    hidPELTemplateID.Value = dtQuestions.Rows[0]["PELTemplateID"].ToString();
                    sEventInfo             = "<b>Event: </b> " + dtQuestions.Rows[0]["EventName"].ToString();

                    DateTime dtEventDate;
                    if (DateTime.TryParse(dtQuestions.Rows[0]["EventStartDate"].ToString(), out dtEventDate))
                    {
                        sEventInfo            += "&nbsp;&nbsp;<b>Event Date: </b> " + dtEventDate.ToShortDateString();
                        ViewState["EventDate"] = dtEventDate.ToShortDateString();
                    }

                    ViewState["EventName"]            = dtQuestions.Rows[0]["EventName"].ToString();
                    ViewState["PELNotificationEMail"] = dtQuestions.Rows[0]["PELNotificationEMail"].ToString();
                    string sPlayerName = dtQuestions.Rows[0]["NickName"].ToString();
                    if (sPlayerName.Length == 0)
                    {
                        sPlayerName = dtQuestions.Rows[0]["FirstName"].ToString();
                    }
                    sPlayerName            += " " + dtQuestions.Rows[0]["LastName"].ToString();
                    ViewState["PlayerName"] = sPlayerName;

                    int.TryParse(dtQuestions.Rows[0]["CharacterID"].ToString(), out iCharacterID);
                    int.TryParse(dtQuestions.Rows[0]["UserID"].ToString(), out iUserID);

                    if (iCharacterID != 0)
                    {
                        // A character.
                        sEventInfo += "&nbsp;&nbsp;<b>Character: </b> " + dtQuestions.Rows[0]["CharacterAKA"].ToString();
                        ViewState["CharacterAKA"] = dtQuestions.Rows[0]["CharacterAKA"].ToString();
                    }
                    else
                    {
                        // Non character.
                        sEventInfo += "&nbsp;&nbsp;<b>Player: </b> " + dtQuestions.Rows[0]["NickName"].ToString();
                        ViewState["CharacterAKA"] = "a non-player.";
                    }

                    int.TryParse(dtQuestions.Rows[0]["CharacterID"].ToString(), out iCharacterID);
                    if (iCharacterID != 0)
                    {
                        Classes.cCharacter cChar = new Classes.cCharacter();
                        cChar.LoadCharacter(iCharacterID);
                        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';";
                    }
                    else
                    {
                        Classes.cPlayer PLDemography = null;

                        string uName = "";
                        int    uID   = 0;
                        if (!string.IsNullOrEmpty(Session["Username"].ToString()))
                        {
                            uName = Session["Username"].ToString();
                        }
                        int.TryParse(Session["UserID"].ToString(), out uID);

                        PLDemography = new Classes.cPlayer(uID, 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)
                    {
                        btnSubmit.Visible       = false;
                        pnlSaveReminder.Visible = false;
                        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() + " and cannot be edited.";
                            TextBoxEnabled          = false;
                            hidTextBoxEnabled.Value = "0";
                            btnCancel.Visible       = false;
                            foreach (DataRow dRow in dtQuestions.Rows)
                            {
                                dRow["Answer"] = dRow["Answer"].ToString().Replace("\n", "<br>");
                            }
                        }
                    }
                    else if (dtQuestions.Rows[0]["PELDateSubmitted"] != DBNull.Value)
                    {
                        btnSubmit.Visible       = false;
                        pnlSaveReminder.Visible = false;
                        btnSave.Text            = "Done";
                        btnSave.CommandName     = "Done";
                        DateTime dtTemp;
                        if (DateTime.TryParse(dtQuestions.Rows[0]["PELDateSubmitted"].ToString(), out dtTemp))
                        {
                            lblEditMessage.Visible  = true;
                            lblEditMessage.Text     = "<br>This PEL was submitted on " + dtTemp.ToShortDateString() + " and cannot be edited.";
                            TextBoxEnabled          = false;
                            hidTextBoxEnabled.Value = "0";
                            btnCancel.Visible       = false;
                            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.Count > 1)
                {
                    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();
                }
            }
        }
示例#21
0
        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);
        }