예제 #1
0
        private void DisplayTaskInTextArea(DateTime date)
        {
            TaskListArea.Clear();
            DateLabel.Text = date.ToShortDateString();
            DayLabel.Text  = date.DayOfWeek.ToString();
            using (SqlInterface task = new SqlInterface(FormDate))
            {
                if (task.Tasks != null && task.Tasks.Count != 0)
                {
                    int i = 0;

                    foreach (SingleTask EachTask in task.Tasks)
                    {
                        TaskListArea.AppendText(
                            ++i
                            + EachTask.TimeCreated.ToString().Substring(0, 8).PadLeft(9 + 15)
                            + EachTask.Task.PadLeft(EachTask.Task.Length + 25)
                            + "\n"
                            );
                    }
                }
                else
                {
                    DisplayWhenNoTask();
                }
            }
        }
예제 #2
0
        private void DeleteTaskButton_Click(object sender, EventArgs e)
        {
            try
            {
                using (SqlInterface task = new SqlInterface(FormDate))
                {
                    DeleteForm DeleteTaskEvent = new DeleteForm();
                    DeleteTaskEvent.ShowDialog();
                    int index = DeleteTaskEvent.IndexofTask;
                    task.DeleteTask(index);
                    DisplayTaskInTextArea(FormDate);
                }
            }

            catch (IncorrectInputException IIE)
            {
                MessageBox.Show("Index can be in range [" + 1 + "-" + IIE.Message + "]");
            }
        }
예제 #3
0
        /* private void YesterdaysScheduleButton_Click(object sender, EventArgs e)
         * {
         *       dateTimePicker.Value = DateTime.Now.AddDays(-1);
         * }*/
        private void AddTaskButton_Click(object sender, EventArgs e)
        {
            Form2 AddTaskEventHandler = new Form2(FormDate); // creating new form for taking input

            AddTaskEventHandler.ShowDialog();                // this will display the form
            try
            {
                using (SqlInterface task = new SqlInterface(FormDate))
                {
                    task.AddTask(AddTaskEventHandler.EnteredTask, AddTaskEventHandler.SelectedTime);
                }
                dateTimePicker.Value = FormDate.AddMilliseconds(1);
            }
            catch (ConflictingScheduledTimeException CSTE)
            {
                MessageBox.Show(CSTE.Message);
            }
            catch (WindowClosedException)
            {
            }
        }