public void AddEditGeneralRequestInfo(int maintReqId, GeneralRequest generalRequest, string newEdit) { if (newEdit == "New") { _sacoMaintenanceContext.GeneralRequests.Add ( new GeneralRequest { MaintRequestId = maintReqId, AuthorityToWorkUserId = generalRequest.AuthorityToWorkUserId, AuthorityToWorkDateTime = generalRequest.AuthorityToWorkDateTime, DetailOfWorkCompleted = generalRequest.DetailOfWorkCompleted, DetailOfWorkCompeltedUserId = generalRequest.DetailOfWorkCompeltedUserId, DetailOfWorkCompeltedDateTime = generalRequest.DetailOfWorkCompeltedDateTime, WorkCompletedYesNo = generalRequest.WorkCompletedYesNo, WorkCompletedDetails = generalRequest.WorkCompletedDetails, SignOffDetails = generalRequest.SignOffDetails, WorkCompletedSignOffYesNo = generalRequest.WorkCompletedSignOffYesNo, WorkCompletedSignOffUserId = generalRequest.WorkCompletedSignOffUserId, WorkCompletedSignOffDateTime = generalRequest.WorkCompletedSignOffDateTime } ); } else if (newEdit == "Edit") { _sacoMaintenanceContext.Update(generalRequest); } _sacoMaintenanceContext.SaveChanges(); }
public void Update(int AuthId, string Type, string CommentReason) { var getAuth = _sacoContext.AuthorizationRequests.FirstOrDefault(i => i.Id == AuthId); getAuth.Satus = Type; getAuth.CommentRejection = CommentReason; getAuth.ConfirmationDate = DateTime.Now; _sacoContext.Update <AuthorizationRequest>(getAuth); _sacoContext.SaveChanges(); //Set the status to be 2 == Open var foundRequest = _sacoContext.MaintRequestInitiations.Where(id => id.Id == getAuth.MaintRequestInitiationId).FirstOrDefault(); foundRequest.StatusId = 2; _sacoContext.Update(foundRequest); _sacoContext.SaveChanges(); }
/// <summary> /// Updates the PPE list for the chosen maintenance request /// </summary> /// <param name="PPEItems">The list of selected PPE</param> /// <param name="MaintId">the request Id</param> public void UpdatePPE(List <PPE> PPEItems, int MaintId) { //Get the maintenance request var Request = _ppeDBContext.MaintRequestInitiations.Where(id => id.Id == MaintId).FirstOrDefault(); //Remove the PPE equipment if any Request.PPEEquipment.Clear(); //Loop through the PPEITems and add to the Request foreach (var item in PPEItems) { Request.PPEEquipment.Add(item); } //update and save _ppeDBContext.Update(Request); _ppeDBContext.SaveChanges(); }
public void UpdateSupplier(Supplier supplier) { _sacoMaintenanceContext.Update <Supplier>(supplier); _sacoMaintenanceContext.SaveChanges(); }