Exemple #1
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (GetUrlParamType() == UrlParamType.View)
        {
            Response.Redirect(UrlParamModifier.AddEdit(Request.RawUrl, "type", "edit"));
        }
        else if (GetUrlParamType() == UrlParamType.Edit)
        {
            if (!IsValidFormID())
            {
                HideTableAndSetErrorMessage();
                return;
            }

            int offeringID = GetFormID();
            if (!OfferingDB.Exists(offeringID))
            {
                HideTableAndSetErrorMessage("Invalid Offering ID");
                return;
            }

            OfferingDB.UpdatePopupMessage(offeringID, txtPopupMessage.Text);

            //close this window
            Page.ClientScript.RegisterStartupScript(this.GetType(), "close", "<script language=javascript>window.returnValue=false;self.close();</script>");
        }
        else if (GetUrlParamType() == UrlParamType.Add)
        {
            if (!IsValidFormID())
            {
                HideTableAndSetErrorMessage();
                return;
            }

            int offeringID = GetFormID();
            if (!OfferingDB.Exists(offeringID))
            {
                HideTableAndSetErrorMessage("Invalid Offering ID");
                return;
            }


            OfferingDB.UpdatePopupMessage(offeringID, txtPopupMessage.Text);


            // close this window
            Page.ClientScript.RegisterStartupScript(this.GetType(), "close", "<script language=javascript>window.returnValue=false;self.close();</script>");
        }
        else
        {
            HideTableAndSetErrorMessage("", "Invalid URL Parameters");
        }
    }