ÎļþÃû´Ó Service/IStation.Service.Product/iot/iot_payment_record/IotPaymentRecord.cs ÐÞ¸Ä |
| | |
| | | /// <summary> |
| | | /// ç©èå¡ç¼´è´¹è®°å½ |
| | | /// </summary> |
| | | public partial class IotPaymentRecord |
| | | public partial class SimPaymentRecord |
| | | { |
| | | #region Cache |
| | | |
| | | //éè¿ CorpID è·åç¼å |
| | | private List<Model.IotPaymentRecord> GetCorpCache(long CorpID) |
| | | private List<Model.SimPaymentRecord> GetCorpCache(long CorpID) |
| | | { |
| | | return IotPaymentRecordCacheHelper.GetSet(CorpID, () => |
| | | return SimPaymentRecordCacheHelper.GetSet(CorpID, () => |
| | | { |
| | | var dal = new DAL.IotPaymentRecord(); |
| | | var dal = new DAL.SimPaymentRecord(); |
| | | var entity_list = dal.GetByCorpID(CorpID); |
| | | var model_list = Entity2Models(entity_list); |
| | | if (model_list == null) |
| | | { |
| | | model_list = new List<Model.IotPaymentRecord>(); |
| | | model_list = new List<Model.SimPaymentRecord>(); |
| | | } |
| | | return model_list; |
| | | }, ConfigHelper.CacheKeepTime, ConfigHelper.CacheRandomTime); |
| | |
| | | //éè¿ ID æ´æ°ç¼å |
| | | internal void UpdateCorpCache(long CorpID, long ID) |
| | | { |
| | | var dal = new DAL.IotPaymentRecord(); |
| | | var dal = new DAL.SimPaymentRecord(); |
| | | var entity_ds = dal.GetByID(CorpID, ID); |
| | | var model_ds = Entity2Model(entity_ds); |
| | | var all = GetCorpCache(CorpID); |
| | |
| | | { |
| | | if (Ids == null || Ids.Count() < 1) |
| | | return; |
| | | var dal = new DAL.IotPaymentRecord(); |
| | | var dal = new DAL.SimPaymentRecord(); |
| | | var entity_list = dal.GetByIds(CorpID, Ids); |
| | | var model_list = Entity2Models(entity_list); |
| | | var all = GetCorpCache(CorpID); |
| | |
| | | /// <summary> |
| | | /// éè¿ CorpID è·å |
| | | /// </summary> |
| | | public List<Model.IotPaymentRecord> GetByCorpID(long CorpID) |
| | | public List<Model.SimPaymentRecord> GetByCorpID(long CorpID) |
| | | { |
| | | var all = GetCorpCache(CorpID); |
| | | return all.OrderBy(x=>x.PaymentTime).ToList(); |
| | |
| | | /// <summary> |
| | | /// éè¿ ID è·å |
| | | /// </summary> |
| | | public Model.IotPaymentRecord GetByID(long CorpID, long ID) |
| | | public Model.SimPaymentRecord GetByID(long CorpID, long ID) |
| | | { |
| | | var all = GetByCorpID(CorpID); |
| | | return all.Find(x => x.ID == ID); |
| | |
| | | /// <summary> |
| | | /// éè¿ Idsè·å |
| | | /// </summary> |
| | | public List<Model.IotPaymentRecord> GetByIds(long CorpID, List<long> Ids) |
| | | public List<Model.SimPaymentRecord> GetByIds(long CorpID, List<long> Ids) |
| | | { |
| | | if (Ids == null || Ids.Count() < 1) |
| | | return default; |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿ ProductID è·å |
| | | /// éè¿ CardID è·å |
| | | /// </summary> |
| | | public List<Model.IotPaymentRecord> GetByProductID(long CorpID, long ProductID) |
| | | public List<Model.SimPaymentRecord> GetByCardID(long CorpID, long CardID) |
| | | { |
| | | var all = GetByCorpID(CorpID); |
| | | return all.Where(x => x.ProductID == ProductID).OrderBy(x => x.PaymentTime).ToList(); |
| | | return all.Where(x => x.CardID == CardID).OrderBy(x => x.PaymentTime).ToList(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿ ProductIds è·å |
| | | /// éè¿ CardIds è·å |
| | | /// </summary> |
| | | public List<Model.IotPaymentRecord> GetByProductIds(long CorpID, List<long> ProductIds) |
| | | public List<Model.SimPaymentRecord> GetByCardIds(long CorpID, List<long> CardIds) |
| | | { |
| | | if (ProductIds == null || ProductIds.Count < 1) |
| | | if (CardIds == null || CardIds.Count < 1) |
| | | return default; |
| | | var all=GetByCorpID(CorpID); |
| | | return all.Where(x => ProductIds.Contains(x.ProductID)).OrderBy(x => x.PaymentTime).ToList(); |
| | | return all.Where(x => CardIds.Contains(x.CardID)).OrderBy(x => x.PaymentTime).ToList(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿ BelongType å BelongID è·å |
| | | /// </summary> |
| | | public List<Model.IotPaymentRecord> GetByBelongTypeAndBelongID(long CorpID, string BelongType, long BelongID) |
| | | public List<Model.SimPaymentRecord> GetByBelongTypeAndBelongID(long CorpID, string BelongType, long BelongID) |
| | | { |
| | | var productList = new Product().GetByBelongTypeAndBelongID(CorpID,BelongType,BelongID); |
| | | if (productList == null || productList.Count < 1) |
| | | return default; |
| | | var all = GetByCorpID(CorpID); |
| | | var list = (from x in all join y in productList on x.ProductID equals y.ID orderby x.PaymentTime select x).ToList(); |
| | | var list = (from x in all join y in productList on x.CardID equals y.ID orderby x.PaymentTime select x).ToList(); |
| | | return list; |
| | | } |
| | | |
| | |
| | | /// <summary> |
| | | /// æå
¥ä¸æ¡æ°æ® |
| | | /// </summary> |
| | | public long Insert(Model.IotPaymentRecord model) |
| | | public long Insert(Model.SimPaymentRecord model) |
| | | { |
| | | if (model == null) |
| | | return default; |
| | | if (model.CorpID < 1) |
| | | return default; |
| | | |
| | | var dal = new DAL.IotPaymentRecord(); |
| | | var dal = new DAL.SimPaymentRecord(); |
| | | var entity = Model2Entity(model); |
| | | var id = dal.Insert(entity); |
| | | if (id > 0) |
| | |
| | | /// <summary> |
| | | /// æå
¥å¤æ¡ |
| | | /// </summary> |
| | | public bool Inserts(IEnumerable<Model.IotPaymentRecord> list) |
| | | public bool Inserts(IEnumerable<Model.SimPaymentRecord> list) |
| | | { |
| | | if (list == null || list.Count() < 1) |
| | | return default; |
| | | var corpIds = list.Select(x => x.CorpID).Distinct().ToList(); |
| | | if (corpIds.Count != 1 || corpIds[0] < 1) |
| | | return default; |
| | | var dal = new DAL.IotPaymentRecord(); |
| | | var dal = new DAL.SimPaymentRecord(); |
| | | var entity_list = Model2Entities(list.ToList()); |
| | | var ids = dal.InsertsR(entity_list); |
| | | if (ids != null && ids.Count > 0) |
| | |
| | | /// <summary> |
| | | /// æ´æ°ä¸æ¡ |
| | | /// </summary> |
| | | public bool Update(Model.IotPaymentRecord model) |
| | | public bool Update(Model.SimPaymentRecord model) |
| | | { |
| | | if (model == null) |
| | | return default; |
| | |
| | | return default; |
| | | if (model.ID < 1) |
| | | return default; |
| | | var dal = new DAL.IotPaymentRecord(); |
| | | var dal = new DAL.SimPaymentRecord(); |
| | | var entity = Model2Entity(model); |
| | | var bol = dal.Update(entity); |
| | | if (bol) |
| | |
| | | /// <summary> |
| | | /// æ¹éæ´æ° |
| | | /// </summary> |
| | | public bool Updates(List<Model.IotPaymentRecord> list) |
| | | public bool Updates(List<Model.SimPaymentRecord> list) |
| | | { |
| | | if (list == null || list.Count() < 1) |
| | | return default; |
| | |
| | | return default; |
| | | if (list.ToList().Exists(x => x.ID < 1)) |
| | | return default; |
| | | var dal = new DAL.IotPaymentRecord(); |
| | | var dal = new DAL.SimPaymentRecord(); |
| | | var entity_list = Model2Entities(list.ToList()); |
| | | var bol = dal.Updates(entity_list); |
| | | if (bol) |
| | |
| | | public bool DeleteByID(long CorpID, long ID, out string Msg) |
| | | { |
| | | Msg = string.Empty; |
| | | var dal = new DAL.IotPaymentRecord(); |
| | | var dal = new DAL.SimPaymentRecord(); |
| | | var bol = dal.DeleteByID(CorpID, ID); |
| | | if (bol) |
| | | { |