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