/// <summary> /// 获得数据列表 /// </summary> public List <ZhangWei.Model.EnterStock> DataTableToList(DataTable dt) { List <ZhangWei.Model.EnterStock> modelList = new List <ZhangWei.Model.EnterStock>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { ZhangWei.Model.EnterStock model; for (int n = 0; n < rowsCount; n++) { model = new ZhangWei.Model.EnterStock(); if (dt.Rows[n]["EnterStock_ID"] != null && dt.Rows[n]["EnterStock_ID"].ToString() != "") { model.EnterStock_ID = int.Parse(dt.Rows[n]["EnterStock_ID"].ToString()); } if (dt.Rows[n]["EnterDate"] != null && dt.Rows[n]["EnterDate"].ToString() != "") { model.EnterDate = DateTime.Parse(dt.Rows[n]["EnterDate"].ToString()); } if (dt.Rows[n]["Dept_ID"] != null && dt.Rows[n]["Dept_ID"].ToString() != "") { model.Dept_ID = int.Parse(dt.Rows[n]["Dept_ID"].ToString()); } if (dt.Rows[n]["StoreHouse_ID"] != null && dt.Rows[n]["StoreHouse_ID"].ToString() != "") { model.StoreHouse_ID = int.Parse(dt.Rows[n]["StoreHouse_ID"].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()); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(ZhangWei.Model.EnterStock model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(ZhangWei.Model.EnterStock model) { return(dal.Add(model)); }