/// <summary> /// Delete one item /// </summary> /// <param name="queueItem"></param> /// Called from loader public static void DeleteQueueItem(GTPQueue gTPQueue, bool deleteAll = false) { try { ConnectionHelper.Connect(AutoCreateOption.None); Session session = new Session(XpoDefault.DataLayer); { if (deleteAll) { IQueryable <Queue> ps = new XPQuery <Queue>(session); foreach (Queue p in ps) { p.Delete(); } } else { IQueryable <Queue> ps = new XPQuery <Queue>(session).Where(q => q.Id.CompareTo(gTPQueue.Id) == 0); foreach (Queue p in ps) { p.Delete(); } } session.DataLayer.Dispose(); } } catch (Exception ex) { log.Error(FormatMessages.getLogMessage( "GTPQueue", System.Reflection.MethodBase.GetCurrentMethod().Name, TokenKey.NoMethodParams, ex.ToString())); } }
/// <summary> /// Update object out. /// </summary> /// <param name="queueItem"></param> /// Called from Loader public static void UpdateQueueItemStatusAndPriority(GTPQueue gTPQueue) { //queueItem.Message = "Ok from UpdateQueueItemObjectOutAndStatus"; ConnectionHelper.Connect(AutoCreateOption.None); Session session = new Session(XpoDefault.DataLayer); { Queue r = new XPQuery <Queue>(session).SingleOrDefault(q => q.Id.CompareTo(gTPQueue.Id) == 0); r.Status = gTPQueue.Status; r.Priority = gTPQueue.PriorityValue; r.Save(); session.DataLayer.Dispose(); } }