LoginDetails _userType = new LoginDetails(); //Access Privilages handler

        public FinalAnalysis()
        {
            InitializeComponent();
            _context = new adoraDBContext();                 // Initialize DB Context
            _dao = new FinalAnalysisDAO();                   // Initialize Data access object

            // Set the ChartController class as the dataContext for this class
            DataContext = new ChartController();

            // Yearly radio button is checked defaultly
            radioYearly.IsChecked = true;

            // Yearly radio button in tabular format is checked defaultly
            radioYearly1.IsChecked = true;
           

            // Add years from 2012 onwards till current year
            for (int i = 2012; i <= DateTime.Today.Year; i++)
            {
                dropYear.Items.Add(i);
                dropYear1.Items.Add(i);
            }

            // Select Current Year and month defaultly
            dropYear1.SelectedIndex = dropYear1.Items.Count -1;
            dropMonth1.SelectedIndex = DateTime.Now.Month -1;

            // Populate statistical data
            populateData();
        }
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     // If the yearly radio button is checked and type is stock lots sales summary
     if (dropChartType.SelectedIndex == 0 && radioYearly.IsChecked == true)
     { 
         // Set the data context to chartController class with chart type stocklots sales by year
         DataContext = new ChartController("StockLotsSalesByYear"); 
     }
     else if (dropChartType.SelectedIndex == 1 && radioYearly.IsChecked == true)
     {
         DataContext = new ChartController("FOBSalesByYear");
     }
     else if (dropChartType.SelectedIndex == 2 && radioYearly.IsChecked == true)
     {
         DataContext = new ChartController("TotalByYear");
     }
     else if (dropChartType.SelectedIndex == 3 && radioYearly.IsChecked == true)
     {
         DataContext = new ChartController("NetProfitByYear");
     }
     
 }