/// <summary> /// 增加一条数据 /// </summary> public void Add(RelayTest.Model.ModelTEST_PAR_VALUE_SWJ model) { try { Log.Info("BllTEST_PAR_VALUE_SWJ->Add---START"); ConnectionOpen(); dal.SetDBAccess(GetDBAccess()); dal.Add(model); } catch (Exception ex) { Log.Error("BllTEST_PAR_VALUE_SWJ->Add---FAILED", ex); throw ex; } finally { ConnectionClose(); Log.Info("BllTEST_PAR_VALUE_SWJ->Add---finally"); } }
/// <summary> /// 更新一条数据 /// </summary> /// <param name="model">相应的数据实体</param> /// <returns>真表示有记录被更新,否表示没有记录被更新</returns> public bool Update(RelayTest.Model.ModelTEST_PAR_VALUE_SWJ model) { try { Log.Info("BllTEST_PAR_VALUE_SWJ->Update---START"); ConnectionOpen(); dal.SetDBAccess(GetDBAccess()); return(dal.Update(model)); } catch (Exception ex) { Log.Error("BllTEST_PAR_VALUE_SWJ->Update---FAILED", ex); throw ex; } finally { ConnectionClose(); Log.Info("BllTEST_PAR_VALUE_SWJ->Update---finally"); } }
/// <summary> /// 获得数据列表 /// </summary> public List <RelayTest.Model.ModelTEST_PAR_VALUE_SWJ> DataTableToList(DataTable dt) { try { Log.Info("BllTEST_PAR_VALUE_SWJ->DataTableToList---START"); ConnectionOpen(); dal.SetDBAccess(GetDBAccess()); List <RelayTest.Model.ModelTEST_PAR_VALUE_SWJ> modelList = new List <RelayTest.Model.ModelTEST_PAR_VALUE_SWJ>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { RelayTest.Model.ModelTEST_PAR_VALUE_SWJ model; for (int n = 0; n < rowsCount; n++) { model = new RelayTest.Model.ModelTEST_PAR_VALUE_SWJ(); //试验任务编号 model.F_TASK_ID = dt.Rows[n]["F_TASK_ID"].ToString(); //工作模式名称 model.F_WORKTYPE_NAME = dt.Rows[n]["F_WORKTYPE_NAME"].ToString(); //工作模式编码 model.F_WORKTYPE_CODE = dt.Rows[n]["F_WORKTYPE_CODE"].ToString(); //程序代码 model.F_PROGRAM_CODE = dt.Rows[n]["F_PROGRAM_CODE"].ToString(); //参数名称 model.F_SENDPAR_NAME = dt.Rows[n]["F_SENDPAR_NAME"].ToString(); //参数值 model.F_SENDPAR_VALUE = dt.Rows[n]["F_SENDPAR_VALUE"].ToString(); //排序序号 if (dt.Rows[n]["F_SENDORDER"].ToString() != "") { model.F_SENDORDER = decimal.Parse(dt.Rows[n]["F_SENDORDER"].ToString()); } //备注 model.F_SENDPAR_MEMO = dt.Rows[n]["F_SENDPAR_MEMO"].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("BllTEST_PAR_VALUE_SWJ->DataTableToList---FAILED", ex); throw ex; } finally { ConnectionClose(); Log.Info("BllTEST_PAR_VALUE_SWJ->DataTableToList---finally"); } }