Esempio n. 1
0
 private void TasksListViewItemClicked(object sender, RoutedEventArgs e)
 {
     try
     {
         // get the task clicked
         ListView l = (ListView)sender;
         task t = (task)l.SelectedItem;
         DB1 = new DBManager();
         this.TaskDetailsListView.ItemsSource = null;
         this.TaskDetailsListView.ItemsSource = DB1.GetTaskDetails("SELECT a.* , b.project_name , c.employee_name , TIMESTAMPDIFF(DAY, a.start_date, a.end_date) AS duration FROM tasks a , projects b , employees c WHERE a.project_id = b.project_id AND a.employee_id = c.employee_id AND a.task_id = " + t.task_id);
         this.TaskResourcesListView.ItemsSource = DB1.GetProjectMaterials("SELECT a.*, d.*, SUM(b.quantity) AS quantity, SUM(b.quantity * b.unit_buying_price) AS Cost FROM materials a , task_materials b , tasks c , projects d WHERE a.material_id = b.material_id AND b.task_id = c.task_id AND c.project_id = d.project_id AND c.task_id = " + t.task_id + " Group BY a.material_name");
         Debug.WriteLine("SELECT a.*, d.*, SUM(b.quantity) AS quantity, SUM(b.quantity * b.unit_buying_price) AS Cost FROM materials a , task_materials b , tasks c , projects d WHERE a.material_id = b.material_id AND b.task_id = c.task_id AND c.project_id = d.project_id AND c.task_id = " + t.task_id + " Group BY a.material_name");
     }
     catch { }
 }