Ejemplo n.º 1
0
        public List <DataDetail> ConvertDataTableToListDetail(DataTable dt)
        {
            PropertyInfo[] AllProps;

            int i = 0;

            AllProps = new DataDetail().GetType().GetProperties();
            List <DataDetail> lDetail = new List <DataDetail>();
            DataDetail        dD;

            foreach (DataRow dr in dt.Rows)
            {
                dD = new DataDetail();
                i  = 0;
                foreach (PropertyInfo PropA in AllProps)
                {
                    PropA.SetValue(dD, dr[i], null);
                    i++;
                }
                lDetail.Add(dD);
            }
            return(lDetail);
        }
Ejemplo n.º 2
0
        public List <DataHeader> ConvertDataTableToListHeader(DataTable dt)
        {
            PropertyInfo[] AllProps;

            int i = 0;

            AllProps = new DataHeader().GetType().GetProperties();
            List <DataHeader> lHead = new List <DataHeader>();
            DataHeader        dH;

            foreach (DataRow dr in dt.Rows)
            {
                dH = new DataHeader();
                i  = 0;
                foreach (PropertyInfo PropA in AllProps)
                {
                    PropA.SetValue(dH, dr[i], null);
                    i++;
                }
                lHead.Add(dH);
            }
            return(lHead);
        }