コード例 #1
0
        //protected void CharacterHistoryEmailNotificaiton()
        //{
        //    if (hidPlayerEMail.Value.Length > 0)
        //    {
        //        string strSubject = "Character History Approved for Character " + lblCharacter.Text;
        //        string strBody = "Your character history for " + lblCharacter.Text + " has been approved.<br>";
        //        strBody += "You have been awarded " + tbCPAwarded.Text + " CP.<br><br>";
        //        strBody = strBody + "History Text:<br>" + lblHistory.Text;
        //        strBody = strBody.Replace(System.Environment.NewLine, "<br />");

        //        Classes.cEmailMessageService SubmitCharacterHistory = new Classes.cEmailMessageService();
        //        try
        //        {
        //            SubmitCharacterHistory.SendMail(strSubject, strBody, hidPlayerEMail.Value, "", "");
        //        }
        //        catch (Exception)
        //        {

        //        }
        //    }
        //}
        protected void btnApprove_Command(object sender, CommandEventArgs e)
        {
            int iCharID;

            if (int.TryParse(Request["CharID"], out iCharID))
            {
                Classes.cCharacter cChar = new Classes.cCharacter();
                cChar.LoadCharacter(iCharID);

                if (e.CommandName == "APPROVE")
                {
                    cChar.DateHistoryApproved = DateTime.Now;
                    cChar.SaveCharacter(Session["UserName"].ToString(), (int)Session["UserID"]);
                    lblCharApprovedMessage.Text = "The character history for " + cChar.AKA + " has been approved.";

                    Classes.cPoints Points      = new Classes.cPoints();
                    int             UserID      = 0;
                    int             CharacterID = 0;
                    int             CampaignCPOpportunityDefaultID = 0;
                    double          CPAwarded = 0.0;

                    int.TryParse(Session["UserID"].ToString(), out UserID);
                    int.TryParse(hidCampaignCPOpportunityDefaultID.Value, out CampaignCPOpportunityDefaultID);
                    double.TryParse(tbCPAwarded.Text, out CPAwarded);

                    Points.AssignHistoryPoints(UserID, cChar.PlayerID, CharacterID, CampaignCPOpportunityDefaultID, cChar.CampaignID, CPAwarded, DateTime.Now);

                    ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true);

                    if (hidPlayerEMail.Value.Length > 0)
                    {
                        string strSubject = "Character History Approved for Character " + lblCharacter.Text;
                        string strBody    = "Your character history for " + lblCharacter.Text + " has been approved.<br>";
                        strBody += "You have been awarded " + tbCPAwarded.Text + " CP.<br><br>";
                        strBody  = strBody + "History Text:<br>" + lblHistory.Text;
                        strBody  = strBody.Replace(System.Environment.NewLine, "<br />");

                        Classes.cEmailMessageService SubmitCharacterHistory = new Classes.cEmailMessageService();
                        try
                        {
                            SubmitCharacterHistory.SendMail(strSubject, strBody, hidPlayerEMail.Value, "", "", "CharacterHistory", Session["Username"].ToString());
                        }
                        catch (Exception)
                        {
                        }
                    }
                }
            }
        }
コード例 #2
0
        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);
        }