Example #1
0
        public FormBudgetDetails(AppSettings app, BudgetObj bud, int id)
        {
            this.appConfig = app;
            this.budget = bud;
            this.budgetId = id;
            InitializeComponent();

            budget.UpdateBudgetSelgerkoder(budgetId);
            budgetInfo = budget.GetBudgetInfo(budgetId);

            SetUI();

            RefreshDataGridView();
        }
Example #2
0
        public FormBudgetCreation(FormMain form)
        {
            this.main = form;
            InitializeComponent();
            ImportSettings();
            dateTimePicker_Date.Format = DateTimePickerFormat.Custom;
            dateTimePicker_Date.CustomFormat = "MMMM yyyy";
            dateTimePicker_Date.Value = FormMain.GetLastDayOfMonth(main.appConfig.dbTo);
            comboBox_Acc.SelectedIndex = 0;
            comboBox_Finans.SelectedIndex = 0;
            comboBox_Kategori.SelectedIndex = 0;
            comboBox_Rtgsa.SelectedIndex = 0;
            comboBox_Strom.SelectedIndex = 0;
            comboBox_TA.SelectedIndex = 0;
            comboBox_Vinn.SelectedIndex = 0;
            budget = new BudgetObj(main);
            UpdateDb();
            if (dataGridView1.RowCount != 0)
                tabControl1.SelectedTab = tabPageSettings;

            Random rnd = new Random();
            labelTips.Text = tips[rnd.Next(tips.Length)];
        }
Example #3
0
        private void ReloadBudget(bool forced = false)
        {
            try
            {
                if (forced)
                {
                    ClearBudgetHash(BudgetCategory.None);
                }
                if (EmptyDatabase())
                {
                    webBudget.Navigate(htmlImport);
                    groupBudgetPages.Enabled = false;
                    groupBudgetChoices.Enabled = false;

                    buttonBudgetUpdate.BackColor = SystemColors.ControlLight;
                    buttonBudgetUpdate.ForeColor = SystemColors.ControlText;
                }
                else
                {
                    groupBudgetPages.Enabled = true;
                    groupBudgetChoices.Enabled = true;

                    budget = new BudgetObj(this);

                    if (!autoMode)
                        UpdateBudget();

                    moveBudgetDate(0, true);
                }
            }
            catch (Exception ex)
            {
                FormError errorMsg = new FormError("Kritisk feil ved initialisering av databasen.\nInstaller programmet på nytt hvis problemet vedvarer.", ex);
                errorMsg.ShowDialog(this);
            }
        }
Example #4
0
        public RankingBudget(FormMain form, DateTime dtFraArg, DateTime dtTilArg, BudgetCategory cat)
        {
            try
            {
                this.main = form;
                dtFra = dtFraArg;
                dtTil = dtTilArg;
                velgerPeriode = FormMain.datoPeriodeVelger;

                this.varekoderAlle = main.appConfig.varekoder.ToList();
                this.varekoderAlleAlias = varekoderAlle.Where(item => item.synlig == true).Select(x => x.alias).Distinct();

                budget = new BudgetObj(main);

                budgetInfo = budget.GetBudgetInfo(dtTil, cat);
                if (budgetInfo != null)
                    if (budgetInfo.selgere != null)
                        if (budgetInfo.selgere.Count == 0)
                            budgetInfo = null;
            }
            catch (Exception ex)
            {
                Log.Unhandled(ex);
                budgetInfo = null;
            }
        }