/// <summary> /// 取得匯入帳號訂單號碼,將銷帳紀錄改為已銷帳 /// </summary> /// <param name="models"></param> /// <returns></returns> public bool WriteOffMoney(List <PhuraseDetailModel> models) { var repo = new PhuraseDetailRepository(); var result = new List <PhuraseDetailModel>(); foreach (var item in models) { var ordernum = item.OrderNumber; Expression <Func <PhuraseDetailEntity, bool> > itemWhere = c => true; var prefix = itemWhere.Compile(); itemWhere = c => prefix(c) && c.OrderNumber == item.OrderNumber; var a = repo.GetList(itemWhere).First(); a.IsWriteOffMoney = true; result.Add(a); } return(repo.UpdateItems(result)); }
public List <PhuraseDetailModel> GetSalesRecords(SearchModel searchModel) { var repo = new PhuraseDetailRepository(); var result = new List <PhuraseDetailModel>(); System.Linq.Expressions.Expression <Func <PhuraseDetailEntity, bool> > itemWhere = c => true; if (searchModel.Brand != Common.Enum.BrandEnum.Null) { var prefix = itemWhere.Compile(); itemWhere = c => prefix(c) && c.Products.Any(x => x.Brand == ((int)searchModel.Brand)); } if (searchModel.StartTime != null) { var prefix = itemWhere.Compile(); itemWhere = c => prefix(c) && c.OrderCreateTime >= searchModel.StartTime; } if (searchModel.EndTime != null) { var prefix = itemWhere.Compile(); itemWhere = c => prefix(c) && c.OrderCreateTime <= searchModel.EndTime; } if (searchModel.Flavor != Common.Enum.FlavorEnum.Null) { var prefix = itemWhere.Compile(); itemWhere = c => prefix(c) && c.Products.Any(x => x.Flavor == ((int)searchModel.Flavor)); } if (searchModel.Package != Common.Enum.PackageEnum.Null) { var prefix = itemWhere.Compile(); itemWhere = c => prefix(c) && c.Products.Any(x => x.Package == ((int)searchModel.Package)); } if (searchModel.ProductionDetailType != Common.Enum.ProductionDetail.Null) { var prefix = itemWhere.Compile(); itemWhere = c => prefix(c) && c.Products.Any(x => x.ProductionDetailType == ((int)searchModel.ProductionDetailType)); } if (searchModel.ProductionType != Common.Enum.ProductionType.Null) { var prefix = itemWhere.Compile(); itemWhere = c => prefix(c) && c.Products.Any(x => x.ProductionType == ((int)searchModel.ProductionType)); } if (searchModel.IsWriteOffMoney != -1) { var prefix = itemWhere.Compile(); var b = searchModel.IsWriteOffMoney == 1 ? true : false; itemWhere = c => prefix(c) && c.IsWriteOffMoney == b; } if (searchModel.KeyWord != "") { var prefix = itemWhere.Compile(); itemWhere = c => prefix(c) && (c.Account == searchModel.KeyWord || c.OrderNumber == searchModel.KeyWord); } return(repo.GetList(itemWhere)); }
/// <summary> /// 加入用戶購買紀錄到資料庫 /// </summary> /// <param name="stockData"></param> /// <returns></returns> public bool AddDBlientPhuraseRecord(List <PhuraseDetailModel> stockData) { var repo = new PhuraseDetailRepository(); return(repo.AddItems(stockData)); }