Exemple #1
0
    public static bool CheckNick(string nick)
    {
        IList <TopNickSessionInfo> list = CacheCollection.GetNickSessionList().Where(o => o.Nick == nick).ToList();

        if (list.Count == 0)
        {
            return(false);
        }
        if (!list[0].NickState)
        {
            return(false);
        }
        return(true);
    }
    // Start is called before the first frame update
    void Start()
    {
        // Factory
        CardFactory      cardFactory      = new CardFactory();
        CharacterFactory characterFactory = new CharacterFactory(cardFactory);

        // Cache
        PlayerCache     playerCache     = new PlayerCache();
        CacheCollection cacheCollection = new CacheCollection(playerCache);

        playerCache.ActiveCharacter = characterFactory.GetCharacter(CharacterType.Warrior);

        cardList.Setup(playerCache.ActiveCharacter.Type);
    }
Exemple #3
0
 public MruItem RemoveInTail(bool moveToRemoveList)
 {
     if (Count > 0 &&
         (SaveState & SaveTypes.CollectionSave) != SaveTypes.CollectionSave)
     {
         var itm = mruManager.RemoveInTail(moveToRemoveList);
         if (itm != null && itm.Key != null)
         {
             CacheCollection.Remove(itm.Key);
             return(itm);
         }
     }
     return(null);
 }
Exemple #4
0
    protected string GetAdsType(string adsId)
    {
        IList <AdsInfo> list = CacheCollection.GetAllAdsInfo().Where(o => o.AdsId.ToString() == adsId).ToList();

        if (list.Count == 0)
        {
            return("");
        }
        if (list[0].AdsType == 1)
        {
            return("列表-图文");
        }
        return("单个投放");
    }
    protected void ddl_Pr_SelectedIndexChanged(object sender, EventArgs e)
    {
        //CityService csDal = new CityService();
        IList <CityInfo> list = new List <CityInfo>(CacheCollection.GetAllProvinceInfo().Where(o => o.ID == new Guid(ddl_Pr.SelectedValue)).ToList()[0].CityList);//csDal.GetAllCity(new Guid(ddl_Pr.SelectedValue));

        list.Insert(0, new CityInfo {
            ID = Guid.Empty, CityName = "所有城市"
        });

        ddl_City.DataSource     = list;
        ddl_City.DataTextField  = "CityName";
        ddl_City.DataValueField = "ID";
        ddl_City.DataBind();
    }
Exemple #6
0
 internal MruItem <TKey, TValue> RemoveInTail(bool moveToRemoveList)
 {
     if (Count > 0 &&
         (SaveState & Sop.Mru.SaveTypes.CollectionSave) !=
         Sop.Mru.SaveTypes.CollectionSave)
     {
         MruItem <TKey, TValue> itm = mruManager.RemoveInTail(moveToRemoveList);
         if (itm != null && (typeof(TKey).IsValueType || itm.Key != null))
         {
             CacheCollection.Remove(itm.Key);
             return(itm);
         }
     }
     return(null);
 }
    protected void BTN_Up_Click(object sender, EventArgs e)
    {
        if (CheckNull())
        {
            AdsInfo info = new AdsInfo();
            info.AdsId   = new Guid(ViewState["adsid"].ToString());
            info.AdsName = TB_AdsName.Text.Trim();
            info.AdsSize = TB_AdsSize.Text.Trim();
            info.AdsType = int.Parse(DDL_AdsType.SelectedValue);

            adsSiteDal.UpdateAds(info);
            CacheCollection.RemoveCacheByKey(CacheCollection.KEY_ALLADSINFO);
            Response.Redirect("AddAds.aspx?siteid=" + Request.QueryString["siteid"]);
        }
    }
    public T GetOrAddItem <T>(int id, Func <int, T> factory) where T : EntityBase
    {
        Type t = typeof(T);

        CacheCollection collection;

        if (!_collections.TryGetValue(t, out collection))
        {
            collection = _collections[t] = new CacheCollection <T>(factory);
        }

        CacheCollection <T> stronglyTyped = (CacheCollection <T>)collection;

        return(stronglyTyped.Item(id));
    }
Exemple #9
0
    protected string GetSize(string adsId)
    {
        IList <SiteAdsInfo> list = CacheCollection.GetAllSiteAdsInfo().Where(o => o.Id.ToString() == adsId).ToList();

        if (list.Count == 0)
        {
            return("");
        }
        IList <AdsInfo> alist = CacheCollection.GetAllAdsInfo().Where(o => o.AdsId == list[0].AdsId).ToList();

        if (alist.Count == 0)
        {
            return("");
        }
        return(alist[0].AdsSize);
    }
Exemple #10
0
    protected void BTN_Up_Click(object sender, EventArgs e)
    {
        SiteAdsInfo info = new SiteAdsInfo();

        info.Id           = new Guid(ViewState["siteadsId"].ToString());
        info.AdsId        = new Guid(DDL_AdsList.SelectedValue);
        info.SiteId       = new Guid(DDL_SiteList.SelectedValue);
        info.AdsPosition  = TB_AdsName.Text.Trim();
        info.AdsCount     = int.Parse(TB_Count.Text.Trim());
        info.AdsCalCount  = info.AdsCount;
        info.PositionCode = int.Parse(TB_PostCode.Text.Trim());

        new SiteAdsService().UpdateAds(info);
        CacheCollection.RemoveCacheByKey(CacheCollection.KEY_ALLSITEADS);
        Response.Redirect("AddAds.aspx?siteid=" + (string.IsNullOrEmpty(Request.QueryString["siteid"]) ? DDL_SiteList.SelectedValue : Request.QueryString["siteid"]));
    }
Exemple #11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request.Cookies["nick"] == null || string.IsNullOrEmpty(Request.Cookies["nick"].Value))
            {
                Response.Write("false");
                Response.End();
                return;
            }
            string nick    = HttpUtility.UrlDecode(Request.Cookies["nick"].Value);
            string session = Request.Cookies["nicksession"].Value;

            if (CacheCollection.GetNickSessionList().Where(o => o.Nick == nick).ToList().Count > 0)
            {
                //try
                //{
                DateTime now = DateTime.Now;
                DataHelper.InsertGoodsOrder(DateTime.Parse(now.AddDays(-7).ToShortDateString()), now, session, nick);
                //获取聊天记录
                DateTime start = DataHelper.GetTalkContent(nick, session, now);

                //添加统计数据
                SiteTotalService taoDal = new SiteTotalService();
                for (DateTime i = DateTime.Parse(now.AddDays(-7).ToShortDateString()); i <= now; i = i.AddDays(1))
                {
                    DataHelper.UpdateSiteTotal(nick, session, i, taoDal);
                }

                //添加客服绩效统计
                DataHelper.GetKfjxTotal(nick, start, now);
                //}
                //catch (Exception ex)
                //{
                //    LogInfo.WriteLog("出错了", ex.Message);
                //}

                Response.Write("true");
                Response.End();
            }
            else
            {
                Response.Write("false");
                Response.End();
            }
        }
    }
Exemple #12
0
        public static void SendMany(this CacheCollection cache)
        {
            if (cache == null || cache.Count == 0)
            {
                return;
            }

            var messages = cache.ToMessages();

            using (var ctx = BusFactory.CreateBusContext())
            {
                foreach (var message in messages)
                {
                    SendInternal(ctx, message);
                }
            }
        }
Exemple #13
0
        /// <summary>
        /// Removes entry with key.
        /// </summary>
        /// <param name="key">key of entry to delete from collection</param>
        /// <param name="removeFromCache"> </param>
        public virtual object Remove(object key, bool removeFromCache)
        {
            var itm = (MruItem)CacheCollection[key];

            if (itm != null)
            {
                if ((SaveState & SaveTypes.CollectionSave) != SaveTypes.CollectionSave)
                {
                    if (itm.IndexToMruList != null)
                    {
                        mruManager.RemoveNode(itm.IndexToMruList, removeFromCache);
                    }
                    CacheCollection.Remove(key);
                }
            }
            return(itm);
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string nick = "";
            if (Request.Cookies["nick"] != null)
            {
                nick = HttpUtility.UrlDecode(Request.Cookies["nick"].Value); //"nick";
            }
            else
            {
                nick = Session["snick"].ToString();
            }
            if (nick == "")
            {
                Response.Write("请重新登录");
                return;
            }

            DDL_App.DataSource     = CacheCollection.GetAllSiteList();
            DDL_App.DataTextField  = "SiteName";
            DDL_App.DataValueField = "SiteId";

            DDL_AdsType.DataSource     = CacheCollection.GetAllAdsInfo();
            DDL_AdsType.DataTextField  = "AdsName";
            DDL_AdsType.DataValueField = "AdsId";

            DDL_App.DataBind();
            DDL_App.Items.Insert(0, new ListItem("请选择", Guid.Empty.ToString()));
            DDL_AdsType.DataBind();
            DDL_AdsType.Items.Insert(0, new ListItem("请选择", Guid.Empty.ToString()));

            TaoBaoShopInfo info = new ShopService().SelectShopByNick(nick);

            ViewState["shopcid"] = "50023878";

            if (info != null)
            {
                ViewState["shopcid"] = info.CateId;
                TB_ShppName.Text     = info.Name;
                TB_Description.Text  = info.Description;
                TB_ShowUrl.Text      = "http://shop" + info.ShopId + ".taobao.com/";
                ViewState["logourl"] = " http://logo.taobao.com/shop-logo" + info.ShopLogo;
            }
        }
    }
Exemple #15
0
    /// <summary>
    /// 插入session
    /// </summary>
    private void InsertSession()
    {
        TopNickSessionInfo info = new TopNickSessionInfo();

        info.Nick      = nick;
        info.Session   = top_session;
        info.NickState = true;
        DateTime now = DateTime.Now;

        info.JoinDate         = now;
        info.LastGetOrderTime = now;
        info.ShopId           = shopId;
        info.ServiceId        = Enum.TopTaoBaoService.YingXiaoJueCe;
        info.RefreshToken     = refreshToken;
        //有则不添加
        if (CacheCollection.GetNickSessionList().Where(o => o.Nick == nick && o.ServiceId == Enum.TopTaoBaoService.YingXiaoJueCe).ToList().Count == 0)
        {
            //先添加后删除缓存
            new NickSessionService().InsertSerssionNew(info);
            CacheCollection.RemoveCacheByKey(CacheCollection.KEY_ALLNICKSESSIONINFO);
        }
        else
        {
            //新session赋值
            CacheCollection.GetNickSessionList().Where(o => o.Nick == nick && o.ServiceId == Enum.TopTaoBaoService.YingXiaoJueCe).ToList()[0].Session = top_session;
        }
        //修改缓存后读取店铺信息
        //info.ShopId = TaoBaoAPI.GetShopInfo(nick, top_session);
        //更新店铺信息
        //new NickSessionService().UpdateSession(info);
        //更新缓存
        //CacheCollection.GetNickSessionList().Where(o => o.Nick == nick && o.ServiceId == Enum.TopTaoBaoService.YingXiaoJueCe).ToList()[0].ShopId = info.ShopId;

        HttpCookie cookie       = new HttpCookie("nick", HttpUtility.UrlEncode(nick));
        HttpCookie cooksession  = new HttpCookie("nicksession", top_session);
        HttpCookie cookietongji = new HttpCookie("istongji", "1");

        cookie.Expires       = DateTime.Now.AddDays(1);
        cooksession.Expires  = DateTime.Now.AddDays(1);
        cookietongji.Expires = DateTime.Now.AddDays(1);

        Response.Cookies.Add(cookie);
        Response.Cookies.Add(cooksession);
        Response.Cookies.Add(cookietongji);
    }
        public CategoryService() : base("allCategories")
        {
            InitCommands();

            CacheData.Do(_ => Debug.WriteLine("Caching category items"))
            .InvokeCommand(this, x => x.CacheCollection)
            .DisposeWith(Disposables);

            CategoryItems = CacheCollection.Select(items => items.Where(x => !string.IsNullOrWhiteSpace(x.Name)).OrderBy(x => x.Name))
                            .Do(_ => Debug.WriteLine("Updated collection of categories"))
                            .Publish()
                            .RefCount();

            Refresh = ReactiveCommand.Create <Unit, long>(_ => DateTime.Now.Ticks);

            Refresh.ThrownExceptions.Subscribe(ex =>
            {
                Debug.WriteLine($"Failed to Refresh: {ex.Message}");
            }).DisposeWith(Disposables);

            Refresh.Select(_ => Unit.Default)
            .Do(_ => Debug.WriteLine("Updating UI prior to syncing"))
            .SelectMany(async _ => await LoadDataFromTable())
            .Do(data => CachedData = new ObservableCollection <Category>(data))
            .Select(_ => Unit.Default)
            .Do(_ => Debug.WriteLine("Syncing category items"))
            .InvokeCommand(this, x => x.SyncItems).DisposeWith(Disposables);

            AddCategoryItem = ReactiveCommand.Create <string, Category>(name =>
            {
                return(new Category
                {
                    Name = name
                });
            });

            AddCategoryItem.ThrownExceptions.Subscribe(ex =>
            {
                Debug.WriteLine($"Failed to AddCategoryItem: {ex.Message}");
            }).DisposeWith(Disposables);

            AddCategoryItem.Do(_ => Debug.WriteLine("Adding category item to database"))
            .InvokeCommand(this, x => x.AddItem)
            .DisposeWith(Disposables);
        }
    protected void BTN_Add_Click(object sender, EventArgs e)
    {
        if (CheckNull())
        {
            if (DDL_SiteList.SelectedValue != Guid.Empty.ToString())
            {
                AdsInfo info = new AdsInfo(new Guid(DDL_SiteList.SelectedValue), TB_AdsName.Text.Trim(), TB_AdsSize.Text.Trim());
                info.AdsType = int.Parse(DDL_AdsType.SelectedValue);

                FUP_Up.SaveAs(Server.MapPath("~/adsimg") + "/" + info.AdsId + ".jpg");
                info.AdsPic = "/adsimg/" + info.AdsId + ".jpg";

                adsSiteDal.AddAds(info);
                CacheCollection.RemoveCacheByKey(CacheCollection.KEY_ALLADSINFO);
                Response.Redirect("AddAds.aspx?siteid=" + info.SiteId);
            }
        }
    }
Exemple #18
0
        /// <summary>
        /// 注入数据缓存
        /// </summary>
        public static void InjectionDataCache(bool isreset = false)
        {
            //注入数据缓存组件
            DataCacheExtensions.UseDataCache(new DataCacheServerOptions
            {
                CacheItems            = null,
                InitIfNull            = true,
                RedisConnectionString = DataCacheRedisConnectionString,
                SqlConnection         = KylinDBConnectionString,
                SqlType   = SqlType,
                KeepAlive = true
            });

            if (isreset)
            {
                CacheCollection.Reset();
            }
        }
Exemple #19
0
        /// <summary>
        /// Removes entry with key.
        /// </summary>
        /// <param name="key">key of entry to delete from collection</param>
        public virtual object Remove(TKey key)
        {
            MruItem <TKey, TValue> itm = CacheCollection[key];

            if (itm != null)
            {
                if ((SaveState & Sop.Mru.SaveTypes.CollectionSave) !=
                    Sop.Mru.SaveTypes.CollectionSave)
                {
                    if (itm.IndexToMruList != null)
                    {
                        mruManager.RemoveNode(itm.IndexToMruList);
                    }
                    CacheCollection.Remove(key);
                }
            }
            return(itm);
        }
Exemple #20
0
    protected override void InitializeCulture()
    {
        string msg = "尊敬的用户您好,非常抱歉的告诉您,您尚未订购该功能,如需继续使用请购买该服务:<br><br>9元/月  <a href=' http://fuwu.taobao.com/item/subsc.htm?items=service-0-22762-6:1;' target='_blank'>立即购买</a><br>";

        if (!string.IsNullOrEmpty(Request.QueryString["nick"]) && !string.IsNullOrEmpty(Request.QueryString["nicksession"]) && !string.IsNullOrEmpty(Request.QueryString["mobile"]))
        {
            HttpCookie cookie = new HttpCookie("nick", HttpUtility.UrlEncode(Request.QueryString["nick"]));
            cookie.Expires = DateTime.Now.AddDays(1);
            Response.Cookies.Add(cookie);
            HttpCookie cookieSe = new HttpCookie("nicksession", Request.QueryString["nicksession"]);
            cookieSe.Expires = DateTime.Now.AddDays(1);
            Response.Cookies.Add(cookieSe);

            HttpCookie cookieM = new HttpCookie("mobile", Request.QueryString["nicksession"]);
            cookieM.Expires = DateTime.Now.AddDays(1);
            Response.Cookies.Add(cookieM);

            TeteShopService tss = new TeteShopService();
            if (CacheCollection.GetNickSessionList().Where(o => o.Short == Request.QueryString["nick"]).ToList().Count == 0)
            {
                TeteShopInfo info = new TeteShopInfo();
                info.Nick      = Encrypt(Request.QueryString["nick"]);
                info.Session   = Request.QueryString["nicksession"];
                info.Short     = Request.QueryString["nick"];
                info.Adddate   = DateTime.Now;
                info.Appkey    = "12132145";
                info.Appsecret = "1fdd2aadd5e2ac2909db2967cbb71e7f";
                tss.InsertShop(info);
                CacheCollection.RemoveCacheByKey(CacheCollection.KEY_ALLNICKSESSIONINFO);
            }
        }
        else
        {
            if (Request.Cookies["nick"] == null || Request.Cookies["nicksession"] == null || Request.Cookies["mobile"] == null)
            {
                Response.Redirect("http://www.7fshop.com/top/market/buy.aspx?msg=" + msg);
            }
        }
        //else
        //{
        //    Session["nick"] = Request.Cookies["nick"].Value;
        //    Session["session"] = Request.Cookies["nicksession"].Value;
        //}
    }
Exemple #21
0
        /* ----------------------------------------------------------------- */
        ///
        /// ImageCollection
        ///
        /// <summary>
        /// Initializes a new instance of the ImageCollection class with
        /// the specified arguments.
        /// </summary>
        ///
        /// <param name="getter">Function to get the renderer.</param>
        /// <param name="context">Synchronization context.</param>
        ///
        /* ----------------------------------------------------------------- */
        public ImageCollection(Func <string, IDocumentRenderer> getter, SynchronizationContext context)
        {
            ImageSource create(ImageItem e) => getter(e.RawObject.File.FullName).Create(e);

            void update(string s)
            {
                if (s == nameof(Preferences.VisibleLast))
                {
                    Reschedule(null);
                }
            };

            _dispose = new OnceAction <bool>(Dispose);
            _inner   = new ObservableCollection <ImageItem>();
            _cache   = new CacheCollection <ImageItem, ImageSource>(create);

            _inner.CollectionChanged += (s, e) => OnCollectionChanged(e);
            _cache.Created           += (s, e) => e.Key.Refresh();
            _cache.Failed            += (s, e) => this.LogDebug($"[{e.Key.Index}] {e.Value.GetType().Name}");

            Context   = context;
            Selection = new ImageSelection   {
                Context = context
            };
            Preferences = new ImagePreferences {
                Context = context
            };

            Create = (i, r) =>
            {
                if (i < 0 || i >= Count)
                {
                    return(null);
                }
                var src = _inner[i].RawObject;
                return(getter(src.File.FullName).Create(src, r));
            };

            Convert = (e) => Preferences.FrameOnly ? null :
                      _cache.TryGetValue(e, out var dest) ? dest :
                      Preferences.Dummy;

            Preferences.PropertyChanged += (s, e) => update(e.PropertyName);
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (!string.IsNullOrEmpty(Request.QueryString["adsid"]))
            {
                IList <AdsInfo> list = CacheCollection.GetAllAdsInfo().Where(o => o.AdsId.ToString() == Request.QueryString["adsid"]).ToList();
                if (list.Count > 0)
                {
                    AdsInfo info = list[0];
                    ViewState["ImgUrl"] = info.AdsPic;
                    IList <SiteInfo> sitelist = CacheCollection.GetAllSiteList().Where(o => o.SiteId == info.SiteId).ToList();

                    LB_SiteUrl1.Text = sitelist[0].SiteUrl;

                    ViewState["SiteUrl"] = sitelist[0].SiteUrl;
                }
            }
        }
    }
    protected void RPT_AdsList_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (e.CommandName == "Up")
        {
            AdsInfo info = adsSiteDal.SelectAdsInfo(new Guid(e.CommandArgument.ToString()));

            TB_AdsName.Text           = info.AdsName;
            TB_AdsSize.Text           = info.AdsSize;
            DDL_AdsType.SelectedValue = info.AdsType.ToString();
            ViewState["adsid"]        = info.AdsId.ToString();
            BTN_Up.Visible            = true;
            BTN_Add.Visible           = false;
        }
        if (e.CommandName == "De")
        {
            adsSiteDal.DeleteAds(new Guid(e.CommandArgument.ToString()));
            CacheCollection.RemoveCacheByKey(CacheCollection.KEY_ALLADSINFO);
            Response.Redirect("AddAds.aspx?siteid=" + Request.QueryString["siteid"]);
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request.Cookies["nick"] == null || string.IsNullOrEmpty(Request.Cookies["nick"].Value))
            {
                Response.Write("false");
                Response.End();
                return;
            }
            string nick    = HttpUtility.UrlDecode(Request.Cookies["nick"].Value);
            string session = Request.Cookies["nicksession"].Value;
            //"610062491512599df1afc0664ee3a7041eb4f8d0b200134204200856";//测试

            if (CacheCollection.GetNickSessionList().Where(o => o.Nick == nick).ToList().Count > 0)
            {
                DateTime now = DateTime.Now;
                DataHelper.InsertGoodsOrder(DateTime.Parse(now.AddDays(-7).ToShortDateString()), now, session, nick);
                //获取聊天记录
                DateTime start = DataHelper.GetTalkContent(nick, session, now);

                //添加统计数据
                SiteTotalService taoDal = new SiteTotalService();
                for (DateTime i = DateTime.Parse(now.AddDays(-7).ToShortDateString()); i <= now; i = i.AddDays(1))
                {
                    DataHelper.UpdateSiteTotal(nick, session, i, taoDal);
                }

                //添加客服绩效统计
                DataHelper.GetKfjxTotal(nick, start, now);

                Response.Write("true");
                Response.End();
            }
            else
            {
                Response.Write("false");
                Response.End();
            }
        }
    }
Exemple #25
0
    protected void RPT_AdsList_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (e.CommandName == "Up")
        {
            SiteAdsInfo info = CacheCollection.GetAllSiteAdsInfo().Where(o => o.Id == new Guid(e.CommandArgument.ToString())).ToList()[0];

            TB_AdsName.Text           = info.AdsPosition;
            DDL_AdsList.SelectedValue = info.AdsId.ToString();
            TB_PostCode.Text          = info.PositionCode.ToString();
            TB_Count.Text             = info.AdsCount.ToString();
            BTN_Up.Visible            = true;
            BTN_Add.Visible           = false;
            ViewState["siteadsId"]    = info.Id;
        }
        if (e.CommandName == "De")
        {
            adsSiteDal.DeleteAds(new Guid(e.CommandArgument.ToString()));
            CacheCollection.RemoveCacheByKey(CacheCollection.KEY_ALLADSINFO);
            Response.Redirect("AddAds.aspx?siteid=" + (string.IsNullOrEmpty(Request.QueryString["siteid"]) ? DDL_SiteList.SelectedValue : Request.QueryString["siteid"]));
        }
    }
Exemple #26
0
    protected void BTN_Add_Click(object sender, EventArgs e)
    {
        if (DDL_SiteList.SelectedValue != Guid.Empty.ToString())
        {
            SiteAdsInfo info = new SiteAdsInfo();
            info.AdsId        = new Guid(DDL_AdsList.SelectedValue);
            info.SiteId       = new Guid(DDL_SiteList.SelectedValue);
            info.AdsPosition  = TB_AdsName.Text.Trim();
            info.AdsCount     = int.Parse(TB_Count.Text.Trim());
            info.AdsCalCount  = info.AdsCount;
            info.PositionCode = int.Parse(TB_PostCode.Text.Trim());
            info.Id           = Guid.NewGuid();

            FUP_Up.SaveAs(Server.MapPath("~/adsimg") + "/" + info.Id + ".jpg");
            info.AdsPic = "/adsimg/" + info.Id + ".jpg";

            new SiteAdsService().InsertSiteAds(info);
            CacheCollection.RemoveCacheByKey(CacheCollection.KEY_ALLSITEADS);
            Response.Redirect("AddAds.aspx?siteid=" + info.SiteId);
        }
    }
Exemple #27
0
        public void GetOrCreate()
        {
            var cnt = 0;
            var key = 10;
            var src = new CacheCollection <int, int>(n => Sigma(n));

            src.Created += (s, e) => ++ cnt;
            Parallel.For(0, 10, _ => src.GetOrCreate(key));
            Task.Delay(200).Wait();

            Assert.That(cnt, Is.EqualTo(1));
            Assert.That(src.Count, Is.EqualTo(1));
            Assert.That(src.TryGetValue(key, out var _), Is.True, nameof(src.TryGetValue));
            Assert.That(src.TryGetValue(999, out var _), Is.False, nameof(src.TryGetValue));
            Assert.That(src.Contains(key), Is.True, nameof(src.Contains));
            Assert.That(src.GetOrCreate(key), Is.EqualTo(55), nameof(src.GetOrCreate));

            src.Remove(key);
            src.Clear();
            Assert.That(src.Count, Is.EqualTo(0));
        }
Exemple #28
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (!string.IsNullOrEmpty(Request.QueryString["id"]))
            {
                HttpCookie cookie = new HttpCookie("nick", Request.QueryString["id"]);
                cookie.Expires = DateTime.Now.AddDays(1);

                Response.Cookies.Add(cookie);
                IList <string> list = CacheCollection.GetShopIdList().Where(o => o == Request.QueryString["id"]).ToList();
                if (list.Count == 0)
                {
                    ShopTotalInfo info = new ShopTotalInfo(Request.QueryString["id"], DateTime.Now);
                    new ShopTotalService().InsertShopTotal(info);
                }

                Response.Redirect("index.html");
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //ProvinceService pvDal = new ProvinceService();

            IList <ExpressInfo> list = CacheCollection.GetAllExpressInfo(); //esDal.GetAllExpressInfo("");
            ddl_Express.DataSource     = list;
            ddl_Express.DataTextField  = "ExpressName";
            ddl_Express.DataValueField = "ExpressId";
            ddl_Express.DataBind();

            IList <ProvinceInfo> plist = CacheCollection.GetAllProvinceInfo(); //pvDal.GetAllProvince();
            ddl_Pr.DataSource     = plist;
            ddl_Pr.DataTextField  = "ProvinceName";
            ddl_Pr.DataValueField = "ID";
            ddl_Pr.DataBind();

            Bind();
        }
    }
    protected void DDL_AdsType_TextChanged(object sender, EventArgs e)
    {
        if (DDL_App.SelectedValue == Guid.Empty.ToString())
        {
            return;
        }
        if (DDL_AdsType.SelectedValue == Guid.Empty.ToString())
        {
            return;
        }
        if (DDL_AdsType.SelectedItem.Text == "瀑布流广告")
        {
            DDL_Position.DataSource = CacheCollection.GetAllSiteAdsInfo().Where(o => o.SiteId.ToString() == DDL_App.SelectedValue).Where(o => o.PositionCode == 6 || o.PositionCode == 7).ToList();
        }

        if (DDL_AdsType.SelectedItem.Text == "首页切换大广告")
        {
            DDL_Position.DataSource = CacheCollection.GetAllSiteAdsInfo().Where(o => o.SiteId.ToString() == DDL_App.SelectedValue).Where(o => o.PositionCode == 0 && o.AdsPosition == "首页头部").ToList();
        }
        if (DDL_AdsType.SelectedItem.Text == "首页大图")
        {
            DDL_Position.DataSource = CacheCollection.GetAllSiteAdsInfo().Where(o => o.SiteId.ToString() == DDL_App.SelectedValue).Where(o => o.PositionCode == 0 && o.AdsPosition == "首页中部").ToList();
        }

        if (DDL_AdsType.SelectedItem.Text == "分类页切换大广告")
        {
            DDL_Position.DataSource = CacheCollection.GetAllSiteAdsInfo().Where(o => o.SiteId.ToString() == DDL_App.SelectedValue).Where(o => o.PositionCode > 0 && o.PositionCode < 6 && o.AdsPosition.Contains("头部")).ToList();
        }

        if (DDL_AdsType.SelectedItem.Text == "分类页大图")
        {
            DDL_Position.DataSource = CacheCollection.GetAllSiteAdsInfo().Where(o => o.SiteId.ToString() == DDL_App.SelectedValue).Where(o => o.PositionCode > 0 && o.PositionCode < 6 && o.AdsPosition.Contains("中部")).ToList();
        }

        DDL_Position.DataTextField  = "AdsPosition";
        DDL_Position.DataValueField = "Id";

        DDL_Position.DataBind();
    }