예제 #1
0
 public void CreateSearchTasks(CancellationToken token)
 {
     using (DatabaseContext context = GetContext())
     {
         int i = 0;
         foreach (ViewNewSearch w in context.ViewNewSearches)
         {
             if (token.IsCancellationRequested) break;
             WebTask task = new WebTask()
             {
                 ProductId = w.ProductId,
                 EngineId = w.EngineId,
                 TaskType = Member.TASKTYPE_SEARCH,
                 Url = SearchEngineManager.GetSearchUrl(w.EngineId, w.ProductName),
                 Status = Member.STATUS_NEW
             };
             context.AddToWebTasks(task);
             i++;
         }
         if (i > 0 && !token.IsCancellationRequested) context.SaveChanges();
     }
 }
예제 #2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the WebTasks EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToWebTasks(WebTask webTask)
 {
     base.AddObject("WebTasks", webTask);
 }
예제 #3
0
 internal void CreateUpdateTasks(CancellationToken token)
 {
     using (DatabaseContext context = GetContext())
     {
         int i = 0;
         foreach (var w in context.ViewUpdates)
         {
             if (token.IsCancellationRequested) break;
             WebTask task = new WebTask()
             {
                 ProductId = w.ProductId,
                 EngineId = w.EngineId,
                 TaskType = Member.TASKTYPE_UPDATE_INFO,
                 Url = w.Url,
                 Status = Member.STATUS_NEW
             };
             context.AddToWebTasks(task);
             i++;
         }
         if (i > 0 && !token.IsCancellationRequested) context.SaveChanges();
     }
 }
예제 #4
0
 /// <summary>
 /// Create a new WebTask object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="url">Initial value of the Url property.</param>
 /// <param name="status">Initial value of the Status property.</param>
 /// <param name="errors">Initial value of the Errors property.</param>
 /// <param name="taskType">Initial value of the TaskType property.</param>
 /// <param name="engineId">Initial value of the EngineId property.</param>
 /// <param name="productId">Initial value of the ProductId property.</param>
 public static WebTask CreateWebTask(global::System.Int64 id, global::System.String url, global::System.Byte status, global::System.Byte errors, global::System.Byte taskType, global::System.Int64 engineId, global::System.Int64 productId)
 {
     WebTask webTask = new WebTask();
     webTask.Id = id;
     webTask.Url = url;
     webTask.Status = status;
     webTask.Errors = errors;
     webTask.TaskType = taskType;
     webTask.EngineId = engineId;
     webTask.ProductId = productId;
     return webTask;
 }