Ejemplo n.º 1
0
        public void TaskIsComplete(bool complete, int taskId)
        {
            using var con = HelperDataAccess.Conn();

            con.Open();
            String dapperChecked = "UPDATE Tasks SET TaskComplete = '" + complete + "' WHERE TaskId = '" + taskId + "'";

            var affectedRows = con.Execute(dapperChecked, new { TaskComplete = complete });
        }
Ejemplo n.º 2
0
        public void EditTask(int taskId, string name, Category category, DateTime due, Reminder reminder, Repetition repetition, bool important, bool complete)
        {
            using var con = HelperDataAccess.Conn();

            con.Open();

            String dapperChecked = "UPDATE Tasks SET TaskName = '" + name + "', TaskCategory = '" + (int)category + "', DueDate = '" + due + "', Reminder = '" + (int)reminder + "', TaskRepetition = '" + (int)repetition + "', IsImportant = '" + important + "' WHERE TaskId = '" + taskId + "'";

            var affectedRows = con.Execute(dapperChecked, new { TaskName = name, IsImportant = important, TaskCategory = (int)category, DueDate = due, Reminder = (int)reminder, TaskRepetition = (int)repetition });
        }
Ejemplo n.º 3
0
        public IEnumerable <Task> Connect(string sqlQuery)
        {
            using var con = HelperDataAccess.Conn();

            con.Open();

            IEnumerable <Task> taskList = new ObservableCollection <Task>(con.Query <Task>(sqlQuery).ToList());

            con.Close();

            return(taskList);
        }
Ejemplo n.º 4
0
        public void CreateTask(string name, bool Complete, bool Important, DateTime Due, Reminder Reminder, Category Category, Repetition Repetition)
        {
            using var con = HelperDataAccess.Conn();

            con.Open();

            string insertTask = "INSERT INTO dbo.[Tasks] (TaskName, TaskComplete, IsImportant, TaskCategory, DueDate, Reminder, TaskRepetition) VALUES" +
                                "(@TaskName, @TaskComplete, @IsImportant, @TaskCategory, @DueDate, @Reminder, @TaskRepetition)";

            var affectedRows = con.Execute(insertTask, new { TaskName = name, TaskComplete = Complete, IsImportant = Important, TaskCategory = Category, DueDate = Due, Reminder, TaskRepetition = Repetition });

            con.Close();
        }