public SYS_Right SelectSYS_Right(int ID) { DbConnection conn = _DbHelper.CreateConnection(Common.ConnectionString); conn.Open(); SYS_Right sys_right = new SYS_Right(); DbDataReader reader = null; try { List <DbParameter> para = new List <DbParameter>(); para.Add(_DbHelper.CreateParameter(FIELD_ID, ID, false)); reader = _DbHelper.ExecuteReader(conn, Common.DatabaseSchema + "[SYS_Right_GetByID]", para.ToArray()); if (reader.HasRows && reader.Read()) { SYS_RightDataAccess.SetSYS_RightInfo(reader, ref sys_right); } return(sys_right); } catch (Exception ex) { throw new Exception(String.Format("SYS_RightDataAccess.SelectById: {0}", ex.Message)); } finally { if (reader != null) { reader.Close(); } conn.Close(); } }
private static void SetListSYS_RightInfo(ref DbDataReader reader, ref List <SYS_Right> sys_rights) { SYS_Right sys_right = null; while (reader.Read()) { sys_right = new SYS_Right(); SYS_RightDataAccess.SetSYS_RightInfo(reader, ref sys_right); sys_rights.Add(sys_right); } }
private static void SetListSYS_RightInfoModulName(ref DbDataReader reader, ref List <SYS_Right> sys_rights) { SYS_Right sys_right = null; SYS_ModunDataAccess isysModunDataAccess = new SYS_ModunDataAccess(); SYS_Modun sysModun = new SYS_Modun(); while (reader.Read()) { sys_right = new SYS_Right(); SYS_RightDataAccess.SetSYS_RightInfo(reader, ref sys_right); sysModun = isysModunDataAccess.SelectSYS_Modun(sys_right.ModuleID); sys_right.ModuleName = sysModun.Name; sys_rights.Add(sys_right); } }