Arvind Singh Baghel

Arvind Singh Baghel

  • NA
  • 6.7k
  • 73.1k

How can i set variable value to take on some condition.

Jul 5 2016 7:41 AM
i have a situation in which i have 4 root level types
BH, IN, KW, UK 
i declared some values for them
string const BH= "ORG_BH";
string const IN= "ORG_IN";  etc.
 
I will get this value in begining of program execution ,
later i have some variable need to set in my other class
its path 
 
public class ClsOrgPath
{
public static string path = "BH"; or "IN" or "KW"  etc
;
}
public class ClslistPath
{
public static string BHcust = "ORG_GLOBAL/ORG_BH/BH_RETAIL/CUS";
public static string BHcustId = "ORG_GLOBAL/ORG_BH/BH_RETAIL/ID";
public static string BHcustAdress = "ORG_GLOBAL/ORG_BH/BH_RETAIL/ADR";
public static string BHcustAccount = "ORG_GLOBAL/ORG_BH/BH_RETAIL/ACC";
public static string BHcustRelation = "ORG_GLOBAL/ORG_BH/BH_RETAIL/REL";
public static string INcust = "ORG_GLOBAL/ORG_IN/IN_RETAIL/CUS";
public static string INcustId = "ORG_GLOBAL/ORG_IN/IN_RETAIL/ID";
public static string INcustAdress = "ORG_GLOBAL/ORG_IN/IN_RETAIL/ADR";
public static string INcustAccount = "ORG_GLOBAL/ORG_IN/IN_RETAIL/ACC";
public static string INcustRelation = "ORG_GLOBAL/ORG_IN/IN_RETAIL/REL";
etc 
}
 
class ClsPrecess
{
  here i know  path is BH or IN or UK
  need to set this based on  path
  string locationpath=BHcust;  //if bh then BHcust if IN then INcust  
//I have many type so can not use if else condition 
 
is there any way so i can take value if i select its BH or IN  
 any solution i will restructure code also. 

Answers (3)