Ejemplo n.º 1
0
        protected void btnApproveAll_Click(object sender, EventArgs e)
        {
            MethodBase lmth          = MethodBase.GetCurrentMethod();
            string     lsRoutineName = lmth.DeclaringType + "." + lmth.Name;

            DataView dvPELs = Session["PELApprovalList_dvPELs"] as DataView;

            dvPELs.RowFilter = dvPELs.RowFilter + " and (DateApproved is null)";
            foreach (DataRowView dRow in dvPELs)
            {
                int iRegistrationID;
                if (int.TryParse(dRow["RegistrationID"].ToString(), out iRegistrationID))
                {
                    int iPELID;

                    int.TryParse(dRow["PELID"].ToString(), out iPELID);

                    SortedList sParams = new SortedList();
                    sParams.Add("@UserID", Master.UserID);
                    sParams.Add("@PELID", iPELID);

                    double dCPAwarded;
                    if (double.TryParse(dRow["CPValue"].ToString(), out dCPAwarded))
                    {
                        sParams.Add("@CPAwarded", dCPAwarded);
                    }
                    sParams.Add("@DateApproved", DateTime.Now);

                    Classes.cUtilities.PerformNonQuery("uspInsUpdCMPELs", sParams, "LARPortal", Master.UserName);

                    Classes.cPoints Points = new Classes.cPoints();
                    //int UserID = 0;
                    int      CampaignPlayerID = 0;
                    int      CharacterID      = 0;
                    int      CampaignCPOpportunityDefaultID = 0;
                    int      EventID         = 0;
                    int      ReasonID        = 0;
                    int      CampaignID      = 0;
                    double   CPAwarded       = 0.0;
                    DateTime dtDateSubmitted = DateTime.Now;

                    //int.TryParse(Session["UserID"].ToString(), out UserID);
                    int.TryParse(dRow["CampaignPlayerID"].ToString(), out CampaignPlayerID);
                    int.TryParse(dRow["CharacterID"].ToString(), out CharacterID);
                    int.TryParse(dRow["CampaignCPOpportunityDefaultID"].ToString(), out CampaignCPOpportunityDefaultID);
                    int.TryParse(dRow["ReasonID"].ToString(), out ReasonID);
                    int.TryParse(dRow["CampaignID"].ToString(), out CampaignID);
                    int.TryParse(dRow["EventID"].ToString(), out EventID);
                    double.TryParse(dRow["CPValue"].ToString(), out CPAwarded);
                    DateTime.TryParse(dRow["DateSubmitted"].ToString(), out dtDateSubmitted);

                    Points.AssignPELPoints(Master.UserID, CampaignPlayerID, CharacterID, CampaignCPOpportunityDefaultID, EventID, dRow["EventName"].ToString(), ReasonID, CampaignID, CPAwarded, dtDateSubmitted);
                }
            }
        }
Ejemplo n.º 2
0
        protected void btnApproveAll_Click(object sender, EventArgs e)
        {
            DataTable dtPELs = ViewState["PELsDisplayed"] as DataTable;

            DataView dvPELs = new DataView(dtPELs, "DateApproved is null", "", DataViewRowState.CurrentRows);

            foreach (DataRowView dRow in dvPELs)
            {
                int iRegistrationID;
                if (int.TryParse(dRow["RegistrationID"].ToString(), out iRegistrationID))
                {
                    int iPELID;

                    int.TryParse(dRow["PELID"].ToString(), out iPELID);

                    SortedList sParams = new SortedList();
                    sParams.Add("@UserID", Session["UserID"].ToString());
                    sParams.Add("@PELID", iPELID);

                    double dCPAwarded;
                    if (double.TryParse(dRow["CPValue"].ToString(), out dCPAwarded))
                    {
                        sParams.Add("@CPAwarded", dCPAwarded);
                    }
                    sParams.Add("@DateApproved", DateTime.Now);

                    Classes.cUtilities.PerformNonQuery("uspInsUpdCMPELs", sParams, "LARPortal", Session["UserName"].ToString());

                    Classes.cPoints Points           = new Classes.cPoints();
                    int             UserID           = 0;
                    int             CampaignPlayerID = 0;
                    int             CharacterID      = 0;
                    int             CampaignCPOpportunityDefaultID = 0;
                    int             EventID         = 0;
                    int             ReasonID        = 0;
                    int             CampaignID      = 0;
                    double          CPAwarded       = 0.0;
                    DateTime        dtDateSubmitted = DateTime.Now;

                    int.TryParse(Session["UserID"].ToString(), out UserID);
                    int.TryParse(dRow["CampaignPlayerID"].ToString(), out CampaignPlayerID);
                    int.TryParse(dRow["CharacterID"].ToString(), out CharacterID);
                    int.TryParse(dRow["CampaignCPOpportunityDefaultID"].ToString(), out CampaignCPOpportunityDefaultID);
                    int.TryParse(dRow["ReasonID"].ToString(), out ReasonID);
                    int.TryParse(dRow["CampaignID"].ToString(), out CampaignID);
                    int.TryParse(dRow["EventID"].ToString(), out EventID);
                    double.TryParse(dRow["CPValue"].ToString(), out CPAwarded);
                    DateTime.TryParse(dRow["DateSubmitted"].ToString(), out dtDateSubmitted);

                    Points.AssignPELPoints(UserID, CampaignPlayerID, CharacterID, CampaignCPOpportunityDefaultID, EventID, dRow["EventName"].ToString(), ReasonID, CampaignID, CPAwarded, dtDateSubmitted);
                }
            }
        }
Ejemplo n.º 3
0
        protected void ProcessButton(object sender, CommandEventArgs e)
        {
            int iPELID = -1;
            int iTemp;

            if (int.TryParse(hidPELID.Value, out iTemp))
            {
                iPELID = iTemp;
            }

            if ((e.CommandName.ToUpper() == "SAVE") || (e.CommandName.ToUpper() == "SUBMIT"))
            {
                foreach (RepeaterItem item in rptQuestions.Items)
                {
                    if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem)
                    {
                        SortedList sParams = new SortedList();

                        TextBox     tbAnswer      = (TextBox)item.FindControl("tbAnswer");
                        HiddenField hidQuestionID = (HiddenField)item.FindControl("hidQuestionID");
                        HiddenField hidAnswerID   = (HiddenField)item.FindControl("hidAnswerID");
                        int         iQuestionID   = 0;
                        int         iAnswerID     = 0;

                        if (hidQuestionID != null)
                        {
                            int.TryParse(hidQuestionID.Value, out iQuestionID);
                        }
                        if (hidAnswerID != null)
                        {
                            int.TryParse(hidAnswerID.Value, out iAnswerID);
                        }

                        if (iPELID == 0)
                        {
                            iPELID = -1;
                        }
                        if (iAnswerID == 0)
                        {
                            iAnswerID = -1;
                        }

                        sParams.Add("@PELAnswerID", iAnswerID);
                        sParams.Add("@PELQuestionsID", iQuestionID);
                        sParams.Add("@PELID", iPELID);
                        sParams.Add("@Answer", tbAnswer.Text);
                        sParams.Add("@RegistrationID", hidRegistrationID.Value);

                        DataSet dsPELS = new DataSet();
                        dsPELS = Classes.cUtilities.LoadDataSet("uspPELsAnswerInsUpd", sParams, "LARPortal", Session["UserName"].ToString(), "PELEdit.btnSave_Click");

                        if ((dsPELS.Tables.Count > 1) && (iPELID == -1))
                        {
                            if (int.TryParse(dsPELS.Tables[1].Rows[0]["PELID"].ToString(), out iTemp))
                            {
                                iPELID         = iTemp;
                                hidPELID.Value = iTemp.ToString();
                            }
                        }
                    }
                    Session["UpdatePELMessage"] = "alert('The PEL has been saved.');";
                }
            }
            if (e.CommandName.ToUpper() == "SUBMIT")
            {
                SortedList sParams = new SortedList();
                sParams.Add("@UserID", Session["UserID"].ToString());
                sParams.Add("@PELID", iPELID);
                sParams.Add("@DateSubmitted", DateTime.Now);

                Classes.cUtilities.PerformNonQuery("uspInsUpdCMPELs", sParams, "LARPortal", Session["UserName"].ToString());
                Session["UpdatePELMessage"] = "alert('The PEL has been saved and submitted.');";
            }
            if (e.CommandName.ToUpper() == "APPROVE")
            {
                SortedList sParams = new SortedList();
                sParams.Add("@UserID", Session["UserID"].ToString());
                sParams.Add("@PELID", iPELID);

                double dCPAwarded;
                if (double.TryParse(tbCPAwarded.Text, out dCPAwarded))
                {
                    sParams.Add("@CPAwarded", dCPAwarded);
                }
                sParams.Add("@DateApproved", DateTime.Now);

                Classes.cUtilities.PerformNonQuery("uspInsUpdCMPELs", sParams, "LARPortal", Session["UserName"].ToString());
                Session["UpdatePELMessage"] = "alert('The PEL has been approved.');";

                Classes.cPoints Points           = new Classes.cPoints();
                int             UserID           = 0;
                int             CampaignPlayerID = 0;
                int             CharacterID      = 0;
                int             CampaignCPOpportunityDefaultID = 0;
                int             EventID    = 0;
                int             ReasonID   = 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(hidReasonID.Value, out ReasonID);
                int.TryParse(hidCampaignID.Value, out CampaignID);
                int.TryParse(hidEventID.Value, out EventID);
                double.TryParse(tbCPAwarded.Text, out CPAwarded);

                DateTime dtDateSubmitted;
                if (!DateTime.TryParse(hidSubmitDate.Value, out dtDateSubmitted))
                {
                    dtDateSubmitted = DateTime.Now;
                }

                Points.AssignPELPoints(UserID, CampaignPlayerID, CharacterID, CampaignCPOpportunityDefaultID, EventID, hidEventDesc.Value, ReasonID, CampaignID, CPAwarded, dtDateSubmitted);
            }

            Response.Redirect("PELApprovalList.aspx", true);
        }