/// <summary> /// 获得数据列表 /// </summary> public List <EtNet_Models.ProdClass> DataTableToList(DataTable dt) { List <EtNet_Models.ProdClass> modelList = new List <EtNet_Models.ProdClass>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { EtNet_Models.ProdClass model; for (int n = 0; n < rowsCount; n++) { model = new EtNet_Models.ProdClass(); if (dt.Rows[n]["ProdClassNo"] != null && dt.Rows[n]["ProdClassNo"].ToString() != "") { model.ProdClassNo = dt.Rows[n]["ProdClassNo"].ToString(); } if (dt.Rows[n]["ProdClassName"] != null && dt.Rows[n]["ProdClassName"].ToString() != "") { model.ProdClassName = dt.Rows[n]["ProdClassName"].ToString(); } if (dt.Rows[n]["Prior"] != null && dt.Rows[n]["Prior"].ToString() != "") { model.Prior = int.Parse(dt.Rows[n]["Prior"].ToString()); } if (dt.Rows[n]["ViewInReport"] != null && dt.Rows[n]["ViewInReport"].ToString() != "") { if ((dt.Rows[n]["ViewInReport"].ToString() == "1") || (dt.Rows[n]["ViewInReport"].ToString().ToLower() == "true")) { model.ViewInReport = true; } else { model.ViewInReport = false; } } modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(EtNet_Models.ProdClass model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(EtNet_Models.ProdClass model) { return(dal.Add(model)); }