public static void ImportCouponGood(string path) { CouponGood t = new CouponGood(); var list = TaoBaoImport.Import(t, path); var tempList = new List <CouponGood>(500); foreach (var item in list) { item.Id = Guid.NewGuid(); item.CreatedTime = DateTime.Now; item.Tags = item.TypeName.Replace("/", ","); tempList.Add(item); if (tempList.Count == 500) { BLL.CouponGoodBLL.BatchInsert(tempList); tempList.Clear(); } } if (tempList.Count > 0) { BLL.CouponGoodBLL.BatchInsert(tempList); } Console.WriteLine("ImportCouponGood done, total count:" + list.Count.ToString()); }
public static CouponGood Insert(CouponGood param) { var dbContext = new DbContext(); var id = dbContext.CouponGoodDb.InsertReturnIdentity(param); return(GetById(param.Id)); }
public static CouponGood Update(CouponGood param) { var dbContext = new DbContext(); dbContext.CouponGoodDb.Update(param); return(GetById(param.Id)); }
public CouponGood ConvertData() { CouponGood data = new CouponGood() { Id = this.Id, GoodName = this.GoodName, EndTime = this.Endime }; return(data); }