private SearchStatus ScheduleSearch(string entitySchemaName, TimeSchedule timeSchedule)
        {
            searchUpdate(entitySchemaName, "Finished");
            string jobProcessName = string.Format("StartGlobal{0}DuplicatesSearch", entitySchemaName);

            AppScheduler.RemoveJob(entitySchemaName + "DuplicatesSearchJob", "DuplicatesSearchGroup");
            IJobDetail job = AppScheduler.CreateProcessJob(entitySchemaName + "DuplicatesSearchJob",
                                                           "DuplicatesSearchGroup",
                                                           jobProcessName,
                                                           UserConnection.Workspace.Name,
                                                           UserConnection.CurrentUser.Name);
            ICronTrigger trigger = new CronTriggerImpl(entitySchemaName + "DuplicatesSearchJob", "DuplicatesSearchGroup",
                                                       string.Format("0 {0} {1} ? * {2}", timeSchedule.Minutes, timeSchedule.Hours, timeSchedule.SelectedDays));

            trigger.TimeZone = TimeZoneInfo.Utc;
            AppScheduler.Instance.ScheduleJob(job, trigger);
            SearchStatus responce = new SearchStatus();

            responce.ChangeOn = DateTime.Now;
            responce.Code     = "InProgress";
            responce.Percent  = 0;
            return(responce);
        }
 public SearchStatus ScheduleContactSearch(TimeSchedule timeSchedule)
 {
     return(ScheduleSearch("Contact", timeSchedule));
 }
 public SearchStatus ScheduleAccountSearch(TimeSchedule timeSchedule)
 {
     return(ScheduleSearch("Account", timeSchedule));
 }