/// <summary> /// 获得数据列表 /// </summary> public List <RelayTest.Model.ModelDEV_WORK_TO_COILPOWER> DataTableToList(DataTable dt) { try { Log.Info("BllDEV_WORK_TO_COILPOWER->DataTableToList---START"); ConnectionOpen(); dal.SetDBAccess(GetDBAccess()); List <RelayTest.Model.ModelDEV_WORK_TO_COILPOWER> modelList = new List <RelayTest.Model.ModelDEV_WORK_TO_COILPOWER>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { RelayTest.Model.ModelDEV_WORK_TO_COILPOWER model; for (int n = 0; n < rowsCount; n++) { model = new RelayTest.Model.ModelDEV_WORK_TO_COILPOWER(); model.F_WORKSTATION_ID = dt.Rows[n]["FMasterId"].ToString(); model.F_WORKSTATION_NAME = dt.Rows[n]["F_MASTER_NAME"].ToString(); model.F_COILPOWER_ID = dt.Rows[n]["F_COILPOWER_ID"].ToString(); model.F_COILPOWER_NAME = dt.Rows[n]["F_COILPOWER_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_WORK_TO_COILPOWER->DataTableToList---FAILED", ex); throw ex; } finally { ConnectionClose(); Log.Info("BllDEV_WORK_TO_COILPOWER->DataTableToList---finally"); } }
/// <summary> /// 更新一条数据 /// </summary> /// <param name="model">相应的数据实体</param> /// <returns>真表示有记录被更新,否表示没有记录被更新</returns> public bool Update(RelayTest.Model.ModelDEV_WORK_TO_COILPOWER model) { try { Log.Info("BllDEV_WORK_TO_COILPOWER->Update---START"); ConnectionOpen(); dal.SetDBAccess(GetDBAccess()); return(dal.Update(model)); } catch (Exception ex) { Log.Error("BllDEV_WORK_TO_COILPOWER->Update---FAILED", ex); throw ex; } finally { ConnectionClose(); Log.Info("BllDEV_WORK_TO_COILPOWER->Update---finally"); } }