﻿-----------------------------------------Mostafa 2026-1-20 --------------------

CREATE TABLE dbo.MobileDashboardOrder (
    MobileDashboardOrderCode INT IDENTITY(1,1) NOT NULL,
    SecurityUserCode INT NOT NULL,
    DashboardID INT NOT NULL,
    OrderNo INT NOT NULL,
    
    CONSTRAINT PK_MobileDashboardOrder 
        PRIMARY KEY (MobileDashboardOrderCode),
    
    -- One dashboard per user
    CONSTRAINT UQ_MobileDashboardOrder_User_Dashboard 
        UNIQUE (SecurityUserCode, DashboardID),
    
    -- One order number per user
    CONSTRAINT UQ_MobileDashboardOrder_User_Order 
        UNIQUE (SecurityUserCode, OrderNo),
    
    -- Order numbers must be positive
    CONSTRAINT CK_MobileDashboardOrder_OrderNo_Positive 
        CHECK (OrderNo > 0),
    
    CONSTRAINT FK_MobileDashboardOrder_SecurityUser 
        FOREIGN KEY (SecurityUserCode) 
        REFERENCES dbo.SecurityUser(SecurityUserCode) 
        ON DELETE CASCADE,
    
);

-- Index for user-specific queries
CREATE INDEX IX_MobileDashboardOrder_SecurityUserCode 
    ON dbo.MobileDashboardOrder(SecurityUserCode);

-- Index for dashboard-to-user lookups
CREATE INDEX IX_MobileDashboardOrder_DashboardID 
    ON dbo.MobileDashboardOrder(DashboardID);
    GO
-----------------------------------------End 2026-1-20 --------------------
-----------------------------------------End 2026-1-19 --------------------
-----------------------------------------Shehab 2026-1-21 --------------------
GO
INSERT [dbo].[SystemMenu] ([SystemMenuCode], [Name], [Arabic_Name], [ParentID], [ControllerName], [ActionName], 
[ImageURL], [HTTPMethod], [Sequence], [IsVisible], [ShowInPrivilegePage]) VALUES (1241, N'Employment Status Types', 
N'انواع حالة التوظيف', 28, N'/WorkFlow/EmploymentStatusTypes', N'Index', N'fa fa-user-check', N'get', 36, 1, 1)


Go
INSERT [dbo].[SystemMenuModule] ([SystemMenuCode], [AppModuleCode]) VALUES (1241, 1)
GO

Go
INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(15619,N'انواع حالة التوظيف ',N'Employment Status Types',1241,1)
Go																																  
INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(15620,N'عرض انواع حالة التوظيف ',N'View Employment Status Types',1241,2)
Go																																  
INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(15621,N'إضافة انواع حالة التوظيف ',N'Add  Employment Status Types',1241,2)
Go																																  
INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(15622,N'تعديل انواع حالة التوظيف ',N'Edit  Employment Status Types',1241,2)
Go																																  
INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(15623,N' حذف انواع حالة التوظيف  ',N'Delete  Employment Status Types',1241,2)
Go																																  
INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(15624,N'حفظ انواع حالة التوظيف ',N'Save  Employment Status Types',1241,2)
-----------------------------------------End 2026-1-21 --------------------
-----------------------------------------Shehab 2026-1-22 --------------------
Go
INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(15625,N'اضافة حالة التوظيف لطلب موظفين جدد',
N'Add Employment Status To New Employees Request',138,2)

-----------------------------------------End 2026-1-22 --------------------