コード例 #1
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();
            }
        }
コード例 #2
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();
                }
            }
        }
コード例 #3
0
        private bool HasRightOutput(ITransactionEntity entity)
        {
            if (entity is IIOExecute)
            {
                IEnumerable <Type> arguments = entity.GetType().GetGenericArguments();

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

            return(false);
        }