public async Task <IActionResult> Edit(int id, [Bind("ID,Name,Desc,EstCost,BidDate,EstStartDate,EstFinishDate,StartDate,FinishDate,Cost,BidCustApproved,BidManagementApproved,ClientID,DesignerID")] Project project)
        {
            if (id != project.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(project);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProjectExists(project.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            PopulateDropDownLists(project);
            return(View(project));
        }
        public async Task <IActionResult> Update(int id, [Bind("ID,EstStartDate,EstHours,TeamID,TaskID")] Labour labour)
        {
            if (id != labour.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(labour);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LabourExists(labour.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            //PopulateDDl(labour);
            return(View(labour));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ID,Name,Desc,EstCost,BidDate,EstStartDate,EstFinishDate,CurrentPhase,StartDate,FinishDate,Cost,BidCustApproved,BidManagementApproved,ClientID,DesignerID")] Project project)
        {
            if (id != project.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(project);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProjectExists(project.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ClientID"]   = new SelectList(_context.Clients, "ID", "ConFirst", project.ClientID);
            ViewData["DesignerID"] = new SelectList(_context.Employees, "ID", "FirstName", project.DesignerID);
            return(View(project));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ID,Hour,Date,EmployeeID,ProjectID,TaskID,StageID")] DesignReport designReport)
        {
            if (id != designReport.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(designReport);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DesignReportExists(designReport.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmployeeID"] = new SelectList(_context.Employees, "ID", "FullName", designReport.EmployeeID);
            ViewData["ProjectID"]  = new SelectList(_context.Projects, "ID", "Name", designReport.ProjectID);
            ViewData["StageID"]    = new SelectList(_context.Stages, "ID", "Name", designReport.StageID);
            ViewData["TaskID"]     = new SelectList(_context.Tasks, "ID", "Description", designReport.TaskID);
            return(View(designReport));
        }
Esempio n. 5
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Submitter,SubmissionDate,ProjectID")] ProductionWorkReport productionWorkReport)
        {
            if (id != productionWorkReport.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(productionWorkReport);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProductionWorkReportExists(productionWorkReport.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ProjectID"] = new SelectList(_context.Projects, "ID", "Desc", productionWorkReport.ProjectID);
            return(View(productionWorkReport));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ID,CurrentHours,EstHours,HoursTotal,SubmissionDate,Submitter,ProjectID")] DesignBudget designBudget)
        {
            if (id != designBudget.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(designBudget);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DesignBudgetExists(designBudget.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ProjectID"] = new SelectList(_context.Projects, "ID", "Desc", designBudget.ProjectID);
            return(View(designBudget));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Bid,EstProdPlan,TotalCosttoDate,ActualMtl,EstimatedDesingCost,ActuLaborPro,EstLaborProdCost,ActuLaborDesingCost,EstLaborDesingCost,ProjectID")] ProductionStageReport productionStageReport)
        {
            if (id != productionStageReport.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(productionStageReport);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProductionStageReportExists(productionStageReport.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ProjectID"] = new SelectList(_context.Projects, "ID", "Name", productionStageReport.ProjectID);
            return(View(productionStageReport));
        }
Esempio n. 8
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Name")] Stage stage)
        {
            if (id != stage.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(stage);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StageExists(stage.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(stage));
        }
Esempio n. 9
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,EstBid,ActlHours,EstHours,ActlCosts,EstCost,HoursRemaining,CostsRemaining,ProjectID")] BidReport bidReport)
        {
            if (id != bidReport.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(bidReport);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BidReportExists(bidReport.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ProjectID"] = new SelectList(_context.Projects, "ID", "Desc", bidReport.ProjectID);
            return(View(bidReport));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ID,Quantity,Costs,Date,EmployeeID,ProjectID,MaterialID")] MaterialReport materialReport)
        {
            if (id != materialReport.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(materialReport);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MaterialReportExists(materialReport.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmployeeID"] = new SelectList(_context.Employees, "ID", "Email", materialReport.EmployeeID);
            ViewData["MaterialID"] = new SelectList(_context.Materials, "ID", "Description", materialReport.MaterialID);
            ViewData["ProjectID"]  = new SelectList(_context.Projects, "ID", "Name", materialReport.ProjectID);
            return(View(materialReport));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ID,AvgNetPrice,ListPrice,SizeValue,SizeUnit,Quantity,MaterialID")] Inventory inventory)
        {
            if (id != inventory.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(inventory);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!InventoryExists(inventory.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MaterialID"] = new SelectList(_context.Materials, "ID", "ID", inventory.MaterialID);
            return(View(inventory));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ID,Name,Phone,Address,Province,Postal,ConFirst,ConLast,ConPhone,ConPosition,CityID")] Client client)
        {
            if (id != client.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(client);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ClientExists(client.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(client));
        }
Esempio n. 13
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,FirstName,LastName,Email,PhoneNumber,DepartmentID")] Employee employee)
        {
            if (id != employee.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(employee);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EmployeeExists(employee.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DepartmentID"] = new SelectList(_context.Departments, "ID", "Description", employee.DepartmentID);
            return(View(employee));
        }
Esempio n. 14
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,FirstName,LastName,CompanyName,Position,PhoneNumber,Address,CityID,Province,PostalCode,Email")] Client client)
        {
            if (id != client.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(client);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ClientExists(client.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CityID"] = new SelectList(_context.Cities, "ID", "Name", client.CityID);
            return(View(client));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ID,BidID,EstStart,EstEnd,Amount,Location,ProjectID")] Bid bid)
        {
            if (id != bid.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(bid);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BidExists(bid.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ProjectID"] = new SelectList(_context.Projects, "ID", "Desc", bid.ProjectID);
            return(View(bid));
        }
Esempio n. 16
0
        public async Task <IActionResult> Edit(int id, [Bind("ProjectID,InventoryID,MatDelivery,MatInstall,MatEstQty,MatActQty")] ProjectMaterials projectMaterials)
        {
            if (id != projectMaterials.ProjectID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(projectMaterials);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProjectMaterialsExists(projectMaterials.ProjectID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["InventoryID"] = new SelectList(_context.Inventories, "ID", "ID", projectMaterials.InventoryID);
            ViewData["ProjectID"]   = new SelectList(_context.Projects, "ID", "Desc", projectMaterials.ProjectID);
            return(View(projectMaterials));
        }
Esempio n. 17
0
        public async Task <IActionResult> Edit(int id, string[] selectedOptions)
        {
            var teamToUpdate = await _context.Teams
                               .Include(t => t.TeamEmployees).ThenInclude(t => t.Employee)
                               .Include(t => t.Projects)
                               .SingleOrDefaultAsync(d => d.ID == id);

            if (teamToUpdate == null)
            {
                return(NotFound());
            }

            UpdateEmpFullNametoTeam(selectedOptions, teamToUpdate);

            if (await TryUpdateModelAsync <Team>(teamToUpdate, "",
                                                 d => d.Phase, d => d.TeamName))
            {
                try
                {
                    _context.Update(teamToUpdate);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction(nameof(Index)));
                }
                catch (RetryLimitExceededException /* dex */)
                {
                    ModelState.AddModelError("", "Unable to save changes after multiple attempts. Try again, and if the problem persists, see your system administrator.");
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TeamExists(teamToUpdate.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                catch (DbUpdateException)
                {
                    ModelState.AddModelError("", "Something went wrong in the database.");
                }
            }
            //ViewData["EmployeeID"] = new SelectList(_context.Employees, "ID", "FullName", team.EmployeeID);
            //ViewData["ProjectID"] = new SelectList(_context.Projects, "ID", "Name", team.ProjectID);
            PopulateAssignedEmpData(teamToUpdate);
            return(View(teamToUpdate));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ID,ProjectID,TeamID")] ProductionPlan productionPlan, string[] selectedProdLabors, string[] selectedProdMaterials)
        {
            var productionPlanToUpdate = await _context.ProductionPlans
                                         .Include(p => p.Project)
                                         .Include(p => p.Team)
                                         .Include(p => p.ProdPlanLabours)
                                         .ThenInclude(pl => pl.LabourRequirement)
                                         .ThenInclude(l => l.Task)
                                         .Include(p => p.ProdPlanMaterials)
                                         .ThenInclude(pm => pm.MaterialRequirement)
                                         .ThenInclude(m => m.Inventory)
                                         .ThenInclude(i => i.Material)
                                         .SingleOrDefaultAsync(d => d.ID == id);

            if (productionPlanToUpdate == null)
            {
                return(NotFound());
            }
            UpdateProdLabors(selectedProdLabors, productionPlanToUpdate);
            UpdateProdMaterials(selectedProdMaterials, productionPlanToUpdate);

            if (await TryUpdateModelAsync <ProductionPlan>
                    (productionPlanToUpdate, "",
                    p => p.ProjectID, p => p.TeamID
                    ))
            {
                try
                {
                    await _context.SaveChangesAsync();

                    return(RedirectToAction(nameof(Index)));
                }
                catch (RetryLimitExceededException /* dex */)
                {
                    ModelState.AddModelError("", "Unable to save changes after multiple attempts. Try again, and if the problem persists, see your system administrator.");
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProductionPlanExists(productionPlanToUpdate.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                catch (DbUpdateException)
                {
                    ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator.");
                }
            }
            if (id != productionPlan.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(productionPlan);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProductionPlanExists(productionPlan.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ProjectID"] = new SelectList(_context.Projects, "ID", "Name", productionPlan.ProjectID);
            ViewData["TeamID"]    = new SelectList(_context.Teams, "ID", "ID", productionPlan.TeamID);
            return(View(productionPlan));
        }
Esempio n. 19
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Name,ProjSite,ProjBidDate,EstStartDate,EstEndDate,StartDate,EndDate,ActAmount,EstAmount,ClientApproval,AdminApproval,ProjCurrentPhase,ClientID,ProjIsFlagged")] Project project, string[] selectedLabors, string[] selectedMaterials)
        {
            var projectToUpdate = await _context.Projects
                                  .Include(p => p.Client)
                                  .Include(p => p.ProjectLabours)
                                  .ThenInclude(p => p.LabourRequirement)
                                  .Include(p => p.ProjectLabours)
                                  .ThenInclude(pl => pl.LabourRequirement)
                                  .ThenInclude(l => l.Task)
                                  .Include(p => p.ProjectLabours)
                                  .ThenInclude(pl => pl.LabourRequirement)
                                  .ThenInclude(l => l.Team)
                                  .Include(p => p.ProjectMaterials)
                                  .ThenInclude(pm => pm.MaterialRequirement)
                                  .ThenInclude(m => m.Inventory)
                                  .ThenInclude(i => i.Material)

                                  .SingleOrDefaultAsync(p => p.ID == id);

            if (projectToUpdate == null)
            {
                return(NotFound());
            }

            UpdateProjectLabours(selectedLabors, projectToUpdate);
            UpdateProjectMaterials(selectedMaterials, projectToUpdate);

            if (await TryUpdateModelAsync <Project>(projectToUpdate, "",
                                                    p => p.Name, p => p.ProjSite, p => p.ProjBidDate, p => p.EstStartDate,
                                                    p => p.EstEndDate, p => p.StartDate, p => p.EndDate, p => p.ActAmount,
                                                    p => p.EstAmount, p => p.ClientApproval, p => p.AdminApproval,
                                                    p => p.ProjCurrentPhase, p => p.ProjIsFlagged))
            {
                try
                {
                    await _context.SaveChangesAsync();

                    return(RedirectToAction(nameof(Index)));
                }
                catch (RetryLimitExceededException /* dex */)
                {
                    ModelState.AddModelError("", "Unable to save changes after multiple attempts. Try again, and if the problem persists, see your system administrator.");
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProjectExists(projectToUpdate.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                catch (DbUpdateException)
                {
                    ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator.");
                }
            }


            if (id != project.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(project);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProjectExists(project.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            PopulateAssignedLaborData(projectToUpdate);
            PopulateAssignedMaterialData(projectToUpdate);
            ViewData["ClientID"] = new SelectList(_context.Clients, "ID", "FullName", project.ClientID);
            return(View(projectToUpdate));
        }