/// <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); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(EtNet_Models.TargetType model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(EtNet_Models.TargetType model) { return(dal.Add(model)); }