private async static Task <string> CheckWithAcrolinx(string url, string genericToken, string username) { Debug.Assert(!string.IsNullOrWhiteSpace(url), "No Acrolinx URL was provided"); Debug.Assert(!string.IsNullOrWhiteSpace(genericToken), "No generic SSO token was provided"); Debug.Assert(!string.IsNullOrWhiteSpace(username), "No username was provided"); var endpoint = new AcrolinxEndpoint(url, "SW50ZWdyYXRpb25EZXZlbG9wbWVudERlbW9Pbmx5"); var accessToken = await endpoint.SignInWithSSO(genericToken, username); var checkRequest = new CheckRequest() { CheckOptions = new CheckOptions() { CheckType = CheckType.Automated, ContentFormat = "AUTO" }, Document = new DocumentDescriptorRequest(@"c:\demo.net.txt", new System.Collections.Generic.List <CustomField>()), Content = "This is an tesst" }; var checkResult = await endpoint.Check(accessToken, checkRequest); Console.WriteLine($"Check {checkResult.Id}: {checkResult.Quality.Score} ({checkResult.Quality.Status})"); Console.WriteLine($"Acrolinx Scorecard: {checkResult.Reports["scorecard"].Link}"); return(checkResult.Reports["scorecard"].Link); }
public IHttpActionResult Check([FromBody] CheckRequest request) { try { var code = CookieUtils.GetCookie(CookieName); if (string.IsNullOrEmpty(code) || CacheUtils.Exists($"{CookieName}.{code}")) { return(BadRequest("验证码已超时,请点击刷新验证码!")); } CookieUtils.Erase(CookieName); CacheUtils.InsertMinutes($"{CookieName}.{code}", true, 10); if (!StringUtils.EqualsIgnoreCase(code, request.Captcha)) { return(BadRequest("验证码不正确,请重新输入!")); } return(Ok(new { Value = true })); } catch (Exception ex) { return(InternalServerError(ex)); } }
public ActionResult CheckUser(CheckRequest check) { CheckResponse response; if (check.Ma.Length > 30) { response = new CheckResponse { Thongbao = "Mã dài quá 30 kí tự.", flag = "0" }; return(Ok(response)); } var mh = _context.MonHocs.Where(x => x.Ma == check.Ma).SingleOrDefault(); if (mh == null) { response = new CheckResponse { Thongbao = "Mã có thẻ sử dụng được", flag = "1" }; } else { response = new CheckResponse { Thongbao = "Mã đã bị trùng ", flag = "0" }; } return(Ok(response)); }
public async Task <OperationResult <CheckResult> > Check(Guid firstElementId, Guid secondElementId) { var checkRequest = new CheckRequest { FirstElement = firstElementId.ToString(), SecondElement = secondElementId.ToString(), UserId = _userId }; InternalCheckResult intermediateResult; try { var url = Constants.ApiUrl + "/api/Elements/merge"; intermediateResult = await HttpClient.PostWithRetry <InternalCheckResult>(url, checkRequest); } catch { return(OperationResult <CheckResult> .Failure()); } if (intermediateResult.isSuccess) { return(OperationResult <CheckResult> .Success( CheckResult.Success( intermediateResult.mergeResultElement.id, intermediateResult.mergeResultElement.imageName, intermediateResult.mergeResultElement.name, intermediateResult.mergeResultElement.score, intermediateResult.mergeResultElement.description))); } return(OperationResult <CheckResult> .Success(CheckResult.Failure())); }
public void CheckRequestObject() { moq::Mock <ServiceController.ServiceControllerClient> mockGrpcClient = new moq::Mock <ServiceController.ServiceControllerClient>(moq::MockBehavior.Strict); CheckRequest request = new CheckRequest { ServiceName = "service_named5df05d5", Operation = new Operation(), ServiceConfigId = "service_config_id1616022f", }; CheckResponse expectedResponse = new CheckResponse { OperationId = "operation_id8a494117", CheckErrors = { new CheckError(), }, ServiceConfigId = "service_config_id1616022f", CheckInfo = new CheckResponse.Types.CheckInfo(), ServiceRolloutId = "service_rollout_id901a2f43", }; mockGrpcClient.Setup(x => x.Check(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); ServiceControllerClient client = new ServiceControllerClientImpl(mockGrpcClient.Object, null); CheckResponse response = client.Check(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
// GET: CheckRequests/Edit/5 public async Task <ActionResult> Edit(int?id) { var checkrequests = db.CheckRequests.SingleOrDefault(c => c.CheckRequestId == id); var checkstatus = db.CheckStatuses.ToList(); var viewModel = new SaveCheckRequestViewModel() { CheckRequest = checkrequests, CheckStatuses = checkstatus }; if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CheckRequest checkRequest = await db.CheckRequests.FindAsync(id); if (checkRequest == null) { return(HttpNotFound()); } return(View("Edit", viewModel)); //return View(checkRequest); }
public async Task <HttpResult> CheckHttp(CheckRequest request) { var uriResult = await LookupDefaultUri(request.Domain); if (!uriResult.results) { return new HttpResult { HadResults = false } } ; var robotsResponseTask = CheckUrl(uriResult.defaultUri, "/robots.txt"); var humansResponseTask = CheckUrl(uriResult.defaultUri, "/humans.txt"); var securityResponseTask = CheckUrl(uriResult.defaultUri, "/.well-known/security.txt"); var faviconResponseTask = CheckUrl(uriResult.defaultUri, "/favicon.ico"); await Task.WhenAll(robotsResponseTask, humansResponseTask, faviconResponseTask); var serverHeaders = uriResult.response.Headers.Where(h => h.Key.Trim().ToLowerInvariant().Equals("server")).ToList(); var hstsHeaders = uriResult.response.Headers.Where(h => h.Key.Trim().ToLowerInvariant().Equals("Strict-Transport-Security")).ToList(); return(new HttpResult { HadResults = uriResult.results, Https = uriResult.defaultUri.AbsoluteUri.Contains("https://") || hstsHeaders.Any(), RobotsTxt = robotsResponseTask.Result.hadResult, HumansTxt = humansResponseTask.Result.hadResult, SecurityTxt = securityResponseTask.Result.hadResult, ServerHeaders = serverHeaders.Any(), ServerHeadersValue = string.Join('|', serverHeaders.SelectMany(h => h.Value)) }); }
public async stt::Task CheckRequestObjectAsync() { moq::Mock <ServiceController.ServiceControllerClient> mockGrpcClient = new moq::Mock <ServiceController.ServiceControllerClient>(moq::MockBehavior.Strict); CheckRequest request = new CheckRequest { ServiceName = "service_named5df05d5", Operation = new Operation(), ServiceConfigId = "service_config_id1616022f", }; CheckResponse expectedResponse = new CheckResponse { OperationId = "operation_id8a494117", CheckErrors = { new CheckError(), }, ServiceConfigId = "service_config_id1616022f", CheckInfo = new CheckResponse.Types.CheckInfo(), ServiceRolloutId = "service_rollout_id901a2f43", }; mockGrpcClient.Setup(x => x.CheckAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <CheckResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null)); ServiceControllerClient client = new ServiceControllerClientImpl(mockGrpcClient.Object, null); CheckResponse responseCallSettings = await client.CheckAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); CheckResponse responseCancellationToken = await client.CheckAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public async Task <DnsResult> CheckDnsRecords(CheckRequest request) { if (!Validation.DomainRegex.IsMatch(request.Domain)) { return new DnsResult { HadResults = false } } ; var lookupTasks = new List <Task <IDnsQueryResponse> >(); lookupTasks.AddRange( new[] { QueryType.AAAA, QueryType.A, QueryType.TXT }.Select(r => _dnsLookupClient.QueryAsync(request.Domain, r))); lookupTasks.Add(_dnsLookupClient.QueryAsync($"_dmarc.{request.Domain}", QueryType.TXT)); var results = (await Task.WhenAll(lookupTasks)).SelectMany(r => r.Answers).ToImmutableList(); Logging.LogMessage(LogLevel.Info, $"Processing {results.Count} results for {request.Domain}"); var dmarc = results.Where(c => c.DomainName == $"_dmarc.{request.Domain}.").TxtRecords() .FirstOrDefault(); var dmarcPolicyMatch = DmarcPolicyRegex.Match(dmarc?.Text?.FirstOrDefault() ?? string.Empty); return(new DnsResult { HadResults = results.Any(), IpV6 = results.AaaaRecords().Any(), Spf = results.TxtRecords().Any(t => t.Text.Any(l => l.Contains("v=spf"))), Dmarc = dmarc != null, DmarcPolicy = dmarcPolicyMatch.Success ? dmarcPolicyMatch.Groups[1].Value : string.Empty }); } }
public DTOResponse RestForArc(CheckRequest request) { DTOResponse dtoResponse = new DTOResponse(); IDbConnection dbCon = (IDbConnection)null; IDbTransaction dbTrans = (IDbTransaction)null; try { HelperDbOperation.BeginTransaction(ref dbCon, ref dbTrans); IDbConnection dbConn = dbCon; Expression <Func <SysCheckEntity, bool> > predicate = (Expression <Func <SysCheckEntity, bool> >)(x => x.ITEMSTATE == 1); foreach (SysCheckEntity uldCheck in dbConn.Select <SysCheckEntity>(predicate).OrderBy <SysCheckEntity, int>((Func <SysCheckEntity, int>)(x => x.ID)).ToList <SysCheckEntity>()) { if (!string.IsNullOrEmpty(uldCheck.ARCITEMVALUE)) { long num = (long)dbCon.ExecuteSql(uldCheck.ARCITEMVALUE); } } dtoResponse.IsSuccess = true; dtoResponse.MessageText = "执行成功!"; return(dtoResponse); } catch (Exception ex) { dtoResponse.IsSuccess = false; dtoResponse.MessageText = ex.ToString(); return(dtoResponse); } finally { HelperDbOperation.EndTransaction(dtoResponse.IsSuccess, ref dbCon, ref dbTrans); } }
public IActionResult Index() { var completePathway = new List <CompletedPathway>(); var request = _checkRequest.AsQueryable().ToList(); var claimsIdentity = (ClaimsIdentity)User.Identity; /*var claim = claimsIdentity.FindFirst(ClaimTypes.Email);*/ var claim = claimsIdentity.Claims.ToArray(); var email = claim[1].Value; var userid = User.Claims.FirstOrDefault(c => c.Type == AppUtility.UserId).Value; var issuer = _issuer.AsQueryable().ToList(); var actualIssuer = issuer.Where(e => e.UserId == new MongoDB.Bson.ObjectId(userid)).FirstOrDefault(); var pathstep = _pathwaySteps.AsQueryable().ToList(); var actualstep = pathstep.Where(e => e.IssuerId == actualIssuer.Id).ToList(); var req = new List <CheckRequest>(); for (int x = 0; x < actualstep.Count; x++) { var creq = request.Where(e => e.PathwayStepId == new MongoDB.Bson.ObjectId(actualstep[x].Id.ToString())).ToList(); for (int creqCountAccordingToSteps = 0; creqCountAccordingToSteps < creq.Count; creqCountAccordingToSteps++) { CheckRequest crp = creq[creqCountAccordingToSteps]; if (crp != null) { req.Add(crp); } } } for (int a = 0; a < req.Count; a++) { CheckRequest cr = req[a]; var p = _pathway.FindById(cr.PathwayId.ToString()); var uid = _user.FindById(cr.UserId.ToString()); var pathwaySteps = _pathwaySteps.FindById(cr.PathwayStepId.ToString()); CompletedPathway c = new CompletedPathway() { id = cr.Id, IsApproved = cr.IsApproved, IsCompleted = cr.IsCompleted, Name = uid.FirstName + uid.LastName, PathwayName = p.PathwayName, StepName = pathwaySteps.StepName, uploadedDocuments = cr.Documents, IsDeclined = cr.IsDeclined }; completePathway.Add(c); } return(View(completePathway)); }
public async Task <ActionResult> DeleteConfirmed(int id) { CheckRequest checkRequest = await db.CheckRequests.FindAsync(id); db.CheckRequests.Remove(checkRequest); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public static async Task <SendMessageResponse> QueueRequest(CheckRequest request) { if (string.IsNullOrWhiteSpace(request?.Domain)) { return(null); } return(await SqsClient.SendMessageAsync(QueueUrl, JsonConvert.SerializeObject(request))); }
public static CheckResponse Check(CheckRequest request) { var jsonstring = ApiRequest.DoRequest(ApiRequest.GetBaseUriFor(typeof(NumberVerify), "/verify/check/json"), new Dictionary<string, string>() { {"request_id", request.request_id}, {"code", request.code} }); return JsonConvert.DeserializeObject<CheckResponse>(jsonstring); }
public IActionResult CheckVerification([FromBody] CheckRequest request) { var verificationCheck = VerificationCheckResource.Create( to: $"+{request.CountryCode}{request.PhoneNumber}", code: request.Code, pathServiceSid: _options.VerifyServiceSid ); return(Ok(verificationCheck)); }
public static CheckResponse Check(CheckRequest request) { var jsonstring = ApiRequest.DoRequest(ApiRequest.GetBaseUriFor(typeof(NumberVerify), "/verify/check/json"), new Dictionary <string, string>() { { "request_id", request.request_id }, { "code", request.code } }); return(JsonConvert.DeserializeObject <CheckResponse>(jsonstring)); }
public async Task <CheckResponse> SubmitCheck(AccessToken accessToken, CheckRequest request) { var serializerSettings = new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver(), NullValueHandling = NullValueHandling.Ignore }; var content = JsonConvert.SerializeObject(request, serializerSettings); return(await FetchDataFromApiPath <CheckResponse>("checking/checks", HttpMethod.Post, accessToken, null, content)); }
public CheckResponse Check(CheckRequest request) { using (var context = new TypeFineContext()) { SaveInfo(request, context, RequestType.Check, true); return(new CheckResponse { NewPhrasesCount = context.Phrases.Count(x => x.AddDate > request.LastUpdateDate && x.Interesting), }); } }
protected override CheckResult Check(dynamic rest, CheckRequest request) { var budgetItem = rest; if (budgetItem.Residual >= request.Sum) { return(CheckResult.Success); } return(CheckResult.LimitBlocked); }
//public async Task<ActionResult> Edit([Bind(Include = "CheckRequestId,MlsCo,CheckStatus,PurchaseOrderNumber,PartNumber,PartDescription,CheckNo,Customer,Supplier,RequestDateTime,MailDateTime,ActualMailDateTime,ShipMethod,TrackingInfo,Notes")] CheckRequest checkRequest) public async Task <ActionResult> Edit(CheckRequest checkRequest) { if (ModelState.IsValid) { db.Entry(checkRequest).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index", checkRequest)); } return(View(checkRequest)); }
public CheckModel ProcceedBackgroundCheck(CheckRequest model) { var checkModel = new CheckModel(model); checkModel.SSN = SSN.FromString(model.SSN); checkModel.CrimeRecords = model.LastName.EndsWith("Clear") ? new List <string>(0) : new List <string>(new string[] { "crime reco 1", "crime reco 2", "crime reco 3", "crime reco 4" }); return(checkModel); }
public IActionResult StepPost(string id, string isCompleted) { if (isCompleted != null) { var v = _checkRequest.FindById(isCompleted); //CheckRequest c = new CheckRequest() { // IsCompleted = true, // Id= new ObjectId("5efc43e8bbe4823244bd798a") //}; string webRootPath = _hostEnvironment.WebRootPath; var files = HttpContext.Request.Form.Files; if (files.Count > 0) { string fileName = Guid.NewGuid().ToString(); var uploads = Path.Combine(webRootPath, @"UploadedDocuments"); var extenstion = Path.GetExtension(files[0].FileName); using (var filesStreams = new FileStream(Path.Combine(uploads, files[0].FileName), FileMode.Create)) { files[0].CopyTo(filesStreams); } v.Documents = files[0].FileName; } v.IsCompleted = true; v.IsDeclined = null; _checkRequest.ReplaceOne(v); return(RedirectToAction("PathwaySteps", new { pathwayId = v.PathwayId })); } var claimsIdentity = (ClaimsIdentity)User.Identity; /*var claim = claimsIdentity.FindFirst(ClaimTypes.Email);*/ var claim = claimsIdentity.Claims.ToArray(); var email = claim[1].Value; var userid = User.Claims.FirstOrDefault(c => c.Type == AppUtility.UserId).Value; var all = _pathSteps.AsQueryable().ToList(); PathwaySteps p = all.Where(e => e.count == 1).Where(e => e.PathwayId == id).FirstOrDefault(); if (p != null) { CheckRequest check = new CheckRequest() { CreatedAt = DateTime.Now, IsApproved = false, IsCompleted = false, PathwayId = new MongoDB.Bson.ObjectId(id), UserId = new ObjectId(userid), PathwayStepId = p.Id }; _checkRequest.InsertOne(check); } return(RedirectToAction("Index")); }
//public async Task<ActionResult> Create([Bind(Include = "CheckRequestId,MlsCo,CheckStatus,PurchaseOrderNumber,PartNumber,PartDescription,CheckNo,Customer,Supplier,RequestDateTime,MailDateTime,ActualMailDateTime,ShipMethod,TrackingInfo,Notes")] CheckRequest checkRequest) public async Task <ActionResult> Create(CheckRequest checkRequest) { if (ModelState.IsValid) { db.CheckRequests.Add(checkRequest); await db.SaveChangesAsync(); return(RedirectToAction("Index", checkRequest)); } return(View()); }
public object Any(CheckRequest request) { if (!string.IsNullOrEmpty(request?.AccountNumber) && !string.IsNullOrEmpty(request.SortCode)) { return(new CheckResponse()); } return(new CheckResponse { IsValid = false, Message = this.InValidRequestMsg }); }
/// <summary> /// Number Verify: Confirm that the PIN you received from your user matches the one sent by Nexmo as a result of your Verify Request. /// </summary> /// <param name="request">Check request</param> /// <param name="creds">(Optional) Overridden credentials for only this request</param> /// <returns></returns> public static CheckResponse Check(CheckRequest request, Credentials creds = null) { var response = ApiRequest.DoGetRequestWithQueryParameters <CheckResponse>(ApiRequest.GetBaseUriFor(typeof(NumberVerify), "/verify/check/json"), ApiRequest.AuthType.Query, new Dictionary <string, string> { { "request_id", request.request_id }, { "code", request.code } }, creds); ValidateVerifyResponse(response); return(response); }
public void CheckRequestValidator_LastNameIsNotValid_ValidationFailed(string lastName) { var model = new CheckRequest { FirstName = "Yevhen", LastName = lastName, DateOfBirth = new DateTime(2002, 10, 10), SSN = "123456789" }; var validationResult = validator.Validate(model); VerifyValidationResult(validationResult, "LastName", "Please, provide only letters"); }
public void CheckRequestValidator_DateOfBirthLessThanEighteenYearsAgo_ValidationFailed(DateTime dateOfBirth) { var model = new CheckRequest { FirstName = "Yevhen", LastName = "Skrypnyk", DateOfBirth = dateOfBirth, SSN = "123456789" }; var validationResult = validator.Validate(model); VerifyValidationResult(validationResult, "DateOfBirth", "You are under 18 years old"); }
public void CheckRequestValidator_LastNameIsEmpty_ValidationFailed() { var model = new CheckRequest { FirstName = "Yevhen", LastName = "", DateOfBirth = new DateTime(2002, 10, 10), SSN = "123456789" }; var validationResult = validator.Validate(model); VerifyValidationResult(validationResult, "LastName", "Please, provide a last name"); }
/// <summary>Snippet for Check</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void CheckRequestObject() { // Create client ServiceControllerClient serviceControllerClient = ServiceControllerClient.Create(); // Initialize request argument(s) CheckRequest request = new CheckRequest { ServiceName = "", Operation = new Operation(), ServiceConfigId = "", }; // Make the request CheckResponse response = serviceControllerClient.Check(request); }
// GET: CheckRequests/Details/5 public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CheckRequest checkRequest = await db.CheckRequests.FindAsync(id); if (checkRequest == null) { return(HttpNotFound()); } return(View(checkRequest)); }
public void ProcceedBackgroundCheck_LastNameEndsWithClear_ListCrimeRecordsEmpty(string lastName) { var ssnNumber = "123456789"; var model = new CheckRequest { FirstName = "Yevhen", LastName = lastName, DateOfBirth = new DateTime(2002, 10, 10), SSN = ssnNumber }; var result = _service.ProcceedBackgroundCheck(model); Assert.Zero(result.CrimeRecords.Count); }