Пример #1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <EtNet_Models.TargetType> DataTableToList(DataTable dt)
        {
            List <EtNet_Models.TargetType> modelList = new List <EtNet_Models.TargetType>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                EtNet_Models.TargetType model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new EtNet_Models.TargetType();
                    if (dt.Rows[n]["TargetTypeID"] != null && dt.Rows[n]["TargetTypeID"].ToString() != "")
                    {
                        model.TargetTypeID = int.Parse(dt.Rows[n]["TargetTypeID"].ToString());
                    }
                    if (dt.Rows[n]["TypeNo"] != null && dt.Rows[n]["TypeNo"].ToString() != "")
                    {
                        model.TypeNo = dt.Rows[n]["TypeNo"].ToString();
                    }
                    if (dt.Rows[n]["TypeName"] != null && dt.Rows[n]["TypeName"].ToString() != "")
                    {
                        model.TypeName = dt.Rows[n]["TypeName"].ToString();
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Пример #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(EtNet_Models.TargetType model)
 {
     return(dal.Update(model));
 }
Пример #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(EtNet_Models.TargetType model)
 {
     return(dal.Add(model));
 }