예제 #1
0
        public WFStateDTO ToStateDTO(State item, bool withDetails)
        {
            WFStateDTO result = new WFStateDTO();

            result.ID          = item.ID;
            result.Name        = item.Name;
            result.Description = item.Description;
            result.StateType   = (StateType)item.StateTypeID;
            result.ProcessID   = item.ProcessID;
            if (withDetails)
            {
                foreach (var sbsf in item.State_Formula)
                {
                    var sf = new StateFormulaDTO();
                    sf.FormulaID = sbsf.FormulaID;
                    sf.Message   = sbsf.Message;
                    sf.TrueFalse = sbsf.TrueFalse;
                    result.Formulas.Add(sf);
                }
            }
            if (withDetails)
            {
                BizActivity bizActivity = new BizActivity();
                foreach (var act in item.StateActivity)
                {
                    result.Activities.Add(bizActivity.ToActivityDTO(act.Activity, true));
                }
            }
            return(result);
        }
예제 #2
0
        public TransitionDTO ToTransitionDTO(DR_Requester requester, DataAccess.Transition item, bool withDetails)
        {
            TransitionDTO result = new TransitionDTO();

            result.ID             = item.ID;
            result.CurrentStateID = item.CurrentStateID;
            result.NextStateID    = item.NextStateID;
            result.Name           = item.Name;

            result.ProcessID = item.ProcessID;

            if (withDetails)
            {
                BizState bizState = new BizState();
                result.CurrentState = bizState.ToStateDTO(item.State, false);
                result.NextState    = bizState.ToStateDTO(item.State1, false);

                BizActivity bizActivity = new BizActivity();
                foreach (var act in item.TransitionActivity)
                {
                    result.TransitionActivities.Add(bizActivity.ToActivityDTO(act.Activity, withDetails));
                }

                foreach (var act in item.TransitionAction)
                {
                    result.TransitionActions.Add(ToTransitionAction(requester, act, withDetails));
                }
            }
            return(result);
        }
        public ProcessDTO ToProcessDTO(DR_Requester requester, Process item, bool withDetails)
        {
            ProcessDTO result = new ProcessDTO();
            result.ID = item.ID;
            result.Name = item.Name;
            result.EntityID = item.TableDrivedEntityID ?? 0;
            result.TransitionFlowSTR = item.TransitionFlowSTR;
            if (withDetails)
            {
                BizRoleType bizRoleType = new BizRoleType();
                //result.AdminRoleGroup = bizRole.ToRoleGroupDTO(item.RoleGroup);

                BizAction bizAction = new BizAction();
                //foreach (var citem in item.Action)
                //{
                //    result.Actions.Add(bizAction.ToActionDTO(citem));
                //}
                BizActivity bizActivity = new BizActivity();
                foreach (var citem in item.Activity)
                {
                    result.Activities.Add(bizActivity.ToActivityDTO(citem, false));
                }
                BizEntityGroup bizEntityGroup = new BizEntityGroup();
                foreach (var citem in item.EntityGroup)
                {
                    result.EntityGroups.Add(bizEntityGroup.ToEntityGroupDTO(requester, citem, withDetails));
                }
                BizState bizState = new BizState();
                foreach (var citem in item.State)
                {
                    result.States.Add(bizState.ToStateDTO(citem, false));
                }

                //foreach (var citem in item.ProcessAdminRoleTypes)
                //{
                //    result.AdminRoleTypes.Add(bizRoleType.ToRoleTypeDTO(citem.RoleType));
                //}
                //foreach (var citem in item.RequestInitializers)
                //{
                //    result.ProcessInitializerRoleGroups.Add(bizRole.ToRoleGroupDTO(citem.RoleGroup));
                //}

            }
            return result;
        }