示例#1
0
        private void cmdAdd_Click(object sender, System.EventArgs e)
        {
            bool   bolError    = false;
            string strTmpError = "The following errors have occurred:<BR><BR>";

            panelError.Visible   = false;
            lblErrorMessage.Text = "";

            if (txtPayloadName.Text.Trim() == "")
            {
                bolError    = true;
                strTmpError = strTmpError + "Payload Name is blank<BR>";
            }

            if (txtPayloadData.Text.Trim() == "")
            {
                bolError    = true;
                strTmpError = strTmpError + "Payload Data is blank<BR>";
            }

            if (txtDescription.Text.Trim() == "")
            {
                bolError    = true;
                strTmpError = strTmpError + "Description is blank<BR>";
            }

            if (txtPayloadOrder.Text.Trim() == "")
            {
                bolError    = true;
                strTmpError = strTmpError + "Payload Order is blank<BR>";
            }
            else
            {
                try
                {
                    int intTest = 0;
                    intTest = System.Convert.ToInt32(txtPayloadOrder.Text);
                }
                catch
                {
                    bolError    = true;
                    strTmpError = strTmpError + "Payload Order is invalid<BR>";
                }
            }



            if (bolError == true)
            {
                panelError.Visible   = true;
                lblErrorMessage.Text = strTmpError;

                return;
            }


            objPayload.payloadName  = "" + txtPayloadName.Text;
            objPayload.payloadData  = "" + txtPayloadData.Text;
            objPayload.description  = "" + txtDescription.Text;
            objPayload.payloadOrder = System.Convert.ToInt32(txtPayloadOrder.Text);

            objPayload.type = System.Convert.ToInt32(dropDownType.SelectedItem.Value);



            if (lblHiddenId.Text == "")
            {
                objPayload.add();
            }
            else
            {
                objPayload.id = System.Convert.ToInt32(lblHiddenId.Text);
                objPayload.update();
            }

            panelAdd_reset();
            panelAdd.Visible = false;

            dbGrid_bind();
        }
示例#2
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                //Start new recording session
                if ("" + Request.QueryString["action"] == "reset")
                {
                    clearSession();
                }

                if ("" + Session["sessionId"] != "")
                {
                    objSession.id = System.Convert.ToInt32(Session["sessionId"]);
                    objSession.populate();
                }

                //Set Buttons
                if (Session["mode"].ToString() == "record")
                {
                    cmdRecord.Enabled = false;
                    cmdPause.Enabled  = true;
                    cmdStop.Enabled   = true;
                }

                if (Session["mode"].ToString() == "pause")
                {
                    cmdRecord.Enabled = true;
                    cmdPause.Enabled  = false;
                    cmdStop.Enabled   = true;
                }

                try
                {
                    strRedirectUrl = "" + Request.QueryString["pageUrl"].ToString();
                }
                catch
                {
                }

                //Get Form Submission
                if ("" + Session["mode"].ToString() == "record")
                {
                    string strPayload = "" + Request.Form;

                    //replace modified view state field
                    strPayload = strPayload.Replace("__RETREIVEDVIEWSTATE", "__VIEWSTATE");

                    //add this payload if we are in record mode
                    objPayload.payloadName  = "Auto Generated for " + objSession.sessionName + ", " + Session["url"].ToString();
                    objPayload.description  = "" + Session["url"].ToString();
                    objPayload.payloadData  = "" + strPayload;
                    objPayload.payloadOrder = System.Convert.ToInt32(Session["payloadOrder"]);
                    objPayload.type         = 0;
                    objPayload.add();

                    txtPayload.Text    = "" + objPayload.payloadData;
                    txtCurrentURL.Text = "" + strRedirectUrl;
                    payloadDataAccess.addSessionPayload(System.Convert.ToInt32(Session["sessionId"]), objPayload.id, System.Convert.ToInt32(Session["urlId"]), System.Convert.ToInt32(Session["payloadOrder"]));

                    intTmp = System.Convert.ToInt32(Session["payloadOrder"]);
                    intTmp = intTmp + 1;

                    Session["payloadOrder"] = intTmp.ToString();
                }

                //Display Results of form submission on page
                if ("" + Session["mode"].ToString() == "pause" || Session["mode"].ToString() == "record")
                {
                    //Increment recording values
                    intTmp           = System.Convert.ToInt32(Session["order"]);
                    intTmp           = intTmp + 1;
                    Session["order"] = intTmp;

                    objUrl.description  = "Auto Generated URL";
                    objUrl.sessionId    = System.Convert.ToInt32(Session["sessionId"]);
                    objUrl.sessionOrder = System.Convert.ToInt32(Session["order"]);
                    objUrl.url          = strRedirectUrl;
                    objUrl.add();

                    Session["urlId"] = objUrl.id.ToString();
                    Session["url"]   = "" + objUrl.url;

                    strHtml = "" + objFormSubmitter.submitData("" + objPayload.payloadData, strRedirectUrl, true, "POST", "");

                    strHtml = strHtml.Replace("__VIEWSTATE", "__RETREIVEDVIEWSTATE");
                    strHtml = objFormRedirect.rewriteForm(strHtml, System.Configuration.ConfigurationSettings.AppSettings.Get("siteRoot") + "default.aspx?pageId=46&pageUrl=" + System.Web.HttpUtility.UrlEncode(strRedirectUrl), System.Configuration.ConfigurationSettings.AppSettings.Get("siteRoot") + "default.aspx?pageId=46&pageUrl=", objSession.applicationBaseUrl);

                    Literal objLiteral = new Literal();
                    objLiteral.Text = strHtml;
                    panelHtml.Controls.Add(objLiteral);

                    panelInitialSessionSetup.Visible = false;
                    panelRecord.Visible        = true;
                    panelRetrievedSite.Visible = true;
                }


                else if ("" + Session["mode"].ToString() == "start")
                {
                    Session["mode"] = "record";
                }
            }
            catch
            {
            }
        }