Exemplo n.º 1
0
        public async Task <long> Create(WorkCreateInput input)
        {
            var work     = input.MapTo <Deskwork>();
            var receiver = UserCache.Get(input.ReceiverId);

            work.CreateStep(new DeskworkStep(AbpSession.UserId.Value, AbpSession.GetCurrentUser().Name, input.ReceiverId, receiver.Name, receiver.OrganizationUnitName));
            return(await _workRepository.InsertAndGetIdAsync(work));
        }
Exemplo n.º 2
0
        public async Task <bool> FinishStep(FinishStepInput input)
        {
            var work = await _workRepository.GetAllIncluding(x => x.Steps)
                       .FirstOrDefaultAsync(x => x.Id == input.WorkId);

            EnsureWorkActive(work);

            DeskworkStep next = null;

            if (input.ReceiverId != null)
            {
                var receiver = await UserCache.GetAsync(input.ReceiverId.Value);

                next = new DeskworkStep(AbpSession.UserId.Value,
                                        AbpSession.GetCurrentUser().Name,
                                        receiver.Id,
                                        receiver.Name,
                                        receiver.OrganizationUnitName
                                        );
            }

            work.CompleteStep(AbpSession.UserId.Value, input.StepId, input.Result, next);
            return(true);
        }