public JsonResult CallSupervisor(CallSupervisorViewModel param) { var location = 2; var result = _integrationOrderService.CallSupervisor(param, CurrentUserName, location); return(Json(result)); }
public CallSupervisorViewModel CreateCallSupervisorViewModel(int OrderId) { var model = new CallSupervisorViewModel { SupervisorRequest = new SupervisorRequestViewModel { SupervisorRequetTypes = _repository.GetAll <SupervisorRequestType>().Where(p => !p.IsArchived), CurrentOrderId = OrderId, IntegrationOrders = _repository.GetAll <IntegrationOrder>().Where(p => p.Id == OrderId), Isolators = _repository.GetAll <Pharmix.Web.Entities.Isolator>().Where(p => !p.IsArchived) }, IntegrationOrderComment = new IntegrationOrderCommentViewModel { OrderId = OrderId } }; return(model); }
public BaseResultViewModel <string> CallSupervisor(CallSupervisorViewModel param, string user, int location) { var result = new BaseResultViewModel <string> { IsSuccess = false, Message = "", Extra = null }; try { var getStatusProgress = _repository.GetAll <IntegrationOrderProgress>().Where(p => !p.IsArchived && p.Name.Contains("Supervisor", StringComparison.OrdinalIgnoreCase)).FirstOrDefault(); if (getStatusProgress != null) { //SupervisorRequest var request = new SupervisorRequest() { Title = param.SupervisorRequest.Title, IsArchived = false, IsolatorId = param.SupervisorRequest.IsolatorId, LatestRequestStatus = RequestStatusEnum.Awaiting, Priority = param.SupervisorRequest.Priority, CurrentOrderId = param.IntegrationOrderComment.OrderId, TypeId = param.SupervisorRequest.TypeId, RequestedBy = user }; request.SetCreateDetails(user); _repository.SaveNew <SupervisorRequest>(request); //Update progress status of IntegrationOrder var findOrder = _repository.GetById <IntegrationOrder>(param.IntegrationOrderComment.OrderId); findOrder.OrderLastProgressId = getStatusProgress.Id; _repository.SaveExisting(findOrder); //Save to tracker var tracker = new IntegrationOrderTracking { IntegrationOrderId = findOrder.Id, OrderCurrentLocationId = location, OrderLastProgressId = findOrder.OrderLastProgressId, Comment = param.IntegrationOrderComment.Comment }; tracker.SetCreateDetails(user); var saveTracking = _repository.SaveNew(tracker); result.IsSuccess = true; result.Message = "Success: Call Supervisor"; return(result); } else { result.Message = "No Call Supervisor status describe on database, please check database"; return(result); } } catch (Exception ex) { result.Extra = ex.Message; } return(result); }