/// <summary> /// 获得数据列表 /// </summary> public List <Hownet.Model.ItemsText> DataTableToList(DataTable dt) { List <Hownet.Model.ItemsText> modelList = new List <Hownet.Model.ItemsText>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Hownet.Model.ItemsText model; for (int n = 0; n < rowsCount; n++) { model = new Hownet.Model.ItemsText(); 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]["ItemsID"].ToString() != "") { model.ItemsID = int.Parse(dt.Rows[n]["ItemsID"].ToString()); } if (dt.Rows[n]["UserID"].ToString() != "") { model.UserID = int.Parse(dt.Rows[n]["UserID"].ToString()); } model.ColumnsName = dt.Rows[n]["ColumnsName"].ToString(); model.ShowText = dt.Rows[n]["ShowText"].ToString(); if (dt.Rows[n]["IsVisible"].ToString() != "") { if ((dt.Rows[n]["IsVisible"].ToString() == "1") || (dt.Rows[n]["IsVisible"].ToString().ToLower() == "true")) { model.IsVisible = true; } else { model.IsVisible = false; } } if (dt.Rows[n]["Widths"].ToString() != "") { model.Widths = int.Parse(dt.Rows[n]["Widths"].ToString()); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Hownet.Model.ItemsText model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Hownet.Model.ItemsText model) { return(dal.Add(model)); }