public void Validate() { if (!Guid.TryParseExact(ProjectUid.ToString(), "D", out Guid _) || ProjectUid == Guid.Empty) { throw new ServiceException(HttpStatusCode.BadRequest, new ContractExecutionResult(ContractExecutionStatesEnum.ValidationError, "ProjectUid must be provided")); } if (FileType != ImportedFileType.DesignSurface && FileType != ImportedFileType.SurveyedSurface && FileType != ImportedFileType.Alignment) { throw new ServiceException(HttpStatusCode.BadRequest, new ContractExecutionResult(ContractExecutionStatesEnum.ValidationError, "File type must be DesignSurface, SurveyedSurface or Alignment")); } if (FileName == null || string.IsNullOrEmpty(FileName)) { throw new ServiceException(HttpStatusCode.BadRequest, new ContractExecutionResult(ContractExecutionStatesEnum.ValidationError, "File name must be provided")); } var extention = Path.GetExtension(FileName); if (string.IsNullOrEmpty(extention) || (FileType != ImportedFileType.Alignment && (string.Compare(extention, ".ttm", StringComparison.OrdinalIgnoreCase) != 0)) || (FileType == ImportedFileType.Alignment && (string.Compare(extention, ".svl", StringComparison.OrdinalIgnoreCase) != 0)) ) { throw new ServiceException(HttpStatusCode.BadRequest, new ContractExecutionResult(ContractExecutionStatesEnum.ValidationError, "File name extension incorrect")); } if (!Guid.TryParseExact(DesignUid.ToString(), "D", out Guid _) || DesignUid == Guid.Empty) { throw new ServiceException(HttpStatusCode.BadRequest, new ContractExecutionResult(ContractExecutionStatesEnum.ValidationError, "DesignUid must be provided")); } if (FileType == ImportedFileType.SurveyedSurface && SurveyedUtc == null) { throw new ServiceException(HttpStatusCode.BadRequest, new ContractExecutionResult(ContractExecutionStatesEnum.ValidationError, "SurveyedUtc must be provided for a SurveyedSurface file type")); } }
public List <string> GetIdentifiers() => new List <string>() { DesignUid.ToString() };