private void Synchronization(PersonEntity entity) { if (Constant.Sysc) { try { var requestXml = GetXml(entity); if (requestXml == null) { return; } Log.Debug(this.GetType().ToString(), requestXml); var areaS = new Lkb.PersonServiceImplService(); var responseXml = areaS.insertPerson(requestXml); Log.Debug(this.GetType().ToString(), responseXml); var syncLog = new SyncLogEntity(); syncLog.SyncType = SyncLogEnum.InsertPerson.ToString(); syncLog.ResquestXml = requestXml; syncLog.ResponseXml = responseXml; syncLog.SyncTime = DateTime.Now; syncLog.SyncResult = 0; syncLog.CommunityId = entity.CommunityUUID; var resultRes = responseXml.Deserial <ResultResponse>(); if (resultRes != null && resultRes.Header != null) { var header = resultRes.Header; if (header.RspCode.Equals("0")) { var entity2 = _personRepository.GetById(entity.PersonUUID); entity2.SyncVersion += 1; entity2.SyncStatus = true; _personRepository.Update(entity2); syncLog.SyncResult = 1; } } _syncService.InsertSyncLog(syncLog); } catch (Exception ex) { Log.Error(null, ex.Message); } } }
public virtual void SynchronizationPersonCard(string userCardId) { if (Constant.Sysc) { try { var entity = _userCardRepository.GetEntity(a => a.CardUUID == userCardId); if (entity == null) { return; } if (entity.Deleted && entity.SyncVersion == 0) { return; } var person = GetPersonByCardId(entity.CardUUID); if (person == null) { return; } var requestXml = GetRoomUserCardXml(entity, person); Log.Debug(this.GetType().ToString(), requestXml); if (requestXml.IsBlank()) { return; } var areaS = new Lkb.PersonServiceImplService(); var responseXml = areaS.insertPersonCard(requestXml); Log.Debug(this.GetType().ToString(), responseXml); var syncLog = new SyncLogEntity(); syncLog.SyncType = SyncLogEnum.InsertPersonCard.ToString(); syncLog.ResquestXml = requestXml; syncLog.ResponseXml = responseXml; syncLog.SyncTime = DateTime.Now; syncLog.SyncResult = 0; syncLog.CommunityId = person.CommunityUUID; var resultRes = responseXml.Deserial <ResultResponse>(); if (resultRes != null && resultRes.Header != null) { var header = resultRes.Header; if (header.RspCode.Equals("0")) { entity.SyncVersion += 1; entity.SyncStatus = true; _userCardRepository.Update(entity); syncLog.SyncResult = 1; } } _syncLogService.InsertSyncLog(syncLog); } catch (Exception ex) { Log.Error(null, ex.Message); } } }