Пример #1
0
        // this function forwards the inputs for validations check and then forwards to User class
        public static InfoObject addTask(string email, string title, string description, string dueDate)
        {
            Log.Info("Add new task request by: " + email + ". Task: " + title);
            User CurrUser = (User)currUsers[email];

            if (CurrUser != null && (IsValid.IsValidTaskTitle(title) & IsValid.IsValidTaskDescreption(description) & IsValid.IsValidTaskDueDate(dueDate)))
            {
                return(CurrUser.addTask(title, description, dueDate));
            }
            else
            {
                Log.Error("Adding task failed.");
                InfoObject info = new InfoObject(false, "Adding task failed.");
                return(info);
            }
        }
Пример #2
0
        // this function forwards the inputs for validations check and then forwards to User class
        public static InfoObject editTaskTitle(string email, int taskID, int status, string newTitle)
        {
            Log.Info("Edit existing task title request by: " + email + ". Task ID: " + taskID);
            User CurrUser = (User)currUsers[email];

            if (CurrUser != null && IsValid.IsValidTaskTitle(newTitle))
            {
                return(CurrUser.editTaskTitle(taskID, status, newTitle));
            }
            else
            {
                Log.Error("Edit task title failed. the new title is over 300 chars");
                InfoObject info = new InfoObject(false, "Edit task title failed. the new title is over 50 chars");
                return(info);
            }
        }