I have 1 PDF "Window Sticker" template class that I can use for all car dealers but this one dealer wants to customize it his way, not the all dealers' way.
So, I created a 2nd PDF "Window Sticker" template class for that particular dealer.
Then I found I'm having trouble instantiating it in switch statement for any particular dealer due to scope issues. What's the workaround to it, or other way to do it?
public class Foo1
{
public Foo1() { }
public string GeneratePdf() { return "Red"; }
}
public class Foo2
{
public Foo2() { }
public string GeneratePdf() { return "Blue"; }
}
Object pdfTemplate;
long dealerAccountId = 121; //247
switch(dealerAccountId)
{
case 247:
pdfTemplate = new Foo2();
break;
default:
pdfTemplate = new Foo1();
break;
}
string color = pdfTemplate.GeneratePdf();