/// <summary> /// 获得数据列表 /// </summary> public List <Hownet.Model.ClothAmount> DataTableToList(DataTable dt) { List <Hownet.Model.ClothAmount> modelList = new List <Hownet.Model.ClothAmount>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Hownet.Model.ClothAmount model; for (int n = 0; n < rowsCount; n++) { model = new Hownet.Model.ClothAmount(); if (dt.Rows[n]["ID"] != null && dt.Rows[n]["ID"].ToString() != "") { model.ID = int.Parse(dt.Rows[n]["ID"].ToString()); } if (dt.Rows[n]["MainID"] != null && dt.Rows[n]["MainID"].ToString() != "") { model.MainID = int.Parse(dt.Rows[n]["MainID"].ToString()); } model.BoxNum = dt.Rows[n]["BoxNum"].ToString(); if (dt.Rows[n]["ColorID"] != null && dt.Rows[n]["ColorID"].ToString() != "") { model.ColorID = int.Parse(dt.Rows[n]["ColorID"].ToString()); } model.ColorName = dt.Rows[n]["ColorName"].ToString(); if (dt.Rows[n]["BrandID"] != null && dt.Rows[n]["BrandID"].ToString() != "") { model.BrandID = int.Parse(dt.Rows[n]["BrandID"].ToString()); } model.BrandName = dt.Rows[n]["BrandName"].ToString(); model.Size1 = dt.Rows[n]["Size1"].ToString(); model.Size2 = dt.Rows[n]["Size2"].ToString(); model.Size3 = dt.Rows[n]["Size3"].ToString(); model.Size4 = dt.Rows[n]["Size4"].ToString(); model.Size5 = dt.Rows[n]["Size5"].ToString(); model.Size6 = dt.Rows[n]["Size6"].ToString(); model.Size7 = dt.Rows[n]["Size7"].ToString(); model.Size8 = dt.Rows[n]["Size8"].ToString(); model.Size9 = dt.Rows[n]["Size9"].ToString(); model.Size10 = dt.Rows[n]["Size10"].ToString(); model.Size11 = dt.Rows[n]["Size11"].ToString(); model.Size12 = dt.Rows[n]["Size12"].ToString(); model.Size13 = dt.Rows[n]["Size13"].ToString(); model.Size14 = dt.Rows[n]["Size14"].ToString(); model.Size15 = dt.Rows[n]["Size15"].ToString(); model.SumAmount = dt.Rows[n]["SumAmount"].ToString(); modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Hownet.Model.ClothAmount model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Hownet.Model.ClothAmount model) { return(dal.Add(model)); }