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(); } }
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); }