/// <summary> /// 获得数据列表 /// </summary> public List <Hownet.Model.Accounts> DataTableToList(DataTable dt) { List <Hownet.Model.Accounts> modelList = new List <Hownet.Model.Accounts>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Hownet.Model.Accounts model; for (int n = 0; n < rowsCount; n++) { model = new Hownet.Model.Accounts(); 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()); } model.Sn = dt.Rows[n]["Sn"].ToString(); model.Name = dt.Rows[n]["Name"].ToString(); if (dt.Rows[n]["TypeID"].ToString() != "") { model.TypeID = int.Parse(dt.Rows[n]["TypeID"].ToString()); } if (dt.Rows[n]["PrantID"].ToString() != "") { model.PrantID = int.Parse(dt.Rows[n]["PrantID"].ToString()); } if (dt.Rows[n]["CompanyID"] != null && dt.Rows[n]["CompanyID"].ToString() != "") { model.CompanyID = int.Parse(dt.Rows[n]["CompanyID"].ToString()); } if (dt.Rows[n]["Money"] != null && dt.Rows[n]["Money"].ToString() != "") { model.Money = decimal.Parse(dt.Rows[n]["Money"].ToString()); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Hownet.Model.Accounts model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Hownet.Model.Accounts model) { return(dal.Add(model)); }