コード例 #1
0
ファイル: Root.xaml.cs プロジェクト: muneneevans/CRMS
        private void UpdateTaskCreateButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                // get id of the task
                DB1 = new DBManager();
                task t = DB1.GetTasks("SELECT a.* FROM tasks a , projects b WHERE a.project_id = b.project_id AND a.task_name = '" + this.UpdateTaskTaskNameTextBox.Text + "' AND b.project_name = '" + this.UpdateTaskProjectNameTextBox.Text + "'").First();

                //  fill the records
                t.start_date = (DateTime) this.UpdateTaskStartDatePicker.SelectedDate;
                t.end_date = (DateTime) this.UpdateTaskDeadlineDatePicker.SelectedDate;
                t.employee_id = DB1.GetEmployees("SELECT * from employees where employee_name = '" + this.UpdateTaskForemanTextBox.Text +  "'").First().employee_id;
                t.budget = Convert.ToInt32(this.UpdateTaskBudgetTextBox.Text);

                if (DB1.UpdateTask(t))
                {
                    MessageBox.Show("Task has been updated");
                    EmptyAllfields(this.UpdateTasksGrid);
                    Initialization();
                }
            }
            catch { }
        }