One Customer Platform to connect everything. For any Salesforce related training (Admin,Apex,Advance Apex,Web Services,Lightening). contact me at Mobile Number: +91-8050010804,9113835016 Email: grv.shukla2@gmail.com
Tuesday, 23 September 2014
Monday, 8 September 2014
On click of save button It should update the EXP. date and new expiry date is a future date
Requirement:
====================================================================
public PageReference modifyExpDate()
{
list<Payment_Profile__c>Updatelist=new list<Payment_Profile__c>();
map<string,Payment_Profile__C> UpdateMap=new map<string,Payment_Profile__C>();
for(Payment_Profile__C ppval:getcatInnerObjMod()){
if(ppval.Active__c == false){
ppval.Active__c = true;
}
if((integer.valueof(ppval.Expiration_Year__c)>System.Today().year())||((integer.valueof(ppval.Expiration_Year__c)==System.Today().year())&& (integer.valueof(ppval.Expiration_Month__c)>System.Today().month())))
{
if(TokenMap.get(ppval.Gateway_Token_Id__c)!=null)
{
for(Payment_Profile__C p:TokenMap.get(ppval.Gateway_Token_Id__c))
{
p.Expiration_Month__c=ppval.Expiration_Month__c;
p.Expiration_Year__c=ppval.Expiration_Year__c;
if(UpdateMap.get(p.id)==null)
UpdateMap.put(p.id,p);
}
}
UpdateMap.put(ppval.id,ppval);
}
else{
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.Error,'Exp.Date should be future'));
continue;
}
}
if(UpdateMap.keyset().size()>0){
System.debug('UpdateMap-->'+UpdateMap);
update UpdateMap.values();
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO,'Exp.Date modified for selected payment profiles'));
}
return null;
}
Cheers..
1. On click of save button new expiry date is a
future date.
a. It
should update the expiry date of the record which is selected.
b. It
should enable the payment profile if it is disabled
c. It
should update all the members payment profiles which all belongs to same token.
public PageReference modifyExpDate()
{
list<Payment_Profile__c>Updatelist=new list<Payment_Profile__c>();
map<string,Payment_Profile__C> UpdateMap=new map<string,Payment_Profile__C>();
for(Payment_Profile__C ppval:getcatInnerObjMod()){
if(ppval.Active__c == false){
ppval.Active__c = true;
}
if((integer.valueof(ppval.Expiration_Year__c)>System.Today().year())||((integer.valueof(ppval.Expiration_Year__c)==System.Today().year())&& (integer.valueof(ppval.Expiration_Month__c)>System.Today().month())))
{
if(TokenMap.get(ppval.Gateway_Token_Id__c)!=null)
{
for(Payment_Profile__C p:TokenMap.get(ppval.Gateway_Token_Id__c))
{
p.Expiration_Month__c=ppval.Expiration_Month__c;
p.Expiration_Year__c=ppval.Expiration_Year__c;
if(UpdateMap.get(p.id)==null)
UpdateMap.put(p.id,p);
}
}
UpdateMap.put(ppval.id,ppval);
}
else{
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.Error,'Exp.Date should be future'));
continue;
}
}
if(UpdateMap.keyset().size()>0){
System.debug('UpdateMap-->'+UpdateMap);
update UpdateMap.values();
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO,'Exp.Date modified for selected payment profiles'));
}
return null;
}
Cheers..
Subscribe to:
Posts (Atom)
Salesforce Certified Application Architect & Certified Data Architecture and Management Designer Exam
How to pass Salesforce Certified Data Architecture and Management Designer Exam This exam was 1st architect exam for me. Its not that muc...
-
Add the following snippet to your visualforce page: <apex:actionStatus id="pageStatus"> <apex:facet name="sta...
-
List<String> StringTempList = new List<String>{'One','two','Three','Four','One','tw...
-
Boolean variables can have three possible variables: true, false and undefined. To make it even more confusing, if you check for the valu...