public static void AddNewSubscriber(int userId, int queueElemId) { CanonDataContext db = Cdb.Instance; ManualImportSubscriber subs = new ManualImportSubscriber(); subs.ManualImportId = queueElemId; subs.SubscriptDate = DateTime.Now; subs.UserId = userId; db.ManualImportSubscribers.InsertOnSubmit(subs); db.SubmitChanges(); }
public static void RemoveSubscriber(int userId, int queueElemId) { CanonDataContext db = Cdb.Instance; ManualImportSubscriber subs = db.ManualImportSubscribers.Where(m => m.ManualImportId == queueElemId && m.UserId == userId).FirstOrDefault(); if (subs != null) { db.ManualImportSubscribers.DeleteOnSubmit(subs); db.SubmitChanges(); } }
public static ManualImportQueue GetCompleteChannelByUser(int userId) { CanonDataContext db = Cdb.Instance; ManualImportSubscriber ms = db.ManualImportSubscribers.Where(m => m.UserId == userId && m.ManualImportQueue.Status == (int)ManualImportStatusEnum.ImportComplete).FirstOrDefault(); if (ms != null) { return(ms.ManualImportQueue); } return(null); }