Ejemplo n.º 1
0
 public FlowService()
 {
     _flowRepository = new FlowRepository();
     _flowNodeInstanceRepository = new FlowNodeInstanceRepository();
     _flowTypeRepository = new FlowTypeRepository();
     _flowNodeInstanceTaskRepository = new FlowNodeInstanceTaskRepository();
 }
Ejemplo n.º 2
0
        /// <summary>
        /// جریان های یک مدیر را برمیگرداند
        /// مشخص میکند که آیا توسط جانشین استفاده شده است یا خیر
        /// </summary>
        /// <param name="managerPersonId">شناسه پرسنلی مدیر</param>
        /// <returns></returns>
        public IList <Flow> GetAllFlowByManager(decimal substituteId, decimal managerPersonId)
        {
            try
            {
                ManagerRepository rep     = new ManagerRepository(false);
                FlowRepository    flowRep = new FlowRepository(false);
                Manager           manager = rep.GetManagerByPersonID(managerPersonId);
                if (manager == null)
                {
                    return(new List <Flow>());
                }
                var flowList = from mngFlw in manager.ManagerFlowList
                               where mngFlw.Active
                               select mngFlw.Flow;

                foreach (Flow flow in flowList)
                {
                    if (flowRep.GetSubstituteAccessGroupCount(substituteId, flow.ID) > 0)
                    {
                        flow.IsAssignedToSubstitute = true;
                    }
                }
                return(flowList.ToList <Flow>());
            }
            catch (Exception ex)
            {
                LogException(ex, "BSubstitute", "GetAllFlowByManager");
                throw ex;
            }
        }
Ejemplo n.º 3
0
 public FlowEngineService()
 {
     _logger = new DefaultLoggerFactory().GetLogger();
     _flowNodeInstanceRepository = new FlowNodeInstanceRepository();
     _flowRepository = new FlowRepository();
     _flowNodeInstanceTaskRepository = new FlowNodeInstanceTaskRepository();
 }
        public void Setup()
        {
            var dbOptions = new DbContextOptionsBuilder <StateManagementContext>()
                            .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString())
                            .Options;

            _stateManagementContext = new StateManagementContext(dbOptions);
            var flowRepository  = new FlowRepository(_stateManagementContext);
            var stateRepository = new StateRepository(_stateManagementContext);
            var taskRepository  = new TaskRepository(_stateManagementContext);

            _unitOfWork = new UnitOfWork(flowRepository, stateRepository, taskRepository, _stateManagementContext);
        }
Ejemplo n.º 5
0
        protected override void DeleteValidate(FlowGroup flowGroup)
        {
            UIValidationExceptions exception = new UIValidationExceptions();

            FlowRepository flowRep = new FlowRepository(false);
            int            count   = flowRep.Find(f => f.FlowGroup.ID == flowGroup.ID).Count();

            if (count > 0)
            {
                exception.Add(ExceptionResourceKeys.DepUsedByPersons, "این گروه به جریان انتساب داده شده است", ExceptionSrc);
            }
            if (exception.Count > 0)
            {
                throw exception;
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// در جریان ها استفاده نشده باشد
        /// </summary>
        /// <param name="obj"></param>
        protected override void DeleteValidate(PrecardAccessGroup accessGroup)
        {
            UIValidationExceptions exception = new UIValidationExceptions();
            FlowRepository         flowRep   = new FlowRepository(false);
            int flowCount = flowRep.GetCountByCriteria(new CriteriaStruct(Utility.GetPropertyName(() => new Model.RequestFlow.Flow().AccessGroup), accessGroup));

            if (flowCount > 0)
            {
                exception.Add(new ValidationException(ExceptionResourceKeys.AccessGroupUsedByFlow, "گروه دسترسی در جریان مورد استفاده قرار گرفته است", ExceptionSrc));
            }

            if (exception.Count > 0)
            {
                throw exception;
            }
        }
Ejemplo n.º 7
0
 public FlowNodeInstanceService( )
 {
     _flowRepository = new FlowRepository();
     _flowNodeInstanceRepository = new FlowNodeInstanceRepository();
     _userRepository = new UserRepository();
 }