/// <summary> /// 获得数据列表 /// </summary> public List <Hownet.Model.VouchersInfo> DataTableToList(DataTable dt) { List <Hownet.Model.VouchersInfo> modelList = new List <Hownet.Model.VouchersInfo>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Hownet.Model.VouchersInfo model; for (int n = 0; n < rowsCount; n++) { model = new Hownet.Model.VouchersInfo(); if (dt.Rows[n]["A"].ToString() != "") { model.A = int.Parse(dt.Rows[n]["A"].ToString()); } if (dt.Rows[n]["ID"].ToString() != "") { model.ID = int.Parse(dt.Rows[n]["ID"].ToString()); } if (dt.Rows[n]["MainID"].ToString() != "") { model.MainID = int.Parse(dt.Rows[n]["MainID"].ToString()); } model.Summary = dt.Rows[n]["Summary"].ToString(); if (dt.Rows[n]["AccountsOne"].ToString() != "") { model.AccountsOne = int.Parse(dt.Rows[n]["AccountsOne"].ToString()); } if (dt.Rows[n]["AccountsTwo"].ToString() != "") { model.AccountsTwo = int.Parse(dt.Rows[n]["AccountsTwo"].ToString()); } if (dt.Rows[n]["DebitMoney"].ToString() != "") { model.DebitMoney = decimal.Parse(dt.Rows[n]["DebitMoney"].ToString()); } if (dt.Rows[n]["CreditMoney"].ToString() != "") { model.CreditMoney = decimal.Parse(dt.Rows[n]["CreditMoney"].ToString()); } if (dt.Rows[n]["IsPosting"].ToString() != "") { if ((dt.Rows[n]["IsPosting"].ToString() == "1") || (dt.Rows[n]["IsPosting"].ToString().ToLower() == "true")) { model.IsPosting = true; } else { model.IsPosting = false; } } model.AOne = dt.Rows[n]["AOne"].ToString(); model.ATwo = dt.Rows[n]["ATwo"].ToString(); modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Hownet.Model.VouchersInfo model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Hownet.Model.VouchersInfo model) { return(dal.Add(model)); }