Пример #1
0
        /// <summary>
        /// button do dodawania kolejnych task
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonAddTask_Click(object sender, EventArgs e)
        {
            if (checkedListBoxImportance.CheckedItems == null)
            {
                MessageBox.Show("Zaznacz ważność!");
                return;
            }
            Classes.TaskRelated.Task task = new Classes.TaskRelated.Task(textBoxTask.Text.ToString(), checkedListBoxImportance.CheckedItems[0].ToString(), false);

            SQLConnector sQLConnector = new SQLConnector();

            sQLConnector.InsertTaskIntoTasks(task, user, diary);
            diary.addTaskToDayTasks(task);

            SQLConnector sQLConnetor = new SQLConnector();

            dataGridViewTasks.DataSource = sQLConnetor.ReturnDataTable(user, diary.Date);

            textBoxTask.Text = "";
            foreach (int i in checkedListBoxImportance.CheckedIndices)
            {
                checkedListBoxImportance.SetItemCheckState(i, CheckState.Unchecked);
            }
            MessageBox.Show("Zadanie dodane!");
        }