public CommandResult InsertRecordWithCheck(CardChargeRecord info) { RecordSearchCondition searchCondition = new RecordSearchCondition(); searchCondition.CardID = info.CardID; searchCondition.RecordDateTimeRange = new DateTimeRange(info.ChargeDateTime, info.ChargeDateTime); List <CardChargeRecord> check = provider.GetItems(searchCondition).QueryObjects; if (check == null || check.Count == 0) { return(provider.Insert(info)); } //已存在该记录,可认为插入成功 return(new CommandResult(ResultCode.Successful, string.Empty)); }
/// <summary> /// 通过查询条件获取相应的卡片充值记录 /// </summary> /// <param name="search"></param> /// <returns></returns> public QueryResultList <CardChargeRecord> GetCardChargeRecords(RecordSearchCondition search) { ICardChargeRecordProvider p = ProviderFactory.Create <ICardChargeRecordProvider>(_RepoUri); return(p.GetItems(search)); }