public AddProjectDialog(Project current)
 {
     InitializeComponent();
     ProjectTitle.Text = current.Name;
     Description.Text = current.Description;
     DueDate.SelectedDate = current.DueDate;
 }
Beispiel #2
0
 public IEnumerable<Project> LoadProjects()
 {
     _dbconnection.Open();
     var sql = "SELECT * FROM projects";
     var command = new SQLiteCommand(sql, _dbconnection);
     var reader = command.ExecuteReader();
     var projects = new List<Project>();
     while (reader.Read())
     {
         var name = (string)reader["name"];
         var description = (string) reader["description"];
         var due = (DateTime) reader["duedate"];
         var proj = new Project(name, description, due);
         projects.Add(proj);
     }
     _dbconnection.Close();
     return projects;
 }
Beispiel #3
0
        private void EditProject_Click(object sender, RoutedEventArgs e)
        {
            var selected = (Project) Projects.SelectedItem;
            if (selected != null)
            {
                var proj = Manager.Projects.Find(p => p.Name == selected.Name);
                if (proj != null)
                {
                    var dialog = new AddProjectDialog(proj);
                    if (dialog.ShowDialog() == true)
                    {
                        Manager.Projects.Remove(proj);
                        var name = dialog.DialogProjectTitle;
                        var desc = dialog.ProjectDescription;
                        var due = dialog.ProjectDue;
                        var newProj = new Project(name, desc, due);
                        Manager.Projects.Add(newProj);

                        Projects.Items.Remove(proj);
                        Projects.Items.Add(newProj);
                    }
                }
            }
        }
Beispiel #4
0
 private void AddProject(Project p)
 {
     Projects.Items.Add(p);
 }
Beispiel #5
0
 private void AddProject(Project proj)
 {
     Projects.Add(proj);
 }
Beispiel #6
0
 public Project AddNewProject(string title, string description, DateTime due)
 {
     var proj = new Project(title, description, due);
     Projects.Add(proj);
     return proj;
 }