예제 #1
0
        public ProjectForm(long id) : this()
        {
            idToUpdate = id;

            if (idToUpdate != null)
            {
                Project project = _service.ReadById(Convert.ToInt64(idToUpdate));
                project.Customer  = _customerService.ReadById(project.CustomerId);
                project.Manager   = _managerService.ReadById(project.ManagerId);
                project.Plannings = _planningService.ReadAllByProjectId(project.Id).ToList();
                txtNome.Text      = project.Name;
                dtpInicio.Value   = project.StartDate;
                dtpFim.Value      = project.EndDate;
                txtDescricao.Text = project.Description;
                numReceita.Value  = (decimal)project.ExpectedReveneu;
                cbEstado.Text     = ProjectStateExtensions.ToDescriptionString(project.State);
                cbCliente.Text    = project.Customer.Id + " " + project.Customer.Name;

                if (project.Plannings != null)
                {
                    foreach (var planning in project.Plannings)
                    {
                        planning.JobRole = _jobRoleService.ReadById(planning.JobRoleId);
                        dgvRecursos.Rows.Add(planning.JobRole.Id, planning.JobRole.Name, planning.JobRole.Level, planning.Quantity, planning.PlannedHours);
                        planning.JobRole = null;
                    }
                }

                planningsToDelete = project.Plannings.ToList();
            }
        }
예제 #2
0
        private void LoadData()
        {
            Dictionary <string, int> horasPorCargo = new Dictionary <string, int>();

            List <Project> projects = projectService.ReadWithParameters(dtpInicio.Value, dtpFim.Value, 0, ProjectState.NULL).ToList();

            foreach (var project in projects)
            {
                project.Plannings = planningService.ReadAllByProjectId(project.Id).ToList();
                foreach (var planning in project.Plannings)
                {
                    planning.JobRole = jobRoleService.ReadById(planning.JobRoleId);
                    if (horasPorCargo.ContainsKey(planning.JobRole.Name))
                    {
                        horasPorCargo[planning.JobRole.Name] += 1;
                    }
                    else
                    {
                        horasPorCargo.Add(planning.JobRole.Name, 1);
                    }
                }
            }

            this.chart1.Palette = ChartColorPalette.SeaGreen;
            this.chart1.Series.Clear();

            foreach (var a in horasPorCargo.Keys)
            {
                Series series = this.chart1.Series.Add(a);
                series.Points.Add(horasPorCargo[a]);
            }
        }
예제 #3
0
        public JobRoleForm(long id) : this()
        {
            idToUpdate = id;

            if (idToUpdate != null)
            {
                JobRole jobRole = _service.ReadById(Convert.ToInt64(idToUpdate));

                txtCargo.Text = jobRole.Name;
                txtNivel.Text = jobRole.Level;
            }
        }
예제 #4
0
 private void DgpJobRoles_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (e.ColumnIndex == 4)
         {
             string id = dgvJobRoles.Rows[e.RowIndex].Cells[0].Value.ToString();
             if (id.Trim() != "")
             {
                 if (DialogResult.Yes == MessageBox.Show("Tem certeza que deseja excluir o cargo?", "Confirmação", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                 {
                     int idI = int.Parse(id);
                     if (!_planningService.ExistsWithJobRole(idI))
                     {
                         _service.ActivateOrDeactivateById(idI, false);
                         LoadToDataGridView();
                     }
                     else
                     {
                         MessageBox.Show("Cargos associados a projetos não podem ser excluídos!", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     }
                 }
             }
         }
         else if (e.ColumnIndex == 3)
         {
             string      id          = dgvJobRoles.SelectedCells[0].Value.ToString();
             JobRole     jobRole     = _service.ReadById(long.Parse(id));
             JobRoleForm jobRoleForm = new JobRoleForm(jobRole.Id);
             jobRoleForm.ShowDialog();
         }
     }
     catch (Exception)
     {
     }
 }