Beispiel #1
0
        private void AttachParams(BaseDetail detail)
        {
            if (detail == null || m_map == null)
            {
                throw new Exception(ErrorConstants.NoDetailNoMap);
            }
            DetachParams();
            Type dettype = detail.GetType();

            FieldInfo[]  mapflds = m_map.GetType().GetFields(EnumConstants.GetField);
            PropertyInfo pi;

            foreach (FieldInfo fld in mapflds)
            {
                pi = dettype.GetProperty(fld.Name);
                if (pi != null)
                {
                    SetParameter(fld.GetValue(m_map), pi.GetValue(detail, null));
                }
            }
        }
Beispiel #2
0
        private Hashtable GetFields(IBaseMap mapinstance, bool isswap)
        {
            if (mapinstance == null)
            {
                throw new Exception(ErrorConstants.NoDetailNoMap);
            }
            FieldInfo[] mapflds = mapinstance.GetType().GetFields(EnumConstants.GetField);
            Hashtable   ht      = new Hashtable();

            foreach (FieldInfo fld in mapflds)
            {
                if (isswap)
                {
                    ht.Add(fld.GetValue(mapinstance), fld.Name);
                }
                else
                {
                    ht.Add(fld.Name, fld.GetValue(mapinstance));
                }
            }
            return(ht);
        }