Пример #1
0
        public void ApplyUserRequest(IUserService user)
        {
            var  uid        = user.Uid;
            bool needNotify = false;
            var  now        = DateTime.Now;
            List <UserDockMsg> unSendUserDockMsgs = new List <UserDockMsg>();;
            var dockRecoreds = _DockedRecordRepository.Entities.Where(p => p.sender == uid && p.status == Docked.DockedStatus.None).ToArray();

            if (dockRecoreds.Any())
            {
                needNotify = true;
                foreach (var dockRecord in dockRecoreds)
                {
                    dockRecord.status  = Docked.DockedStatus.Apply;
                    dockRecord.updated = now;
                    unSendUserDockMsgs.Add(new UserDockMsg()
                    {
                        Uid = dockRecord.receiver, Msg = dockRecord.message
                    });
                }
                _DockedRecordRepository.SaveChanges();
            }
            if (needNotify)
            {
                try
                {
                    _FootPrintDockedEventFactory.CreateEvent().OnDockedApply(dockRecoreds);
                }
                catch (System.Exception e)
                {
                    Tgnet.Log.LoggerResolver.Current.Error(e);
                    Tgnet.Log.LoggerResolver.Current.Debug("请求对接,发送通知失败", e.Message);
                }
            }
        }
Пример #2
0
        public void DockedPass()
        {
            if (Status == DockedStatus.Apply)
            {
                ThrowIfNoPermissions();
                using (var scope = new System.Transactions.TransactionScope())
                {
                    _LazyDockedRecord.Value.status  = DockedStatus.Pass;
                    _LazyDockedRecord.Value.updated = DateTime.Now;
                    _DockedRecordRepository.SaveChanges();

                    //推送
                    var footprint = _FootPrintServiceFactory.GetService(Fid);
                    _FootPrintDockedEventFactory.CreateEvent().OnDockedPass(this, footprint.Pid, footprint.ProjectName);
                    scope.Complete();
                }
            }
        }