Ejemplo n.º 1
0
 private void bgw_EndOfMonthOperations_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
 {
     try
     {
         var settings = _SettingsRepo.GetConfig();
         if (settings.AllowReminderForClosingMonth)
         {
             AllowNonFlexibleClosingOfMonthOperation(settings);
         }
         if (settings.AllowFlexibleClosingOfMonth)
         {
             if (!_TransactionRepo.HasMonthBeenClosed(DateTime.Now.Month - 1))
             {
                 AllowFlexibleClosingOfMonthOperation(settings);
             }
         }
         else
         {
             if (!_TransactionRepo.HasMonthBeenClosed(DateTime.Now.Month - 1))
             {
                 var previousMonthName = GetMonthName(DateTime.Now.Month - 1);
                 ForcefullyCloseMonth(settings, previousMonthName);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show($"{ERRORMESSAGE} \n Error details: {ex.Message}", "Superior Investment!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Ejemplo n.º 2
0
        private void Settings_Load(object sender, EventArgs e)
        {
            try
            {
                cmb_AllowReminderOptions.Enabled = cmb_FlexibleClosingOfMonthOptions.Enabled = false;
                var settingsRecord = _SettingsRepo.GetConfig();

                chk_AllowReminder.Checked = settingsRecord.AllowReminderForClosingMonth == true ? true : false;
                if (chk_AllowReminder.Checked)
                {
                    cmb_AllowReminderOptions.Enabled = true;
                    switch (settingsRecord.DaysToRemindForClosingMonth)
                    {
                    case "1":
                        cmb_AllowReminderOptions.SelectedItem = "1 day to close of month";
                        break;

                    case "2":
                        cmb_AllowReminderOptions.SelectedItem = "2 days to close of month";
                        break;

                    case "3":
                        cmb_AllowReminderOptions.SelectedItem = "3 days to close of month";
                        break;

                    case "4":
                        cmb_AllowReminderOptions.SelectedItem = "4 days to close of month";
                        break;

                    case "5":
                        cmb_AllowReminderOptions.SelectedItem = "5 days to close of month";
                        break;

                    case "6":
                        cmb_AllowReminderOptions.SelectedItem = "6 days to close of month";
                        break;

                    case "7":
                        cmb_AllowReminderOptions.SelectedItem = "7 days to close of month";
                        break;
                    }
                }

                chk_AllowFlexibleClosing.Checked = settingsRecord.AllowFlexibleClosingOfMonth == true ? true : false;
                if (chk_AllowFlexibleClosing.Checked)
                {
                    cmb_FlexibleClosingOfMonthOptions.Enabled = true;
                    switch (settingsRecord.DaysToAllowForFlexibleClosingOfMonth)
                    {
                    case "1":
                        cmb_FlexibleClosingOfMonthOptions.SelectedItem = "1 day after end of month";
                        break;

                    case "2":
                        cmb_FlexibleClosingOfMonthOptions.SelectedItem = "2 days after end of month";
                        break;

                    case "3":
                        cmb_FlexibleClosingOfMonthOptions.SelectedItem = "3 days after end of month";
                        break;

                    case "4":
                        cmb_FlexibleClosingOfMonthOptions.SelectedItem = "4 days after end of month";
                        break;

                    case "5":
                        cmb_FlexibleClosingOfMonthOptions.SelectedItem = "5 days after end of month";
                        break;

                    case "6":
                        cmb_FlexibleClosingOfMonthOptions.SelectedItem = "6 days after end of month";
                        break;

                    case "7":
                        cmb_FlexibleClosingOfMonthOptions.SelectedItem = "7 days after end of month";
                        break;
                    }
                }

                switch (settingsRecord.ReminderOptions)
                {
                case "Use Voice":
                    rbtn_UseVoice.Checked = true;
                    break;

                case "Use Dialog":
                    rbtn_UseDialog.Checked = true;
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show($"{Utilities.ERRORMESSAGE} \n Error details: {ex.Message}", "Superior Investment!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }