/// <summary> /// 得到一个对象实体 /// </summary> public RelayTest.Model.ModelSYSTEM_ROLE_AUTH GetModel(string F_MODULE_ID, string F_ROLE_ID) { try { Log.Info("DalSYSTEM_ROLE_AUTH->GetModel---START"); StringBuilder strSql = new StringBuilder(); strSql.Append("select F_MODULE_ID, F_ROLE_ID, F_CREATE_TIME, F_OPERATOR_ID, F_OPERATIONTIME, F_DEL "); strSql.Append(" from T_SYSTEM_ROLE_AUTH "); strSql.Append(" where F_DEL=0 AND F_MODULE_ID=:F_MODULE_ID and F_ROLE_ID=:F_ROLE_ID "); OracleParameter[] parameters = { new OracleParameter(":F_MODULE_ID", OracleType.VarChar, 50), new OracleParameter(":F_ROLE_ID", OracleType.VarChar, 10) }; parameters[0].Value = F_MODULE_ID; parameters[1].Value = F_ROLE_ID; RelayTest.Model.ModelSYSTEM_ROLE_AUTH model = new RelayTest.Model.ModelSYSTEM_ROLE_AUTH(); DataSet ds = Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { model.F_MODULE_ID = ds.Tables[0].Rows[0]["F_MODULE_ID"].ToString(); model.F_ROLE_ID = ds.Tables[0].Rows[0]["F_ROLE_ID"].ToString(); if (ds.Tables[0].Rows[0]["F_CREATE_TIME"].ToString() != "") { model.F_CREATE_TIME = DateTime.Parse(ds.Tables[0].Rows[0]["F_CREATE_TIME"].ToString()); } model.F_OPERATOR_ID = ds.Tables[0].Rows[0]["F_OPERATOR_ID"].ToString(); if (ds.Tables[0].Rows[0]["F_OPERATIONTIME"].ToString() != "") { model.F_OPERATIONTIME = DateTime.Parse(ds.Tables[0].Rows[0]["F_OPERATIONTIME"].ToString()); } if (ds.Tables[0].Rows[0]["F_DEL"].ToString() != "") { model.F_DEL = decimal.Parse(ds.Tables[0].Rows[0]["F_DEL"].ToString()); } return(model); } else { return(null); } } catch (Exception ex) { Log.Error("DalSYSTEM_ROLE_AUTH->GetModel---FAILED", ex); throw ex; } }
/// <summary> /// 增加一条数据 /// </summary> public void Add(RelayTest.Model.ModelSYSTEM_ROLE_AUTH model) { try { Log.Info("DalSYSTEM_ROLE_AUTH->Add---START"); StringBuilder strSql = new StringBuilder(); strSql.Append("insert into T_SYSTEM_ROLE_AUTH("); strSql.Append("F_MODULE_ID,F_ROLE_ID,F_CREATE_TIME,F_OPERATOR_ID,F_OPERATIONTIME,F_DEL"); strSql.Append(") values ("); strSql.Append(":F_MODULE_ID,:F_ROLE_ID,:F_CREATE_TIME,:F_OPERATOR_ID,:F_OPERATIONTIME,:F_DEL"); strSql.Append(") "); OracleParameter[] parameters = { new OracleParameter(":F_MODULE_ID", OracleType.VarChar, 50), new OracleParameter(":F_ROLE_ID", OracleType.VarChar, 10), new OracleParameter(":F_CREATE_TIME", OracleType.DateTime), new OracleParameter(":F_OPERATOR_ID", OracleType.VarChar, 10), new OracleParameter(":F_OPERATIONTIME", OracleType.DateTime), new OracleParameter(":F_DEL", OracleType.Number, 4) }; if (model.F_MODULE_ID == null) { parameters[0].Value = DBNull.Value; } else { parameters[0].Value = model.F_MODULE_ID; } if (model.F_ROLE_ID == null) { parameters[1].Value = DBNull.Value; } else { parameters[1].Value = model.F_ROLE_ID; } if (model.F_CREATE_TIME == null) { parameters[2].Value = DBNull.Value; } else { parameters[2].Value = model.F_CREATE_TIME; } if (model.F_OPERATOR_ID == null) { parameters[3].Value = DBNull.Value; } else { parameters[3].Value = model.F_OPERATOR_ID; } if (model.F_OPERATIONTIME == null) { parameters[4].Value = DBNull.Value; } else { parameters[4].Value = model.F_OPERATIONTIME; } if (model.F_DEL == null) { parameters[5].Value = DBNull.Value; } else { parameters[5].Value = model.F_DEL; } ExecuteSql(strSql.ToString(), parameters); } catch (Exception ex) { Log.Error("DalSYSTEM_ROLE_AUTH->Add---FAILED", ex); throw ex; } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(RelayTest.Model.ModelSYSTEM_ROLE_AUTH model) { try { Log.Info("DalSYSTEM_ROLE_AUTH->Update---START"); StringBuilder strSql = new StringBuilder(); strSql.Append("update T_SYSTEM_ROLE_AUTH set "); strSql.Append(" F_MODULE_ID = :F_MODULE_ID , "); strSql.Append(" F_ROLE_ID = :F_ROLE_ID , "); strSql.Append(" F_OPERATOR_ID = :F_OPERATOR_ID , "); strSql.Append(" F_OPERATIONTIME = :F_OPERATIONTIME , "); strSql.Append(" F_DEL = :F_DEL "); strSql.Append(" where F_MODULE_ID=:F_MODULE_ID and F_ROLE_ID=:F_ROLE_ID "); OracleParameter[] parameters = { new OracleParameter(":F_MODULE_ID", OracleType.VarChar, 50), new OracleParameter(":F_ROLE_ID", OracleType.VarChar, 10), new OracleParameter(":F_OPERATOR_ID", OracleType.VarChar, 10), new OracleParameter(":F_OPERATIONTIME", OracleType.DateTime), new OracleParameter(":F_DEL", OracleType.Number, 4) }; if (model.F_MODULE_ID == null) { parameters[0].Value = DBNull.Value; } else { parameters[0].Value = model.F_MODULE_ID; } if (model.F_ROLE_ID == null) { parameters[1].Value = DBNull.Value; } else { parameters[1].Value = model.F_ROLE_ID; } if (model.F_OPERATOR_ID == null) { parameters[2].Value = DBNull.Value; } else { parameters[2].Value = model.F_OPERATOR_ID; } if (model.F_OPERATIONTIME == null) { parameters[3].Value = DBNull.Value; } else { parameters[3].Value = model.F_OPERATIONTIME; } if (model.F_DEL == null) { parameters[4].Value = DBNull.Value; } else { parameters[4].Value = model.F_DEL; } int rows = ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } } catch (Exception ex) { Log.Error("DalSYSTEM_ROLE_AUTH->Update---FAILED", ex); throw ex; } }