示例#1
0
        private void loginButton_Click(object sender, EventArgs e)
        {
            if (emailForm.Text == "")
            {
                MessageBox.Show("Please enter user name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                emailForm.Focus();
                return;
            }
            if (passwordForm.Text == "")
            {
                MessageBox.Show("Please enter password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                passwordForm.Focus();
                return;
            }
            dao.Login(emailForm.Text, security.EncryptSHA256_EUCKR(passwordForm.Text));

            this.Hide();
            TodoList mainTodoList = new TodoList();

            mainTodoList.ShowDialog();
            this.Close();
        }
示例#2
0
        public static void AddTask(string taskTitle, string taskDescription)
        {
            var task = new TodoList(IdGenerator(), taskTitle, taskDescription, DateGenerator());

            todolistArray.Add(task);
        }
示例#3
0
 public void Execute(TodoList todo, string item)
 {
 }
示例#4
0
 public TodoController(TodoList todo)
 {
     this.todo = todo;
 }
示例#5
0
        public void Execute(TodoList todo, string item)
        {
            var index = int.Parse(item) - 1;

            todo.Complete(index);
        }
示例#6
0
 public void Execute(TodoList todo, string item)
 {
     todo.Add(item);
 }
示例#7
0
        static void Main(string[] args)
        {
            TodoList.PreAddTasks();
            Console.WriteLine("Hi, this is a Todo task manager! ");

            while (true)
            {
                Console.WriteLine(" ");
                TodoList.ShowOptions();

                var readline        = Console.ReadLine();
                var readlineToLower = readline.ToLower();

                switch (readlineToLower)
                {
                case "a":
                    Console.WriteLine("     Enter title");
                    string taskTitle = Console.ReadLine();
                    Console.WriteLine("     Enter Description");
                    string taskDescription = Console.ReadLine();
                    TodoList.AddTask(taskTitle, taskDescription);
                    TodoList.ShowTask();
                    break;

                case "e":
                    Console.WriteLine("     Please write the ID to edit task");
                    string itemEditId = Console.ReadLine().ToUpper();

                    //Task Exist ?
                    if (TodoList.CheckTaskExist(itemEditId) == 0)
                    {
                        Console.WriteLine("     ******");
                        Console.WriteLine("     The entered Id does not exist, please try again");
                        Console.WriteLine("******");
                    }
                    else
                    {
                        Console.WriteLine("     Select what you want to edit");
                        Console.WriteLine("     For title press       [t]");
                        Console.WriteLine("     For Description press [d]");

                        string columnToEdit = Console.ReadLine();

                        Console.WriteLine("     Please enter your phrase");

                        string enteredPhrase = Console.ReadLine();
                        TodoList.EditTask(itemEditId, columnToEdit, enteredPhrase);
                    }

                    //TodoList.ShowTask();
                    break;

                case "d":
                    Console.WriteLine("     Please write the ID of the task you want to delete");
                    string itemDeleteId = Console.ReadLine().ToUpper();
                    //Task Exist ?
                    if (TodoList.CheckTaskExist(itemDeleteId) == 0)
                    {
                        Console.WriteLine("     ******");
                        Console.WriteLine("     The entered Id does not exist, please try again");
                        Console.WriteLine("     ******");
                    }
                    else
                    {
                        TodoList.DeleteTask(itemDeleteId);
                    }
                    TodoList.ShowTask();
                    break;

                case "s":
                    TodoList.ShowTask();
                    break;

                default:
                    TodoList.ShowOptions();
                    break;
                }
            }
        }