示例#1
0
        public RPMSync(string apiUrl, string apiKey)
        {
            this.rpmApiUrl = apiUrl;
            this.rpmApiKey = apiKey;

            this.syncDataWorker.WorkerReportsProgress = true;
            this.syncDataWorker.DoWork += syncData;
            this.syncDataWorker.RunWorkerCompleted += syncingComplete;
            this.syncDataWorker.ProgressChanged += syncingProgressChanged;

            this.checkRPMAccess();

            if (this.infoSuccessful())
            {
                ProcsResult procs = this.getAllProcs();
                this.jobProcess = this.getProc("External-JobInformation", procs);
                if (this.jobProcess == null)
                {
                    throw new ProcessNotFoundException("The RPM Process \"External-JobInformation\" was not Found.");
                }
                if (!this.jobProcess.Enabled)
                {
                    RPMApiError error = new RPMApiError();
                    error.Error = new Dictionary<string,string>{
                        {"Message", "The RPM Process \"External-JobInformation\" is not enabled."}
                    };
                    throw error;
                }
            }
        }
示例#2
0
 private void synchronizeJobInformation(ProcResult jobProc)
 {
     Dictionary<string, ProcForm> forms = this.byExternalJobID(jobProc.ProcessID, this.getListOfForms(jobProc.ProcessID));
     int jobCount = googleData.Count;
     int current = 0;
     foreach (string jobId in googleData.Keys)
     {
         string description = googleData[jobId].Description;
         string location = googleData[jobId].Location;
         if (forms.ContainsKey(jobId))
         {
             ProcForm form = forms[jobId];
             if (form.valueForField("Job Description") != description || form.valueForField("Job Location") != location)
             {
                 this.updateJobForm(forms[jobId], description, location);
             }
         }
         else
         {
             this.createJobForm(jobProc.ProcessID, jobId, description, location);
         }
         current += 1;
         forms.Remove(jobId);
         this.syncDataWorker.ReportProgress(current * 100 / jobCount);
     }
     foreach (string deletedJobId in forms.Keys)
     {
         ProcForm form = forms[deletedJobId];
         this.updateJobForm(form, form.valueForField("Job Description"), form.valueForField("Job Location"), true);
     }
 }