public static void Insert(ShoppingCartEntity cart) { using (MongoDBHelper mongoDb = new MongoDBHelper("Server=127.0.0.1:27017", "ShoppingCart")) { mongoDb.GetCollection<ShoppingCartEntity>().Insert(cart); } }
public static void Update(ShoppingCartEntity cart) { using (MongoDBHelper mm = new MongoDBHelper()) { mm.GetCollection<ShoppingCartEntity>().Update(cart, new { CartId = cart.CartId }); } }
public static void Update(ShoppingCartEntity cart) { using (MongoDBHelper mm = new MongoDBHelper()) { mm.GetCollection <ShoppingCartEntity>().Update(cart, new { CartId = cart.CartId }); } }
public static void Insert(ShoppingCartEntity cart) { using (MongoDBHelper mongoDb = new MongoDBHelper("Server=127.0.0.1:27017", "ShoppingCart")) { mongoDb.GetCollection <ShoppingCartEntity>().Insert(cart); } }
public static ObjectId Insert(ShoppingCartEntity cart) { using (MongoDBOfficial mongoDb = new MongoDBOfficial("Server=127.0.0.1:27017", "ShoppingCart")) { var data = mongoDb.GetCollection <ShoppingCartEntity>("ShoppingCart") .Insert(cart); return(cart.Id); } }
public static ObjectId Insert(ShoppingCartEntity cart) { using (MongoDBOfficial mongoDb = new MongoDBOfficial("Server=127.0.0.1:27017", "ShoppingCart")) { var data = mongoDb.GetCollection<ShoppingCartEntity>("ShoppingCart") .Insert(cart); return cart.Id; } }
static void Main(string[] args) { Test(); return; StepHelper stepHelper=new StepHelper(); var context = new StepStateContext() {CurrentStatus = DrawState.InitDraw,CurrentDrawStatus=DrawState.None, InDate = DateTime.Now.AddDays(-1)}; stepHelper.Parse(context); return; NPOIExcel.ReadYinTaiStoreExcel(); return; var cart3 = MongoDBOfficialTest.GetById(new ObjectId("518758109e3eca0f702f940e")); var cart = new ShoppingCartEntity() { CartId = "123", Ha = "ssss", Promotions = new List<PromotionEntity>() }; cart.Promotions.Add(new PromotionEntity(){Date1 = "基类"}); cart.Promotions.Add(new ManJian(){Date3 = "子类"}); cart.Data=new DataCollection(); cart.Data.Add(new PromotionEntity() { Date1 = "基类" }); var objectid = MongoDBOfficialTest.Insert(cart); //var objid = new ObjectId(); //var cart2 = MongoDBOfficialTest.GetById(objectid); var cart2= MongoDBOfficialTest.GetById(objectid); #region //HttpClient hc3 = new HttpClient("http://www.soxuan.com"); //var html2=hc3.Request(); //return; #endregion #region FileRead.Read(); FileRead.Read("GetPromotionRulesByIdsWithoutRuleExpands"); return; #endregion #region mongodb //var objectid= MongoDBOfficialTest.Insert(new ShoppingCartEntity(){CartId = "123",Ha = "ssss",Promotion = new PromotionEntity(){Date1="满赠新促销",Date2 = new List<string>(){"测试"}}}); //var objectid = new ObjectId("50e78f8c9e3eca2d6c538b9d"); MongoDBOfficialTest.GetById(objectid); //MongoDBOfficialTest.GetById(objectid); //MongoDBTest.Insert(new ShoppingCartEntity(){CartId = "123456"}); //MongoDBTest.GetById("123456"); //MongoDBTest.Update(new ShoppingCartEntity(){CartId = "123456"}); return; #endregion //var indexUrls= GoldSpider.GetUrls(); //var urls= GoldSpider.Spider(indexUrls); //string json = JsonHelper.ToJson(urls); //File.WriteAllText(Environment.CurrentDirectory+"\\urls.json",json); var data= JsonHelper.FromJson<List<string>>(File.ReadAllText(Environment.CurrentDirectory + "\\urls.json")); var finalDatas= GoldSpider.SpiderPrice(data); File.WriteAllText(Environment.CurrentDirectory + "\\data.json", JsonHelper.ToJson(finalDatas)); return; //SqliteTest.Test(); //string connectionstring1 = "Data Source=e:\\sqlite.db3"; //string connectionstring2 = "Data Source=e:\\sqlite.db3;PRAGMA cache_size=10000"; //SqliteTest.Query("select id from test1 limit 0,10000", connectionstring2); //SqliteTest.Query("select id from test1 limit 0,10000", connectionstring1); //SqliteTest.Query("select id from test1 limit 0,10000", connectionstring1); SqliteTest.Memory(100000); SqliteTest.MemoryQuery("select id from test1 limit 0,10000"); return; WebBrowerManager.Instance.Setup(new cEXWB()); WebBrowerManager.Instance.TimeOut = 15; WebBrowerManager.Instance.FilterRequest = true; WebBrowerManager.Instance.FilterAction.Add(".css", (string key, string source) => { if(source.EndsWith(key)) { return true; } return false; }); string html1 = WebBrowerManager.Instance.Run("http://www.sge.sh/publish/sge/xqzx/jyxq/index.htm"); Console.WriteLine(html1); Console.Read(); return; TaskManager taskManager=new TaskManager(); taskManager.Test02(); Console.ReadKey(); return; Process.Start("IExplore.exe", "www.northwindtraders.comTest"); // //EncodingTest.Test(); //return; using(HttpClient hc1 = new HttpClient("http://www.cnblogs.com")) { string html = hc1.Request(); } //WebPage page = new WebPage(html, "http://www.cnblogs.com", Encoding.UTF8); //page.SaveHtmlAndResource(@"1.html", false, new DirConfig(@"z:\1")); //return; HttpClientTest.Test(); return; SqliteTest.Test(); var uri = new Uri("http://misc.360buyimg.com/lib/js/2012/base-v1.js"); //WebBrowerManager.Instance.ToVisitUrls = new List<string> { "http://www.360buy.com" }; WebBrowerManager.Instance.Setup(new cEXWB()); WebBrowerManager.Instance.Run(uri.ToString()); BootStrapperManager.Initialize(new NinjectBootstrapper()); var add = CommonBootStrapper.ServiceLocator.GetInstance<Test>(); //add.Alert("ceshi"); add.Test1(); HttpClient hc = new HttpClient("http://misc.360buyimg.com/lib/js/2012/base-v1.js"); hc.SaveFile("e:\\1.js"); hc.Request(); hc.BeginRequest((h) => { Console.Write(h); }); Console.ReadKey(); var s= hc.Request(); var list = new List<UnionOrderTransBFD>(); list.Add(new UnionOrderTransBFD() { ActualPrice = 1, CommissionPrice = 1, Rate = 1, Source = ">123", SONumber = 111111111111, UpdateDate = DateTime.Now }); list.Add(new UnionOrderTransBFD() { ActualPrice = 1, CommissionPrice = 1, Rate = 1, Source = ">123", SONumber = 111111111111, UpdateDate = DateTime.Now }); var xml= ObjectXmlSerializer.ToXml(list,"ccc",true,false); var a=new A(); a.name = 1; //a.ObjectB = new B() { ItemCode = "1", Qty = 1 }; var b = new A(); b.name =1; //b.ObjectB = new B() { ItemCode = "1", Qty = 1 }; var isEqual = DotNet.Common.Utility.GenericEqualityComparer<A>.Equals(a, b); Console.WriteLine(isEqual); }
static void Main(string[] args) { Test(); return; StepHelper stepHelper = new StepHelper(); var context = new StepStateContext() { CurrentStatus = DrawState.InitDraw, CurrentDrawStatus = DrawState.None, InDate = DateTime.Now.AddDays(-1) }; stepHelper.Parse(context); return; NPOIExcel.ReadYinTaiStoreExcel(); return; var cart3 = MongoDBOfficialTest.GetById(new ObjectId("518758109e3eca0f702f940e")); var cart = new ShoppingCartEntity() { CartId = "123", Ha = "ssss", Promotions = new List <PromotionEntity>() }; cart.Promotions.Add(new PromotionEntity() { Date1 = "基类" }); cart.Promotions.Add(new ManJian() { Date3 = "子类" }); cart.Data = new DataCollection(); cart.Data.Add(new PromotionEntity() { Date1 = "基类" }); var objectid = MongoDBOfficialTest.Insert(cart); //var objid = new ObjectId(); //var cart2 = MongoDBOfficialTest.GetById(objectid); var cart2 = MongoDBOfficialTest.GetById(objectid); #region //HttpClient hc3 = new HttpClient("http://www.soxuan.com"); //var html2=hc3.Request(); //return; #endregion #region FileRead.Read(); FileRead.Read("GetPromotionRulesByIdsWithoutRuleExpands"); return; #endregion #region mongodb //var objectid= MongoDBOfficialTest.Insert(new ShoppingCartEntity(){CartId = "123",Ha = "ssss",Promotion = new PromotionEntity(){Date1="满赠新促销",Date2 = new List<string>(){"测试"}}}); //var objectid = new ObjectId("50e78f8c9e3eca2d6c538b9d"); MongoDBOfficialTest.GetById(objectid); //MongoDBOfficialTest.GetById(objectid); //MongoDBTest.Insert(new ShoppingCartEntity(){CartId = "123456"}); //MongoDBTest.GetById("123456"); //MongoDBTest.Update(new ShoppingCartEntity(){CartId = "123456"}); return; #endregion //var indexUrls= GoldSpider.GetUrls(); //var urls= GoldSpider.Spider(indexUrls); //string json = JsonHelper.ToJson(urls); //File.WriteAllText(Environment.CurrentDirectory+"\\urls.json",json); var data = JsonHelper.FromJson <List <string> >(File.ReadAllText(Environment.CurrentDirectory + "\\urls.json")); var finalDatas = GoldSpider.SpiderPrice(data); File.WriteAllText(Environment.CurrentDirectory + "\\data.json", JsonHelper.ToJson(finalDatas)); return; //SqliteTest.Test(); //string connectionstring1 = "Data Source=e:\\sqlite.db3"; //string connectionstring2 = "Data Source=e:\\sqlite.db3;PRAGMA cache_size=10000"; //SqliteTest.Query("select id from test1 limit 0,10000", connectionstring2); //SqliteTest.Query("select id from test1 limit 0,10000", connectionstring1); //SqliteTest.Query("select id from test1 limit 0,10000", connectionstring1); SqliteTest.Memory(100000); SqliteTest.MemoryQuery("select id from test1 limit 0,10000"); return; WebBrowerManager.Instance.Setup(new cEXWB()); WebBrowerManager.Instance.TimeOut = 15; WebBrowerManager.Instance.FilterRequest = true; WebBrowerManager.Instance.FilterAction.Add(".css", (string key, string source) => { if (source.EndsWith(key)) { return(true); } return(false); }); string html1 = WebBrowerManager.Instance.Run("http://www.sge.sh/publish/sge/xqzx/jyxq/index.htm"); Console.WriteLine(html1); Console.Read(); return; TaskManager taskManager = new TaskManager(); taskManager.Test02(); Console.ReadKey(); return; Process.Start("IExplore.exe", "www.northwindtraders.comTest"); // //EncodingTest.Test(); //return; using (HttpClient hc1 = new HttpClient("http://www.cnblogs.com")) { string html = hc1.Request(); } //WebPage page = new WebPage(html, "http://www.cnblogs.com", Encoding.UTF8); //page.SaveHtmlAndResource(@"1.html", false, new DirConfig(@"z:\1")); //return; HttpClientTest.Test(); return; SqliteTest.Test(); var uri = new Uri("http://misc.360buyimg.com/lib/js/2012/base-v1.js"); //WebBrowerManager.Instance.ToVisitUrls = new List<string> { "http://www.360buy.com" }; WebBrowerManager.Instance.Setup(new cEXWB()); WebBrowerManager.Instance.Run(uri.ToString()); BootStrapperManager.Initialize(new NinjectBootstrapper()); var add = CommonBootStrapper.ServiceLocator.GetInstance <Test>(); //add.Alert("ceshi"); add.Test1(); HttpClient hc = new HttpClient("http://misc.360buyimg.com/lib/js/2012/base-v1.js"); hc.SaveFile("e:\\1.js"); hc.Request(); hc.BeginRequest((h) => { Console.Write(h); }); Console.ReadKey(); var s = hc.Request(); var list = new List <UnionOrderTransBFD>(); list.Add(new UnionOrderTransBFD() { ActualPrice = 1, CommissionPrice = 1, Rate = 1, Source = ">123", SONumber = 111111111111, UpdateDate = DateTime.Now }); list.Add(new UnionOrderTransBFD() { ActualPrice = 1, CommissionPrice = 1, Rate = 1, Source = ">123", SONumber = 111111111111, UpdateDate = DateTime.Now }); var xml = ObjectXmlSerializer.ToXml(list, "ccc", true, false); var a = new A(); a.name = 1; //a.ObjectB = new B() { ItemCode = "1", Qty = 1 }; var b = new A(); b.name = 1; //b.ObjectB = new B() { ItemCode = "1", Qty = 1 }; var isEqual = DotNet.Common.Utility.GenericEqualityComparer <A> .Equals(a, b); Console.WriteLine(isEqual); }