Ejemplo n.º 1
0
        /// <summary>
        /// 关闭工作
        /// </summary>
        /// <typeparam name="TData"></typeparam>
        /// <param name="data"></param>
        /// <param name="entityType"></param>
        /// <param name="pass"></param>
        private void OnAuditEnd(TData data, int entityType, bool pass)
        {
            Expression <Func <UserJobData, bool> > lambda;

            if (data.AuditState == AuditStateType.Deny)
            {
                lambda = p => p.EntityType == entityType &&
                         p.LinkId == data.Id &&
                         p.JobType == UserJobType.Audit &&
                         p.JobStatus < JobStatusType.Succeed;
            }
            else
            {
                lambda = p => p.EntityType == entityType &&
                         p.LinkId == data.Id &&
                         p.JobType == UserJobType.Audit &&
                         p.JobStatus < JobStatusType.Succeed &&
                         p.ToUserId == TriggerUserId;
            }

            string message = $"已由{GetUserName(TriggerUserId)}{(!pass ? "否决" : "审批通过")}";
            var    jobs    = business.Access.All(lambda);

            foreach (var job in jobs)
            {
                job.JobStatus = job.ToUserId == TriggerUserId
                    ? JobStatusType.Succeed
                    : JobStatusType.NoHit;
                if (job.ToUserId == TriggerUserId)
                {
                    job.DataState = DataStateType.Discard;
                }
                business.Access.Update(job);
            }
            //回到申请者
            var last = business.Access.Last(p => p.EntityType == entityType && p.LinkId == data.Id &&
                                            p.JobType == UserJobType.Edit && p.JobStatus == JobStatusType.Succeed) ??
                       business.Access.Last(p => p.EntityType == entityType && p.LinkId == data.Id &&
                                            p.JobType == UserJobType.Edit);

            if (last != null)
            {
                AddNew(new UserJobData
                {
                    LinkId     = data.Id,
                    Title      = data.Title,
                    EntityType = entityType,
                    Message    = message,
                    JobType    = UserJobType.Message,
                    FromUserId = TriggerUserId,
                    ToUserId   = last.FromUserId
                });
            }
        }
Ejemplo n.º 2
0
 public bool setName(string Name)
 {
     if (model.threadStart)
     {
         GetUserName gun = new GetUserName();
         gun.num  = model.number;
         gun.name = Name;
         Writing(gun);
         return(true);
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 3
0
 public NameViewModel Handle(GetUserName message, NameViewModel result)
 {
     result.Name = "Some Name";
     return result;
 }