示例#1
0
        private void MainMenuDataDeleteTimecard_Click(object sender, EventArgs e)
        {
            Log("MainMenuDataDeleteTimecard_Click event");

            if (MessageBox.Show(this,
                                "Delete this timecard?\nWarning: all activity for this timecard will also be deleted",
                                this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
            {
                SetStatusMessage("Deleting timecard...");

                try
                {
                    _timecardLogic.DeleteTimecard();
                }
                catch (TimecardNotFoundException)
                {
                    _timecardLogic.GetNewTimecard();
                }

                MainDate.Value = _timecardLogic.GetCurrentTimecard().Date;
                UpdateMainDateLabel();
                PopulateActivitiesGrid();

                ClearStatusMessage();
            }
        }
示例#2
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            Log("MainForm_Load event");

            _timecardLogic = new TimecardLogic(Factory);
            _reportLogic   = new ReportLogic(Factory);

            _loading = true;

            Timecard tc;

            try
            {
                tc = _timecardLogic.GetLatestTimecard();
            }
            catch (TimecardNotFoundException)
            {
                tc = _timecardLogic.GetNewTimecard();
            }

            MainDate.Value = tc.Date;
            UpdateMainDateLabel();
            PopulateActivitiesGrid();
            ClearStatusMessage();

            ReportOptionHundredths.Checked = (Configuration.MinutesPerReportUnit == 1);
            ReportOptionTenths.Checked     = (Configuration.MinutesPerReportUnit == 6);
            ReportOptionQuarters.Checked   = (Configuration.MinutesPerReportUnit == 15);

            _loading = false;
        }