﻿---------------------Mostafa 2021-08-05--------------------------------------
CREATE TABLE [dbo].[WF_TaskForceDirection](
	[TaskForceDirectionCode] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](50) NULL,
	[Arabic_Name] [nvarchar](50) NULL,
 CONSTRAINT [PK_Direction] PRIMARY KEY CLUSTERED 
(
	[TaskForceDirectionCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET IDENTITY_INSERT [dbo].[WF_TaskForceDirection] ON 

INSERT [dbo].[WF_TaskForceDirection] ([TaskForceDirectionCode], [Name], [Arabic_Name]) VALUES (1, N'Go', N'ذهاب
')
INSERT [dbo].[WF_TaskForceDirection] ([TaskForceDirectionCode], [Name], [Arabic_Name]) VALUES (2, N'Back', N'عودة')
SET IDENTITY_INSERT [dbo].[WF_TaskForceDirection] OFF
GO


ALTER TABLE WF_TaskForceRequest
ADD CONSTRAINT FK_TaskForceRequestDirection
FOREIGN KEY (TaskForceDirection) REFERENCES WF_TaskForceDirection(TaskForceDirectionCode);
GO
  ---------------------End 2021-08-05--------------------------------------
  ---------------------Ali 2021-08-07--------------------------------------
   update  SystemMenu set [IsVisible]=0	where SystemMenuCode=206
   Go
  ---------------------End 2021-08-07--------------------------------------
  ---------------------Ali 2021-08-08--------------------------------------
ALTER TABLE WF_OverTimeRequest
ALTER COLUMN CostCenter nvarchar(150);
Go

   INSERT [dbo].[SystemMenu] ([SystemMenuCode], [Name], [Arabic_Name], [ParentID], [ControllerName], [ActionName], [ImageURL], [HTTPMethod], [Sequence], [IsVisible], [ShowInPrivilegePage])
VALUES(556,N'Task Force Request Signature',N'اعتماد طلب انتداب',501,N'/WorkFlow/TaskForceRequestSignature',N'Index','fa fa-thumb-tack',N'get',24,1,1)
Go

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

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(15234,N'اعتماد طلب انتداب',N'Task Force Request Signature',556,1)
INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(15235,N'عرض اعتماد طلب انتداب',N'View Task Force Request Signature',556,2)
INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(15236,N'تعديل اعتماد طلب انتداب',N'Edit Task Force Request Signature',556,2)
INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(15237,N'حفظ اعتماد طلب انتداب',N'Save Task Force Request Signature',556,2)
INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(15238,N'حفظ متعدد للاعتماد',N'Multiple Save',556,2)
INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(15239,N'عرض سجل الموظف',N'View Employee History',556,2)
INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(15240,N'ارجاع الطلب',N'Inverse Request',556,2)
INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(15241,N'اختيار كل الطلبات',N'Choose All Requests',556,2)

Go

  ---------------------End 2021-08-08--------------------------------------
    ---------------------Mostafa 2021-08-08--------------------------------------

  IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[WF_TaskForceRequest]') AND type in (N'U'))
DROP TABLE [dbo].[WF_TaskForceRequest]
GO



CREATE TABLE [dbo].[WF_TaskForceRequest](
	[MasterRequestCode] [int] NOT NULL,
	[CurrentBranchCode] [int] NOT NULL,
	[TaskForceDirectionCode] [int] NOT NULL,
	[TaskForceBranchCode] [int] NOT NULL,
 CONSTRAINT [PK_WF_TaskForceRequest] PRIMARY KEY CLUSTERED 
(
	[MasterRequestCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[WF_TaskForceRequest]  WITH CHECK ADD  CONSTRAINT [FK_WF_AssignmentRequest_WF_MasterRequests] FOREIGN KEY([MasterRequestCode])
REFERENCES [dbo].[WF_MasterRequests] ([MasterRequestCode])
GO

ALTER TABLE [dbo].[WF_TaskForceRequest] CHECK CONSTRAINT [FK_WF_AssignmentRequest_WF_MasterRequests]
GO

ALTER TABLE [dbo].[WF_TaskForceRequest]  WITH CHECK ADD  CONSTRAINT [FK_WF_TaskForceRequest_WF_TaskForceDirection] FOREIGN KEY([TaskForceDirectionCode])
REFERENCES [dbo].[WF_TaskForceDirection] ([TaskForceDirectionCode])
GO

ALTER TABLE [dbo].[WF_TaskForceRequest] CHECK CONSTRAINT [FK_WF_TaskForceRequest_WF_TaskForceDirection]
GO

  ---------------------End 2021-08-08--------------------------------------
  ---------------------MOstafa 2021-08-09--------------------------------------

  INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(15242,N'الغاء طلب انتداب',N'}Cancel Task Force Request',555,2)
Go
  ---------------------End 2021-08-09--------------------------------------
  ---------------------Hammad 2021-08-09--------------------------------------

INSERT [dbo].[ConsolidatedReport] ([ConsolidatedReportCode], [ReportName], [ReportNameAr], [Name], [Arabic_Name], [IsForAllBranchs])
 VALUES (24, N'Task Force', N'BudgetTaskForce.trdx', N'BudgetTaskForce.trdx', N'الموازنة العددية مع الانتداب', 1)
 GO
   ---------------------End 2021-08-09--
   ---------------------Mostafa 2021-08-10--


   INSERT [dbo].[SystemMenu] ([SystemMenuCode], [Name], [Arabic_Name], [ParentID], [ControllerName], [ActionName], [ImageURL], [HTTPMethod], [Sequence], [IsVisible], [ShowInPrivilegePage])
VALUES(557,N'Member Category',N'فئة العضو',532,N'/Meeting/MemberCategory',N'Index','fa fa-thumb-tack',N'get',5,1,1)
Go

INSERT[dbo].[SystemMenuModule]( [SystemMenuCode], [AppModuleCode]) VALUES(557,15)
Go

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(17030,N'فئة العضو',N'Member Category',557,1)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(17031,N'عرض فئة العضو',N'View Member Category',557,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(17032,N'إضافة فئة العضو',N'Add Member Category',557,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(17033,N'تعديل فئة العضو',N'Edit Member Category',557,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(17034,N'حذف فئة العضو',N'Delete Member Category',557,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(17035,N'حفظ فئة العضو',N'Save Member Category',557,2)
Go
insert SecurityPrivilegeActions  
(ID,AreaName,ControllerName,ActionName,ActionType,HTTPMethod,SecurityPrivilegeID)
values(836,'Meeting','MemberCategory','Index',0,'get',17030),
      (837,'Meeting','MemberCategory','MemberCategory_Read',0,'post',17031),
      (838,'Meeting','MemberCategory','Save',1,'get',17032),
      (839,'Meeting','MemberCategory','Save',2,'get',17033),
      (840,'Meeting','MemberCategory','Delete',0,'post',17034),
      (841,'Meeting','MemberCategory','Save',0,'post',17035)
	  GO

	  --------------------------Start 2021-08-10-----------------------------


INSERT [dbo].[SystemMenu] ([SystemMenuCode], [Name], [Arabic_Name], [ParentID], [ControllerName], [ActionName], [ImageURL], [HTTPMethod], [Sequence], [IsVisible], [ShowInPrivilegePage])
VALUES(558,N'Meeting Branch',N'فروع الاجتماع',532,N'/Meeting/MeetingBranch',N'Index','fa fa-thumb-tack',N'get',6,1,1)
Go

INSERT[dbo].[SystemMenuModule]( [SystemMenuCode], [AppModuleCode]) VALUES(558,15)
Go

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(17036,N'فروع الاجتماع',N'Meeting Branch',558,1)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(17037,N'عرض فروع الاجتماع',N'View Meeting Branch',558,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(17038,N'إضافة فروع الاجتماع',N'Add Meeting Branch',558,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(17039,N'تعديل فروع الاجتماع',N'Edit Meeting Branch',558,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(17040,N'حذف فروع الاجتماع',N'Delete Meeting Branch',558,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(17041,N'حفظ فروع الاجتماع',N'Save Meeting Branch',558,2)
Go

-- SSTAuthorizationActionFilterBefore (script only not added in db Check it and run if you want) 

INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES(842,N'Meeting',N'MeetingBranch',N'Index',0,N'get',17036)

INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES(843,N'Meeting',N'MeetingBranch',N'MeetingBranch_Read',0,N'post',17037)

INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES(844,N'Meeting',N'MeetingBranch',N'Save',1,N'get',17038)

INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES(845,N'Meeting',N'MeetingBranch',N'Save',2,N'get',17039)

INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES(846,N'Meeting',N'MeetingBranch',N'Delete',0,N'post',17040)

INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES(847,N'Meeting',N'MeetingBranch',N'Save',0,N'post',17041)
GO
   ---------------------End 2021-08-10---------------
---------------------Hammad 2021-08-15-------
ALTER TABLE dbo.GeneralTypes ADD
	ManagerCode int NULL
GO
INSERT [dbo].[UserType] ([UserTypeCode], [Name], [Arabic_Name], [HaveEmployee], [OrganizationCategoryCode]) VALUES (36, N'General Type', N'النوع العام', 0, NULL)
GO

---------------------End 2021-08-15------------
---------------------MOstafa 2021-08-17------------
alter table SecurityGroupDetail
add CreationDate datetime NULL,
CreatedBy int NULL
GO
alter table SecurityUserDetail
add CreationDate datetime NULL,
CreatedBy int NULL
GO
---------------------End 2021-08-17------------
---------------------Ali 2021-08-17------------

 INSERT[dbo].[ConfigParameter]  ([ConfigKey], [Name], [Arabic_Name], [ConfigValue], [ConfigCategoryCode], [OrderNo], [ConfigType], [IsVisible], [ModifiedBy], [ModificationDate], [RequestTypeId])
VALUES(N'DisplayAllUserInChangeSign',N'Display All Users In Change Signatures page',N'عرض كل المستخدمين فى شاشة تغيير الاعتمادات',N'true',2,15,1,1,Null,Null,0)
Go
---------------------End 2021-08-17------------
