/// <summary> /// 获得数据列表 /// </summary> public List <Hownet.Model.SizePart> DataTableToList(DataTable dt) { List <Hownet.Model.SizePart> modelList = new List <Hownet.Model.SizePart>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Hownet.Model.SizePart model; for (int n = 0; n < rowsCount; n++) { model = new Hownet.Model.SizePart(); if (dt.Rows[n]["ID"].ToString() != "") { model.ID = int.Parse(dt.Rows[n]["ID"].ToString()); } else { model.ID = 0; } model.Name = dt.Rows[n]["Name"].ToString(); model.Remark = dt.Rows[n]["Remark"].ToString(); model.EnName = dt.Rows[n]["EnName"].ToString(); if (dt.Rows[n]["IsEnd"].ToString() != "") { model.IsEnd = int.Parse(dt.Rows[n]["IsEnd"].ToString()); } else { model.IsEnd = 0; } model.Tolerance = dt.Rows[n]["Tolerance"].ToString(); model.A = int.Parse(dt.Rows[n]["A"].ToString()); modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(Hownet.Model.SizePart model) { dal.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Hownet.Model.SizePart model) { return(dal.Add(model)); }