/// <summary> /// 更新一条数据 /// </summary> /// <param name="model">相应的数据实体</param> /// <returns>真表示有记录被更新,否表示没有记录被更新</returns> public bool Update(RelayTest.Model.ModelDEV_LOADPOW_TO_SWITCH model) { try { Log.Info("BllDEV_LOADPOW_TO_SWITCH->Update---START"); ConnectionOpen(); dal.SetDBAccess(GetDBAccess()); return(dal.Update(model)); } catch (Exception ex) { Log.Error("BllDEV_LOADPOW_TO_SWITCH->Update---FAILED", ex); throw ex; } finally { ConnectionClose(); Log.Info("BllDEV_LOADPOW_TO_SWITCH->Update---finally"); } }
/// <summary> /// 获得数据列表 /// </summary> public List <RelayTest.Model.ModelDEV_LOADPOW_TO_SWITCH> DataTableToList(DataTable dt) { try { Log.Info("BllDEV_LOADPOW_TO_SWITCH->DataTableToList---START"); ConnectionOpen(); dal.SetDBAccess(GetDBAccess()); List <RelayTest.Model.ModelDEV_LOADPOW_TO_SWITCH> modelList = new List <RelayTest.Model.ModelDEV_LOADPOW_TO_SWITCH>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { RelayTest.Model.ModelDEV_LOADPOW_TO_SWITCH model; for (int n = 0; n < rowsCount; n++) { model = new RelayTest.Model.ModelDEV_LOADPOW_TO_SWITCH(); //供电柜编号 model.F_POWER_ID = dt.Rows[n]["F_POWER_ID"].ToString(); //开关序号 model.F_POWER_SWITCH_ID = dt.Rows[n]["F_POWER_SWITCH_ID"].ToString(); //负载电源编号 model.F_LOADPOWER_ID = dt.Rows[n]["F_LOADPOWER_ID"].ToString(); //负载电源名称 model.F_LOADPOWER_NAME = dt.Rows[n]["F_LOADPOWER_NAME"].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("BllDEV_LOADPOW_TO_SWITCH->DataTableToList---FAILED", ex); throw ex; } finally { ConnectionClose(); Log.Info("BllDEV_LOADPOW_TO_SWITCH->DataTableToList---finally"); } }