/// <summary> /// 增加一条数据 /// </summary> public void Add(RelayTest.Model.ModelSYSTEM_LIST model) { try { Log.Info("BllSYSTEM_LIST->Add---START"); ConnectionOpen(); dal.SetDBAccess(GetDBAccess()); dal.Add(model); } catch (Exception ex) { Log.Error("BllSYSTEM_LIST->Add---FAILED", ex); throw ex; } finally { ConnectionClose(); Log.Info("BllSYSTEM_LIST->Add---finally"); } }
/// <summary> /// 更新一条数据 /// </summary> /// <param name="model">相应的数据实体</param> /// <returns>真表示有记录被更新,否表示没有记录被更新</returns> public bool Update(RelayTest.Model.ModelSYSTEM_LIST model) { try { Log.Info("BllSYSTEM_LIST->Update---START"); ConnectionOpen(); dal.SetDBAccess(GetDBAccess()); return(dal.Update(model)); } catch (Exception ex) { Log.Error("BllSYSTEM_LIST->Update---FAILED", ex); throw ex; } finally { ConnectionClose(); Log.Info("BllSYSTEM_LIST->Update---finally"); } }
/// <summary> /// 获得数据列表 /// </summary> public List <RelayTest.Model.ModelSYSTEM_LIST> DataTableToList(DataTable dt) { try { Log.Info("BllSYSTEM_LIST->DataTableToList---START"); ConnectionOpen(); dal.SetDBAccess(GetDBAccess()); List <RelayTest.Model.ModelSYSTEM_LIST> modelList = new List <RelayTest.Model.ModelSYSTEM_LIST>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { RelayTest.Model.ModelSYSTEM_LIST model; for (int n = 0; n < rowsCount; n++) { model = new RelayTest.Model.ModelSYSTEM_LIST(); model.F_TYPE = dt.Rows[n]["F_TYPE"].ToString(); if (dt.Rows[n]["F_VALUE"].ToString() != "") { model.F_VALUE = decimal.Parse(dt.Rows[n]["F_VALUE"].ToString()); } model.F_DISPLAY = dt.Rows[n]["F_DISPLAY"].ToString(); modelList.Add(model); } } return(modelList); } catch (Exception ex) { Log.Error("BllSYSTEM_LIST->DataTableToList---FAILED", ex); throw ex; } finally { ConnectionClose(); Log.Info("BllSYSTEM_LIST->DataTableToList---finally"); } }