Use switch case: 
something similar to switch(dataType)
case: year
add
//no break;
case: month
add..
//no break

the code will be much cleaner