/// <summary> /// 增加一条数据 /// </summary> public int Add(Hownet.Model.PlanUseRep model) { return(dal.Add(model)); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(Hownet.Model.PlanUseRep model) { dal.Update(model); }
/// <summary> /// 获得数据列表 /// </summary> public List <Hownet.Model.PlanUseRep> DataTableToList(DataTable dt) { List <Hownet.Model.PlanUseRep> modelList = new List <Hownet.Model.PlanUseRep>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Hownet.Model.PlanUseRep model; for (int n = 0; n < rowsCount; n++) { model = new Hownet.Model.PlanUseRep(); if (dt.Rows[n]["ID"].ToString() != "") { model.ID = int.Parse(dt.Rows[n]["ID"].ToString()); } else { model.ID = 0; } if (dt.Rows[n]["RelatedID"].ToString() != "") { model.RelatedID = int.Parse(dt.Rows[n]["RelatedID"].ToString()); } else { model.RelatedID = 0; } if (dt.Rows[n]["Amount"].ToString() != "") { model.Amount = decimal.Parse(dt.Rows[n]["Amount"].ToString()); } else { model.Amount = 0; } if (dt.Rows[n]["DemandID"].ToString() != "") { model.DemandID = int.Parse(dt.Rows[n]["DemandID"].ToString()); } else { model.DemandID = 0; } if (dt.Rows[n]["TypeID"].ToString() != "") { model.TypeID = int.Parse(dt.Rows[n]["TypeID"].ToString()); } else { model.TypeID = 0; } if (dt.Rows[n]["MListID"].ToString() != "") { model.MListID = int.Parse(dt.Rows[n]["MListID"].ToString()); } else { model.MListID = 0; } if (dt.Rows[n]["TaskID"].ToString() != "") { model.TaskID = int.Parse(dt.Rows[n]["TaskID"].ToString()); } else { model.TaskID = 0; } if (dt.Rows[n]["StockInfoID"].ToString() != "") { model.StockInfoID = int.Parse(dt.Rows[n]["StockInfoID"].ToString()); } else { model.StockInfoID = 0; } if (dt.Rows[n]["NotAmount"].ToString() != "") { model.NotAmount = decimal.Parse(dt.Rows[n]["NotAmount"].ToString()); } else { model.NotAmount = 0; } if (dt.Rows[n]["IsEnd"].ToString() != "") { model.IsEnd = int.Parse(dt.Rows[n]["IsEnd"].ToString()); } else { model.IsEnd = 0; } model.A = int.Parse(dt.Rows[n]["A"].ToString()); modelList.Add(model); } } return(modelList); }