301 lines
7.3 KiB
C#
301 lines
7.3 KiB
C#
using System.Reflection;
|
||
|
||
namespace GozareshgirProgramManager.Application._Common.Constants;
|
||
|
||
public static class ProgramManagerPermissionCode
|
||
{
|
||
/// <summary>
|
||
/// دسترسی به بخش مدیریت پروژه
|
||
/// </summary>
|
||
public const int Code = 99;
|
||
|
||
#region DeveloperUsers[تب کاربران برنامه نویسی]
|
||
/// <summary>
|
||
/// تب کاربران برنامه نویسی
|
||
/// </summary>
|
||
public static class DeveloperUsers
|
||
{
|
||
public const int Code = 9900;
|
||
|
||
/// <summary>
|
||
/// تب تعیین حقوق
|
||
/// </summary>
|
||
public static class SalaryDetermination
|
||
{
|
||
public const int Code = 990001;
|
||
|
||
/// <summary>
|
||
/// تعیین زمان
|
||
/// </summary>
|
||
public const int WorkingHoursDetermination = 990001;
|
||
}
|
||
|
||
/// <summary>
|
||
/// تب وضعیت کارکرد
|
||
/// </summary>
|
||
public static class WorkingStatus
|
||
{
|
||
public const int Code = 990002;
|
||
}
|
||
|
||
/// <summary>
|
||
/// تب فیش حقوقی
|
||
/// </summary>
|
||
public static class Checkout
|
||
{
|
||
public const int Code = 990003;
|
||
|
||
/// <summary>
|
||
/// ایجاد فیش
|
||
/// </summary>
|
||
public const int Create = 99000301;
|
||
|
||
/// <summary>
|
||
/// حذف تکی فیش
|
||
/// </summary>
|
||
public const int SingleDeletion = 99000302;
|
||
|
||
/// <summary>
|
||
/// حذف گروهی فیش ها
|
||
/// </summary>
|
||
public const int GroupDeletion = 99000303;
|
||
|
||
/// <summary>
|
||
/// محاسبه مجدد گروهی فیش ها
|
||
/// </summary>
|
||
public const int GroupReCompute = 99000304;
|
||
|
||
/// <summary>
|
||
/// محاسبه مجدد تکی فیش
|
||
/// </summary>
|
||
public const int SingleReCompute = 99000305;
|
||
|
||
}
|
||
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region ProgramManager[تب مدیریت پروژه]
|
||
|
||
/// <summary>
|
||
/// تب مدیریت پروژه
|
||
/// </summary>
|
||
public static class ProgramManager
|
||
{
|
||
public const int Code = 9901;
|
||
|
||
/// <summary>
|
||
/// ایجاد پروژه
|
||
/// </summary>
|
||
public static class CreateProject
|
||
{
|
||
public const int Code = 9901;
|
||
}
|
||
|
||
/// <summary>
|
||
/// همه پروژه ها
|
||
/// </summary>
|
||
public static class AllProjects
|
||
{
|
||
public const int Code = 990102;
|
||
|
||
}
|
||
|
||
/// <summary>
|
||
/// تعیین کاربر
|
||
/// </summary>
|
||
public static class UserDetermination
|
||
{
|
||
public const int Code = 990106;
|
||
}
|
||
|
||
/// <summary>
|
||
/// تعیین زمان پروژه
|
||
/// </summary>
|
||
public static class ProjectTimeSetting
|
||
{
|
||
public const int Code = 990107;
|
||
}
|
||
|
||
/// <summary>
|
||
/// ویرایش پروژه
|
||
/// </summary>
|
||
public static class EditProject
|
||
{
|
||
public const int Code = 990108;
|
||
}
|
||
|
||
/// <summary>
|
||
/// حذف پروژه
|
||
/// </summary>
|
||
public static class DeleteProject
|
||
{
|
||
public const int Code = 990109;
|
||
}
|
||
|
||
/// <summary>
|
||
/// ایجاد بخش اصلی
|
||
/// </summary>
|
||
public static class CreateMainSection
|
||
{
|
||
public const int Code = 990110;
|
||
}
|
||
|
||
/// <summary>
|
||
/// ایجاد بخش فرعی
|
||
/// </summary>
|
||
public static class CreateSubSection
|
||
{
|
||
public const int Code = 990111;
|
||
}
|
||
|
||
/// <summary>
|
||
/// اولویت بندی
|
||
/// </summary>
|
||
public static class Priority
|
||
{
|
||
public const int Code = 990112;
|
||
}
|
||
|
||
/// <summary>
|
||
/// ایجاد تسک باگ
|
||
/// </summary>
|
||
public static class CreateBug
|
||
{
|
||
public const int Code = 990113;
|
||
}
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region Board[تب اجرا]
|
||
|
||
/// <summary>
|
||
///تب اجرا
|
||
/// </summary>
|
||
public static class Board
|
||
{
|
||
public const int Code = 9902;
|
||
|
||
/// <summary>
|
||
/// تب همه
|
||
/// </summary>
|
||
public static class All
|
||
{
|
||
public const int Code = 990201;
|
||
}
|
||
|
||
/// <summary>
|
||
/// آماده اجرا
|
||
/// </summary>
|
||
public static class ReadyToRun
|
||
{
|
||
public const int Code = 990202;
|
||
}
|
||
|
||
/// <summary>
|
||
/// در حال اجرا
|
||
/// </summary>
|
||
public static class Running
|
||
{
|
||
public const int Code = 990203;
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// نیمه کاره
|
||
/// </summary>
|
||
public static class Unfinished
|
||
{
|
||
public const int Code = 990204;
|
||
}
|
||
|
||
/// <summary>
|
||
/// اتمام اجرا
|
||
/// </summary>
|
||
public static class Finished
|
||
{
|
||
public const int Code = 990204;
|
||
}
|
||
|
||
/// <summary>
|
||
/// دیدن پروژه همه کاربران
|
||
/// </summary>
|
||
public static class ViewAllUsersProjects
|
||
{
|
||
public const int Code = 990206;
|
||
}
|
||
|
||
/// <summary>
|
||
/// ارجاع به دیگران
|
||
/// </summary>
|
||
public static class ReferralToOthers
|
||
{
|
||
public const int Code = 990207;
|
||
}
|
||
|
||
/// <summary>
|
||
/// چت
|
||
/// </summary>
|
||
public static class Chat
|
||
{
|
||
public const int Code = 990208;
|
||
}
|
||
|
||
/// <summary>
|
||
/// رد با تایید اتمام اجرا
|
||
/// </summary>
|
||
public static class RejectOrApproveTaskComplete
|
||
{
|
||
public const int Code = 990209;
|
||
}
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region Workflow[تب کارپوشه]
|
||
public static class Workflow
|
||
{
|
||
public const int Code = 9903;
|
||
}
|
||
|
||
#endregion
|
||
|
||
public static Dictionary<string, object> GetAllCodes()
|
||
{
|
||
var result = new Dictionary<string, object>();
|
||
|
||
void Collect(Type type, Dictionary<string, object> 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<string, object>();
|
||
Collect(nt, nestedDict);
|
||
if (nestedDict.Count > 0)
|
||
{
|
||
dict[nt.Name] = nestedDict;
|
||
}
|
||
}
|
||
}
|
||
|
||
Collect(typeof(ProgramManagerPermissionCode), result);
|
||
return result;
|
||
}
|
||
} |