using System.Reflection; namespace GozareshgirProgramManager.Application._Common.Constants; public static class ProgramManagerPermissionCode { /// /// دسترسی به بخش مدیریت پروژه /// public const int Code = 99; #region DeveloperUsers[تب کاربران برنامه نویسی] /// /// تب کاربران برنامه نویسی /// public static class DeveloperUsers { public const int Code = 9900; /// /// تب تعیین حقوق /// public static class SalaryDetermination { public const int Code = 990001; /// /// تعیین زمان /// public const int WorkingHoursDetermination = 990001; } /// /// تب وضعیت کارکرد /// public static class WorkingStatus { public const int Code = 990002; } /// /// تب فیش حقوقی /// public static class Checkout { public const int Code = 990003; /// /// ایجاد فیش /// public const int Create = 99000301; /// /// حذف تکی فیش /// public const int SingleDeletion = 99000302; /// /// حذف گروهی فیش ها /// public const int GroupDeletion = 99000303; /// /// محاسبه مجدد گروهی فیش ها /// public const int GroupReCompute = 99000304; /// /// محاسبه مجدد تکی فیش /// public const int SingleReCompute = 99000305; } } #endregion #region ProgramManager[تب مدیریت پروژه] /// /// تب مدیریت پروژه /// public static class ProgramManager { public const int Code = 9901; /// /// ایجاد پروژه /// public static class CreateProject { public const int Code = 9901; } /// /// همه پروژه ها /// public static class AllProjects { public const int Code = 990102; } /// /// تعیین کاربر /// public static class UserDetermination { public const int Code = 990106; } /// /// تعیین زمان پروژه /// public static class ProjectTimeSetting { public const int Code = 990107; } /// /// ویرایش پروژه /// public static class EditProject { public const int Code = 990108; } /// /// حذف پروژه /// public static class DeleteProject { public const int Code = 990109; } /// /// ایجاد بخش اصلی /// public static class CreateMainSection { public const int Code = 990110; } /// /// ایجاد بخش فرعی /// public static class CreateSubSection { public const int Code = 990111; } } #endregion #region Board[تب اجرا] /// ///تب اجرا /// public static class Board { public const int Code = 9902; /// /// تب همه /// public static class All { public const int Code = 990201; } /// /// آماده اجرا /// public static class ReadyToRun { public const int Code = 990202; } /// /// در حال اجرا /// public static class Running { public const int Code = 990203; } /// /// نیمه کاره /// public static class Unfinished { public const int Code = 990204; } /// /// اتمام اجرا /// public static class Finished { public const int Code = 990204; } /// /// دیدن پروژه همه کاربران /// public static class ViewAllUsersProjects { public const int Code = 990206; } /// /// ارجاع به دیگران /// public static class ReferralToOthers { public const int Code = 990207; } /// /// چت /// public static class Chat { public const int Code = 990208; } } #endregion public static Dictionary GetAllCodes() { var result = new Dictionary(); void Collect(Type type, Dictionary dict) { // Collect const int fields directly declared on this type var fields = type.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.DeclaredOnly); foreach (var f in fields) { if (f.FieldType == typeof(int) && f.IsLiteral && !f.IsInitOnly) { var raw = f.GetRawConstantValue(); if (raw is int value) { dict[f.Name] = value; } } } // Recurse into nested types var nestedTypes = type.GetNestedTypes(BindingFlags.Public | BindingFlags.NonPublic); foreach (var nt in nestedTypes) { var nestedDict = new Dictionary(); Collect(nt, nestedDict); if (nestedDict.Count > 0) { dict[nt.Name] = nestedDict; } } } Collect(typeof(ProgramManagerPermissionCode), result); return result; } }