Exemplo n.º 1
0
 public static object GetValue(object dat, string property, ref bool propIsfound)
 {
     if (dat == null)
     {
         propIsfound = false;
         return(null);
     }
     else
     {
         propIsfound = true;
         Type    datType = dat.GetType();
         varInfo var     = GetVar(datType, property.ToUpper());
         if (var == null)
         {
             propIsfound = false;
             return(ProxyInfo.GetPropValue(dat, property, ref propIsfound));
         }
         try
         {
             Result result = doEval(dat, var.Item);
             if (result.HasError)
             {
                 return(result.Error);
             }
             else
             {
                 return(result.Value);
             }
         }
         catch
         {
             return(var.err);
         }
     }
 }
Exemplo n.º 2
0
        public itemInfo[] AppendGroups(itemInfo[] items, object dat)
        {
            List <itemInfo> new_items = new List <itemInfo>(items);
            Dictionary <string, ReportGroup> groups = new Dictionary <string, ReportGroup>();

            foreach (itemInfo item in new_items)
            {
                foreach (KeyValuePair <string, ReportGroup> group in groups)
                {
                    if (item.group != FOOTER && item.group != HEADER && (Common.IsNullOrEmpty(item.group) || !groups.ContainsKey(item.group)))
                    {
                        group.Value.RestItems.Add(item);
                    }
                }
                if (!Common.IsNullOrEmpty(item.group) /*&& dat is IDatInfo*/ && item.group != FOOTER && item.group != HEADER)
                {
                    try
                    {
                        if (!groups.ContainsKey(item.group))
                        {
                            object        vals = ProxyInfo.GetPropValue(dat, item.group);
                            List <object> lst  = new List <object>();
                            if (vals is BaseSet)
                            {
                                lst.AddRange(((BaseSet)vals).ToArray());
                            }
                            else if (vals is Array)
                            {
                                lst.AddRange(vals as object[]);
                            }
                            else
                            {
                                lst.Add(vals);
                            }
                            groups.Add(item.group, new ReportGroup(item.group, new_items, lst));
                        }
                        groups[item.group].TemplateItems.Add(item);
                    }
                    catch (Exception exp)
                    {
                        string str = exp.Message;
                    }
                }
            }
            foreach (KeyValuePair <string, ReportGroup> group in groups)
            {
                group.Value.Fill();
            }
            return(new_items.ToArray());
        }