예제 #1
0
        private void AssignProjectEmployeeAssignButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                // check for empty value
                CheckForEmpty(this.AssignProjectEmployeeGrid);
                if (this.textboxstatus == false)
                {
                    MessageBox.Show("A field has not been entered");
                    textboxstatus = false;
                    return;
                }
            }
            catch
            { }
            try
            {
                // get the details of employee and project
                DB1 = new DBManager();
                projects prj = (projects)DB1.GetProjects("SELECT * FROM projects where project_name = '" + this.AssignProjectEmployeeProjectNameTextBox.Text + "'").First();
                employees emp = (employees)DB1.GetEmployees("SELECT * FROM employees WHERE employee_name = '" + this.AssignProjectEmployeeEmployeeNameComboBox.SelectedItem.ToString() + "'").First();
                Container c = new Container();
                c._project_employee_allocation = new project_employee_allocation();
                c._project_employee_allocation.employee_id = emp.employee_id;
                c._project_employee_allocation.project_id = prj.project_id;

                if (DB1.InsertValue(c, Constants.Project_Employee_Allocation))
                {
                    MessageBox.Show("Employee allocated");
                    EmptyAllfields(this.AssignProjectEmployeeGrid);
                    RefreshContainer();
                }
            }
            catch { }
        }
예제 #2
0
 private void ProjectSummary()
 {
     // get a summary of all data relating to the projects
     try
     {
         // get a list of all running projects
         try
         {
             DB1 = new DBManager();
             this.RunningProjectsListView.ItemsSource = DB1.GetProjects("SELECT * FROM projects WHERE start_date < '" + DateTime.Now.ToString("yyyy'-'MM'-'dd") + "' AND end_date > '" + DateTime.Now.ToString("yyyy'-'MM'-'dd") + "'");
             Debug.WriteLine("SELECT * FROM projects WHERE start_date < '" + DateTime.Now.ToString("yyyy'-'MM'-'dd") + "' AND end_date > '" + DateTime.Now.ToString("yyyy'-'MM'-'dd") + "'");
             ProjectListviewItem_Click(null, null);
             this.ProjectsDatagrid.ItemsSource = DB1.GetRawData("SELECT project_name AS 'ALL PROJECTS' FROM projects ").DefaultView;
         }
         catch { }
     }
     catch { }
 }
예제 #3
0
        private void UpdateProjectButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                // check for empty ness
                CheckForEmpty(this.UpdateProjectGrid);
                if (this.textboxstatus == false)
                {
                    MessageBox.Show("A field has not been entered");
                    textboxstatus = false;
                    return;
                }
                DB1 = new DBManager();

                Container Entity1 = new Container();
                Entity1._project.project_id = DB1.GetProjects("SELECT * FROM projects WHERE project_name = '" + this.UpdateProjectProjectNameComboBox.SelectedItem.ToString() + "'").First().project_id;
                Entity1._project.project_name = this.UpdateProjectProjectNameTextBox.Text;
                Entity1._project.location = this.UpdateProjectLocationTextBox.Text;
                Entity1._project.description = this.UpdateProjectDescriptionTextBox.Text;
                Entity1._project.end_date = (DateTime)this.UpdateProjectEndDatePicker.SelectedDate;
                Entity1._project.start_date = (DateTime)this.UpdateProjectStartDatePicker.SelectedDate;

                // get the client
                try
                {
                    List<clients> cc = DB1.GetClients("");
                    var result = from item in cc
                                 where item.client_name.ToLower().Contains(this.RegisterProjectClientTextBox.Text.ToLower())
                                 select item;

                    if (result != null)
                    {
                        Entity1._project.client_id = Convert.ToInt32(((List<clients>)result.ToList()).First().client_id);
                    }

                }
                catch { }

                if (DB1.UpdateProject(Entity1._project))
                {
                    MessageBox.Show("Project Successfully updated");
                    EmptyAllfields(this.UpdateProjectGrid);
                    Initialization();
                    //this.UpdateProjectProjectNameComboBox = new ComboBox();
                    //ComboboxPopulating(this.UpdateProjectProjectNameComboBox, null);
                }

            }
            catch { }
        }
예제 #4
0
        private void UpdateProjectProjectNameComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                DB1 = new DBManager();
                projects p = DB1.GetProjects("SELECT * FROM projects WHERE project_name = '" + ((ComboBox)sender).SelectedItem.ToString() + "'").First();
                clients c = DB1.GetClients("SELECT a.* FROM clients a , projects b WHERE a.client_id = b.client_id AND a.client_id = " + p.client_id).First();
                Debug.WriteLine("SELECT a.* FROM clients a , projects b WHERE a.client_id = b.client_id AND a.client_id = " + p.client_id);
                //populate fields with values
                this.UpdateProjectProjectNameTextBox.Text = p.project_name;
                this.UpdateProjectDescriptionTextBox.Text = p.description;
                this.UpdateProjectLocationTextBox.Text = p.location;
                this.UpdateProjectStartDatePicker.SelectedDate = p.start_date;
                this.UpdateProjectEndDatePicker.SelectedDate = p.end_date;
                this.UpdateProjectClientTextBox.Text = c.client_name;

            }
            catch { }
        }
예제 #5
0
        private void AssignProjectEmployeeEmployeeNameComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                // get a list of all projects the employee is in

                DB1 = new DBManager();
                this.CommitedProjectsListView.ItemsSource = DB1.GetProjects("SELECt a.* from projects a , project_employee_allocation b , employees c where a.project_id = b.project_id AND b.employee_id = c.employee_id and c.employee_name = '" + ((ComboBox)sender).SelectedItem.ToString() + "'");

            }
            catch { }
        }