Пример #1
0
 /// <summary>
 /// 重置未提醒扫描状态:正在扫描=>等待扫描
 /// </summary>
 /// <returns></returns>
 public bool ResetNotNoticeScanningToWait()
 {
     try
     {
         using (var scope = TransactionUtilities.CreateTransactionScopeWithNoLock())
         {
             _userInfoRepository.ChangeScanningToWait();
             scope.Complete();
             return(true);
         }
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Пример #2
0
        /// <summary>
        /// 提交未提醒
        /// </summary>
        /// <param name="strId"></param>
        public void PostNotNotice(string strId)
        {
            var entity = new UserInfo();

            try
            {
                using (var scope = TransactionUtilities.CreateTransactionScopeWithNoLock())
                {
                    var id = int.Parse(strId);
                    entity =
                        _userInfoRepository.GetByCondition(
                            new DirectSpecification <UserInfo>(
                                x => x.ID == id));
                    entity.ScanFlag = 3;
                    //entity.NoticeTime = DateTime.Now;
                    base.Update(entity, x => x.ScanFlag);
                    scope.Complete();
                }
            }
            catch (InvalidOperationException e)
            {
                lock (_myLock)
                {
                    LoggerHelper.Log("【发起提醒】失败,失败原因:" + (e.InnerException == null ? e.Message : e.InnerException.ToString()));
                }
            }
            catch (Exception ex)
            {
                lock (_myLock)
                {
                    LoggerHelper.Log("【未提醒】失败,失败原因:" + (ex.InnerException == null ? ex.Message : ex.InnerException.ToString()));
                    //避免数据库异常下,无法记录错误日志
                    entity.ScanFlag = 3;
                    base.Update(entity, x => x.ScanFlag);
                }
            }
        }