Пример #1
0
        private CoupletEntity DataRowToModel(DataRow row)
        {
            CoupletEntity model = null;

            if (row != null)
            {
                model = new CoupletEntity();
                if (row["CoupletID"] != null && row["CoupletID"].ToString() != "")
                {
                    model.CoupletID = int.Parse(row["CoupletID"].ToString());
                }
                if (row["CoupletContentTypeID"] != null && row["CoupletContentTypeID"].ToString() != "")
                {
                    model.CoupletContentTypeID = int.Parse(row["CoupletContentTypeID"].ToString());
                }
                if (row["CoupletContent"] != null)
                {
                    model.CoupletContent = row["CoupletContent"].ToString();
                }
                if (row["OrderBy"] != null && row["OrderBy"].ToString() != "")
                {
                    model.OrderBy = int.Parse(row["OrderBy"].ToString());
                }
                if (row["StateTypeID"] != null && row["StateTypeID"].ToString() != "")
                {
                    model.StateTypeID = int.Parse(row["StateTypeID"].ToString());
                }
                if (row["CoupletTypeID"] != null && row["CoupletTypeID"].ToString() != "")
                {
                    model.CoupletTypeID = int.Parse(row["CoupletTypeID"].ToString());
                }
            }
            return(model);
        }
Пример #2
0
        /// <summary>
        /// 获取对联对象
        /// </summary>
        /// <returns></returns>
        public List <CoupletEntity> GetCoupletList()
        {
            List <CoupletEntity> list  = null;
            DataTable            table = this.GetCoupletTable();

            if (table != null)
            {
                list = new List <CoupletEntity>();
                foreach (DataRow dr in table.Rows)
                {
                    CoupletEntity item = DataRowToModel(dr);
                    list.Add(item);
                }
            }
            return(list);
        }