public ActionResult MoreInformation([Bind(Exclude = "Site")] InformationRequest informationRequest) { ModelState.Clear(); informationRequest.Site = SiteService.LoadSite(Site); informationRequest.Seminar = SiteService.GetLatestSeminar(Site); informationRequest.TransferValidationMessagesTo(ModelState); if (ModelState.IsValid) { _informationRequestRepository.EnsurePersistent(informationRequest); Message = string.Format("Your request for information has been submitted."); // send the information request notification to admin _notificationService.SendInformationRequestNotification(informationRequest, informationRequest.Site); // queue an email for the person requesting information _notificationService.SendInformationRequestConfirmatinon(informationRequest.Email, informationRequest.Site); return(this.RedirectToAction <HomeController>(a => a.Index())); } ViewBag.Countries = RepositoryFactory.CountryRepository.Queryable.OrderBy(a => a.Name).ToList(); return(View(informationRequest)); }
private async Task SendResolutionRequestAsync(ResolutionRequest request) { var instrument = request.Instrument; var data = await InstrumentConverter.ResolveInstrumentAsync(adapter, instrument); // если символ не зарезолвился, выходим if (data == null) { request.Resolve(uint.MaxValue); return; } var message = new InformationRequest { symbol_resolution_request = new SymbolResolutionRequest { symbol = data.Symbol }, id = request.Id }; request.OnSent(); using (requestBatchLock.Lock()) { requestBatch.Add(message); } _Log.Debug().PrintFormat( "Sending a symbol resolution request {0} for instrument {1} mapped to symbol {2}", request.Id, instrument, data.Symbol ); }
private IEnumerable <InformationProperty> GetPropertiesFromPropertiesNode(InformationRequest request) { var properties = Enumerable.Empty <InformationProperty>(); request.Properties = request.Properties ?? Enumerable.Empty <InformationPropertyRequest>(); foreach (var propertyNode in request.Properties) { var propertyName = propertyNode.Name; var property = properties.FirstOrDefault(p => p.Name == propertyName); if (property == null) { property = new InformationProperty { Name = propertyName }; properties = properties.Concat(new[] { property }); } property.Values = property.Values ?? Enumerable.Empty <object>(); foreach (var propertyNodeValue in propertyNode.Values) { var propertyObject = GetPropertyObjectFromValue(propertyNodeValue); if (!property.Values.Contains(propertyObject)) { property.Values = property.Values.Concat(new[] { propertyObject }); } } } return(properties); }
public async Task <InformationRequestDto> Handle(Command request, CancellationToken cancellationToken) { var ir = new InformationRequest { DoctorId = _userService.GetUserAuthId(), IsActive = request.IsActive, PatientId = request.PatientId, RequestedBms = request.RequestedBms, RequestedPain = request.RequestedPain, RequestedDataFrom = request.RequestedDataFrom, RequestedDataTo = request.RequestedDataTo }; await _context.InformationRequests.AddAsync(ir, cancellationToken); await _context.SaveChangesAsync(cancellationToken); return(new() { InformationRequestId = ir.InformationRequestId, DoctorId = ir.DoctorId, IsActive = ir.IsActive, PatientId = ir.PatientId, RequestedBms = ir.RequestedBms, RequestedPain = ir.RequestedPain, RequestedDataFrom = ir.RequestedDataFrom, RequestedDataTo = ir.RequestedDataTo }); }
public StoreInformationRequest CreateRequest(InformationRequest request) { return(new StoreInformationRequest { Id = request?.Id ?? string.Empty, Properties = GetPropertiesFromPropertiesNode(request) }); }
/// <summary> /// Запрос необходимых данных после успешного логина: /// - список счетов /// - позиции /// - сделки /// - заявки /// </summary> private void RequestInitializingData() { var request = new InformationRequest { id = IncrementRequestId(), accounts_request = new AccountsRequest() }; SendMessage(request); }
public void StoreInformation(InformationRequest request) { var storeInformationRequest = new StoreInformationRequestFromServiceRequestFactory( new IStringToObject[] { new NullableBooleanFromStringFactory(), new NullableIntegerFromStringFactory(), new NullableDateTimeFromStringFactory() } ).CreateRequest(request); var mongoClient = new MongoClient(); var repository = new StoreInformationMongoDatabaseRepository(mongoClient.GetDatabase("information-store")); var interactor = new StoreInformationInteractor(repository); interactor.Execute(storeInformationRequest); }
/// <summary> /// Проверить подписку /// </summary> async Task <SubscriptionTestResult> ISubscriptionTester <InstrumentData> .TestSubscriptionAsync(InstrumentData data) { var id = GetNextRequestId(); var request = new ResolutionRequest(data.Symbol, id); using (resolutionRequestsLock.Lock()) { resolutionRequestsById.Add(id, request); } var message = new InformationRequest { symbol_resolution_request = new SymbolResolutionRequest { symbol = data.Symbol }, id = id }; SendMessage(message); return(await request.Task); }
public ActionResult Edit(int?id, InformationRequest informationRequest) { var editInformationRequest = _informationrequestRepository.GetNullableById(id.Value); if (editInformationRequest == null) { Message = string.Format(Messages.NotFound, "information request", id); return(this.RedirectToAction(a => a.Index())); } Mapper.Map(informationRequest, editInformationRequest); ModelState.Clear(); editInformationRequest.TransferValidationMessagesTo(ModelState); if (ModelState.IsValid) { _informationrequestRepository.EnsurePersistent(editInformationRequest); Message = string.Format(Messages.Saved, "Information request"); } return(View(InformationRequestViewModel.Create(RepositoryFactory, editInformationRequest))); }
public void SendInformationRequestNotification(InformationRequest informationRequest, Site site) { // send the notification email to the admin try { var client = new SmtpClient(); var message = new MailMessage(); var emails = ConfigurationManager.AppSettings["NotificationUsers"].Split(';'); message.From = new MailAddress("*****@*****.**", "CA&ES Automated Email"); foreach (var email in emails) { message.To.Add(email); } message.Subject = "Information Request Received"; message.Body = string.Format("A new information request has been received for the following person:<br/>{0}<br/>{1}<br/>{2}", informationRequest.FullName(), informationRequest.Email, site.Name); client.Send(message); } catch (Exception ex) { // do nothing } }
public void GetEndpoints_HappyPath() { var request = new InformationRequest { CompanyName = _CompanyName, Username = _Username, Endpoint = _Endpoint, Size = _Size }; var entity = new string[] { "" }; var mockRepository = Substitute.For <IInformationRepository>(); mockRepository.GetEndpoints(_Endpoint, _CompanyName, _Username, _Size).Returns(entity); var engine = new InformationEngine(mockRepository); var response = engine.GetEndpoints(request); Assert.AreEqual(entity[0], response[0]); }
/// <summary> /// Отправить сообщение в сокет /// </summary> public void SendMessage(InformationRequest msg) => SendMessageImpl(new ClientMsg { information_request = { msg } });
public string[] GetUsers(InformationRequest userRequest) { return(_InformationEngine.GetUsers(userRequest)); }
public string[] GetEndpoints(InformationRequest request) { return(_InformationRepository.GetEndpoints(request.Endpoint, request.CompanyName, request.Username, request.Size)); }
public static InformationRequestViewModel Create(IRepositoryFactory repositoryFactory, InformationRequest informationRequest = null) { var viewModel = new InformationRequestViewModel { InformationRequest = informationRequest ?? new InformationRequest(), Countries = repositoryFactory.CountryRepository.Queryable.OrderBy(a => a.Name).ToList() }; return viewModel; }
public ActionResult Edit(int? id, InformationRequest informationRequest) { var editInformationRequest = _informationrequestRepository.GetNullableById(id.Value); if (editInformationRequest == null) { Message = string.Format(Messages.NotFound, "information request", id); return this.RedirectToAction(a => a.Index()); } Mapper.Map(informationRequest, editInformationRequest); ModelState.Clear(); editInformationRequest.TransferValidationMessagesTo(ModelState); if (ModelState.IsValid) { _informationrequestRepository.EnsurePersistent(editInformationRequest); Message = string.Format(Messages.Saved, "Information request"); } return View(InformationRequestViewModel.Create(RepositoryFactory,editInformationRequest)); }
public string[] GetEndpoints(InformationRequest request) { return(_InformationEngine.GetEndpoints(request)); }
public static InformationRequestViewModel Create(IRepositoryFactory repositoryFactory, InformationRequest informationRequest = null) { var viewModel = new InformationRequestViewModel { InformationRequest = informationRequest ?? new InformationRequest(), Countries = repositoryFactory.CountryRepository.Queryable.OrderBy(a => a.Name).ToList() }; return(viewModel); }
public string[] GetCompanies(InformationRequest request) { return(_InformationEngine.GetCompanies(request)); }