Ejemplo n.º 1
0
 public string RenderHeader(int headerDeep)
 {
     var th = new TagBuilder("th");
     if (!ColumnWidth.IsNullOrEmpty())
     {
         th.Attributes.Add("style", "width:" + ColumnWidth);
     }
     if (ColumnName.IsNullOrEmpty())
     {
         ColumnName = FieldName;
     }
     if (Sortable)
     {
         th.InnerHtml = "<a href=\"javascript:void(0);\" sortField=\"" + FieldName + "\" >" + ColumnName + "</a>";
     }
     else
     {
         th.InnerHtml = ColumnName;
     }
     if (Children.IsNullOrEmpty())
     {
         th.Attributes.Add("rowspan", headerDeep.ToString());
     }
     else
     {
         th.Attributes.Add("colspan", Colspan.ToString());
     }
     return th.ToString();
 }
Ejemplo n.º 2
0
        public override bool Filter(IDictionary <string, object> data)
        {
            if (ColumnName.IsNullOrEmpty())
            {
                throw new FoxOneException("ColumnName_Is_Empty");
            }
            bool result = true;

            if (data.IsNullOrEmpty())
            {
                result = false;
            }
            else
            {
                if (AppendType == FilterAppendType.NotNullOrEmpty)
                {
                    if (Value.IsNullOrEmpty())
                    {
                        return(true);
                    }
                }
                if (data.Keys.Contains(ColumnName, StringComparer.OrdinalIgnoreCase))
                {
                    var    columnOperator = AllColumnOperator.OperatorMapping[Operator];
                    var    obj1           = data[ColumnName];
                    object obj2;
                    if (Value.IsNotNullOrEmpty() && Env.TryResolve(Value, out obj2))
                    {
                        if (AppendType == FilterAppendType.NotNullOrEmpty)
                        {
                            if (obj2 == null || obj2.ToString().IsNullOrEmpty())
                            {
                                return(true);
                            }
                        }
                        result = columnOperator.Operate(obj1, obj2);
                    }
                    else
                    {
                        result = columnOperator.Operate(obj1, Value);
                    }
                }
            }
            return(result);
        }