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