private void btn_goodsadd_Click(object sender, EventArgs e) { string goodsname = txt_goodsname.Text; string goodsurl = txt_goodsurl.Text; if (string.IsNullOrEmpty(goodsname)) { "请输入商品名称".ToShow(); return; } if (string.IsNullOrEmpty(goodsurl)) { "请输入商品网址".ToShow(); return; } //IList<Entity.Basic> list = BLL.BasicManager.Search(1, 10, "pdd_daifa_goods", "", 0, ""); //if (list.Count > 0) //{ // Entity.Basic b = list[0]; // //GoodsUrls gu = Newtonsoft.Json.JsonConvert.DeserializeObject<GoodsUrls>(b.Sign2); // List<GoodsUrls> list_goods = Newtonsoft.Json.JsonConvert.DeserializeObject<List<GoodsUrls>>(b.Sign2); //} List <GoodsUrls> list_goods = GetPDDGoods(); if (list_goods != null) { GoodsUrls g = new GoodsUrls(); g.goods = goodsname + "-" + goodsurl; list_goods.Add(g); string jn = Newtonsoft.Json.JsonConvert.SerializeObject(list_goods); IList <Entity.Basic> list = BLL.BasicManager.Search(1, 10, "pdd_daifa_goods", "", 0, ""); if (list.Count > 0) { Entity.Basic b = list[0]; b.Sign2 = jn; BLL.BasicManager.Update(b); "保存成功".ToShow(); bind_cb(); } } }
List <GoodsUrls> GetPDDGoods() { List <GoodsUrls> list_goods = new List <GoodsUrls>(); try { IList <Entity.Basic> list = BLL.BasicManager.Search(1, 10, "pdd_daifa_goods", "", 0, ""); if (list.Count > 0) { Entity.Basic b = list[0]; GoodsUrls g = new GoodsUrls(); list_goods = Newtonsoft.Json.JsonConvert.DeserializeObject <List <GoodsUrls> >(b.Sign2); } } catch (Exception ex) { ex.ToLog(); } return(list_goods); }