Print Page | Close Window

License and Maximum Report Processing Jobs Limit

Printed From: Crystal Reports Book
Category: General Information
Forum Name: Self-Publishing
Forum Discription: Thinking about writing your own book or already have something to sell? Let me give you advice from my experiences.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=20557
Printed Date: 29 Mar 2024 at 2:18am


Topic: License and Maximum Report Processing Jobs Limit
Posted By: jomy
Subject: License and Maximum Report Processing Jobs Limit
Date Posted: 18 Mar 2014 at 9:57am
Based on the various discussion and forums ,   not getting the correction solution close and dispose the objects. if anybody can help i would like to give awards since due to this issue  i am loosing my project amount.


This is my challanges : how to close the pending files form temp folder? . Sometimes its clearing however i am seeing everyday two three files keeping pending in tmep folder



Below my code

Setp 1  :

// page load

   protected void Page_Load(object sender, EventArgs e)

    {

        if (!IsPostBack)

        {

            ShowPOPrint ();

 

        }

        else

        {

 

            if (Request.Params["__EVENTTARGET"] != null)

            {

                if (Request.Params["__EVENTTARGET"].Equals("CLOSE_REPORT_OBJECT"))

                {

                    string ret = Request.Params["__EVENTARGUMENT"];

status = true ;

                }

            }

        }

        

         

    }

 

Step 2

// function for initialize the     

 private void ShowPOPrint()

    {

        DataSet Temp = new DataSet(); 

      

          ReportDocument objrptdoc; 

           if (Session["REPORT_KEY"] != null)

                {

                objrptdoc = (ReportDocument)Session["REPORT_KEY"];

                objrptdoc.Close();

                objrptdoc.Dispose();

                Session.Remove("REPORT_KEY");

                Session.Remove("REPORT_NAME");

          }

        // Create a new report object

        objrptdoc = new ReportDocument(); 

        objrptdoc.Load(Reportclass.RptFileName);  

        Temp = Reportclass.DataSetReport; 

        objrptdoc.SetDataSource(Temp);

        Session["Objrptdoc"] = objrptdoc;

        Session.Add("REPORT_KEY", objrptdoc);

        Session.Add("REPORT_NAME", Reportclass.RptFileName);

 

        crptReport.DisplayGroupTree = false;

        crptReport.ReportSource = objrptdoc;

        crptReport.DataBind();

        crptReport.DisplayPage = true;

        Temp = null; 

 

    }

 

Step 3 : //

// using for paging

protected override void OnInit(EventArgs e)

    {

        if (Session["Objrptdoc"] != null)

        {

            objrptdoc = (ReportDocument)Session["Objrptdoc"];

            crptReport.ReportSource = objrptdoc;

          

        }

    }

 

Step 4 // closing the   report form and calling post back event to dispose the object

 

  protected void Page_Unload(object sender, EventArgs e)

     {

         try

         {

             if (status == true)

             {

                 if (this.crptReport != null)

                 {

                     this.crptReport.Dispose();

                     this.crptReport = null;

                 }

 

                 if (objrptdoc != null)

                 {

                     objrptdoc.Close();

                     objrptdoc.Dispose();

 

                     GC.Collect();

                 }

             }

         }

        catch(Exception ex)

        {

        }

    }

 

 

//-- SCRIPT IS USING TO CALL THE POST BACK EVENT TO  TRIGGER THE PAGE UNLOAD AND DISPOSE THE OBJECT

<script language="javascript" type="text/javascript">

 

    window.onbeforeunload = function () {

        __doPostBack('CLOSE_REPORT_OBJECT', '');

        confirmComplete();

        //alert("Report Generate PDF/Closing");

 

    };

     function confirmComplete() {

         // alert("confirmComplete");

         var answer = confirm("Are you sure you want to continue");

         if (answer == true)

         {

             return true;

         }

         else

         {

             return false;

         }

     }

 

</script>

Thank you ,
jomyoxive@gmail.com






Print Page | Close Window