当前位置: 首页>>代码示例>>C#>>正文


C# RedisClient.Add方法代码示例

本文整理汇总了C#中ServiceStack.Redis.RedisClient.Add方法的典型用法代码示例。如果您正苦于以下问题:C# RedisClient.Add方法的具体用法?C# RedisClient.Add怎么用?C# RedisClient.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ServiceStack.Redis.RedisClient的用法示例。


在下文中一共展示了RedisClient.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ExecuteRedis

 public static void ExecuteRedis()
 {
     RedisClient dataContext = new RedisClient("localhost");
     //dataContext.RemoveAll(new List<string>() { "./test.txt", "./temp.txt" });
     dataContext.Add<string>("harageth./file.txt", "This is a test file to make sure that things are working correctly.");
     dataContext.Add<string>("harageth./temp.txt", "And now we will store a second file to just see if we can get a couple of files at once.");
 }
开发者ID:harageth,项目名称:PolyglotPersistenceDemo,代码行数:7,代码来源:DatabaseInitialize.cs

示例2: ProcessRequest

        public void ProcessRequest(HttpContext context)
        {

            var land = (context.Request["land"] ?? "").ToLower() == "true";
            var image = context.Request["image"] ?? "";
            var width = context.Request["width"] ?? "0";
            var height = context.Request["height"] ?? "0";
            var redis = new RedisClient(ConfigurationManager.AppSettings["ServerRedisMaster"] ?? "", int.Parse(ConfigurationManager.AppSettings["PortRedisMaster"] ?? "0"));
            
            var key = string.Format("storage:imagehandler:{0}", image);
            var done = (redis.ContainsKey(key) && !string.IsNullOrEmpty(redis.Get<string>(key) ?? ""));
            var noimage = ConfigurationManager.AppSettings["StorageNoImage"] ?? "Common/CEO/noimage.jpg";
            //var file = ConfigurationManager.AppSettings["StorageNoImage"] ?? "Common/CEO/noimage.jpg";
            var imgPath = ConfigurationManager.AppSettings["imgPath"] ?? "http://images1.cafef.vn/";
            var storageServer = ConfigurationManager.AppSettings["StorageServer"] ?? "http://testcafef.vcmedia.vn/";
            string imageSrc = storageServer + noimage;
            if (!done)
            {

                if (!string.IsNullOrEmpty(image))
                {
                    imgPath += (land ? "batdongsan/" : "");
                    if (image.StartsWith(imgPath) && StorageUtils.Utils.checkImageExtension(image))
                    {
                        if (StorageUtils.Utils.UploadSiteImage(image, imgPath, (land ? "Common/BDS/" : "")) == "Storage : OK")
                        {
                            //file = image.Replace(imgPath, "");

                        }
                    }
                }

                int iw, ih;
                if (!int.TryParse(width, out iw)) iw = 0;
                if (!int.TryParse(height, out ih)) ih = 0;

                imageSrc = image.Contains(imgPath) ? image : (imgPath + image); //GetStorageImage(file, iw, ih, land);

                if (!CheckFileExist(imageSrc))
                {
                    imageSrc = storageServer + noimage;
                }
                if (redis.ContainsKey(key))
                    redis.Set(key, imageSrc, new TimeSpan(0, 5, 0));
                else
                    redis.Add(key, imageSrc, new TimeSpan(0, 5, 0));
            }
            else
            {
                imageSrc = redis.Get<string>(key) ?? (storageServer + noimage);
            }

            context.Response.ContentType = StorageUtils.Utils.MimeType(imageSrc);
            context.Response.Redirect(imageSrc);
            //context.Response.BinaryWrite(StorageUtils.Utils.GetFileBinary("", imageSrc));
        }
开发者ID:giangcoffee,项目名称:cafef.redis,代码行数:56,代码来源:StorageImage.ashx.cs

示例3: button1_Click

 private void button1_Click(object sender, EventArgs e)
 {
     RedisClient cli = new RedisClient("192.168.2.31");
     Random r = new Random();
     for (int i = 0; i < 1000000; i++)
     {
         cli.Add(r.Next().ToString(), r.Next().ToString());
     }
     cli.Save();
 }
开发者ID:jluchiji,项目名称:svekla-redis-manager,代码行数:10,代码来源:Form1.cs

示例4: Main

 static void Main(string[] args)
 {
     var client = new RedisClient("crestfish.redistogo.com", 10216, "password");
     var count = 10;
     var sw = new Stopwatch();
     sw.Start();
     foreach (var num in Enumerable.Range(0, count))
     {
         var key = num.ToString();
         client.Add(key, key);
     }
     sw.Stop();
     Console.WriteLine("Time to add {0} key/value pairs: {1}ms", count, sw.ElapsedMilliseconds);
 }
开发者ID:JustinBeckwith,项目名称:HashtagRedis,代码行数:14,代码来源:Program.cs

示例5: Post

 public void Post(GroupedError errorWithStatus)
 {
     var client = new RedisClient();
     if (client.Get(errorWithStatus.ElmahErrors.FirstOrDefault().DetailErrorXml.detail)==null)
     {
         client.Add(errorWithStatus.ElmahErrors.FirstOrDefault().DetailErrorXml.detail,
                                  errorWithStatus.ErrorStatus);
     }
     else
     {
         client.Replace(errorWithStatus.ElmahErrors.FirstOrDefault().DetailErrorXml.detail,
                                  errorWithStatus.ErrorStatus);
     }
 }
开发者ID:BhagyashreeHegde15,项目名称:ErrorLogAnalyzer,代码行数:14,代码来源:LogController.cs

示例6: Index

        //
        // GET: /Sample/

        public string Index()
        {
            using (var redisclient = new RedisClient())
            {
                for (int i = 0; i < 10; i++)
                {
                    redisclient.Db.ToJson();
                    redisclient.Add("name", "vijayant");
                    redisclient.Save();
                    redisclient.BgSave();
                }
            }
            return "Saved";
        }
开发者ID:vijayantkatyal,项目名称:RedisApp_ASP.NET_Demo,代码行数:17,代码来源:SampleController.cs

示例7: DoTest

        public static void DoTest()
        {

            Stopwatch stopWatch = new Stopwatch();
            stopWatch.Start();
            RedisClient Client = new RedisClient("192.168.56.2", 6379);
            stopWatch.Stop();

            Console.WriteLine("RedisClient Construct 耗时:{0}ms。", stopWatch.ElapsedMilliseconds);

            Boolean connected = Client.IsSocketConnected();

            stopWatch.Restart();
            string str = Client.Get<string>("city");
            stopWatch.Stop();
            Console.WriteLine("RedisClient Get 耗时:{0}ms。", stopWatch.ElapsedMilliseconds);

            stopWatch.Restart();
            Client.Set<String>("city", "China");
            stopWatch.Stop();

            Console.WriteLine("RedisClient Set 耗时:{0}ms。", stopWatch.ElapsedMilliseconds);



            stopWatch.Restart();
            str = Client.Get<string>("city");
            stopWatch.Stop();
            Console.WriteLine("RedisClient Get 耗时:{0}ms。", stopWatch.ElapsedMilliseconds);

            stopWatch.Restart();
            Boolean req = Client.Add<String>("country", "China", new TimeSpan(0, 0, 1, 0));
            stopWatch.Stop();
            Console.WriteLine("RedisClient Add 耗时:{0}ms。", stopWatch.ElapsedMilliseconds);


            List<String> keys = Client.SearchKeys("MBSOA:*");


            Console.WriteLine("之前通过客户端进行设置的city键值对:{0}", str);
            Console.ReadLine();
        }
开发者ID:vebin,项目名称:soa,代码行数:42,代码来源:RedisTest.cs

示例8: button1_Click

        private void button1_Click(object sender, EventArgs e)
        {
            //var ls = GetTopBCTC("SSI", "BSheet", 2011, 1, 4);
            var log = new LogUtils(LogType.TextLog, true, AppDomain.CurrentDomain.SetupInformation.ApplicationBase + @"log\");
            var redis = new RedisClient(ConfigRedis.Host, ConfigRedis.Port);

            var symbols = SqlDb.GetBCTCSymbols();
            textBox1.Text = "Begin : " + DateTime.Now.ToString() + Environment.NewLine;
            var types = new List<string>() {"IncSta", "BSheet", "CashFlow", "CashFlowDirect"};
            foreach (DataRow dr in symbols.Rows)
            {
                var symbol = dr["Symbol"].ToString();
                //if(symbol!="SSI") continue;
                textBox1.Text += symbol + ",";
               log.WriteEntry(symbol + ",", EventLogEntryType.Warning);
                for(var year = 2005; year <= 2011; year++)
                {
                    for(var quarter = 0; quarter<=4; quarter++)
                    {
                        if(year==2011 && quarter!= 1) continue;
                        foreach (var type in types)
                        {
                            var o = GetBCTC(symbol, type, year, quarter);
                            if(o==null) continue;
                            var key = string.Format(RedisKey.BCTCKey, symbol.ToUpper(), type.ToUpper(), quarter == 0 ? 0 : 1, year, quarter);
                            if (redis.ContainsKey(key))
                                redis.Set(key, o);
                            else
                                redis.Add(key, o);
                            Thread.Sleep(1000);
                        }
                    }
                }
            }
            textBox1.Text += "End : " + DateTime.Now.ToString() + Environment.NewLine;
            
        }
开发者ID:giangcoffee,项目名称:cafef.redis,代码行数:37,代码来源:Form1.cs

示例9: button9_Click

 private void button9_Click(object sender, EventArgs e)
 {
     var redis = new RedisClient(ConfigRedis.Host, ConfigRedis.Port);
     var skey = RedisKey.KeyStockList;
     var sdt = SqlDb.GetSymbolList(-1);
     var sls = new List<StockCompact>();
     var hnx = new List<StockCompact>();
     var hsx = new List<StockCompact>();
     var upc = new List<StockCompact>();
     foreach (DataRow sdr in sdt.Rows)
     {
         var stock = new StockCompact() { Symbol = sdr["Symbol"].ToString(), CategoryId = int.Parse(sdr["StockIndustryId"].ToString()), TradeCenterId = int.Parse(sdr["TradeCenterId"].ToString()) };
         sls.Add(stock);
         switch (stock.TradeCenterId)
         {
             case 1: hsx.Add(stock); break;
             case 2: hnx.Add(stock); break;
             case 9: upc.Add(stock); break;
         }
     }
     if (redis.ContainsKey(skey))
         redis.Set(skey, sls);
     else
         redis.Add(skey, sls);
     skey = string.Format(RedisKey.KeyStockListByCenter, "1");
     if (redis.ContainsKey(skey))
         redis.Set(skey, hsx);
     else
         redis.Add(skey, hsx);
     skey = string.Format(RedisKey.KeyStockListByCenter, "2");
     if (redis.ContainsKey(skey))
         redis.Set(skey, hnx);
     else
         redis.Add(skey, hnx);
     skey = string.Format(RedisKey.KeyStockListByCenter, "9");
     if (redis.ContainsKey(skey))
         redis.Set(skey, upc);
     else
         redis.Add(skey, upc);
 }
开发者ID:giangcoffee,项目名称:cafef.redis,代码行数:40,代码来源:Form1.cs

示例10: button8_Click

        private void button8_Click(object sender, EventArgs e)
        {
            var symbol = "VIC";

            var key = String.Format(RedisKey.KeyFinanceReport, symbol);

            var obj = new FinanceReport() { HtmlContent = FinanceReportData.ReturnHTML_BCTC("VIC"), Symbol = symbol };

            var redis = new RedisClient(ConfigRedis.Host, ConfigRedis.Port);
            if (redis.ContainsKey(key))
                redis.Set(key, obj);
            else
                redis.Add(key, obj);
        }
开发者ID:giangcoffee,项目名称:cafef.redis,代码行数:14,代码来源:Form1.cs

示例11: button7_Click

        private void button7_Click(object sender, EventArgs e)
        {
            var symbol = "SSI";

            var redis = new RedisClient(ConfigRedis.Host, ConfigRedis.Port);
            var keylist = string.Format(RedisKey.FundHistoryKeys, "SSI");
            var ls = redis.ContainsKey(keylist) ? redis.Get<List<String>>(keylist) : new List<string>();

            var pdt = SqlDb.GetFundHistory(symbol, -1);
            foreach (DataRow pdr in pdt.Rows)
            {
                var key = string.Format(RedisKey.FundHistory, "SSI", ((DateTime)pdr["TradingDate"]).ToString("yyyyMMdd"));

                var order = new FundHistory() { Symbol = symbol, TradeDate = (DateTime)pdr["TradingDate"], TransactionType = pdr["Buy_Sale"].ToString() == "s" ? "Bán" : "Mua", PlanVolume = double.Parse(pdr["RegisteredVol"].ToString()), TodayVolume = double.Parse(pdr["TodayTradingVol"].ToString()), AccumulateVolume = double.Parse(pdr["AccumVol"].ToString()), ExpiredDate = (DateTime)pdr["ExpireDate"] };
                if (redis.ContainsKey(key))
                    redis.Set<FundHistory>(key, order);
                else
                    redis.Add<FundHistory>(key, order);

                if (!ls.Contains(key)) ls.Add(key);
            }
            ls.Sort();
            ls.Reverse();
            if (redis.ContainsKey(keylist))
                redis.Set<List<string>>(keylist, ls);
            else
                redis.Add<List<string>>(keylist, ls);

            var test = redis.Get<List<string>>(keylist);
        }
开发者ID:giangcoffee,项目名称:cafef.redis,代码行数:30,代码来源:Form1.cs

示例12: button6_Click

        private void button6_Click(object sender, EventArgs e)
        {
            var symbol = "PTC";

            var redis = new RedisClient(ConfigRedis.Host, ConfigRedis.Port);
            var keylist = string.Format(RedisKey.InternalHistoryKeys, symbol);
            //var ls = redis.ContainsKey(keylist) ? redis.Get<List<String>>(keylist) : new List<string>();
            var ls = new List<string>();

            var pdt = SqlDb.GetInternalHistory(symbol, -1);
            foreach (DataRow pdr in pdt.Rows)
            {
                var key = string.Format(RedisKey.InternalHistory, symbol, (((DateTime?)pdr["NgayThongBao"]) ?? DateTime.Now).ToString("yyyyMMdd"), pdr["ID"], pdr["ShareHolder_ID"]);

                var order = new InternalHistory() { Stock = symbol, TransactionMan = pdr["FullName"].ToString(), TransactionManPosition = pdr["ChucVu"].ToString(), RelatedMan = pdr["NguoiLienQuan"].ToString(), RelatedManPosition = pdr["ChucVuNguoiLienQuan"].ToString(), VolumeBeforeTransaction = double.Parse(pdr["SLCPTruocGD"].ToString()), PlanBuyVolume = double.Parse(pdr["DangKy_Mua"].ToString()), PlanSellVolume = double.Parse(pdr["DangKy_Ban"].ToString()), PlanBeginDate = pdr["DangKy_TuNgay"].Equals(DBNull.Value) ? null : (DateTime?)pdr["DangKy_TuNgay"], PlanEndDate = pdr["DangKy_DenNgay"].Equals(DBNull.Value) ? null : (DateTime?)pdr["DangKy_DenNgay"], RealBuyVolume = double.Parse(pdr["ThucHien_Mua"].ToString()), RealSellVolume = double.Parse(pdr["ThucHien_Ban"].ToString()), RealEndDate = pdr["ThucHien_NgayKetThuc"].Equals(DBNull.Value) ? null : (DateTime?)pdr["ThucHien_NgayKetThuc"], PublishedDate = pdr["NgayThongBao"].Equals(DBNull.Value) ? null : (DateTime?)pdr["NgayThongBao"], VolumeAfterTransaction = double.Parse(pdr["SLCPSauGD"].ToString()), TransactionNote = pdr["GhiChu"].ToString() };
                if (redis.ContainsKey(key))
                    redis.Set<InternalHistory>(key, order);
                else
                    redis.Add<InternalHistory>(key, order);

                if (!ls.Contains(key)) ls.Add(key);
            }
            ls.Sort();
            ls.Reverse();
            if (redis.ContainsKey(keylist))
                redis.Set<List<string>>(keylist, ls);
            else
                redis.Add<List<string>>(keylist, ls);

            var test = redis.Get<List<string>>(keylist);
        }
开发者ID:giangcoffee,项目名称:cafef.redis,代码行数:31,代码来源:Form1.cs

示例13: UpdateCeoImage

        public void UpdateCeoImage()
        {
            try
            {
                if ((ConfigurationManager.AppSettings["CeoImageAllowance"] ?? "") != "TRUE") return;

                var bfirstTime = true;
                //Thread.Sleep(index * 1000);
                var sql = new SqlDb();
                var redis = new RedisClient(ConfigRedis.Host, ConfigRedis.Port);
                while (ServiceStarted)
                {
                    try
                    {
                        if (!bfirstTime) Thread.Sleep(reportInterval);
                        bfirstTime = false;

                        sql.OpenDb();
                        var ldt = sql.GetAllLandProjects();
                        //var cdt = sql.GetAllCeos();
                        sql.CloseDb();

                        landImages = GetAllLandImages();
                        var keys = redis.SearchKeys(string.Format(RedisKey.BDSKey, "*", "*"));
                        foreach(var key in keys)
                        {
                            var t = key.Substring(key.IndexOf(":tiendocode:"), key.IndexOf(":Object") - key.IndexOf(":tiendocode:")).Replace(":tiendocode:", "");
                            if (ldt.Select("MaTienDo = '" + t + "'").Length == 0)
                            {
                                redis.Remove(key);
                                continue;
                            }
                            var o = redis.Get<TienDoBDS>(key);
                            if(o==null) continue;
                            var s = o.MaTienDo;
                            if (string.IsNullOrEmpty(s)) continue;
                            o.BDSImages = landImages.FindAll(i => i.ToUpper().StartsWith(s));
                            redis.Set(key, o);
                        }

                        ceoPhotos = GetCeoPhotos();
                        foreach (var photo in ceoPhotos)
                        {
                            if (!photo.Contains(".")) continue;
                            var code = photo.Substring(0, photo.IndexOf("."));
                            if (redis.ContainsKey(string.Format(RedisKey.CeoImage, code)))
                            {
                                redis.Set(string.Format(RedisKey.CeoImage, code), photo);
                            }
                            else
                            {
                                redis.Add(string.Format(RedisKey.CeoImage, code), photo);
                            }
                            //var o = redis.Get<Ceo>(string.Format(RedisKey.CeoKey, code));
                            //if (o == null) continue;
                            //o.CeoImage = photo;
                            //redis.Set(string.Format(RedisKey.CeoKey, code), o);
                        }
                        var keywords = SqlDb.GetGoogleTag(-1);
                        var ls = new List<string>();
                        foreach (DataRow keyword in keywords.Rows)
                        {
                            if(!ls.Contains(keyword["keyword"].ToString())) ls.Add(keyword["keyword"].ToString());
                        }
                        //if (redis.ContainsKey(RedisKey.GoogleTag))
                        //    redis.Set(RedisKey.GoogleTag, ls);
                        //else
                        //    redis.Add(RedisKey.GoogleTag, ls);
                    }
                    catch (Exception ex)
                    {
                        log.WriteEntry("UpdateCeoImage - " + ex.ToString(), EventLogEntryType.Error);
                    }
                }
            }
            catch (Exception ex)
            {
                log.WriteEntry("UpdateCeoImage - " + ex.ToString(), EventLogEntryType.Error);
            }
        }
开发者ID:giangcoffee,项目名称:cafef.redis,代码行数:80,代码来源:StockData.cs

示例14: UpdateBoxHangHoa

        public void UpdateBoxHangHoa()
        {
            try
            {
                if ((ConfigurationManager.AppSettings["ProductBoxAllowance"] ?? "") != "TRUE")
                {
                    return;
                }
                var tabVN = new List<string>() { ChiTieuCrawler.TabVietnam.VangTheGioi, ChiTieuCrawler.TabVietnam.VangSJC, ChiTieuCrawler.TabVietnam.USDSIN, ChiTieuCrawler.TabVietnam.USDHKD, ChiTieuCrawler.TabVietnam.CNY, ChiTieuCrawler.TabVietnam.BangAnh, ChiTieuCrawler.TabVietnam.USDVCB, ChiTieuCrawler.TabVietnam.EURVCB }; /*, ChiTieuCrawler.TabVietnam.USDtudo, ChiTieuCrawler.TabVietnam.EURtudo*/
                var tabTG = new List<string>() { ChiTieuCrawler.TabTheGioi.USDIndex, ChiTieuCrawler.TabTheGioi.DowJones, ChiTieuCrawler.TabTheGioi.Nasdaq, ChiTieuCrawler.TabTheGioi.SP500, ChiTieuCrawler.TabTheGioi.FTSE100, ChiTieuCrawler.TabTheGioi.DAX, ChiTieuCrawler.TabTheGioi.Nikkei225, ChiTieuCrawler.TabTheGioi.HangSeng, ChiTieuCrawler.TabTheGioi.StraitTimes };
                var tabHH = new List<string>() { ChiTieuCrawler.TabHangHoa.CrudeOil, ChiTieuCrawler.TabHangHoa.NaturalGas, ChiTieuCrawler.TabHangHoa.Gold, ChiTieuCrawler.TabHangHoa.Copper, ChiTieuCrawler.TabHangHoa.Silver, ChiTieuCrawler.TabHangHoa.Corn, ChiTieuCrawler.TabHangHoa.Sugar, ChiTieuCrawler.TabHangHoa.Coffee, ChiTieuCrawler.TabHangHoa.Cotton, ChiTieuCrawler.TabHangHoa.RoughRice, ChiTieuCrawler.TabHangHoa.Wheat, ChiTieuCrawler.TabHangHoa.Soybean, ChiTieuCrawler.TabHangHoa.Ethanol };
                var tabMobile = new List<string>() { ChiTieuCrawler.TabMobile.VangSJC, ChiTieuCrawler.TabMobile.USDVCB, ChiTieuCrawler.TabMobile.VangTD, ChiTieuCrawler.TabMobile.USDTD };
                var bFirstTime = true;
                while (ServiceStarted)
                {
                    try
                    {
                        var dt = SqlDb.GetCrawlerData();
                        var manual = SqlDb.GetManualProductData();
                        var redis = new RedisClient(ConfigRedis.Host, ConfigRedis.Port);

                        #region Tab Viet Nam
                        //tab vietnam
                        var key = string.Format(RedisKey.KeyProductBox, 1);
                        var ls = redis.ContainsKey(key) ? redis.Get<List<ProductBox>>(key) : new List<ProductBox>();
                        var data = new List<ProductBox>();
                        ProductBox box, newbox, otherbox;
                        foreach (var item in tabVN)
                        {
                            if (int.Parse(item) < 0)
                            {
                                newbox = otherbox = null;
                                box = FindBox(item, ls);
                                otherbox = null;
                                if (manual.Rows.Count > 0)
                                {
                                    switch (item)
                                    {
                                        case ChiTieuCrawler.TabVietnam.EURtudo:
                                            if (double.Parse(manual.Rows[0]["Price_EURO"].ToString()) == 0) continue;
                                            otherbox = new ProductBox() { ProductName = "EUR (tự do)", CurrentPrice = double.Parse(manual.Rows[0]["Price_EURO"].ToString()), OtherPrice = double.Parse(manual.Rows[0]["Price_Euro_Sale"].ToString()), PrevPrice = 0, UpdateDate = DateTime.Now, DbId = "-2" };
                                            break;
                                        case ChiTieuCrawler.TabVietnam.USDtudo:
                                            if (double.Parse(manual.Rows[0]["Price_USD"].ToString()) == 0) continue;
                                            otherbox = new ProductBox() { ProductName = "USD (tự do)", CurrentPrice = double.Parse(manual.Rows[0]["Price_USD"].ToString()), OtherPrice = double.Parse(manual.Rows[0]["Price_USD_Sale"].ToString()), PrevPrice = 0, UpdateDate = DateTime.Now, DbId = "-1" };
                                            break;
                                    }
                                }
                                if (otherbox != null)
                                {
                                    otherbox.UpdatePrevPrice(bFirstTime ? null : box);
                                    data.Add(otherbox);
                                }
                                continue;
                            }
                            var drs = dt.Select("ID=" + item);
                            if (drs.Length == 0) continue;
                            var dr = drs[0];
                            try
                            {
                                newbox = otherbox = null;
                                box = FindBox(dr["ID"].ToString(), ls);
                                switch (dr["ID"].ToString())
                                {
                                    case ChiTieuCrawler.TabVietnam.VangTheGioi:
                                        newbox = new ProductBox() { ProductName = "Vàng TG(USD)", CurrentPrice = double.Parse(dr["MuaVao"].ToString()), OtherPrice = 0, PrevPrice = double.Parse(dr["MuaVao"].ToString()) - double.Parse(dr["ThayDoi"].ToString()), UpdateDate = DateTime.Now, DbId = box.DbId };
                                        break;
                                    case ChiTieuCrawler.TabVietnam.VangSJC:
                                        newbox = new ProductBox() { ProductName = "Vàng SJC", CurrentPrice = double.Parse(dr["MuaVao"].ToString().Replace(",", "")), OtherPrice = double.Parse(dr["BanRa"].ToString().Replace(",", "")), PrevPrice = 0, UpdateDate = DateTime.Now, DbId = box.DbId };
                                        break;
                                    case ChiTieuCrawler.TabVietnam.USDVCB:
                                        newbox = new ProductBox() { ProductName = "USD (VCB)", CurrentPrice = double.Parse(dr["MuaVao"].ToString().Replace(",", "")), OtherPrice = double.Parse(dr["BanRa"].ToString().Replace(",", "")), PrevPrice = 0, UpdateDate = DateTime.Now, DbId = box.DbId };
                                        break;
                                    case ChiTieuCrawler.TabVietnam.EURVCB:
                                        newbox = new ProductBox() { ProductName = "EUR (VCB)", CurrentPrice = double.Parse(dr["MuaVao"].ToString().Replace(",", "")), OtherPrice = double.Parse(dr["BanRa"].ToString().Replace(",", "")), PrevPrice = 0, UpdateDate = DateTime.Now, DbId = box.DbId };
                                        break;
                                    case ChiTieuCrawler.TabVietnam.CNY:
                                        newbox = new ProductBox() { ProductName = "CNY", CurrentPrice = double.Parse(dr["MuaVao"].ToString().Replace(",", "")), OtherPrice = double.Parse(dr["BanRa"].ToString().Replace(",", "")), PrevPrice = 0, UpdateDate = DateTime.Now, DbId = box.DbId };
                                        break;
                                    case ChiTieuCrawler.TabVietnam.USDSIN:
                                        newbox = new ProductBox() { ProductName = "SGD", CurrentPrice = double.Parse(dr["MuaVao"].ToString().Replace(",", "")), OtherPrice = double.Parse(dr["BanRa"].ToString().Replace(",", "")), PrevPrice = 0, UpdateDate = DateTime.Now, DbId = box.DbId };
                                        break;
                                    case ChiTieuCrawler.TabVietnam.USDHKD:
                                        newbox = new ProductBox() { ProductName = "HKD", CurrentPrice = double.Parse(dr["MuaVao"].ToString().Replace(",", "")), OtherPrice = double.Parse(dr["BanRa"].ToString().Replace(",", "")), PrevPrice = 0, UpdateDate = DateTime.Now, DbId = box.DbId };
                                        break;
                                    case ChiTieuCrawler.TabVietnam.BangAnh:
                                        newbox = new ProductBox() { ProductName = "Bảng Anh", CurrentPrice = double.Parse(dr["MuaVao"].ToString().Replace(",", "")), OtherPrice = double.Parse(dr["BanRa"].ToString().Replace(",", "")), PrevPrice = 0, UpdateDate = DateTime.Now, DbId = box.DbId };
                                        break;
                                    default:
                                        newbox = null;
                                        break;
                                }
                                if (newbox != null)
                                {
                                    if (newbox.DbId != ChiTieuCrawler.TabVietnam.VangTheGioi) newbox.UpdatePrevPrice(bFirstTime ? null : box);
                                    data.Add(newbox);
                                }

                            }
                            catch (Exception ex) { log.WriteEntry("GetBox : " + dr["ID"] + ":" + ex.ToString(), EventLogEntryType.Error); }
//.........这里部分代码省略.........
开发者ID:giangcoffee,项目名称:cafef.redis,代码行数:101,代码来源:PriceData.cs

示例15: UpdateKby

 private void UpdateKby()
 {
     try
     {
         var redis = new RedisClient(ConfigRedis.Host, ConfigRedis.Port);
         //var pdt = bFirst ? sql.GetAllPrice(centerId) : sql.GetChangedPriceSymbols(centerId);
         var sql = new SqlDb();
         var dt = sql.GetKbyFolder();
         if (redis.ContainsKey(RedisKey.KeyKby))
             redis.Set(RedisKey.KeyKby, dt);
         else
             redis.Add(RedisKey.KeyKby, dt);
     }
     catch (Exception ex)
     {
         log.WriteEntry("UpdateKby : " + ex.ToString(), EventLogEntryType.Error);
     }
 }
开发者ID:giangcoffee,项目名称:cafef.redis,代码行数:18,代码来源:PriceData.cs


注:本文中的ServiceStack.Redis.RedisClient.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。