Esempio n. 1
0
        private bool ChangeEntry(bool isProjectWork, bool isTaskChange)
        {
            //show popup and ask for date
            frmConfirmEndTime tmEdit = new frmConfirmEndTime();

            m_lastTimeEntry.EndDateTime = OperationsReadOnly.RoundToMinute(DateTime.Now);
            tmEdit.PopulateScreen(m_lastTimeEntry, m_currUser);
            tmEdit.StartPosition = FormStartPosition.CenterParent;
            tmEdit.BringToFront();
            tmEdit.ShowDialog(this);

            if (tmEdit.WasConfirmed)
            {
                //change status
                if (isProjectWork)
                {
                    //reset the screen with the newly selected project and task if possible
                    PopulateScreen(m_currUser, new TimeEntry {
                        StartDateTime = tmEdit.SavedEntry.EndDateTime, EndDateTime = OperationsReadOnly.RoundToMinute(DateTime.Now), ProjectId = cbxProjects.SelectedItem == null ? Guid.Empty : ((Project)cbxProjects.SelectedItem).Id, TaskId = cbxTasks.SelectedItem == null ? Guid.Empty : ((Task)cbxTasks.SelectedItem).Id
                    }, AreRemindersOn, m_reminderMilliseconds);
                }
                else
                {
                    //set up the screen for a new entry
                    PopulateScreen(m_currUser, null, AreRemindersOn, m_reminderMilliseconds);
                }

                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
0
        public void PopulateScreen(Goal item, User currUser)
        {
            m_item = item;
            if (item == null)
            {
                m_item        = new Goal();
                m_item.GoalId = Guid.Empty;
                m_item.UserId = currUser.UserId;
                m_item.ActualCompletionDate = OperationsReadOnly.RoundToMinute(DateTime.Now);
                m_item.TargetCompletionDate = OperationsReadOnly.RoundToMinute(DateTime.Now);
            }

            txtDescription.Text = m_item.Description;
            txtMeasure.Text     = m_item.TargetMeasure;
            dtpTarget.Value     = m_item.TargetCompletionDate;

            chkClosed.Checked     = m_item.Completed;
            txtResultMeasure.Text = m_item.ResultMeasure;
            trkMeasure.Value      = m_item.ResultMeasureRating;
            dtpResultDate.Value   = m_item.ActualCompletionDate;
            trkTimeliness.Value   = m_item.ResultTimelinessRating;
            txtPositives.Text     = m_item.Positives;
            txtImprovements.Text  = m_item.Improvements;

            SetupCompleted();
        }
Esempio n. 3
0
        /// <summary>
        /// Populate the times grid
        /// </summary>
        private void SetupGrid()
        {
            if (dgHistory == null)
            {
                dgHistory = new UserControls.TimeEditGrid();
                //dgHistory.Anchor = ( (AnchorStyles)AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top );
                dgHistory.Dock             = DockStyle.Fill;
                dgHistory.EditFormClosing += new FormClosingEventHandler(tmEdit_FormClosing);
                tabPage1.Controls.Add(dgHistory);
            }

            if (showAllForDay)
            {
                dgHistory.SetupGrid(OperationsReadOnly.GetTimeEntryForDate(OperationsReadOnly.RoundToMinute(DateTime.Now), m_currUser), m_currUser);
            }
            else
            {
                dgHistory.SetupGrid(OperationsReadOnly.GetRecentTimeEntry(5, m_currUser), m_currUser);
            }
        }
Esempio n. 4
0
        private void StartClock(bool createNewEntry)
        {
            startNewEntryToolStripMenuItem.Enabled = false;
            startAndContinuePreviousEntryToolStripMenuItem.Enabled = false;

            //set up the screen for a new entry
            if (createNewEntry)
            {
                PopulateScreen(m_currUser, new TimeEntry {
                    StartDateTime = OperationsReadOnly.RoundToMinute(DateTime.Now), EndDateTime = OperationsReadOnly.RoundToMinute(DateTime.Now)
                }, AreRemindersOn, m_reminderMilliseconds);
            }
            else
            {
                m_isInSetupMode = true;
                PopulateScreen(m_currUser, OperationsReadOnly.GetLatestTimeEntry(m_currUser), AreRemindersOn, m_reminderMilliseconds);
                m_isInSetupMode = false;
            }

            chkNothing.Text  = "Stop the Clock       ";
            chkNothing.Image = global::TRec.Windows.UI.Properties.Resources.stopwatch_off;
        }
Esempio n. 5
0
        public void PopulateScreen(User usr, TimeEntry lastTimeEntry, bool remindersOn, int reminderMilliseconds)
        {
            //indicate we are setting up the screen
            m_isInSetupMode = true;

            m_currUser             = usr;
            m_lastTimeEntry        = lastTimeEntry;
            m_reminderMilliseconds = reminderMilliseconds;

            if (lastTimeEntry == null)
            {
                //change enabled status
                chkNothing.Checked = true;
                pnlEntry.Enabled   = false;
                chkNothing.Image   = global::TRec.Windows.UI.Properties.Resources.stopwatch_on;

                dtpStart.Visible = false;
            }
            else
            {
                if (!m_isInSetupMode)
                {
                    chkNothing.Checked = false;
                }
                pnlEntry.Enabled = true;
                chkNothing.Image = global::TRec.Windows.UI.Properties.Resources.stopwatch_off;

                dtpStart.Visible = true;
            }

            //ensure we are back to an empty state for consistency
            ResetScreen();

            //populate & default drop downs
            Project currProj = m_lastTimeEntry == null ? null : OperationsReadOnly.GetProjectForUser(m_lastTimeEntry.ProjectId, m_currUser.UserId);
            Task    currTask = m_lastTimeEntry == null ? null : OperationsReadOnly.GetTaskById(m_lastTimeEntry.TaskId, m_lastTimeEntry.ProjectId, m_currUser.UserId);

            SetupProjectAndTasks(currProj, currTask);

            dtpStart.Value = lastTimeEntry == null?OperationsReadOnly.RoundToMinute(DateTime.Now) : lastTimeEntry.StartDateTime;

            //if the start date is future, add 1 minute to that, otherwise add one minute to now
            DateTime greaterDate = dtpStart.Value > DateTime.Now ? dtpStart.Value : DateTime.Now;

            dtpEnd.Value = OperationsReadOnly.RoundToMinute(greaterDate.AddMinutes(1));

            txtDetails.Text = lastTimeEntry == null ? string.Empty : lastTimeEntry.Details;
            nudExc1.Value   = lastTimeEntry == null ? 0 : lastTimeEntry.ExceptionMinutes;
            txtExc1.Text    = lastTimeEntry == null ? string.Empty : lastTimeEntry.ExceptionDetails;

            AreRemindersOn = remindersOn;
            ToggleReminders();

            SetupGrid();

            //reset the last preferred reminder
            if (reminderMilliseconds != 0)
            {
                nudInterval.Value = reminderMilliseconds / 1000 / 60;
            }

            //indicate we have finished setting up the screen
            m_isInSetupMode = false;

            SetupBottomLink();
            SetupGoals();
        }
Esempio n. 6
0
 public void PopulateScreen(User usr)
 {
     dtpFilterDate.Value = OperationsReadOnly.RoundToMinute(DateTime.Now);
     m_currUser          = usr;
 }