internal static void Update(int UserOid, Channel[] Channels) { var db = DbHelper.GetDatabase(); try { db.BeginTransaction(); int[] allowedChanneldOids = db.Fetch<int>("select oid from channel where [enabled] = 1").ToArray(); foreach (var channel in Channels.Where(x => allowedChanneldOids.Contains(x.Oid))) db.Execute("update userchannel set number = @0, [enabled] = @1 where channeloid = @2 and useroid = @3", channel.Number, channel.Enabled, channel.Oid, UserOid); db.CompleteTransaction(); // flush the cacher Helpers.Cacher.FlushCache(new Regex(@"^Channel\.[^(]+\(" + UserOid)); } catch (Exception ex) { db.AbortTransaction(); throw ex; } }
private static Channel[] LoadHasIcon(Channel[] Channels) { var temp = Helpers.Cacher.RetrieveOrStore<Dictionary<int, NUtility.Channel>>("NUtility.Channel.LoadAll.ToDictionary", new TimeSpan(1, 0, 0), delegate { return NUtility.Channel.LoadAll().ToDictionary(x => x.OID); }); foreach (var channel in Channels) channel.HasIcon = temp.ContainsKey(channel.Oid) && temp[channel.Oid].Icon != null; return Channels; }
public SearchResult(Channel Channel, EpgListing Listing) { this.Channel = Channel; this.Listing = Listing; }