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