protected void ShowImpactPlaceholder()
 {
     int problemid = Convert.ToInt16(Request.QueryString[0]);
     ProblemImpact obj = new ProblemImpact();
     ObjProblemImpact = obj.Get_By_id(problemid);
     string description;
     if (ObjProblemImpact.Impactid ==0)
     {
         description = "";
     }
     else
     {
         description = ObjProblemImpact.Description.ToString();
     }
     Placeholderimpact.Visible = true;
     #region Declaration of Dynamic Table,and Placeholder
     Placeholderimpact.Controls.Clear();
     Table tbl = new Table();
     Placeholderimpact.Controls.Add(tbl);
     int hdwidth = 1500;
     int height = 5;
     #endregion
     #region Declaration of Tablerow,TableCell and lable object
     TableRow tabRow = new TableRow();
     TableCell tbCell = new TableCell();
     tbCell.Width = hdwidth;
     Label lbl = new Label();
     #endregion
     TableRow tabRow1 = new TableRow();
     TableCell tbCell1 = new TableCell();
     tbCell1.Width = hdwidth;
     tbCell1.Height = height;
     Label lbl1 = new Label();
     lbl1.Text = description;
     lbl1.Font.Size = FontUnit.Smaller;
     tbCell1.Controls.Add(lbl1);
     tabRow1.Cells.Add(tbCell1);
     tbl.Rows.Add(tabRow1);
     Editorimpact.Visible = false;
 }
Example #2
0
    protected void Page_Load(object sender, EventArgs e)
    {//Add Exception handilng try catch change by vishal 21-05-2012
        try
        {
            string strStatusClose = Resources.MessageResource.strStatusClose.ToString().Trim();
            string statusString   = "";
            int    problemid      = Convert.ToInt32(Request.QueryString[0]);
            ObjProbelm   = ObjProbelm.Get_By_id(problemid);
            objrootcause = objrootcause.Get_By_id(problemid);
            objimpact    = objimpact.Get_By_id(problemid);
            objstatus    = objstatus.Get_By_id(ObjProbelm.Statusid);
            statusString = objstatus.Statusname.ToString();
            if (statusString.ToLower() == strStatusClose.ToLower())
            {
                string ii        = objimpact.Description.ToString();
                string stripped4 = Regex.Replace(ii, @"<(.|\n)*?>", string.Empty);
                lblserviceeffected.Text = objimpact.Description.ToString();
                string rr        = objrootcause.Description.ToString();
                string stripped1 = Regex.Replace(rr, @"<(.|\n)*?>", string.Empty);
                lblcause.Text      = stripped1.ToString();
                objproblemsysmptom = objproblemsysmptom.Get_By_id(problemid);
                string ss        = objproblemsysmptom.Description.ToString();
                string stripped3 = Regex.Replace(ss, @"<(.|\n)*?>", string.Empty);
                lblsymptom.Text    = stripped3.ToString();
                lbltcktno.Text     = ObjProbelm.ProblemId.ToString();
                lblcreatedate.Text = ObjProbelm.CreateDatetime.ToString();
                if (ObjProbelm.AssginedTime != null)
                {
                    lblstarttime.Text = ObjProbelm.AssginedTime.ToString();
                }
                lblendtime.Text = ObjProbelm.Closedatetime.ToString();
                Objcategory     = Objcategory.Get_By_id(ObjProbelm.Categoryid);

                lblcomponenteffected.Text = Objcategory.CategoryName.ToString();
                lbldescription.Text       = ObjProbelm.title.ToString();
                objproblemtosolution      = objproblemtosolution.Get_By_id(ObjProbelm.ProblemId);
                Objsolution = Objsolution.Get_By_id(objproblemtosolution.Solutionid);
                string bb       = Objsolution.Solution.ToString();
                string stripped = Regex.Replace(bb, @"<(.|\n)*?>", string.Empty);
                lblresolution.Text = stripped.ToString();
                //bind data to data bound controls and do other stuff
                objUser           = objUser.Get_By_id(ObjProbelm.Requesterid);
                lblcustomer.Text  = objUser.Username.ToString();
                objUser           = objUser.Get_By_id(ObjProbelm.Technicianid);
                lblengineer.Text  = objUser.Username.ToString();
                lblrcaresult.Text = "Completed";
            }
            Response.Clear();       //this clears the Response of any headers or previous output
            Response.Buffer = true; //make sure that the entire output is rendered simultaneously

            ///
            ///Set content type to MS Excel sheet
            ///Use "application/msword" for MS Word doc files
            ///"application/pdf" for PDF files
            ///

            Response.ContentType = "application/vnd.ms-excel";
            StringWriter stringWriter = new StringWriter(); //System.IO namespace should be used

            HtmlTextWriter htmlTextWriter = new HtmlTextWriter(stringWriter);

            ///
            ///Render the entire Page control in the HtmlTextWriter object
            ///We can render individual controls also, like a DataGrid to be
            ///exported in custom format (excel, word etc)
            ///
            this.RenderControl(htmlTextWriter);
            Response.Write(stringWriter.ToString());
            Response.End();
        }
        catch (Exception ex)
        {
            string myScript;
            myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>";
            Page.RegisterClientScriptBlock("MyScript", myScript);
            return;
        }
    }