public without sharing class FixtureRemindSnapshotHandler extends Oly_TriggerHandler{
|
private Map<Id, FixtureRemindSnapshot__c> newMap;
|
private Map<Id, FixtureRemindSnapshot__c> oldMap;
|
private List<FixtureRemindSnapshot__c> newList;
|
private List<FixtureRemindSnapshot__c> oldList;
|
public FixtureRemindSnapshotHandler() {
|
this.newMap = (Map<Id, FixtureRemindSnapshot__c>) Trigger.newMap;
|
this.oldMap = (Map<Id, FixtureRemindSnapshot__c>) Trigger.oldMap;
|
this.newList = (List<FixtureRemindSnapshot__c>) Trigger.new;
|
this.oldList = (List<FixtureRemindSnapshot__c>) Trigger.old;
|
}
|
protected override void beforeUpdate() {
|
beforeSetValue();
|
}
|
protected override void beforeInsert() {
|
beforeSetValue();
|
}
|
private void beforeSetValue(){
|
for (FixtureRemindSnapshot__c frs : newList) {
|
Date d = frs.Date__c;
|
Datetime dt = Datetime.newInstance(d.year(), d.month(), d.day());
|
frs.UniqueKey__c = dt.format('YYYY-MM-dd') + ':' + frs.Time__c + ':' + frs.Region__c;
|
frs.Name = frs.UniqueKey__c;
|
}
|
}
|
}
|