/// <summary> /// 获得数据列表 /// </summary> public List <Hownet.Model.SampleMateriel> DataTableToList(DataTable dt) { List <Hownet.Model.SampleMateriel> modelList = new List <Hownet.Model.SampleMateriel>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Hownet.Model.SampleMateriel model; for (int n = 0; n < rowsCount; n++) { model = new Hownet.Model.SampleMateriel(); if (dt.Rows[n]["ID"].ToString() != "") { model.ID = int.Parse(dt.Rows[n]["ID"].ToString()); } else { model.ID = 0; } if (dt.Rows[n]["MainID"].ToString() != "") { model.MainID = int.Parse(dt.Rows[n]["MainID"].ToString()); } else { model.MainID = 0; } model.Fabric1 = dt.Rows[n]["Fabric1"].ToString(); model.Fabric2 = dt.Rows[n]["Fabric2"].ToString(); model.Fabric3 = dt.Rows[n]["Fabric3"].ToString(); model.Fabric4 = dt.Rows[n]["Fabric4"].ToString(); model.Fabric5 = dt.Rows[n]["Fabric5"].ToString(); model.Materiel1 = dt.Rows[n]["Materiel1"].ToString(); model.Materiel2 = dt.Rows[n]["Materiel2"].ToString(); model.Materiel3 = dt.Rows[n]["Materiel3"].ToString(); model.Materiel4 = dt.Rows[n]["Materiel4"].ToString(); model.Materiel5 = dt.Rows[n]["Materiel5"].ToString(); model.Materiel6 = dt.Rows[n]["Materiel6"].ToString(); model.Materiel7 = dt.Rows[n]["Materiel7"].ToString(); model.Company1 = dt.Rows[n]["Company1"].ToString(); model.LH1 = dt.Rows[n]["LH1"].ToString(); model.Plant1 = dt.Rows[n]["Plant1"].ToString(); model.Company2 = dt.Rows[n]["Company2"].ToString(); model.LH2 = dt.Rows[n]["LH2"].ToString(); model.Plant2 = dt.Rows[n]["Plant2"].ToString(); model.SumAmount = dt.Rows[n]["SumAmount"].ToString(); model.A = int.Parse(dt.Rows[n]["A"].ToString()); modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(Hownet.Model.SampleMateriel model) { dal.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Hownet.Model.SampleMateriel model) { return(dal.Add(model)); }