This is a migrated thread and some comments may be shown as answers.

RadProgressManager + RadProgressArea Dilemma

8 Answers 172 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
DoomerDGR8
Top achievements
Rank 2
Iron
Iron
Iron
DoomerDGR8 asked on 15 Dec 2010, 05:34 PM
Hello again!

I'm trying to visualize a very intensive double for-loop piece of code. The story is that there are a number of job I need to process. Say 200 jobs. For each job, i need to go through a list of workers I have, say 500. There are criteria (address, max distance from job, job type) that shortlist the workers to some extent before the inner for-each worker loop starts.

So I have a total progress (Total number of jobs) and a secondary progress for each primary unit. I need to get the RadProgressManager + RadProgressArea working here. I used a tutorail and some forum help to get the basics up but the behaviour is not what I accepted. The only thing that is visualizing is the time elapsed thing and the rest of the control just remains still. no progress bar movement at all.

Currently, the function is taking around 7 minutes to solve 250 jobs. The function has room for improvement, no doubt, but for now, I just need my user(s) to know something is happening and how far along is it.

Thanks.

Code:
protected void Page_Load(object sender, EventArgs e) {
  if (Page.IsPostBack == false) {
 
    if (HasJobsToBook()) {
      FinalSolution.Rows.Clear();
      RetrieveJobsToBookBatchIDs();
      long iCount = RetrieveActualJobsAgainstBatchIDs();
      PreSortTheJobs(iCount);
 
      LabelError.Visible = true;
      LabelError.Text = String.Format("I have {0} job(s) to process!", iCount);
 
      RadProgressAreaGenie.ProgressIndicators &= ~ProgressIndicators.SelectedFilesCount;
    }
 
  }
 
  RadProgressAreaGenie.Localization.Uploaded = "Total Progress";
  RadProgressAreaGenie.Localization.UploadedFiles = "Progress";
  RadProgressAreaGenie.Localization.CurrentFileName = "Job Genie in action!";
}
 
private void MatchALocum() {
  LabelError.Visible = false;
  LabelError.Text = string.Empty;
 
  if (CountOfJobsToBook() < 1) {
    LabelError.Visible = true;
    LabelError.Text = "No job(s) to process.";
    Trace.Warn("Job Genie", "No job(s) to process.");
    return;
  }
 
  RadProgressContext progress = RadProgressContext.Current;
  progress.Speed = "N/A";
 
  try {
 
    #region Declerations
 
    int iCounterControl = 0;
    int iCounterControlInner = 0;
 
    foreach (DataRow Row in TableJobsToBook.Rows) {
      iCounterControl = iCounterControl + 1;
 
      progress.PrimaryTotal = TableJobsToBook.Rows.Count;
      progress.PrimaryValue = iCounterControl;
      progress.PrimaryPercent = (iCounterControl / TableJobsToBook.Rows.Count) * 100;
 
      if (!Response.IsClientConnected) {
        //Cancel button was clicked or the browser was closed, so stop processing
        break;
      }
 
      #region Key Extracted Job Properties
 
      #region Availability
 
      #region Distance Preperation
 
      iCounterControlInner = 0;
 
      foreach (long ListOfCandidateLocumID in ListOfCandidateLocumIDs) {
        iCounterControlInner = iCounterControlInner + 1;
 
        progress.SecondaryTotal = ListOfCandidateLocumIDs.Count();
        progress.SecondaryValue = iCounterControlInner;
        progress.SecondaryPercent = (iCounterControlInner / ListOfCandidateLocumIDs.Count()) * 100;
 
        progress.CurrentOperationText = "Step " + iCounterControlInner.ToString();
 
        //Massive + Intensive code here...
 
        //Stall the current thread for 0.1 seconds
        System.Threading.Thread.Sleep(100);
         
      }//For Loop Candidates
 
 
      progress.TimeEstimated = (TableJobsToBook.Rows.Count - iCounterControl) * 100;
       
      //Stall the current thread for 0.1 seconds
      System.Threading.Thread.Sleep(100);
 
    }//For Loop Jobs
 
  } catch (Exception ex) {
    Trace.Warn("Job Genie", "Exception:" + ex.Message);
    throw new Exception("Error while running Job Genie.", ex);
  }
}

HTML:
<telerik:RadProgressManager ID="RadProgressManagerGenie" runat="server" Skin="Office2007" />
<telerik:RadProgressArea ID="RadProgressAreaGenie" runat="server" Skin="Office2007" Culture="(Default)"
  ProgressIndicators="TotalProgressBar, TotalProgress, TotalProgressPercent, FilesCountBar, FilesCount, FilesCountPercent, SelectedFilesCount, CurrentFileName, TimeElapsed, TimeEstimated"
  Width="100%">
  <Localization Uploaded="Uploaded" />
</telerik:RadProgressArea>

Thanks.

8 Answers, 1 is accepted

Sort by
0
DoomerDGR8
Top achievements
Rank 2
Iron
Iron
Iron
answered on 19 Dec 2010, 02:27 PM
Any pointers please...
0
Genady Sergeev
Telerik team
answered on 20 Dec 2010, 02:32 PM
Hi Hassan,

Your code looks fine, however, I cannot see where do you call the MatchALocum method. It should be called in the click handler of the button that should trigger the custom progress. Do you do that?

Greetings,
Genady Sergeev
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
DoomerDGR8
Top achievements
Rank 2
Iron
Iron
Iron
answered on 20 Dec 2010, 02:41 PM
Yes. The method is called and executes. But the progress bars don't reflect properly. They are both stuck at zero and only elpased time is ticking...
0
Genady Sergeev
Telerik team
answered on 23 Dec 2010, 12:41 PM
Hello Hassan,

This is strange, since this code works on my machine. Please, open a support ticket and attach there a sample project that reproduces the problem. This will allow to test the issue in our local environment and provide you with a solution quickly.

All the best,
Genady Sergeev
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
DoomerDGR8
Top achievements
Rank 2
Iron
Iron
Iron
answered on 23 Dec 2010, 12:45 PM
So, you believe that I have successfully implemented in the right way and the expected behavior should be that the primary progress bar should step and for every step, the secondary progress bar should go from 0% to 100%? My concern is that maybe I'm not giving it enough time to reflect the animation. Should I increase the delay? Also, while all this is happening, how can i disable the whole page so that the user cannot click any where else?
0
Genady Sergeev
Telerik team
answered on 24 Dec 2010, 05:29 PM
Hi Hassan,

Yes, the code that you have should be working fine. I've tried on a sample project as well and it is correctly updating the area. I don't believe that an animation issue is the problem. I am attaching sample project that shows the area inside a modal pop up, so that the user cannot interact with the rest of the page while a file is being uploaded. Please, host the project on the same server that you have used for testing your project and select a file larger than 40-50mb and press upload. Does the area appear?

Kind regards,
Genady Sergeev
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Juan Carlos
Top achievements
Rank 1
answered on 23 Jan 2011, 06:35 PM
I'm having a similar problem. It works fine on a .Net ASP application, however, when I try to do it on a Sharepoint 2010 Application Page the upload page doesn't show any progres... any thoughts? Thanks!
0
Genady Sergeev
Telerik team
answered on 27 Jan 2011, 09:59 AM
Hi Juan Carlos,

Could you please open a support ticket providing details regarding your scenario, do you have the needed handler & module registered in the web.config? Have you tried uploading large files?

Regards,
Genady Sergeev
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Upload (Obsolete)
Asked by
DoomerDGR8
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
DoomerDGR8
Top achievements
Rank 2
Iron
Iron
Iron
Genady Sergeev
Telerik team
Juan Carlos
Top achievements
Rank 1
Share this question
or