/// <summary> /// 获得数据列表 /// </summary> public List <ZhangWei.Model.ProductSpec> DataTableToList(DataTable dt) { List <ZhangWei.Model.ProductSpec> modelList = new List <ZhangWei.Model.ProductSpec>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { ZhangWei.Model.ProductSpec model; for (int n = 0; n < rowsCount; n++) { model = new ZhangWei.Model.ProductSpec(); if (dt.Rows[n]["ProductSpec_ID"] != null && dt.Rows[n]["ProductSpec_ID"].ToString() != "") { model.ProductSpec_ID = int.Parse(dt.Rows[n]["ProductSpec_ID"].ToString()); } if (dt.Rows[n]["Name"] != null && dt.Rows[n]["Name"].ToString() != "") { model.Name = dt.Rows[n]["Name"].ToString(); } if (dt.Rows[n]["Employee_ID"] != null && dt.Rows[n]["Employee_ID"].ToString() != "") { model.Employee_ID = int.Parse(dt.Rows[n]["Employee_ID"].ToString()); } if (dt.Rows[n]["CreateDate"] != null && dt.Rows[n]["CreateDate"].ToString() != "") { model.CreateDate = DateTime.Parse(dt.Rows[n]["CreateDate"].ToString()); } if (dt.Rows[n]["Remark"] != null && dt.Rows[n]["Remark"].ToString() != "") { model.Remark = dt.Rows[n]["Remark"].ToString(); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(ZhangWei.Model.ProductSpec model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(ZhangWei.Model.ProductSpec model) { return(dal.Add(model)); }