Files
ayanova7/source/bizobjects/AyaLib/GZTW.AyaNova.BLL/OldStoredProcedures.txt
2018-06-29 19:47:36 +00:00

174 lines
4.9 KiB
Plaintext

ALTER PROCEDURE _CreateDefaultObjects
AS
truncate table AyaNova.SecurityGroup
truncate table AyaNova.Region
truncate table AyaNova.aUser
truncate table AyaNova.UserRight
print 'Inserting default Security Group...'
INSERT INTO [AyaNova].[dbo].[SecurityGroup]
(aID, aCreated, aModified, aCreator, aModifier, aName)
VALUES
('{FF0DE42A-0EA0-429B-9643-64355703E8D1}',
'2004-06-08 10:21:08.470',
'2004-06-08 10:21:08.470',
'{2ECC77FC-69E2-4A7E-B88D-BD0ECAF36AED}',
'{2ECC77FC-69E2-4A7E-B88D-BD0ECAF36AED}',
'AyaNova Administrator')
print 'Inserting default region...'
INSERT INTO [AyaNova].[dbo].[Region]
(aID, aCreated, aModified, aCreator, aModifier, aName, aLanguage)
VALUES
('{8236E8D1-CAB1-4797-9C34-93861954AE6A}',
'2004-06-08 10:21:08.470',
'2004-06-08 10:21:08.470',
'{2ECC77FC-69E2-4A7E-B88D-BD0ECAF36AED}',
'{2ECC77FC-69E2-4A7E-B88D-BD0ECAF36AED}',
'DEFAULT',
'English')
print 'Inserting default user...'
INSERT INTO [AyaNova].[dbo].[aUser]
(aID, aLogin, aPassword, aCreated, aModified, aCreator, AACTIVE, aModifier, aFirstName, aLastName, aInitials,
[UserType, aRegionID, aMemberOfGroup, aLanguage)
VALUES
('{2ECC77FC-69E2-4A7E-B88D-BD0ECAF36AED}',0x1D0258C2440A8D19E716292B231E3190, 0xAFF29B2BF001A4CF6C3923FFD04CA31E,
'2004-06-08 10:21:08.470', '2004-06-08 10:21:08.470', '{2ECC77FC-69E2-4A7E-B88D-BD0ECAF36AED}', 1,
'{2ECC77FC-69E2-4A7E-B88D-BD0ECAF36AED}',
'AyaNova', 'Administrator', 'AAA', 1,
'{8236E8D1-CAB1-4797-9C34-93861954AE6A}',
'{FF0DE42A-0EA0-429B-9643-64355703E8D1}',
'English')
#################################################################
ALTER PROCEDURE _UtilEraseEntireDatabase
--Remove all optional data from database
AS
--'{FF0DE42A-0EA0-429B-9643-64355703E8D1}' is the built in admin group
DELETE FROM aUser
where ID <> '{2ECC77FC-69E2-4A7E-B88D-BD0ECAF36AED}'--admin user
DELETE FROM aSecurityGroup
where ID <> '{FF0DE42A-0EA0-429B-9643-64355703E8D1}'
DELETE FROM aUserRight
WHERE SecurityGroupID <> '{FF0DE42A-0EA0-429B-9643-64355703E8D1}'
DELETE FROM aRegion
WHERE aID <> '{8236E8D1-CAB1-4797-9C34-93861954AE6A}'
Delete from PartWarehouse
where ID <> '{FECD26B2-26A4-471B-B68B-54B642029943}'
truncate table DispatchZone
truncate table AssignedDoc
DELETE from Address
Delete from Contact
Delete from Client
Delete from ClientGroup
Delete from ContactPhone
Delete from ContactTitle
Delete from ContractRate
Delete from FormFieldLayout
Delete from FormFieldPool
--GLOBAL - update it's defaults fields
Delete from HeadOffice
Delete from Notification
--OBJECTCUSTOMFIELD - update it to default settings
truncate table ClientNote
truncate table ClientNoteType
truncate table ClientServiceRequest
truncate table ClientServiceRequestItem
truncate table ClientRequestPart
truncate table ClientRequestTech
truncate table Contract
truncate table Part
truncate table PartAssembly
Delete from PartBin
Delete from PartCategory
Delete from PartByWarehouseInventory
Delete from PartInventoryAdjustment
Delete from PartInventoryAdjustmentItem
delete from PartRestock
Delete from PartSerial
Delete from PrintSetting
truncate table Priority
truncate table Project
Delete from PurchaseOrder
Delete from PurchaseOrderItem
Delete from PurchaseOrderReceipt
Delete from PurchaseOrderReceiptItem
DELETE FROM aRate
Delete from RateUnitChargeDescription
truncate table Rental
truncate table RentalUnit
truncate table ScheduleableUserGroupUser
truncate table ScheduleableUserGroup
truncate table ScheduleMarker
Delete from ServiceBank
truncate table Task
delete from TaskGroup
Delete from TaskGroupTask
Delete from TaxCode
Delete from UIGridLayout --WHERE ITS NOT DEFAULT
Delete from UIUserFormSetting --WHERE ITS NOT DEFAULT
Delete from UnitMeterReading
truncate table UnitModelCategory
Truncate table UnitModel
truncate table Unit
Delete from UnitOfMeasure
Delete from UnitServiceType
Delete from UserCertification
Delete from UserCertificationAssigned
Delete from UserSkill
Delete from UserSkillAssigned
truncate table [Vendor]
truncate table WorkorderCategory
truncate table Workorder
truncate table WorkorderService
truncate table WorkorderQuote
truncate table WorkorderPreventiveMaintenance
truncate table WorkorderItem
truncate table WorkorderItemLabor
truncate table WorkorderItemMiscExpense
truncate table WorkorderItemOutsideService
truncate table WorkorderItemPart
Delete from WorkorderItemPartRequest
truncate table WorkorderItemScheduledUser
truncate table WorkorderStatus
truncate table WorkorderItemTask
truncate table WorkorderItemTravel
truncate table WorkorderItemType
truncate table Memo
-------------------------------------
-- print '_SearchDictionary:'
--DELETE FROM a_SearchDictionary
truncate table _SearchDictionary
-- print 'aSearchKey:'
--DELETE FROM aSearchKey
truncate table aSearchKey
########################################################################