public List <SYS_Right> SelectAllSYS_Right() { DbConnection conn = _DbHelper.CreateConnection(Common.ConnectionString); conn.Open(); List <SYS_Right> sys_right = new List <SYS_Right>(); DbDataReader reader = null; try { reader = _DbHelper.ExecuteReader(conn, Common.DatabaseSchema + "[SYS_Right_SelectAll]", (DbParameter[])null); if (reader.HasRows) { SYS_RightDataAccess.SetListSYS_RightInfoModulName(ref reader, ref sys_right); } return(sys_right); } catch (Exception ex) { throw new Exception(String.Format(" SYS_RightDataAccess.SelectAll: {0}", ex.Message)); } finally { if (reader != null) { reader.Close(); } conn.Close(); } }
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 SetSYS_RolesInfo(DbDataReader reader, ref SYS_Roles sys_roles) { sys_roles.ID = int.Parse("0" + reader[FIELD_ID]); sys_roles.Name = "" + reader[FIELD_NAME]; sys_roles.IDOrganization = int.Parse("0" + reader[FIELD_IDORGANIZATION]); SYS_RightDataAccess sysRightDataAccess = new SYS_RightDataAccess(); sys_roles.Right = sysRightDataAccess.GetRightsByRole(sys_roles); }
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_RolesInfoAll(ref DbDataReader reader, ref List <SYS_Roles> sys_roless) { SYS_Roles sys_roles = null; SYS_RightDataAccess sysRightDataAccess = new SYS_RightDataAccess(); while (reader.Read()) { sys_roles = new SYS_Roles(); SYS_RolesDataAccess.SetSYS_RolesInfo(reader, ref sys_roles); sys_roles.Right = sysRightDataAccess.GetRightsByRole(sys_roles); sys_roless.Add(sys_roles); } }
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); } }
private static void SetSYS_LogInfo(DbDataReader reader, ref SYS_Log sys_log) { sys_log.ID = int.Parse("0" + reader[FIELD_ID]); sys_log.UserId = int.Parse("0" + reader[FIELD_USERID]); sys_log.FunctionId = int.Parse("0" + reader[FIELD_FUNCTIONID]); sys_log.Action = int.Parse("0" + reader[FIELD_ACTION]); sys_log.Description = "" + reader[FIELD_DESCRIPTION]; DateTime Time = (DateTime)reader[FIELD_TIME]; sys_log.Time = Time != null ? (DateTime)Time : DateTime.Now; sys_log.IDBC = int.Parse("0" + reader[FIELD_IDBC]); sys_log.PhanLoai = int.Parse("0" + reader[FIELD_PHANLOAI]); SYS_UserDataAccess sysUserDataAccess = new SYS_UserDataAccess(); SYS_User sysUser = sysUserDataAccess.SelectSYS_User(sys_log.UserId); sys_log.Username = sysUser.Name; SYS_RightDataAccess sysRightDataAccess = new SYS_RightDataAccess(); SYS_Right sysRight = sysRightDataAccess.SelectSYS_Right(sys_log.FunctionId); sys_log.FuncName = sysRight.FuncName; }