Ejemplo n.º 1
0
        protected void ButtonSubmit_Click(object sender, EventArgs e)
        {
            string mode      = "";
            Int64  itemId    = 0;
            bool   modeCheck = false;

            try
            {
                mode   = Page.RouteData.Values["Mode"].ToString().ToLower();
                itemId = Convert.ToInt64(Page.RouteData.Values["ItemId"].ToString());
            }
            catch (Exception ex)
            {
            }
            finally
            {
            }

            if (mode == "event" || mode == "user" || mode == "error")
            {
                modeCheck = true;
            }

            if (mode == "event" || mode == "user")
            {
                if (itemId == 0)
                {
                    modeCheck = false;
                }
            }

            if (!modeCheck)
            {
                Response.Redirect("~/Error/PageNotFound");
            }

            int reportType = Convert.ToInt32(DropDownListReportType.SelectedValue);

            if (reportType == 0)
            {
                // say select why
            }
            else
            {
                string message = TextBoxMessage.Text;
                int    status  = 0;
                int    userId  = Convert.ToInt32(Session["UserId"]);

                if (mode == "event")
                {
                    Classes.Report r = new Classes.Report();
                    status = r.reportEvent(userId, itemId, reportType, message);
                }
                else if (mode == "user")
                {
                    int            itemId2 = Convert.ToInt32(itemId);
                    Classes.Report r       = new Classes.Report();
                    status = r.reportUser(userId, itemId2, reportType, message);
                }
                else if (mode == "error")
                {
                    HiddenFieldErrorMode.Value = "1";
                    string         page = TextBoxPage.Text;
                    Classes.Report r    = new Classes.Report();
                    status = r.reportError(userId, page, message);
                }

                if (status == 1)
                {
                    Response.Redirect("~/Done/ReportSent");
                }
                else if (status == 0)
                {
                    //notsuccess
                }
            }
        }
Ejemplo n.º 2
0
        protected void ButtonSubmit_Click(object sender, EventArgs e)
        {
            string mode = "";
            Int64 itemId = 0;
            bool modeCheck = false;

            try
            {
                mode = Page.RouteData.Values["Mode"].ToString().ToLower();
                itemId = Convert.ToInt64(Page.RouteData.Values["ItemId"].ToString());
            }
            catch (Exception ex)
            {

            }
            finally
            {

            }

            if (mode == "event" || mode == "user" || mode == "error")
            {
                modeCheck = true;
            }

            if (mode == "event" || mode == "user")
            {
                if (itemId == 0)
                {
                    modeCheck = false;
                }
            }

            if (!modeCheck)
            {
                Response.Redirect("~/Error/PageNotFound");
            }

            int reportType = Convert.ToInt32(DropDownListReportType.SelectedValue);

            if (reportType == 0)
            {
                // say select why
            }
            else
            {
                string message = TextBoxMessage.Text;
                int status = 0;
                int userId = Convert.ToInt32(Session["UserId"]);

                if (mode == "event")
                {
                    Classes.Report r = new Classes.Report();
                    status = r.reportEvent(userId, itemId, reportType, message);
                }
                else if (mode == "user")
                {
                    int itemId2 = Convert.ToInt32(itemId);
                    Classes.Report r = new Classes.Report();
                    status = r.reportUser(userId, itemId2, reportType, message);
                }
                else if (mode == "error")
                {
                    HiddenFieldErrorMode.Value = "1";
                    string page = TextBoxPage.Text;
                    Classes.Report r = new Classes.Report();
                    status = r.reportError(userId, page, message);
                }

                if (status == 1)
                {
                    Response.Redirect("~/Done/ReportSent");
                }
                else if (status == 0)
                {
                    //notsuccess
                }
            }
        }