/// <summary> /// 增加一条数据 /// </summary> public bool Add(GSSModel.Dictionary model) { try { dal.Add(model); return(true); } catch //(System.Exception ex) { return(false); } }
/// <summary> /// 获得数据列表 /// </summary> public List <GSSModel.Dictionary> DataTableToList(DataTable dt) { List <GSSModel.Dictionary> modelList = new List <GSSModel.Dictionary>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { GSSModel.Dictionary model; for (int n = 0; n < rowsCount; n++) { model = new GSSModel.Dictionary(); if (dt.Rows[n]["F_DicID"].ToString() != "") { model.F_DicID = int.Parse(dt.Rows[n]["F_DicID"].ToString()); } if (dt.Rows[n]["F_ParentID"].ToString() != "") { model.F_ParentID = int.Parse(dt.Rows[n]["F_ParentID"].ToString()); } model.F_Value = dt.Rows[n]["F_Value"].ToString(); if (dt.Rows[n]["F_IsUsed"].ToString() != "") { if ((dt.Rows[n]["F_IsUsed"].ToString() == "1") || (dt.Rows[n]["F_IsUsed"].ToString().ToLower() == "true")) { model.F_IsUsed = true; } else { model.F_IsUsed = false; } } if (dt.Rows[n]["F_Sort"].ToString() != "") { model.F_Sort = int.Parse(dt.Rows[n]["F_Sort"].ToString()); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(GSSModel.Dictionary model) { return(dal.Update(model)); }