Beispiel #1
0
        public TaskExecutionMessage Execute(TaskExecutionPayload payloadObj)
        {
            IEntityQueryManager entityQueryManager = new EntityQueryManager();
            var draftId          = entityQueryManager.GetSpecificIdByQuery(payloadObj.TenantId, "Product", payloadObj.Id, "DraftVersion");
            var executionMessage = new TaskExecutionMessage();


            if (draftId != null)
            {
                executionMessage.Message = TaskExecutionCode.AlreadyAdded;
                return(executionMessage);
            }
            var versionId = entityQueryManager.GetSpecificIdByQuery(payloadObj.TenantId, "Product", payloadObj.Id, "ActiveVersion");
            var cloneId   = entityQueryManager.SelectInsert("ProductVersion", payloadObj.TenantId, versionId, Guid.Empty);

            if (cloneId != Guid.Empty)
            {
                var updateStatus = entityQueryManager.UpdateSpecificField(payloadObj.TenantId, "Product", payloadObj.Id, "DraftVersion", cloneId.ToString());

                executionMessage.Message = TaskExecutionCode.Redirect;
                executionMessage.Id      = cloneId;
                return(executionMessage);
            }
            return(null);
        }
        WorkFlowProcessMessage IOperation.Execute(dynamic obj)
        {
            IEntityQueryManager _queryManager    = new EntityQueryManager();
            IMetadataManager    iMetadataManager = new MetadataManager.Contracts.MetadataManager();
            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 userObj = jObject.Children().FirstOrDefault(t => t.Path.ToLower().Equals("user"));
                var details = userObj.First().ToObject <JObject> ();


                var userEntity = EntityMapper <VPC.Entities.EntityCore.Metadata.User> .MapperJObject(details);

                var tenantCode = _queryManager.GetSpecificIdByQuery(tenantId, "Tenant", tenantId, "Code");

                details.Add(new JProperty("TenantCode", tenantCode));
                var template  = _iEntityResourceManager.GetWellKnownTemplate(tenantId, "Emailtemplate", "User", (int)ContextTypeEnum.Welcome, details);
                var returnVal = DataUtility.SaveEmail(tenantId, workFlowProcessProperties.UserId, template, userEntity.UserCredential.Username.Value, "NewUserCredential", InfoType.User);
                return(objWorkFlowProcessMessage);
            }
            catch (System.Exception ex)
            {
                _log.Error("User_Email_Create_Post  having exception message" + ex.Message);

                objWorkFlowProcessMessage.Success      = false;
                objWorkFlowProcessMessage.ErrorMessage = new ErrorMessage
                {
                    Code        = WorkFlowMessage.ApplicationError,
                    Description = ex.Message
                };
                return(objWorkFlowProcessMessage);
            }
        }
        WorkFlowProcessMessage IOperation.Execute(dynamic obj)
        {
            IInitilizeManager   _initilizeManager = new InitilizeManager();
            IEntityQueryManager queryManager      = new EntityQueryManager();
            IManagerTenantSubscriptionEntity _managerSubscriptionEntity = new ManagerTenantSubscriptionEntity();
            var objWorkFlowProcessMessage = new WorkFlowProcessMessage();

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

                var subscriptionId = queryManager.GetSpecificIdByQuery(tenantId, workFlowProcessProperties.EntityName, workFlowProcessProperties.resultId, "TenantSubscription");
                if (subscriptionId != null)
                {
                    var subscriptionEntities = _managerSubscriptionEntity.TenantSubscriptionEntities(tenantId, new Guid(subscriptionId.ToString()));
                    if (subscriptionEntities.Any())
                    {
                        var entityIds = subscriptionEntities.Select(p => p.EntityId).ToList();
                        var status    = _initilizeManager.Initilize(workFlowProcessProperties.resultId, entityIds, workFlowProcessProperties.UserId, subscriptionId);
                    }
                }


                return(objWorkFlowProcessMessage);
            }
            catch (System.Exception ex)
            {
                _log.Error("TenantInitilization_PostProcess  having exception message" + ex.Message);

                objWorkFlowProcessMessage.Success      = false;
                objWorkFlowProcessMessage.ErrorMessage = new ErrorMessage
                {
                    Code        = WorkFlowMessage.ApplicationError,
                    Description = ex.Message
                };
                return(objWorkFlowProcessMessage);
            }
        }