예제 #1
0
        /// <summary>
        /// 添加远程会议/翻译记录
        /// </summary>
        /// <param name="model"></param>
        private void MeetingRemotingData(Guid meetingId, MeetingSyncOutput model)
        {
            if (model.IsNull())
            {
                return;
            }

            if (model.Records.IsEmpty() && model.Translations.IsEmpty())
            {
                return;
            }

            if (!model.Records.IsEmpty())
            {
                model.Records.OrderBy(x => x.LastDt).ToList().ForEach(x =>
                {
                    if (x.LastDt > lastRecordDt)
                    {
                        lastRecordDt = x.LastDt;
                    }
                    x.SyncType = 1;
                    if (x.LocalId.IsEmpty())
                    {
                        x.LocalId = Guid.NewGuid();
                    }
                    MeetingDataAdd(meetingId, x);
                });
            }

            if (!model.Translations.IsEmpty())
            {
                model.Translations.ForEach(x =>
                {
                    if (x.LastDt > lastTranslationDt)
                    {
                        lastTranslationDt = x.LastDt;
                    }
                    x.SyncType = 2;
                    MeetingDataAdd(meetingId, x);
                });
            }
        }
예제 #2
0
        /// <summary>
        /// 保存远程会议/翻译记录
        /// </summary>
        /// <param name="model"></param>
        private void MeetingLocalDBSave(Guid meetingId, MeetingSyncOutput model)
        {
            if (model.IsNull())
            {
                return;
            }

            if (model.Records.IsEmpty() && model.Translations.IsEmpty())
            {
                return;
            }

            var recordService      = MeetingHelper.GetRecordService(meetingId);
            var translationService = MeetingHelper.GetTranslateService(meetingId);

            ThreadPool.QueueUserWorkItem((Object state) =>
            {
                if (!model.Records.IsEmpty())
                {
                    model.Records.ForEach(x =>
                    {
                        if (recordService.Find(where : i => i.Id == x.RecordId).Count() == 0)
                        {
                            recordService.Insert(EngineHelper.Map <MeetingRecordEntity>(x));
                        }
                    });
                }

                if (!model.Translations.IsEmpty())
                {
                    model.Translations.ForEach(x =>
                    {
                        if (translationService.Find(where : i => i.Id == x.TranslationId).Count() == 0)
                        {
                            translationService.Insert(EngineHelper.Map <MeetingTranslationEntity>(x));
                        }
                    });
                }
            });
        }