Beispiel #1
0
 private void LoadMatchType(IDeDupJobProcess job, bool initialize)
 {
     if (job.MatchDuplicateProvider == null)
     {
         return;
     }
     if ((chkListMatchTypes.Items.Count <= 0) || initialize)
     {
         chkListMatchTypes.Items.Clear();
         foreach (MatchSearchTarget target in job.MatchDuplicateProvider.GetSearchTargets())
         {
             ListItem item = new ListItem();
             //If resource does not exist then use the Xml value. Item is prefixed with "Filter" to better identify resource items
             object resource = GetLocalResourceObject("Target." + target.TargetType.Name);
             if (resource != null)
             {
                 item.Text = resource.ToString();
             }
             else
             {
                 string typeName = target.TargetType.Name;
                 // Remove the qualifying Interface prefix on the type
                 typeName  = typeName.Substring(1);
                 item.Text = typeName;
             }
             item.Value    = target.TargetType.AssemblyQualifiedName;
             item.Selected = target.IsActive;
             item.Enabled  = true;
             chkListMatchTypes.Items.Add(item);
         }
     }
 }
    private IDeDupJobProcess CreateJobInstance()
    {
        IDeDupJobProcess job = DeDupService.CreateJobInstance(ddlJobs.SelectedItem.Value);

        job.JobDisplayName = ddlJobs.SelectedItem.Text;
        return(job);
    }
    /// <summary>
    /// Starts the import process inside its own thread.
    /// </summary>
    /// <param name="args">The args.</param>
    public void StartJobProcess(Object args)
    {
        string           jobId = GetJobId();
        IDeDupJobProcess job   = DeDupService.GetJob(jobId);

        if (job != null)
        {
            SetStartProcessInfo();
            try
            {
                SetStartProcessInfo();
                AddJob(job);
                job.OnProgressEvent += JobProgressHandler;
                job.Start();
                SetCompleteProcessInfo();
            }
            catch
            {
            }
            finally
            {
                SetCompleteProcessInfo();
                RemoveJob(job);
                object objShutDown = Page.Session["SessionShutDown"];
                if (Convert.ToBoolean(objShutDown))
                {
                    if (CanShutDown())
                    {
                        ApplicationContext.Shutdown();
                        Page.Session.Abandon();
                    }
                }
            }
        }
    }
    /// <summary>
    /// Loads the view with the defaulted data.
    /// </summary>
    protected void LoadView()
    {
        if (ddlJobs.Items.Count <= 0)
        {
            IList <DeDupJobConfig> jobs = DeDupService.Configurations.DeDupJobs;
            foreach (DeDupJobConfig job in jobs)
            {
                ddlJobs.Items.Add(new ListItem {
                    Text = GetJobDisplayName(job), Value = job.Name
                });
            }
            ddlJobs.SelectedIndex = 0;
            Page.Session.Remove("DeDupJob");
        }

        IDeDupJobProcess savedJob        = Page.Session["DeDupJob"] as IDeDupJobProcess;
        string           selectedAdHocId = string.Empty;

        if (savedJob == null)
        {
            DeDupJobConfig jobConfig = GetConfig(ddlJobs.SelectedValue);
            _selectedEntitySourceName = jobConfig != null ? jobConfig.EntitySourceName : ddlJobs.SelectedValue;
        }
        else
        {
            _selectedEntitySourceName = savedJob.EntitySourceName;
            DeDupGroupDataSource ds = savedJob.DataSource as DeDupGroupDataSource;
            selectedAdHocId = ds.GroupId;
        }

        LoadAddHocGroups(_selectedEntitySourceName, selectedAdHocId);
    }
    private void LoadView()
    {
        if (Job != null)
        {
            if (String.IsNullOrEmpty(Job.JobId))
            {
                using (new SessionScopeWrapper(true))
                {
                    IDeDupJobProcess job = GetJob();
                    if (job != null)
                    {
                        if (string.IsNullOrEmpty(job.JobId))
                        {
                            IDeDupService srv   = ApplicationContext.Current.Services.Get <IDeDupService>();
                            string        jobId = srv.SubmitJob(job);
                            Page.Session["DeDupJobId"] = jobId;
                        }
                        ThreadPoolHelper.QueueTask(StartJobProcess);
                    }
                }
            }
            try
            {
                lnkJobNumber.Text = String.Format("{0}", Job.ProgressInfo.JobNumber);
                switch (Job.ProcessState)
                {
                case DeDupJobProcessState.Aborted:
                    break;

                case DeDupJobProcessState.Completed:
                {
                    cmdAbort.Visible         = false;
                    lblHeader.Text           = String.Format(GetLocalResourceObject("CompletedMsg").ToString());
                    Page.Session["DeDupJob"] = null;
                    RadProgressContext jobProgress = RadProgressContext.Current;
                    jobProgress["ProcessCompleted"]  = "True";
                    jobProgress["OperationComplete"] = "True";
                }
                break;

                default:
                    cmdAbort.Visible = true;
                    lblHeader.Text   = String.Format(GetLocalResourceObject("lblPrimary_Progress.Caption").ToString());
                    lblHeader2.Text  = String.Format(GetLocalResourceObject("ProcessingMsg").ToString());
                    break;
                }
            }
            catch (Exception)
            {
            }
        }
        else
        {
            RadProgressContext jobProgress = RadProgressContext.Current;
            jobProgress["OperationComplete"] = "True";
            GoToDeDupManager();
        }
    }
Beispiel #6
0
    private void LoadFilter(IDeDupJobProcess job, bool initialize)
    {
        if (job.MatchDuplicateProvider == null)
        {
            return;
        }
        if ((chklstFilters.Items.Count <= 0) || initialize)
        {
            chklstFilters.Items.Clear();
            foreach (MatchPropertyFilterMap propertyFilter in job.MatchDuplicateProvider.GetFilters())
            {
                ListItem item = new ListItem();
                // If resource does not exist then use the XML value. Item is prefixed with "Filter" to better identify resource items
                object resourceValue = GetLocalResourceObject("Filter." + propertyFilter.PropertyName);
                item.Text = resourceValue != null && resourceValue.ToString() != ""
                                ? resourceValue.ToString()
                                : propertyFilter.DisplayName;

                if (propertyFilter.Required)
                {
                    // Required folders are selected and disabled by default
                    item.Value    = propertyFilter.PropertyName;
                    item.Selected = true;
                    item.Enabled  = false;
                }
                else
                {
                    item.Value    = propertyFilter.PropertyName;
                    item.Selected = propertyFilter.Enabled;
                    item.Enabled  = true;
                }
                chklstFilters.Items.Add(item);
            }
        }
        else
        {
            foreach (ListItem item in chklstFilters.Items)
            {
                MatchPropertyFilterMap propertyFilter = job.MatchDuplicateProvider.GetPropertyFilter(item.Value);
                item.Enabled = true;
                if (propertyFilter == null)
                {
                    continue;
                }
                if (propertyFilter.Required)
                {
                    item.Selected = true;
                    item.Enabled  = false;
                }
                else if ((!item.Enabled) || (!propertyFilter.Enabled))
                {
                    item.Selected = false;
                }
            }
        }
    }
    private void RemoveJob(IDeDupJobProcess job)
    {
        IDictionary <string, string> jobs = Page.Session["DeDupJobs"] as Dictionary <string, string>;

        if (jobs != null)
        {
            jobs.Remove(job.JobId);
        }
        Page.Session["DeDupJobs"] = jobs;
    }
 private string GetEntityDisplayName(IDeDupJobProcess job)
 {
     object resource = GetLocalResourceObject("EntitySourceName." + job.EntitySourceName);
     string displayName = job.EntitySourceName;
     if (resource != null)
     {
         displayName = resource.ToString();
     }
     return displayName;
 }
    private void AddJob(IDeDupJobProcess job)
    {
        IDictionary <string, string> jobs = Page.Session["DeDupJobs"] as Dictionary <string, string> ??
                                            new Dictionary <string, string>();

        if (!jobs.ContainsKey(job.JobId))
        {
            jobs.Add(job.JobId, job.JobName);
        }
        Page.Session["DeDupJobs"] = jobs;
    }
Beispiel #10
0
    private string GetEntityDisplayName(IDeDupJobProcess job)
    {
        object resource    = GetLocalResourceObject("EntitySourceName." + job.EntitySourceName);
        string displayName = job.EntitySourceName;

        if (resource != null)
        {
            displayName = resource.ToString();
        }
        return(displayName);
    }
    /// <summary>
    /// Sets the source options.
    /// </summary>
    public void SetSourceOptions()
    {
        IDeDupJobProcess     job = GetJob();
        DeDupGroupDataSource ds  = new DeDupGroupDataSource(String.Empty)
        {
            GroupId    = lbxAddHocGroups.SelectedValue,
            GroupName  = lbxAddHocGroups.SelectedItem.Text,
            EntityType = job.EntitySourceType
        };

        job.DataSource = ds;
        Page.Session["DeDupJobInit"] = true;
    }
    private IDeDupJobProcess GetJob()
    {
        IDeDupJobProcess job = Page.Session["DeDupJob"] as IDeDupJobProcess;

        if (job == null)
        {
            job = CreateJobInstance();
            jobProcessId.Value = job.JobId;
            job.MatchDuplicateProvider.SetTargetActive(job.EntitySourceType, true);
            Page.Session["DeDupJobInit"] = null;
            SetJob(job);
        }
        return(job);
    }
    private IDeDupJobProcess GetJob()
    {
        IDeDupJobProcess job = Page.Session["DeDupJob"] as IDeDupJobProcess;

        return(job);
    }
 private void AddJob(IDeDupJobProcess job)
 {
     IDictionary<string, string> jobs = Page.Session["DeDupJobs"] as Dictionary<string, string> ??
                                        new Dictionary<string, string>();
     if (!jobs.ContainsKey(job.JobId))
     {
         jobs.Add(job.JobId, job.JobName);
     }
     Page.Session["DeDupJobs"] = jobs;
 }
 private void RemoveJob(IDeDupJobProcess job)
 {
     IDictionary<string, string> jobs = Page.Session["DeDupJobs"] as Dictionary<string, string>;
     if (jobs != null)
     {
         jobs.Remove(job.JobId);
     }
     Page.Session["DeDupJobs"] = jobs;
 }
    private void LoadFilter(IDeDupJobProcess job, bool initialize)
    {
        if (job.MatchDuplicateProvider == null) return;
        if ((chklstFilters.Items.Count <= 0) || initialize)
        {
            chklstFilters.Items.Clear();
            foreach (MatchPropertyFilterMap propertyFilter in job.MatchDuplicateProvider.GetFilters())
            {
                ListItem item = new ListItem();
                // If resource does not exist then use the XML value. Item is prefixed with "Filter" to better identify resource items
                object resourceValue = GetLocalResourceObject("Filter." + propertyFilter.PropertyName);
                item.Text = resourceValue != null && resourceValue.ToString() != ""
                                ? resourceValue.ToString()
                                : propertyFilter.DisplayName;

                if (propertyFilter.Required)
                {
                    // Required folders are selected and disabled by default
                    item.Value = propertyFilter.PropertyName;
                    item.Selected = true;
                    item.Enabled = false;
                }
                else
                {
                    item.Value = propertyFilter.PropertyName;
                    item.Selected = propertyFilter.Enabled;
                    item.Enabled = true;
                }
                chklstFilters.Items.Add(item);
            }
        }
        else
        {
            foreach (ListItem item in chklstFilters.Items)
            {
                MatchPropertyFilterMap propertyFilter = job.MatchDuplicateProvider.GetPropertyFilter(item.Value);
                item.Enabled = true;
                if (propertyFilter == null) continue;
                if (propertyFilter.Required)
                {
                    item.Selected = true;
                    item.Enabled = false;

                }
                else if ((!item.Enabled) || (!propertyFilter.Enabled))
                {
                    item.Selected = false;
                }
            }
        }
    }
 private void LoadMatchType(IDeDupJobProcess job, bool initialize)
 {
     if (job.MatchDuplicateProvider == null) return;
     if ((chkListMatchTypes.Items.Count <= 0) || initialize)
     {
         chkListMatchTypes.Items.Clear();
         foreach (MatchSearchTarget target in job.MatchDuplicateProvider.GetSearchTargets())
         {
             ListItem item = new ListItem();
             //If resource does not exist then use the Xml value. Item is prefixed with "Filter" to better identify resource items
             object resource = GetLocalResourceObject("Target." + target.TargetType.Name);
             if (resource != null)
             {
                 item.Text = resource.ToString();
             }
             else
             {
                 string typeName = target.TargetType.Name;
                 // Remove the qualifying Interface prefix on the type
                 typeName = typeName.Substring(1);
                 item.Text = typeName;
             }
             item.Value = target.TargetType.AssemblyQualifiedName;
             item.Selected = target.IsActive;
             item.Enabled = true;
             chkListMatchTypes.Items.Add(item);
         }
     }
 }
 /// <summary>
 /// Sets the job.
 /// </summary>
 /// <param name="job">The job.</param>
 public void SetJob(IDeDupJobProcess job)
 {
     Page.Session["DeDupJob"] = job;
 }
 /// <summary>
 /// Sets the job.
 /// </summary>
 /// <param name="job">The job.</param>
 public void SetJob(IDeDupJobProcess job)
 {
     Page.Session["DeDupJob"] = job;
 }