Пример #1
0
        public static CPFlowInstanceLog InitFromTask(CPFlowInstanceTask task)
        {
            Mapper.Initialize(cfg =>
            {
                cfg.CreateMap <CPFlowInstanceTask, CPFlowInstanceLog>().ForMember(dest => dest.Id, opt =>
                {
                    opt.Ignore();
                });;
            });

            CPFlowInstanceLog log = AutoMapper.Mapper.Map <CPFlowInstanceLog>(task);

            if (task.RevUserViewTime.HasValue == false)
            {
                log.RevUserViewTime = DateTime.Now;
            }
            log.TaskManaTime = DateTime.Now;
            //默认是提交
            log.TaskManaType = CPFlowEnum.TaskMakeTypeEnum.Submit;
            return(log);
        }
Пример #2
0
        public static CPFlowInstanceLogUnique InitFromLogAndInstance(CPFlowInstanceLog log, CPFlowInstance instance)
        {
            Mapper.Initialize(cfg =>
            {
                cfg.CreateMap <CPFlowInstanceLog, CPFlowInstanceLogUnique>().ForMember(dest => dest.Id, opt =>
                {
                    opt.Ignore();
                });;
            });

            CPFlowInstanceLogUnique logUnique = AutoMapper.Mapper.Map <CPFlowInstanceLogUnique>(log);

            logUnique.CreateUserId   = instance.CreateUserId;
            logUnique.CreateUserName = instance.CreateUserName;
            logUnique.CreateTime     = instance.CreateTime;
            logUnique.InsState       = instance.InsState;
            logUnique.InsStateTitle  = instance.InsStateTitle;
            logUnique.InsEndTime     = instance.InsEndTime;
            logUnique.ManaPhaseIds   = log.RevUserId.ToString();
            logUnique.ManaPhaseNames = log.RevUserName.ToString();
            logUnique.ManaUserId     = log.RevUserId;
            logUnique.MainFormPk     = instance.MainFormPk;
            return(logUnique);
        }