/// <summary> /// 获得数据列表 /// </summary> public List <Hownet.Model.SumReportInfo> DataTableToList(DataTable dt) { List <Hownet.Model.SumReportInfo> modelList = new List <Hownet.Model.SumReportInfo>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Hownet.Model.SumReportInfo model; for (int n = 0; n < rowsCount; n++) { model = new Hownet.Model.SumReportInfo(); if (dt.Rows[n]["ID"] != null && dt.Rows[n]["ID"].ToString() != "") { model.ID = int.Parse(dt.Rows[n]["ID"].ToString()); } if (dt.Rows[n]["MainID"] != null && dt.Rows[n]["MainID"].ToString() != "") { model.MainID = int.Parse(dt.Rows[n]["MainID"].ToString()); } if (dt.Rows[n]["ColorID"] != null && dt.Rows[n]["ColorID"].ToString() != "") { model.ColorID = int.Parse(dt.Rows[n]["ColorID"].ToString()); } if (dt.Rows[n]["ColorOneID"] != null && dt.Rows[n]["ColorOneID"].ToString() != "") { model.ColorOneID = int.Parse(dt.Rows[n]["ColorOneID"].ToString()); } if (dt.Rows[n]["ColorTwoID"] != null && dt.Rows[n]["ColorTwoID"].ToString() != "") { model.ColorTwoID = int.Parse(dt.Rows[n]["ColorTwoID"].ToString()); } if (dt.Rows[n]["SizeID"] != null && dt.Rows[n]["SizeID"].ToString() != "") { model.SizeID = int.Parse(dt.Rows[n]["SizeID"].ToString()); } if (dt.Rows[n]["LastAmount"] != null && dt.Rows[n]["LastAmount"].ToString() != "") { model.LastAmount = decimal.Parse(dt.Rows[n]["LastAmount"].ToString()); } if (dt.Rows[n]["InAmount"] != null && dt.Rows[n]["InAmount"].ToString() != "") { model.InAmount = decimal.Parse(dt.Rows[n]["InAmount"].ToString()); } if (dt.Rows[n]["OutAmount"] != null && dt.Rows[n]["OutAmount"].ToString() != "") { model.OutAmount = decimal.Parse(dt.Rows[n]["OutAmount"].ToString()); } if (dt.Rows[n]["Amount"] != null && dt.Rows[n]["Amount"].ToString() != "") { model.Amount = decimal.Parse(dt.Rows[n]["Amount"].ToString()); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Hownet.Model.SumReportInfo model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Hownet.Model.SumReportInfo model) { return(dal.Add(model)); }