Exemple #1
0
        bool IEntityResourceManager.UpdateResult(Guid tenantId, Guid userId, Guid resultId, string entityName, JObject resource, string subType)
        {
            IOperationFlowEngine operationEngine = new OperationFlowEngine();
            var subTypeCode = _iMetadataManager.GetSubTypeId(entityName, subType);

            var mainObj   = resource.Children().FirstOrDefault(t => t.Path.ToLower().Equals(entityName.ToLower()));
            var targetObj = mainObj.First().ToObject <JObject> ();

            var properties = new WorkFlowProcessProperties {
                EntityName = entityName, SubTypeCode = subTypeCode, UserId = userId, IsSuperAdmin = false, resultId = resultId
            };

            operationEngine.PreProcess(tenantId, new OperationWapper {
                OperationType = WorkFlowOperationType.Update, Data = targetObj
            }, properties);
            var returnVal = _queryManager.UpdateResult(tenantId, userId, entityName, resultId, resource, subType);

            operationEngine.Process(tenantId, new OperationWapper {
                OperationType = WorkFlowOperationType.Update, Data = targetObj
            }, properties);
            operationEngine.PostProcess(tenantId, new OperationWapper {
                OperationType = WorkFlowOperationType.Update, Data = targetObj
            }, properties);
            return(returnVal);
        }
Exemple #2
0
        WorkFlowProcessMessage IOperation.Execute(dynamic obj)
        {
            IMetadataManager    iMetadataManager = new MetadataManager.Contracts.MetadataManager();
            IEntityQueryManager _queryManager    = new EntityQueryManager();
            // IEntityResourceManager _iEntityResourceManager = new VPC.Framework.Business.EntityResourceManager.Contracts.EntityResourceManager();
            var objWorkFlowProcessMessage = new WorkFlowProcessMessage();

            try
            {
                objWorkFlowProcessMessage = new WorkFlowProcessMessage {
                    Success = true
                };
                var workFlowProcessProperties = (WorkFlowProcessProperties)obj[0];
                var jObject  = (JObject)obj[1];
                var tenantId = (Guid)obj[2];

                var queryFilter1 = new List <QueryFilter> ();
                queryFilter1.Add(new QueryFilter {
                    FieldName = "TenantId", Operator = "Equal", Value = tenantId.ToString()
                });
                queryFilter1.Add(new QueryFilter {
                    FieldName = "ProductId", Operator = "Equal", Value = workFlowProcessProperties.resultId.ToString()
                });
                var queryContext1 = new QueryContext {
                    Fields = "VersionNo", Filters = queryFilter1, PageSize = 100, PageIndex = 1
                };
                DataTable productVersionDataTable = _queryManager.GetResult(tenantId, "productversion", queryContext1);



                var productVersionInfo = EntityMapper <ProductVersion> .Mapper(productVersionDataTable);

                var updateStatus = _queryManager.UpdateSpecificField(tenantId, "Product", workFlowProcessProperties.resultId, "ActiveVersion", productVersionInfo.InternalId.Value.ToString());

                //Update WorkFlowFirst step
                IOperationFlowEngine operationEngine = new OperationFlowEngine();
                var subTypeCode = iMetadataManager.GetSubTypeId("productversion", "standard");
                var properties  = new WorkFlowProcessProperties {
                    resultId = Guid.Parse(productVersionInfo.InternalId.Value), EntityName = "productversion", SubTypeCode = subTypeCode, UserId = workFlowProcessProperties.UserId, IsSuperAdmin = false
                };
                operationEngine.FirstOperation(tenantId, properties);
                return(objWorkFlowProcessMessage);
            }
            catch (System.Exception ex)
            {
                _log.Error("TenantEmailPostProcess  having exception message" + ex.Message);

                objWorkFlowProcessMessage.Success      = false;
                objWorkFlowProcessMessage.ErrorMessage = new ErrorMessage
                {
                    Code        = WorkFlowMessage.ApplicationError,
                    Description = ex.Message
                };
                return(objWorkFlowProcessMessage);
            }
        }
Exemple #3
0
        bool IEntityResourceManager.DeleteResult(Guid tenantId, Guid userId, Guid resultId, string entityName, string subType)
        {
            IOperationFlowEngine operationEngine = new OperationFlowEngine();
            var subTypeCode = _iMetadataManager.GetSubTypeId(entityName, subType);
            var properties  = new WorkFlowProcessProperties {
                EntityName = entityName, SubTypeCode = subTypeCode, UserId = userId, IsSuperAdmin = false, resultId = resultId
            };

            operationEngine.PreProcess(tenantId, new OperationWapper {
                OperationType = WorkFlowOperationType.Create, Data = null
            }, properties);
            var returnVal = _queryManager.DeleteResult(tenantId, userId, resultId, entityName);

            operationEngine.Process(tenantId, new OperationWapper {
                OperationType = WorkFlowOperationType.Create, Data = null
            }, properties);
            operationEngine.PostProcess(tenantId, new OperationWapper {
                OperationType = WorkFlowOperationType.Create, Data = null
            }, properties);
            return(returnVal);
        }
        WorkFlowResultMessage <WorkFlowTransition> IManagerWorkFlow.ManageTransitionFirstStep(Guid tenantId, TransitionWapper operationWapper)
        {
            var resM = new WorkFlowResultMessage <WorkFlowTransition>();
            IOperationFlowEngine operationEngine = new OperationFlowEngine();
            var subTypeCode = iMetadataManager.GetSubTypeId(operationWapper.EntityName, operationWapper.SubTypeName);
            var properties  = new WorkFlowProcessProperties {
                EntityName = operationWapper.EntityName, SubTypeCode = subTypeCode, UserId = operationWapper.UserId, IsSuperAdmin = false
            };

            operationEngine.PreProcess(tenantId, new OperationWapper {
                OperationType = WorkFlowOperationType.Create, Data = operationWapper.ObjectData
            }, properties);
            resM = Transition(tenantId, operationWapper);
            operationEngine.Process(tenantId, new OperationWapper {
                OperationType = WorkFlowOperationType.Create, Data = operationWapper.ObjectData
            }, properties);
            operationEngine.FirstOperation(tenantId, properties);
            operationEngine.PostProcess(tenantId, new OperationWapper {
                OperationType = WorkFlowOperationType.Create, Data = operationWapper.ObjectData
            }, properties);
            return(resM);
        }