public async Task <IActionResult> Edit(int id, [Bind("Id,StepDescription,StepNumber,LastUpdated,Active,RequestType")] RequestTypeSteps requestTypeSteps) { if (id != requestTypeSteps.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(requestTypeSteps); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RequestTypeStepsExists(requestTypeSteps.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["RequestType"] = new SelectList(_context.RequestTypes, "Id", "RequestTypeDescription", requestTypeSteps.RequestType); return(View(requestTypeSteps)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,StatusTypeDescription")] StatusTypes statusTypes) { if (id != statusTypes.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(statusTypes); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StatusTypesExists(statusTypes.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(statusTypes)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,TeamDescription,TeamEmailAddress")] Teams teams) { if (id != teams.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(teams); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TeamsExists(teams.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(teams)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,NoteDescription,LastUpdated,WrittenBy,ServiceRequest")] ServiceRequestNotes serviceRequestNotes) { if (id != serviceRequestNotes.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(serviceRequestNotes); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ServiceRequestNotesExists(serviceRequestNotes.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ServiceRequest"] = new SelectList(_context.ServiceRequests, "Id", "RequestDescription", serviceRequestNotes.ServiceRequest); return(View(serviceRequestNotes)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,MemberUserid,MemberFirstName,MemberLastName,MemberFullName,MemberEmail,MemberPhone")] Members members) { if (id != members.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(members); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MembersExists(members.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(members)); }
public async Task <IActionResult> Edit(Guid id, [Bind("Id,FileName,Extension,ServiceRequestId")] FileDetails fileDetails) { if (id != fileDetails.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(fileDetails); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FileDetailsExists(fileDetails.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ServiceRequestId"] = new SelectList(_context.ServiceRequests, "Id", "RequestDescription", fileDetails.ServiceRequestId); return(View(fileDetails)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Subject,StartTime,EndTime,Location,Notes,MsgId,MsgSequence,SenderEmail,RecipientEmail")] Appointments appointments) { if (id != appointments.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(appointments); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AppointmentsExists(appointments.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(appointments)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,SAmaccountName,DisplayName,Mail,Title,TelephoneNumber,GivenName,Sn,Company,WwWhomePage,Mobile,Cn,Appusername")] Adinformations adinformations) { if (id != adinformations.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(adinformations); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AdinformationsExists(adinformations.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(adinformations)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,PriorityDescription,LastUpdated,Active,Team")] Priorities priorities) { if (id != priorities.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(priorities); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PrioritiesExists(priorities.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["Team"] = new SelectList(_context.Teams, "Id", "TeamDescription", priorities.Team); return(View(priorities)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,AssignedBy,DateAssigned,ServiceRequest,Team")] TeamAssignmentHistories teamAssignmentHistories) { if (id != teamAssignmentHistories.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(teamAssignmentHistories); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TeamAssignmentHistoriesExists(teamAssignmentHistories.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ServiceRequest"] = new SelectList(_context.ServiceRequests, "Id", "RequestDescription", teamAssignmentHistories.ServiceRequest); ViewData["Team"] = new SelectList(_context.Teams, "Id", "TeamDescription", teamAssignmentHistories.Team); return(View(teamAssignmentHistories)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,FileSystemUpload,Adactive,EmailConfirmation,ModifiedBy,Modified,AppAdmin,BackAdmin,Ldapconn,Ldappath,ManageHremail,ManageHremailPass,Smtphost,Smtpport,EnableSsl")] ApplicConfs applicConfs) { if (id != applicConfs.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(applicConfs); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ApplicConfsExists(applicConfs.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(applicConfs)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,StatusDescription,LastUpdated,Active,StatusType")] StatusSets statusSets) { if (id != statusSets.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(statusSets); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StatusSetsExists(statusSets.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["StatusType"] = new SelectList(_context.StatusTypes, "Id", "StatusTypeDescription", statusSets.StatusType); return(View(statusSets)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,AssignedTo,AssignedBy,DateAssigned,ServiceRequest")] IndividualAssignmentHistories individualAssignmentHistories) { if (id != individualAssignmentHistories.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(individualAssignmentHistories); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!IndividualAssignmentHistoriesExists(individualAssignmentHistories.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["AssignedTo"] = new SelectList(_context.Members, "Id", "MemberEmail", individualAssignmentHistories.AssignedTo); ViewData["ServiceRequest"] = new SelectList(_context.ServiceRequests, "Id", "RequestDescription", individualAssignmentHistories.ServiceRequest); return(View(individualAssignmentHistories)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Member,Team")] TeamMembers teamMembers) { if (id != teamMembers.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(teamMembers); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TeamMembersExists(teamMembers.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["Member"] = new SelectList(_context.Members, "Id", "MemberEmail", teamMembers.Member); ViewData["Team"] = new SelectList(_context.Teams, "Id", "TeamDescription", teamMembers.Team); return(View(teamMembers)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,RequestHeading,RequestDescription,RequestorId,RequestorFirstName,RequestorLastName,RequestorPhone,RequestorEmail,DateTimeSubmitted,DateTimeStarted,DateTimeCompleted,Priority,RequestType,RequestTypeStep,Member,Status,Team")] ServiceRequests serviceRequests, ICollection <IFormFile> files) { if (id != serviceRequests.Id) { return(NotFound()); } if (ModelState.IsValid) { try { ////================File Attachments===================== //////Attached File Processing======================================================== //string path = null; //var uploads = Path.Combine(_environment.WebRootPath, "uploads"); //foreach (var file in files) // try // { // if (file == null || file.Length == 0) // return Content("file not selected"); // else // { // using (var fileStream = new FileStream(Path.Combine(uploads, file.FileName), FileMode.Create)) // { // await file.CopyToAsync(fileStream); // } // var fileName = Path.GetFileName(file.FileName); // path = uploads + "\\" + fileName; // serviceRequests.FileDetails.Add(new FileDetails() // { // FileName = fileName, // Extension = Path.GetExtension(fileName), // Id = Guid.NewGuid(), // ServiceRequestId = id // }); // _context.Entry(serviceRequests.FileDetails).State = EntityState.Added; // } // } // catch // { // ViewBag.Message = "Upload Failed"; // } ////========================================================================================================================= // If Status changes then populate the datetime started and completed fields and send email confirmation========= if (serviceRequests.Status == 2 && serviceRequests.DateTimeStarted == null) { serviceRequests.DateTimeStarted = DateTime.Now; SendStatusConfirmation(2, serviceRequests.RequestorEmail); _context.Entry(serviceRequests).State = EntityState.Modified; } if (serviceRequests.Status == 3 && serviceRequests.DateTimeCompleted == null) { serviceRequests.DateTimeCompleted = DateTime.Now; SendStatusConfirmation(3, serviceRequests.RequestorEmail); _context.Entry(serviceRequests).State = EntityState.Modified; } ////=================================================================================== // If team is modified create new team history record========================== //var lastTeam = _context.TeamAssignmentHistories // .Include(t => t.ServiceRequestNavigation) // .Include(t => t.TeamNavigation) // .Where(t => t.ServiceRequestNavigation.Id == serviceRequests.Id); var lastTeam = from tah in _context.TeamAssignmentHistories where tah.ServiceRequest == serviceRequests.Id orderby tah.DateAssigned descending select tah; int lteam; lteam = lastTeam.FirstOrDefault().Team; if (serviceRequests.Team != lteam) { serviceRequests.TeamAssignmentHistories.Add(new TeamAssignmentHistories() { DateAssigned = DateTime.Now, AssignedBy = User.Identity.Name, ServiceRequest = serviceRequests.Id, Team = serviceRequests.Team }); } //========================================================================================= //========================================================================================= // if individual assigned has changed add individual history record======================== //var lastMember = _context.IndividualAssignmentHistories // .Include(t => t.ServiceRequestNavigation) // .Where(t => t.ServiceRequestNavigation.Id == serviceRequests.Id) // ; var lastMember = from lm in _context.IndividualAssignmentHistories where lm.ServiceRequest == serviceRequests.Id orderby lm.DateAssigned descending select lm; int lmember; lmember = lastMember.FirstOrDefault().AssignedTo; if (serviceRequests.Member != lmember) { serviceRequests.IndividualAssignmentHistories.Add(new IndividualAssignmentHistories() { DateAssigned = DateTime.Now, AssignedBy = User.Identity.Name, ServiceRequest = serviceRequests.Id, AssignedTo = serviceRequests.Member.Value, }); } //=========================================================================================== //===== If request step changes then create request step history record===================== //var lastStep = _context.StepHistories // .Include(t => t.ServiceRequestNavigation) // .Where(t => t.ServiceRequestNavigation.Id == serviceRequests.Id) // ; var lastStep = from ls in _context.StepHistories where ls.ServiceRequest == serviceRequests.Id orderby ls.LastUpdated descending select ls; int lstep; lstep = lastStep.FirstOrDefault().RequestTypeStep; if (serviceRequests.RequestTypeStep != lstep) { serviceRequests.StepHistories.Add(new StepHistories() { LastUpdated = DateTime.Now, RequestTypeStep = serviceRequests.RequestTypeStep.Value, ServiceRequest = serviceRequests.Id }); } //=========================================================================================== _context.Update(serviceRequests); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ServiceRequestsExists(serviceRequests.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["Member"] = new SelectList(_context.Members, "Id", "MemberEmail", serviceRequests.Member); ViewData["Priority"] = new SelectList(_context.Priorities, "Id", "PriorityDescription", serviceRequests.Priority); ViewData["RequestType"] = new SelectList(_context.RequestTypes, "Id", "RequestTypeDescription", serviceRequests.RequestType); ViewData["RequestTypeStep"] = new SelectList(_context.RequestTypeSteps, "Id", "StepDescription", serviceRequests.RequestTypeStep); ViewData["Status"] = new SelectList(_context.StatusSets, "Id", "StatusDescription", serviceRequests.Status); ViewData["Team"] = new SelectList(_context.Teams, "Id", "TeamDescription", serviceRequests.Team); return(View(serviceRequests)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,RequestHeading,RequestDescription,RequestorId,RequestorFirstName,RequestorLastName,RequestorPhone,RequestorEmail,DateTimeSubmitted,DateTimeStarted,DateTimeCompleted,Priority,RequestType,RequestTypeStep,Member,Status,Team")] ServiceRequests serviceRequests) { if (id != serviceRequests.Id) { return(NotFound()); } if (ModelState.IsValid) { try { // If Status changes then populate the datetime started and completed fields and send email confirmation========= if (serviceRequests.Status == 2 && serviceRequests.DateTimeStarted == null) { serviceRequests.DateTimeStarted = DateTime.Now; SendStatusConfirmation(2, serviceRequests.RequestorEmail); _context.Entry(serviceRequests).State = EntityState.Modified; } if (serviceRequests.Status == 3 && serviceRequests.DateTimeCompleted == null) { serviceRequests.DateTimeCompleted = DateTime.Now; SendStatusConfirmation(3, serviceRequests.RequestorEmail); _context.Entry(serviceRequests).State = EntityState.Modified; } ////=================================================================================== // If team is modified create new team history record========================== //var lastTeam = _context.TeamAssignmentHistories // .Include(t => t.ServiceRequestNavigation) // .Include(t => t.TeamNavigation) // .Where(t => t.ServiceRequestNavigation.Id == serviceRequests.Id); var lastTeam = from tah in _context.TeamAssignmentHistories where tah.ServiceRequest == serviceRequests.Id orderby tah.DateAssigned descending select tah; int lteam; lteam = lastTeam.FirstOrDefault().Team; if (serviceRequests.Team != lteam) { serviceRequests.TeamAssignmentHistories.Add(new TeamAssignmentHistories() { DateAssigned = DateTime.Now, AssignedBy = User.Identity.Name, ServiceRequest = serviceRequests.Id, Team = serviceRequests.Team }); } //========================================================================================= //========================================================================================= // if individual assigned has changed add individual history record======================== //var lastMember = _context.IndividualAssignmentHistories // .Include(t => t.ServiceRequestNavigation) // .Where(t => t.ServiceRequestNavigation.Id == serviceRequests.Id) // ; var lastMember = from lm in _context.IndividualAssignmentHistories where lm.ServiceRequest == serviceRequests.Id orderby lm.DateAssigned descending select lm; int lmember; lmember = lastMember.FirstOrDefault().AssignedTo; if (serviceRequests.Member != lmember) { serviceRequests.IndividualAssignmentHistories.Add(new IndividualAssignmentHistories() { DateAssigned = DateTime.Now, AssignedBy = User.Identity.Name, ServiceRequest = serviceRequests.Id, AssignedTo = serviceRequests.Member.Value, }); } //=========================================================================================== //===== If request step changes then create request step history record===================== //var lastStep = _context.StepHistories // .Include(t => t.ServiceRequestNavigation) // .Where(t => t.ServiceRequestNavigation.Id == serviceRequests.Id) // ; var lastStep = from ls in _context.StepHistories where ls.ServiceRequest == serviceRequests.Id orderby ls.LastUpdated descending select ls; int lstep; lstep = lastStep.FirstOrDefault().RequestTypeStep; if (serviceRequests.RequestTypeStep != lstep) { serviceRequests.StepHistories.Add(new StepHistories() { LastUpdated = DateTime.Now, RequestTypeStep = serviceRequests.RequestTypeStep.Value, ServiceRequest = serviceRequests.Id }); } //=========================================================================================== _context.Update(serviceRequests); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ServiceRequestsExists(serviceRequests.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["Member"] = new SelectList(_context.Members, "Id", "MemberEmail", serviceRequests.Member); ViewData["Priority"] = new SelectList(_context.Priorities, "Id", "PriorityDescription", serviceRequests.Priority); ViewData["RequestType"] = new SelectList(_context.RequestTypes, "Id", "RequestTypeDescription", serviceRequests.RequestType); ViewData["RequestTypeStep"] = new SelectList(_context.RequestTypeSteps, "Id", "StepDescription", serviceRequests.RequestTypeStep); ViewData["Status"] = new SelectList(_context.StatusSets, "Id", "StatusDescription", serviceRequests.Status); ViewData["Team"] = new SelectList(_context.Teams, "Id", "TeamDescription", serviceRequests.Team); return(View(serviceRequests)); }