public void TestThatNamespaceCacheKeysAreInvalidatedBySqlCommands() { Caching.Instances.Main.FlushAll(); Usr u1 = new Usr() { NickName= Guid.NewGuid().ToString(), Email = Guid.NewGuid().ToString() }; u1.Update(); Usr u2 = new Usr() { NickName = Guid.NewGuid().ToString(), Email = Guid.NewGuid().ToString() }; u1.Update(); u2.Update(); Assert.IsNull(Caching.Instances.Main.Get(Caching.CacheKeys.Usr.Banners(u1.K))); Assert.IsNull(Caching.Instances.Main.Get(Caching.CacheKeys.Usr.Banners(u2.K))); Banner b = new Banner() { UsrK = u1.K }; b.Update(); Assert.IsNotNull(Caching.Instances.Main.Get(Caching.CacheKeys.Usr.Banners(u1.K))); Assert.IsNull(Caching.Instances.Main.Get(Caching.CacheKeys.Usr.Banners(u2.K))); b.UsrK= u2.K; b.Update(); Assert.IsNotNull(Caching.Instances.Main.Get(Caching.CacheKeys.Usr.Banners(u1.K))); Assert.IsNotNull(Caching.Instances.Main.Get(Caching.CacheKeys.Usr.Banners(u2.K))); }
protected void btnSave_Click(object sender, EventArgs e) { Banner b = new Banner(BannerK); foreach (Control c in pnlTargettingProperties.Controls) { if (c is CheckBoxList) { foreach (ListItem li in ((CheckBoxList)c).Items) { b.SetTargettingProperty((Banner.TargettingProperty)Enum.ToObject(typeof(Banner.TargettingProperty), int.Parse(li.Value)), !li.Selected); } } } if (this.txtFrequencyCap.Text.Trim().Length > 0) { b.FrequencyCapPerIdentifierPerDay = int.Parse(this.txtFrequencyCap.Text); } else { b.FrequencyCapPerIdentifierPerDay = -1; } b.Priority = int.Parse(txtPriority.Text); b.AlwaysShow = cbAlwaysShow.Checked; b.DisplayDuration = this.uiUseCustomBannerRotationRadio.Checked ? int.Parse(this.uiCustomRotationValue.Text) : null as int?; b.Update(); Response.Redirect(CurrentPromoter.UrlApp("banneroptions", "mode", "edit", "bannerk", BannerK.ToString())); }