public List <Chain.Model.GoodsLog> DataTableToList(DataTable dt) { List <Chain.Model.GoodsLog> modelList = new List <Chain.Model.GoodsLog>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { for (int i = 0; i < rowsCount; i++) { Chain.Model.GoodsLog model = new Chain.Model.GoodsLog(); if (dt.Rows[i]["ID"] != null && dt.Rows[i]["ID"].ToString() != "") { model.ID = int.Parse(dt.Rows[i]["ID"].ToString()); } if (dt.Rows[i]["GoodsAccount"] != null && dt.Rows[i]["GoodsAccount"].ToString() != "") { model.GoodsAccount = dt.Rows[i]["GoodsAccount"].ToString(); } if (dt.Rows[i]["Type"] != null && dt.Rows[i]["Type"].ToString() != "") { model.Type = int.Parse(dt.Rows[i]["Type"].ToString()); } if (dt.Rows[i]["GoodsID"] != null && dt.Rows[i]["GoodsID"].ToString() != "") { model.GoodsID = int.Parse(dt.Rows[i]["GoodsID"].ToString()); } if (dt.Rows[i]["TotalPrice"] != null && dt.Rows[i]["TotalPrice"].ToString() != "") { model.TotalPrice = decimal.Parse(dt.Rows[i]["TotalPrice"].ToString()); } if (dt.Rows[i]["GoodsNumber"] != null && dt.Rows[i]["GoodsNumber"].ToString() != "") { model.GoodsNumber = int.Parse(dt.Rows[i]["GoodsNumber"].ToString()); } if (dt.Rows[i]["Remark"] != null && dt.Rows[i]["Remark"].ToString() != "") { model.Remark = dt.Rows[i]["Remark"].ToString(); } if (dt.Rows[i]["CreateTime"] != null && dt.Rows[i]["CreateTime"].ToString() != "") { model.CreateTime = DateTime.Parse(dt.Rows[i]["CreateTime"].ToString()); } if (dt.Rows[i]["ShopID"] != null && dt.Rows[i]["ShopID"].ToString() != "") { model.ShopID = int.Parse(dt.Rows[i]["ShopID"].ToString()); } if (dt.Rows[i]["UserID"] != null && dt.Rows[i]["UserID"].ToString() != "") { model.UserID = int.Parse(dt.Rows[i]["UserID"].ToString()); } if (dt.Rows[i]["ChangeShopID"] != null && dt.Rows[i]["ChangeShopID"].ToString() != "") { model.ChangeShopID = int.Parse(dt.Rows[i]["ChangeShopID"].ToString()); } modelList.Add(model); } } return(modelList); }
public bool Update(Chain.Model.GoodsLog model) { return(this.dal.Update(model)); }
public int Add(Chain.Model.GoodsLog model) { return(this.dal.Add(model)); }