private void FillComboBoxes()
        {
            try
            {
                //Categories
                ListHelper.FillMetroCombo(mcboCategory, catbal.GetAll().Select(i => new { i.CATCODE }).Distinct().ToList(), "CATCODE", "CATCODE");
                mcboCategory.SelectedIndex = -1;

                //First Year
                ListHelper.FillMetroCombo(mcbofrstYear, yrbal.GetAll().Select(i => new { i.RecYear }).Distinct().ToList(), "RecYear", "RecYear");
                mcbofrstYear.SelectedValue = UserSettings.LogInYear;
                //Second Year
                ListHelper.FillMetroCombo(mcboscndYear, yrbal.GetAll().Select(i => new { i.RecYear }).Distinct().ToList(), "RecYear", "RecYear");
                var yearlist = yrbal.GetAll().Select(s => s.RecYear).ToList();
                if (yearlist.Contains(UserSettings.LogInYear - 1))
                {
                    mcboscndYear.SelectedValue = UserSettings.LogInYear - 1;
                }
                else if (yearlist.Contains(UserSettings.LogInYear + 1))
                {
                    mcboscndYear.SelectedValue = UserSettings.LogInYear + 1;
                }
                else
                {
                    mcboscndYear.SelectedIndex = 0;
                }
            }
            catch (Exception ex)
            {
                MessageHelpers.ShowError(ex.Message);
            }
        }
Esempio n. 2
0
 private void GetList()
 {
     try
     {
         ListHelper.FillMetroCombo(mcboLogYear, yearbal.GetAll().OrderByDescending(m => m.RecYear).ToList(), "RecYear", "RecYear");
         mcboLogYear.SelectedValue = DateTime.Today.Year;
     }
     catch (Exception ex)
     {
         MessageHelpers.ShowError(ex.Message);
     }
 }
Esempio n. 3
0
 public void RefreshGrid()
 {
     try
     {
         var list = yearbal.GetAll().Select(i => new{ i.RecID, i.RecYear, i.IsLocked }).Distinct().OrderBy(y => y.RecYear).ToList();
         mgridYearList.DataSource = list;
         mlblNoRecords.Text       = comp.YearList.Count.ToString() + " record(s)";
     }
     catch (Exception ex)
     {
         MessageHelpers.ShowError(ex.Message);
     }
 }