コード例 #1
0
        /*
         * Pre:
         * Post: If the entered data is valid, the points are added
         *       or edited in the datbase
         */
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            clearErrorMessages();

            if (dataIsValid())
            {
                if (audition == null)
                {
                    resetAuditionVar();
                }

                audition.points = Convert.ToInt32(lblPoints.InnerText);

                //if the audition doesn't have an id assigned it is a new audition that needs to be added
                //otherwise the points just need to be updated
                if (audition.auditionId == -1)
                {
                    if (audition.addToDatabase())
                    {
                        displaySuccessMessageAndOptions();
                    }
                    else
                    {
                        lblErrorMsg.Text    = "An error occurred while adding the points.  Please reload this audition to ensure they were added.";
                        lblErrorMsg.Visible = true;
                    }
                }
                else
                {
                    if (audition.updateInDatabase())
                    {
                        displaySuccessMessageAndOptions();
                    }
                    else
                    {
                        lblErrorMsg.Text    = "An error occurred while updating the points.  Please reload this audition to ensure they were updated.";
                        lblErrorMsg.Visible = true;
                    }
                }
            }
        }
コード例 #2
0
        /*
         * Pre:
         * Post: If the entered data is valid, the points are added
         *       or edited in the datbase
         */
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            if (dataIsValid())
            {
                if (audition == null)
                {
                    resetAuditionVar();
                }

                audition.points = Convert.ToInt32(lblPoints.Text);

                //if the audition doesn't have an id assigned it is a new audition that needs to be added
                //otherwise the points just need to be updated
                if (audition.auditionId == -1)
                {
                    if (audition.addToDatabase())
                    {
                        showSuccessMessage("The points were successfully added.");
                        clearPage();
                    }
                    else
                    {
                        showErrorMessage("Error: An error occurred while adding the points.  Please reload this audition to ensure they were added.");
                    }
                }
                else
                {
                    if (audition.updateInDatabase())
                    {
                        showSuccessMessage("The points were successfully updated.");
                        clearPage();
                    }
                    else
                    {
                        showErrorMessage("Error: An error occurred while adding the points.  Please reload this audition to ensure they were added.");
                    }
                }
            }
        }