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