Exemple #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile       = Int32.Parse(Request.Cookies["profileid"].Value);
            oRequest         = new Requests(intProfile, dsn);
            oService         = new Services(intProfile, dsn);
            oServiceRequest  = new ServiceRequests(intProfile, dsn);
            oCustomized      = new Customized(intProfile, dsn);
            oPage            = new Pages(intProfile, dsn);
            oResourceRequest = new ResourceRequest(intProfile, dsn);
            oStatusLevel     = new StatusLevels();
            oUser            = new Users(intProfile, dsn);
            oApplication     = new Applications(intProfile, dsn);
            if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "")
            {
                intApplication = Int32.Parse(Request.QueryString["applicationid"]);
            }
            if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "")
            {
                intPage = Int32.Parse(Request.QueryString["pageid"]);
            }
            if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
            {
                intApplication = Int32.Parse(Request.Cookies["application"].Value);
            }
            if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
            {
                intId = Int32.Parse(Request.QueryString["id"]);
            }

            if (!IsPostBack)
            {
                drpModules.DataValueField = "pageid";
                drpModules.DataTextField  = "menutitle";
                drpModules.DataSource     = oPage.Gets(intApplication, intProfile, 0, 1, 1);
                drpModules.DataBind();
                drpModules.Items.Add(new ListItem("New Module", "-10"));
                drpModules.Items.Insert(0, new ListItem("-- SELECT --", "0"));
            }

            if (intId > 0)
            {
                panIncident.Visible = true;
                DataSet ds = oCustomized.GetIssueByID(intId);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    radNo.Checked            = true;
                    radYes.Enabled           = false;
                    radNo.Enabled            = false;
                    divNo.Style["display"]   = "inline";
                    panStatus.Visible        = true;
                    lblTitle.Text            = "Edit Issue";
                    txtTitle.Text            = ds.Tables[0].Rows[0]["title"].ToString();
                    txtDescription.Text      = ds.Tables[0].Rows[0]["description"].ToString();
                    drpModules.SelectedValue = ds.Tables[0].Rows[0]["pageid"].ToString();
                    txtNumUsers.Text         = ds.Tables[0].Rows[0]["num_users"].ToString();
                    txtURL.Text = ds.Tables[0].Rows[0]["url"].ToString();
                    if (ds.Tables[0].Rows[0]["path"].ToString() != "")
                    {
                        panUploaded.Visible   = true;
                        hypUpload.NavigateUrl = ds.Tables[0].Rows[0]["path"].ToString();
                    }
                    else
                    {
                        panUpload.Visible = true;
                    }
                    lblStatus.Text = oStatusLevel.HTMLSupport(Int32.Parse(ds.Tables[0].Rows[0]["status"].ToString()));
                    lblStatus.Attributes.Add("oncontextmenu", "alert('CVT" + intRequest.ToString() + "');");
                    if (ds.Tables[0].Rows[0]["status"].ToString() == "0")
                    {
                        btnUpdate.Visible = true;
                        panActive.Visible = true;
                    }
                    lblRequestBy.Text = oUser.GetFullName(intProfile);
                    lblRequestOn.Text = DateTime.Parse(ds.Tables[0].Rows[0]["created"].ToString()).ToString();

                    intRequest = Int32.Parse(ds.Tables[0].Rows[0]["requestid"].ToString());
                    oCustomized.UpdateIssueNew(intRequest, 0);
                    panMessage.Visible = (oCustomized.GetMessages(intRequest, 0).Tables[0].Rows.Count > 0);
                    strMessages        = oCustomized.GetMessages(intRequest, false, "#E1FFE1");
                    if (ds.Tables[0].Rows[0]["status"].ToString() == "2" || ds.Tables[0].Rows[0]["status"].ToString() == "7")
                    {
                        btnMessage.Attributes.Add("onclick", "ShowHideDiv2('" + divMessage.ClientID + "');return false;");
                    }
                    else
                    {
                        btnMessage.Attributes.Add("onclick", "alert('You can only post a message to an ACTIVE thread.\\n\\nSince this thread is no longer active, additional posts have been disabled');return false;");
                    }
                }
            }
            else
            {
                panNoIncident.Visible = true;
                panUpload.Visible     = true;
                lblRequestBy.Text     = oUser.GetFullName(intProfile);
                lblRequestOn.Text     = DateTime.Now.ToString();
                lblTitle.Text         = oPage.Get(intPage, "title");
                txtNumUsers.Text      = "0";
                btnSave.Visible       = true;
                panActive.Visible     = true;
            }

            radYes.Attributes.Add("onclick", "ShowHideDiv('" + divYes.ClientID + "','inline');ShowHideDiv('" + divNo.ClientID + "','none');");
            radNo.Attributes.Add("onclick", "ShowHideDiv('" + divNo.ClientID + "','inline');ShowHideDiv('" + divYes.ClientID + "','none');");
            btnSave.Attributes.Add("onclick", "return ValidateText('" + txtTitle.ClientID + "','Please enter a title')" +
                                   " && ValidateText('" + txtDescription.ClientID + "','Please enter a description')" +
                                   " && ValidateNumber('" + txtNumUsers.ClientID + "','Please enter a valid number for the number of users')" +
                                   ";");
            btnUpdate.Attributes.Add("onclick", "return ValidateText('" + txtTitle.ClientID + "','Please enter a title')" +
                                     " && ValidateText('" + txtDescription.ClientID + "','Please enter a description')" +
                                     " && ValidateNumber('" + txtNumUsers.ClientID + "','Please enter a valid number for the number of users')" +
                                     ";");
            btnResponse.Attributes.Add("onclick", "return ValidateText('" + txtResponse.ClientID + "','Please enter a response');");
            btnDeleteAttachment.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this file?');");
        }