/// <summary> /// 获得数据列表 /// </summary> public List <Hownet.Model.MoneyList> DataTableToList(DataTable dt) { List <Hownet.Model.MoneyList> modelList = new List <Hownet.Model.MoneyList>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Hownet.Model.MoneyList model; for (int n = 0; n < rowsCount; n++) { model = new Hownet.Model.MoneyList(); if (dt.Rows[n]["ID"] != null && dt.Rows[n]["ID"].ToString() != "") { model.ID = int.Parse(dt.Rows[n]["ID"].ToString()); } if (dt.Rows[n]["KJKMID"] != null && dt.Rows[n]["KJKMID"].ToString() != "") { model.KJKMID = int.Parse(dt.Rows[n]["KJKMID"].ToString()); } if (dt.Rows[n]["DateTime"] != null && dt.Rows[n]["DateTime"].ToString() != "") { model.DateTime = DateTime.Parse(dt.Rows[n]["DateTime"].ToString()); } if (dt.Rows[n]["InMoney"] != null && dt.Rows[n]["InMoney"].ToString() != "") { model.InMoney = decimal.Parse(dt.Rows[n]["InMoney"].ToString()); } if (dt.Rows[n]["OutMoney"] != null && dt.Rows[n]["OutMoney"].ToString() != "") { model.OutMoney = decimal.Parse(dt.Rows[n]["OutMoney"].ToString()); } if (dt.Rows[n]["Money"] != null && dt.Rows[n]["Money"].ToString() != "") { model.Money = decimal.Parse(dt.Rows[n]["Money"].ToString()); } if (dt.Rows[n]["TableID"] != null && dt.Rows[n]["TableID"].ToString() != "") { model.TableID = int.Parse(dt.Rows[n]["TableID"].ToString()); } if (dt.Rows[n]["TypeID"] != null && dt.Rows[n]["TypeID"].ToString() != "") { model.TypeID = int.Parse(dt.Rows[n]["TypeID"].ToString()); } model.Remark = dt.Rows[n]["Remark"].ToString(); modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Hownet.Model.MoneyList model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Hownet.Model.MoneyList model) { return(dal.Add(model)); }