• forcecloud20
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 3
    Replies

 public void getcount()
   {
     if(opp.provider1__c!=null)
     {
      Score_Count__c scr = [select id,name from Score_Count__c where id = :opp.provider1__c];
      scorecnt= scr.name;     
     }
   }

public with sharing class AccountFinal
{
public account acc{get;set;}
public List<selectoption> so{get;set;}
public String city{get;set;}


public AccountFinal(Apexpages.standardcontroller controller)
{
id id1 = ApexPages.currentPage().getParameters().get('recordtype');
string s = ApexPages.currentPage().getParameters().get('recordTypeName');

id id2 = Apexpages.currentpage().getparameters().get('id');
so = new list<selectoption>();
acc = (account)controller.getRecord();

if(id2 != null){

acc = [select name,fax,type,billingcity from account where id=:id2];


city= acc.billingcity;

}else{

acc.recordtypeid = id1;
If(s=='abc')acc.type='est';
else acc.type='Customer';


so.add(new selectoption('--None--','--None--'));

}

}
public pagereference save()
{
try{

acc.billingcity = city;

if(acc.billingcity == null || acc.billingcity ==''){
acc.addError('city is a required field');
return null;
}

upsert acc;
return (new Apexpages.standardcontroller(acc).view());
}
catch(exception e){
ApexPages.addMessages(e);
return null;}
}


public void pocode(){
postal_code__c pc= [select name,city__c from postal_code__c where id=:acc.Postal_Code_Number__c];
acc.billingcity=pc.city__c;

}

}
..

public with sharing class AccRedirect {

private ApexPages.StandardController controller;
public String retURL {get; set;}
public String rType {get; set;}
public String rTypeName{get;set;}

public AccRedirect(ApexPages.StandardController controller) {

    this.controller = controller;

    retURL = ApexPages.currentPage().getParameters().get('retURL');
    rType = ApexPages.currentPage().getParameters().get('RecordType');
    rTypeName = [select named1 from recordtype where id=:rType].named1;

}

public PageReference redirect() {

    PageReference returnURL;

    IF(rTypeName == 'abc' || rTypeName == 'xyz') {

        returnURL = new PageReference('/apex/custPage');

    }

    ELSE {

        returnURL = new PageReference('/001/e');

    }

    returnURL.getParameters().put('retURL', retURL);
    returnURL.getParameters().put('RecordType', rType);
    returnURL.getParameters().put('rTypeName', rTypeName);
   
    returnURL.setRedirect(true);
    return returnURL;

}

}

public with sharing class AccountFinal
{
public account acc{get;set;}
public List<selectoption> so{get;set;}
public String city{get;set;}


public AccountFinal(Apexpages.standardcontroller controller)
{
id id1 = ApexPages.currentPage().getParameters().get('recordtype');
string s = ApexPages.currentPage().getParameters().get('recordTypeName');

id id2 = Apexpages.currentpage().getparameters().get('id');
so = new list<selectoption>();
acc = (account)controller.getRecord();

if(id2 != null){

acc = [select name,fax,type,billingcity from account where id=:id2];


city= acc.billingcity;

}else{

acc.recordtypeid = id1;
If(s=='abc')acc.type='est';
else acc.type='Customer';


so.add(new selectoption('--None--','--None--'));

}

}
public pagereference save()
{
try{

acc.billingcity = city;

if(acc.billingcity == null || acc.billingcity ==''){
acc.addError('city is a required field');
return null;
}

upsert acc;
return (new Apexpages.standardcontroller(acc).view());
}
catch(exception e){
ApexPages.addMessages(e);
return null;}
}


public void pocode(){
postal_code__c pc= [select name,city__c from postal_code__c where id=:acc.Postal_Code_Number__c];
acc.billingcity=pc.city__c;

}

}

public with sharing class AccRedirect {

private ApexPages.StandardController controller;
public String retURL {get; set;}
public String rType {get; set;}
public String rTypeName{get;set;}

public AccRedirect(ApexPages.StandardController controller) {

    this.controller = controller;

    retURL = ApexPages.currentPage().getParameters().get('retURL');
    rType = ApexPages.currentPage().getParameters().get('RecordType');
    rTypeName = [select named1 from recordtype where id=:rType].named1;

}

public PageReference redirect() {

    PageReference returnURL;

    IF(rTypeName == 'abc' || rTypeName == 'xyz') {

        returnURL = new PageReference('/apex/custPage');

    }

    ELSE {

        returnURL = new PageReference('/001/e');

    }

    returnURL.getParameters().put('retURL', retURL);
    returnURL.getParameters().put('RecordType', rType);
    returnURL.getParameters().put('rTypeName', rTypeName);
   
    returnURL.setRedirect(true);
    return returnURL;

}

}