Ejemplo n.º 1
0
        private void punchOutAtToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string prompt = $"Please specify punch out time (In at {dt.CurrentTimeEntryRow.StartTime:HH:mm})";

            StringInputForm input =
                new StringInputForm(prompt,
                                    DateTime.Now.ToString("MM/dd/yyyy HH:mm"),
                                    "00/00/0000 90:00",
                                    typeof(System.DateTime));

            if (input.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    DateTime outTime = DateTime.Parse(input.Response);
                    if (outTime.CompareTo(dt.CurrentTimeEntryRow.StartTime) > 0)
                    {
                        dt.PunchOut(outTime);
                    }
                    else
                    {
                        MessageBox.Show("You can't punch out prior to punch in time!");
                    }
                }
                catch
                {
                    MessageBox.Show("The time/date you entered was invalid.  Please try again.");
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Event handler for the Add Project menu item.  When clicked,
        /// prompt the user for a project name using the StringInputForm.
        /// A new ProjectsRow is then created, added to the dataset, and
        /// reflected in the menu.  The DataSet is then saved to disk.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addProjectToolStripMenuItem_Click(object sender, EventArgs e)
        {
            StringInputForm input =
                new StringInputForm("Please enter a name for the new project");

            if (input.ShowDialog() == DialogResult.OK)
            {
                dt.AddNewProject(input.Response);
            }
        }