Example #1
0
        public FormMain()
        {
            InitializeComponent();
            Data.Initialise();
            ucWeek.SetFormOnMain = SetForm;
            SetForm();
            if (IsTesting())
            {
                Text += " TEST";
            }

            timer1.Tick       += (s, e) => SetForm();
            FormClosing       += (s, e) => Data.CloseConnection();
            btnClockIn.Click  += (s, e) => OpenFormLoc();
            btnClockOut.Click += (s, e) => { if (Data.CheckOut())
                                             {
                                                 SetForm();
                                             }
            };
            lblOnline.Click          += (s, e) => OpenForm(new FormEditTime());
            dtOverzicht.ValueChanged += (s, e) => SetBtnGenerate();
            chrtUren.Series[1]        = GraphLayer.GetSeries(GraphLayer.HoursByContract);
            tpChart.Controls.Add(chrtUren);
            chrtUren.Location = new Point(0, 0);
            tpUren.Controls.Add(ucWeek);
        }
Example #2
0
        private void SetForm()
        {
            chrtUren.Enabled    = grpTotalen.Enabled = grpOverzicht.Enabled = Data.IsConnected && !Data.DbEmpty;
            grpKlokken.Enabled  = Data.IsConnected;
            btnClockIn.Enabled  = !Data.IsLoggedIn();
            btnClockOut.Enabled = !btnClockIn.Enabled;

            var reg = Data.Last();

            if (reg == null)
            {
                return;
            }
            SetBtnGenerate();
            ucWeek.Init();
            lblOnline.Text        = StringLayer.GetLblOnlineString(reg);
            lblUrenWeek.Text      = Registratie.TotalDuration(Data.GetRegsForWeek(DateTime.Now)) + "/" + Contract.Uren;
            lblUrenTotaal.Text    = Registratie.TotalDuration(Data.All());
            lblUrenDiff.Text      = Registratie.Difference(Data.All());
            lblUrenDiff.ForeColor = lblUrenDiff.Text.StartsWith("-") ? Color.Red : Color.Green;
            chrtUren.Series[0]    = GraphLayer.GetSeries(GraphLayer.WorkedHours);
        }