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