﻿---------------------Hammad 2021-12-07-----
INSERT [dbo].[ConfigParameter] ([ConfigKey], [Name], [Arabic_Name], [ConfigValue], [ConfigCategoryCode], [OrderNo], [ConfigType], [IsVisible], [ModifiedBy], [ModificationDate], [RequestTypeId]) 
VALUES (N'WFPlacementOvertimeFinalHoursToShifthours', N'placement Overtime hours to shift hours', N' تنسيب ساعات العمل المعتمدة على ساعات عمل الوردية الإضافية', N'false', 2, 18, 1, 1, NULL, NULL, 3)
Go
---------------------End 2021-12-07-----
---------------------MOstafa 2021-12-08-----
INSERT [dbo].[SystemMenu] ([SystemMenuCode], [Name], [Arabic_Name], [ParentID], [ControllerName], [ActionName], [ImageURL], [HTTPMethod], [Sequence], [IsVisible], [ShowInPrivilegePage])
VALUES(574,N'Conslidated Purchases Request Signature',N'اعتماد طلب شراء مجمع',499,N'/WorkFlow/ConslidatedPurchasesRequestSignature',N'Index','fa fa-thumb-tack',N'get',4,1,1)
Go

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

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(15289,N'اعتماد طلب شراء مجمع',N'Conslidated Purchases Request Signature',574,1)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(15290,N'عرض اعتماد طلب شراء مجمع',N'View Conslidated Purchases Request Signature',574,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(15291,N'تعديل اعتماد طلب شراء مجمع',N'Edit Conslidated Purchases Request Signature',574,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(15292,N'حفظ اعتماد طلب شراء مجمع',N'Save Conslidated Purchases Request Signature',574,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(15293,N'حفظ متعدد للاعتماد',N'Multiple Save',574,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(15294,N'عرض سجل الموظف',N'View Employee History',574,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(15295,N'ارجاع الطلب',N'Inverse Request',574,2)

INSERT[dbo].[SecurityPrivilege]([ID], [DescriptionAR], [DescriptionEN], [SystemMenuCode], [PrivilegeType]) VALUES(15296,N'اختيار كل الطلبات',N'Choose All Requests',574,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(912,N'WorkFlow',N'ConslidatedPurchasesRequestSignature',N'Index',0,N'get',15289)

INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES(913,N'WorkFlow',N'ConslidatedPurchasesRequestSignature',N'ConslidatedPurchasesRequestSignature_Read',0,N'post',15290)

INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES(914,N'WorkFlow',N'ConslidatedPurchasesRequestSignature',N'Save',2,N'get',15291)

INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) VALUES(915,N'WorkFlow',N'ConslidatedPurchasesRequestSignature',N'Save',0,N'post',15292)

---------------------End 2021-12-08-----
---------------------Ali 2021-12-09-----

INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID])
   VALUES(911,N'WorkFlow',N'MedicalInquiryRequest',N'Cancel',0,N'get',15185)
Go

INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID])
 VALUES(916,N'WorkFlow',N'ConslidatedPurchasesRequest',N'Cancel',0,N'get',15288)
 Go

INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID])
 VALUES(917,N'WorkFlow',N'ConslidatedPurchasesRequest',N'Cancel',0,N'get',15288)
 Go

update [dbo].[SecurityPrivilegeActions] 
set [HTTPMethod]=N'get' where [ID]= 685
Go
update [dbo].[SecurityPrivilegeActions] 
set [HTTPMethod]=N'get' where [ID]= 722
Go

update [dbo].[SecurityPrivilegeActions] 
set [HTTPMethod]=N'get' where [ID]= 878
Go

update [dbo].[SecurityPrivilegeActions] 
set [HTTPMethod]=N'get' where [ID]= 567
Go

update [dbo].[SecurityPrivilegeActions] 
set [HTTPMethod]=N'get' where [ID]= 591
Go

update [dbo].[SecurityPrivilegeActions] 
set [HTTPMethod]=N'get' where [ID]= 538
Go

update [dbo].[SecurityPrivilegeActions] 
set [HTTPMethod]=N'get' where [ID]= 603
Go

INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID])
 VALUES(918,N'WFAcademic',N'PublicationRequest',N'Cancel',0,N'get',3843)
 Go

 INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) 
 VALUES(919,N'WFAcademic',N'ResearchProfileRequest',N'Cancel',0,N'get',3828)
GO
INSERT [dbo].[SecurityPrivilegeActions] ([ID], [AreaName], [ControllerName], [ActionName], [ActionType], [HTTPMethod], [SecurityPrivilegeID]) 
VALUES(920,N'WFAcademic',N'ScientificActivityRequest',N'Cancel',0,N'get',3858)
Go

update [dbo].[SecurityPrivilegeActions] 
set [HTTPMethod]=N'get' where [ID]= 579
Go

update [dbo].[SecurityPrivilegeActions] 
set [HTTPMethod]=N'get' where [ID]= 630
Go

---------------------End 2021-12-09-----
---------------------Hammad 2021-12-09-----
ALTER TABLE WF_MasterRequests
DROP COLUMN MasterRequestNUmber
Go

ALTER TABLE dbo.WF_MasterRequests ADD
	MasterRequestNo int NULL
GO

UPDATE mr SET mr.MasterRequestNo = mrNum.RowNo
FROM WF_MasterRequests AS mr INNER JOIN 
(SELECT RequestTypeCode, MasterRequestCode, MasterRequestNo,ROW_NUMBER() OVER(PARTITION BY RequestTypeCode ORDER BY RequestTypeCode, MasterRequestCode ASC)
 AS RowNo FROM WF_MasterRequests ) mrNum
	  ON mr.MasterRequestCode=mrNum.MasterRequestCode
GO
---------------------End 2021-12-09-----
