protected void btnNewTask_Click(object sender, EventArgs e)
 {
     lblError.Text = "";
     if (currentProject != null && txtNewTask.Text != "")
     {
         Tasks newTask = new Tasks();
         newTask.name = txtNewTask.Text;
         newTask.addToProject(currentProject.id);
         newTask.save();
         txtNewTask.Text = "";
         //liste neu laden
         updateTasks();
     }
     else lblError.Text = "Task kann nicht gespeichert werden!";
 }
Esempio n. 2
0
 // Laden aller Tasks als Liste von Objekten für ein Projekct - Funktion wird von Projects aufgerufen!
 internal static List<Tasks> LoadTasksForProject(Projects theProject)
 {
     SqlCommand cmd = new SqlCommand("select id, name, projectID from Tasks where projectID = @projectID", Main.GetConnection());
     cmd.Parameters.Add(new SqlParameter("projectID", theProject.id));
     SqlDataReader reader = cmd.ExecuteReader();
     List<Tasks> allTasks = new List<Tasks>(); //initialisiere lehre Liste von Tasks
     while (reader.Read())
     {
         Tasks oneTask = new Tasks();
         oneTask.id = reader.GetString(0);
         oneTask.name = reader.GetString(1);
         oneTask.projectID = reader.GetString(2);
         oneTask.comments = oneTask.getComments;
         allTasks.Add(oneTask);
     }
     return allTasks;
 }
Esempio n. 3
0
 // Laden aller Comments als Liste von Objekten für einen Task - Funktion wird von Tasks aufgerufen!
 internal static List<Comments> LoadCommentsForTasks(Tasks theTask)
 {
     SqlCommand cmd = new SqlCommand("select id, text, taskID, date from Comments where taskID = @taskID", Main.GetConnection());
     cmd.Parameters.Add(new SqlParameter("taskID", theTask.id));
     SqlDataReader reader = cmd.ExecuteReader();
     List<Comments> allComments = new List<Comments>(); //initialisiere leere Liste von Tasks
     while (reader.Read())
     {
         Comments oneComment = new Comments();
         oneComment.id = reader.GetString(0);
         oneComment.text = reader.GetString(1);
         oneComment.taskID = reader.GetString(2);
         oneComment.dateString = reader.GetDateTime(3).ToString("dd.MM.yyyy - HH:mm")+" Uhr";
         allComments.Add(oneComment);
     }
     return allComments;
 }