| | |
| | | } |
| | | } |
| | | |
| | | //通过 PropertyIds 更新缓存 |
| | | private void UpdateCorpCacheByPropertyIds(long CorpID, List<long> PropertyIds) |
| | | { |
| | | if (PropertyIds == null || PropertyIds.Count() < 1) |
| | | return; |
| | | var dal = new DAL.SpecialPropertyValue(); |
| | | var entity_list = dal.GetByPropertyIds(CorpID, PropertyIds); |
| | | var model_list = Entity2Models(entity_list); |
| | | var all = GetCorpCache(CorpID); |
| | | all.RemoveAll(x => PropertyIds.Contains(x.PropertyID)); |
| | | if (model_list != null && model_list.Count > 0) |
| | | { |
| | | all.AddRange(model_list); |
| | | } |
| | | } |
| | | |
| | | //通过 ID 移除缓存 |
| | | private void RemoveCorpCache(long CorpID, long ID) |
| | | { |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region Set |
| | | |
| | | /// <summary> |
| | | /// 设置 |
| | | /// </summary> |
| | | public bool Set(List<Model.SpecialPropertyValueSetter> list) |
| | | { |
| | | if (list == null || list.Count() < 1) |
| | | return false; |
| | | var corpIds = list.Select(x => x.CorpID).Distinct().ToList(); |
| | | if (corpIds.Count != 1 || corpIds[0] < 1) |
| | | return false; |
| | | var dal = new DAL.SpecialPropertyValue(); |
| | | var bol = dal.Set(list.ToEntityList()); |
| | | if (bol) |
| | | { |
| | | UpdateCorpCacheByPropertyIds(corpIds[0], list.Select(x => x.PropertyID).ToList()); |
| | | } |
| | | return bol; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | } |
| | | } |