示例#1
0
      /// <summary>
      /// Edits the todo item.
      /// </summary>
      private void EditTodoItem(){
        bool status                 = false;

        try {
          if (tbcMain.SelectedTab != tbTodo) {
            tbcMain.SelectedTab       = tbTodo;
          }

          if ((dgvTodo.SelectedRows.Count > 0) & (dgvTodo.Rows.Count != 1)) {
            if (dgvTodo.SelectedRows.Count == 1) {
              if (dgvTodo.SelectedRows[0].Index != dgvTodo.Rows.Count - 1){
                ToDo todoItem         = (ToDo)dgvTodo.SelectedRows[0].Tag;
                TodoItemForm frm      = new TodoItemForm(ref todoItem);
                frm.ShowDialog();

                if (todoItem.GUID != null) {
                  status              = _todoControl.Edit(todoItem);

                  if (status) {
                    PopulateTodoTab();

                  } else {
                    throw new Exception();
                  }
                }
              }

            } else {
              MessageBox.Show("Please select only one Todo Item you wish to edit.", "EDIT",
                              MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }

          } else {
            MessageBox.Show("Please select the Todo Item you wish to edit.", "EDIT",
                              MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
          }

        } catch (Exception ex) {
          Utilities.ShowErrorMessage("Error Editing TimeSheet Item.", ex);
        }
      }
示例#2
0
      /// <summary>
      /// Adds the todo item.
      /// </summary>
      private void AddTodoItem(){
        try {
          if (tbcMain.SelectedTab != tbTodo) {
            tbcMain.SelectedTab       = tbTodo;
          }

          ToDo todoItem         = new ToDo();
          TodoItemForm frm      = new TodoItemForm(ref todoItem);
          frm.ShowDialog();

          if (todoItem.GUID != "") {
            _todoControl.Add(todoItem);
            PopulateTodoTab();
          }

        } catch (Exception ex) {
          Utilities.ShowErrorMessage("Error Adding TodoList Item!", ex);
        }
      }