public ActionResult UpdateEmployeeRequisition(Requisition requisition)
        {
            if (ModelState.IsValid)
            {
                Requisition editedRequisition = reqService.GetRequisitionById(requisition.RequisitionID);
                for (int i = 0; i < editedRequisition.RequisitionDetails.Count; i++)
                {
                    editedRequisition.RequisitionDetails[i].QuantityReceived = requisition.RequisitionDetails[i].QuantityReceived;
                }

                if (reqService.IsCompleted(editedRequisition))
                {
                    editedRequisition.CompletedDate = DateTime.Now;
                    editedRequisition.Status        = Status.Completed;
                }
                else
                {
                    editedRequisition.Status = Status.Incomplete;
                    RetrievalList retrievalList = reqService.FindCurrentRetrievalList();
                    if (retrievalList == null)
                    {
                        retrievalList = reqService.CreateRetrievalList();
                    }
                    reqService.IncompletedRequisitionTransferToRetrieval(editedRequisition, retrievalList);
                    reqService.UpdateRetrievalList(retrievalList);
                }
                reqService.UpdateRequisition(editedRequisition);
                return(RedirectToAction("EmployeeRequisitionDetails", new { id = requisition.RequisitionID }));
            }
            return(View("~/Views/Department/Representative/UpdateEmployeeRequisition.cshtml", requisition));
        }
Пример #2
0
 public ActionResult UpdateRequisitionDetails(Requisition requisition)
 {
     if (ModelState.IsValid)
     {
         Requisition editedRequisition = reqService.GetRequisitionById(requisition.RequisitionID);
         for (int i = 0; i < editedRequisition.RequisitionDetails.Count; i++)
         {
             editedRequisition.RequisitionDetails.ToList()[i].QuantityReceived = requisition.RequisitionDetails.ToList()[i].QuantityReceived;
         }
         if (reqService.IsCompleted(editedRequisition))
         {
             editedRequisition.CompletedDate = DateTime.Now;
             editedRequisition.Status        = Status.Completed;
         }
         else
         {
             editedRequisition.Status = Status.Incomplete;
             RetrievalList retrievalList = reqService.GetRetrievalListForNow();
             reqService.IncompletedRequisitionTransferToRetrieval(editedRequisition, retrievalList);
             reqService.UpdateRetrievalList(retrievalList);
         }
         reqService.UpdateRequisition(editedRequisition);
         return(RedirectToAction("ViewDetails", new { id = requisition.RequisitionID }));
     }
     return(View("~/Views/Store/Clerk/UpdateRequisitionDetails.cshtml", requisition));
 }