public JsonResult SupportExpertDispatch_Insert(AddSupportExpertDispatchRequest request) { GeneralResponse response = new GeneralResponse(); response = _supportExpertDispatchService.AddSupportExpertDispatch(request, GetEmployee().ID); return(Json(response, JsonRequestBehavior.AllowGet)); }
public GeneralResponse AddSupportExpertDispatch(AddSupportExpertDispatchRequest request, Guid CreateemployeeID) { GeneralResponse response = new GeneralResponse(); try { SupportExpertDispatch supportExpertDispatch = new SupportExpertDispatch(); supportExpertDispatch.ID = Guid.NewGuid(); supportExpertDispatch.CreateDate = PersianDateTime.Now; supportExpertDispatch.CreateEmployee = _employeeRepository.FindBy(CreateemployeeID); supportExpertDispatch.Comment = request.Comment; supportExpertDispatch.DispatchDate = request.DispatchDate; supportExpertDispatch.DispatchTime = request.DispatchTime; supportExpertDispatch.ExpertEmployee = _employeeRepository.FindBy(request.ExpertEmployeeID); supportExpertDispatch.CoordinatorName = request.CoordinatorName; supportExpertDispatch.Support = _supportRepository.FindBy(request.SupportID); supportExpertDispatch.Comment = request.Comment; supportExpertDispatch.IsNewInstallation = request.IsNewInstallation; supportExpertDispatch.RowVersion = 1; SupportStatusRelation supportStatusRelation = _supportStatusRelationRepository.FindBy(request.SupportStatusID); supportExpertDispatch.Support.SupportStatus = _supportStatusRepository.FindBy(supportStatusRelation.RelatedSupportStatus.ID); supportExpertDispatch.Support.Customer.SupportStatus = supportExpertDispatch.Support.SupportStatus; if (supportExpertDispatch.Support.SupportStatus.IsLastSupportState) { supportExpertDispatch.Support.Closed = true; } _supportExpertDispatchRepository.Add(supportExpertDispatch); _uow.Commit(); } catch (Exception ex) { response.ErrorMessages.Add(ex.Message); if (ex.InnerException != null) { response.ErrorMessages.Add(ex.InnerException.Message); } } return(response); }