private void ExecuteEntity(ITransactionEntity entity)
        {
            var beforeExecution = entity as IBeforeExecution;

            beforeExecution?.BeforeExecution();

            var inputExecute = entity as IInputExecute;

            inputExecute?.Execute(Current);

            var outputExecute = entity as IOutputExecute;

            Current = outputExecute?.Execute() ?? Current;

            var ioExecute = entity as IIOExecute;

            Current = ioExecute?.Execute(Current) ?? Current;

            var voidExecute = entity as IExecute;

            voidExecute?.Execute();

            var afterExecution = entity as IAfterExecution;

            afterExecution?.AfterExecution();
        }
Beispiel #2
0
        protected void SetGridDisplay()
        {
            if (this.response.TransactionResult is List <ITransactionEntity> )
            {
                List <Dictionary <string, object> > gcd = new List <Dictionary <string, object> >();
                ITransactionEntity entity = this.MainEntitySample;

                entity.GetType().GetProperties().ToList()
                .Where(p => p.GetCustomAttributes(typeof(DisplayProperty), true).Any())
                .ToList().ForEach(delegate(PropertyInfo pi)
                {
                    DisplayProperty dp = pi.GetCustomAttribute <DisplayProperty>();
                    Dictionary <string, object> dic = new Dictionary <string, object>();
                    dic.Add("text", dp.Text);
                    dic.Add("dataField", dp.DataField);
                    dic.Add("sort", dp.Sort);
                    dic.Add("columnOrder", dp.DisplayOrder);
                    dic.Add("align", dp.Align ?? "right");

                    if (dp.Filter)
                    {
                        dic.Add("filterType", pi.PropertyType.Name);
                    }

                    if (!string.IsNullOrWhiteSpace(dp.ColumnWidth))
                    {
                        dic.Add("columnWidth", dp.ColumnWidth);
                    }

                    gcd.Add(dic);
                });
                ;
                response.GridDisplayMembers = gcd.OrderBy(d => Convert.ToInt32(d["columnOrder"])).ToList();
            }
        }
Beispiel #3
0
        public void Validate()
        {
            ITransactionEntity last = _entities.Last();

            if (last is IExecute || last is IInputExecute)
            {
                throw new WrongSuccessionException();
            }
        }
        public void Validate()
        {
            ITransactionEntity last = _entities.Last();

            if (!(last is IOutputExecute <TRequiredOutput>) && !HasRightOutput(last))
            {
                throw new WrongSuccessionException();
            }
        }
        private void RollbackExecutedEntities(ITransactionEntity failed)
        {
            int failedIndex = _entities.IndexOf(failed);

            for (int index = failedIndex; index >= 0; index--)
            {
                IRollback foundStep = _entities[index] as IRollback;
                foundStep?.Rollback();
            }
        }
Beispiel #6
0
        public void Validate()
        {
            ITransactionEntity last = _entities.Last();

            if (last is IOutputExecute || last is IIOExecute)
            {
                var message = "The transaction you try to execute contains a wrong last step. " +
                              "Input transactions can end only with a non output step.";

                throw new WrongSuccessionException(message);
            }
        }
Beispiel #7
0
        public void Validate()
        {
            ITransactionEntity last = _entities.Last();

            if (last is IIOExecute || last is IOutputExecute)
            {
                IEnumerable <Type> arguments = last.GetType().GetGenericArguments();

                if (arguments.Last() != typeof(TRequiredOutput))
                {
                    throw new WrongSuccessionException();
                }
            }
        }
        private bool HasRightOutput(ITransactionEntity entity)
        {
            if (entity is IIOExecute)
            {
                IEnumerable <Type> arguments = entity.GetType().GetGenericArguments();

                if (arguments.Last() == typeof(TRequiredOutput))
                {
                    return(true);
                }
            }

            return(false);
        }
        private async Task <bool> LogRouting(IPayload payload)
        {
            bool isSuccess = false;

            try
            {
                switch (payload.LogType)
                {
                case LogType.Application:
                    IApplicationEntity applicationEntity = (IApplicationEntity)payload.Payload;
                    break;

                case LogType.MessageQueue:
                    IMessageQueueEntity messageQueueEntity = (IMessageQueueEntity)payload.Payload;
                    break;

                case LogType.RelationalDatabase:
                    IRelationalDatabaseEntity relationalDatabaseEntity = (IRelationalDatabaseEntity)payload.Payload;
                    break;

                case LogType.Transaction:
                    ITransactionEntity transactionEntity = (ITransactionEntity)payload.Payload;
                    if (transactionEntity.TrasactionType == TransactionType.External)
                    {
                    }
                    else
                    {
                    }
                    break;
                }

                isSuccess = true;
                return(isSuccess);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return(isSuccess);
            }
        }
Beispiel #10
0
        /// <summary>
        /// Convert Internal/External transaction object to json
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public byte[] MessageConversion(ITransactionEntity entity)
        {
            var json = JsonConvert.SerializeObject(entity);

            return(MessageFormatting(json));
        }
Beispiel #11
0
 public TransactionDeposit(ITransactionEntity entity, ItransactionItem item)
 {
     _entity = entity;
     _item   = item;
 }
 public Task <bool> InsertTransactionLog(ITransactionEntity transactionEntity)
 {
     throw new System.NotImplementedException();
 }