/// <summary> /// 获得数据列表 /// </summary> public List <Dianda.Model.Cash_CardsDetail> DataTableToList(DataTable dt) { List <Dianda.Model.Cash_CardsDetail> modelList = new List <Dianda.Model.Cash_CardsDetail>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Dianda.Model.Cash_CardsDetail model; for (int n = 0; n < rowsCount; n++) { model = new Dianda.Model.Cash_CardsDetail(); if (dt.Rows[n]["ID"] != null && dt.Rows[n]["ID"].ToString() != "") { model.ID = int.Parse(dt.Rows[n]["ID"].ToString()); } if (dt.Rows[n]["CardID"] != null && dt.Rows[n]["CardID"].ToString() != "") { model.CardID = int.Parse(dt.Rows[n]["CardID"].ToString()); } if (dt.Rows[n]["DetailID"] != null && dt.Rows[n]["DetailID"].ToString() != "") { model.DetailID = int.Parse(dt.Rows[n]["DetailID"].ToString()); } if (dt.Rows[n]["Balance"] != null && dt.Rows[n]["Balance"].ToString() != "") { model.Balance = decimal.Parse(dt.Rows[n]["Balance"].ToString()); } if (dt.Rows[n]["Unit"] != null && dt.Rows[n]["Unit"].ToString() != "") { model.Unit = int.Parse(dt.Rows[n]["Unit"].ToString()); } if (dt.Rows[n]["TypesName"] != null && dt.Rows[n]["TypesName"].ToString() != "") { model.TypesName = dt.Rows[n]["TypesName"].ToString(); } if (dt.Rows[n]["Oldbalance"] != null && dt.Rows[n]["Oldbalance"].ToString() != "") { model.Oldbalance = decimal.Parse(dt.Rows[n]["Oldbalance"].ToString()); } if (dt.Rows[n]["KYbalance"] != null && dt.Rows[n]["KYbalance"].ToString() != "") { model.KYbalance = decimal.Parse(dt.Rows[n]["KYbalance"].ToString()); } if (dt.Rows[n]["DetailName"] != null && dt.Rows[n]["DetailName"].ToString() != "") { model.DetailName = dt.Rows[n]["DetailName"].ToString(); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Dianda.Model.Cash_CardsDetail model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Dianda.Model.Cash_CardsDetail model) { return(dal.Add(model)); }