Beispiel #1
0
        public static HlidacStatu.Lib.OCR.Api.Result AddNewTask(ItemToOcrType itemType, string itemId, string itemSubType = null, int priority = 5)
        {
            using (DbEntities db = new DbEntities())
            {
                IQueryable <ItemToOcrQueue> sql = CreateQuery(db, itemType, itemSubType);
                sql = sql.Where(m => m.itemId == itemId);
                if (sql.Any()) //already in the queue
                {
                    return new OCR.Api.Result()
                           {
                               IsValid = OCR.Api.Result.ResultStatus.InQueueWithCallback,
                               Id      = "uknown"
                           }
                }
                ;

                ItemToOcrQueue i = new ItemToOcrQueue();
                i.created     = DateTime.Now;
                i.itemId      = itemId;
                i.itemType    = itemType.ToString();
                i.itemSubType = itemSubType;
                i.priority    = priority;
                db.ItemToOcrQueue.Add(i);
                db.SaveChanges();
                return(new OCR.Api.Result()
                {
                    IsValid = OCR.Api.Result.ResultStatus.InQueueWithCallback,
                    Id = "uknown"
                });
            }
        }
 public static HlidacStatu.Lib.OCR.Api.Result AddNewTask(ItemToOcrType itemType, string itemId, string itemSubType = null, HlidacStatu.Lib.OCR.Api.Client.TaskPriority priority = OCR.Api.Client.TaskPriority.Standard)
 {
     using (DbEntities db = new DbEntities())
     {
         ItemToOcrQueue i = new ItemToOcrQueue();
         i.created     = DateTime.Now;
         i.itemId      = itemId;
         i.itemType    = itemType.ToString();
         i.itemSubType = itemSubType;
         i.priority    = (int)OCR.Api.Client.TaskPriority.Standard;
         db.ItemToOcrQueue.Add(i);
         db.SaveChanges();
         return(new OCR.Api.Result()
         {
             IsValid = OCR.Api.Result.ResultStatus.InQueueWithCallback,
             Id = "uknown"
         });
     }
 }
Beispiel #3
0
 public static HlidacStatu.Lib.OCR.Api.Result AddNewTask(ItemToOcrType itemType, string itemId, string itemSubType = null, HlidacStatu.Lib.OCR.Api.Client.TaskPriority priority = OCR.Api.Client.TaskPriority.Standard)
 {
     return(AddNewTask(itemType, itemId, itemSubType, (int)priority));
 }