Exemple #1
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var senderGrid = (DataGridView)sender;

            if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn &&
                e.RowIndex >= 0)
            {
                var projectIdCell = dataGridView1[0, e.RowIndex].Value;
                if (e.ColumnIndex == 6 && projectIdCell != null)
                {
                    decimal projectId = decimal.Parse(projectIdCell.ToString());
                    if (this.db.Projects.Any(p => p.ProjectId == projectId))
                    {
                        ProjectEditForm projectEditForm = new ProjectEditForm(e.RowIndex, projectId, this.projectsIds, this.projectsNames);
                        projectEditForm.EditEventHandler += ProjectEditForm_EditEventHandler;
                        projectEditForm.Show();
                    }
                }
                else if (e.ColumnIndex == 7 && projectIdCell != null)
                {
                    decimal projectId = decimal.Parse(projectIdCell.ToString());
                    if (this.db.Projects.Any(p => p.ProjectId == projectId))
                    {
                        ProjectInfoForm projectInfoForm = new ProjectInfoForm(projectId);
                        projectInfoForm.Show();
                    }
                }
            }
        }
        // GET: Admin/Project/Edit/5
        public ActionResult Edit(int id)
        {
            ProjectService  repo    = new ProjectService();
            Project         proj    = repo.Get(id);
            EmployeeService emp     = new EmployeeService();
            Employee        e       = emp.Get(proj.ProjectManager);
            ProjectEditForm project = new ProjectEditForm(proj, e);

            return(View(project));
        }
 public ActionResult Edit(int id, ProjectEditForm collection)
 {
     try
     {
         // TODO: Add update logic here
         return(View());
     }
     catch
     {
         return(View());
     }
 }
        public ActionResult Edit(int id, ProjectEditForm collection)
        {
            try
            {
                // TODO: Add update logic here
                if (ModelState.IsValid)
                {
                    ProjectService  repo           = new ProjectService();
                    EmployeeService repoemployee   = new EmployeeService();
                    Employee        Projectmanager = repoemployee.Get().Where <Employee>((emp) => emp.Email == collection.ProjectManager).FirstOrDefault();
                    Project         oldData        = repo.Get(id);

                    if (Projectmanager == null)
                    {
                        return(View(collection));
                    }

                    bool isUpdated = false;

                    if (Projectmanager.Id != oldData.ProjectManager)
                    {
                        oldData.ProjectManager = Projectmanager.Id;
                        isUpdated = repo.UpdatePM(oldData);
                    }
                    oldData.Name        = collection.Name;
                    oldData.Description = collection.Description;
                    oldData.StartDate   = collection.StartDate;
                    oldData.EndDate     = collection.EndDate;
                    isUpdated           = repo.Update(oldData);



                    if (isUpdated)
                    {
                        return(RedirectToAction("Index"));
                    }
                    else
                    {
                        return(View(collection));
                    }
                }
                else
                {
                    return(View(collection));
                }
            }
            catch
            {
                return(View());
            }
        }
        public async Task CreateProjectUsingPostWithHttpMessagesAsync_StateUnderTest_ExpectedBehavior()
        {
            // Arrange
            var             kimai2APIDocs = this.CreateKimai2APIDocs();
            ProjectEditForm body          = null;
            Dictionary <string, List <string> > customHeaders = null;
            CancellationToken cancellationToken = default(global::System.Threading.CancellationToken);

            // Act
            var result = await kimai2APIDocs.CreateProjectUsingPostWithHttpMessagesAsync(
                body,
                customHeaders,
                cancellationToken);

            // Assert
            Assert.True(false);
        }