public async Task <NotificationResult> ValidateUsernameAndTokenAsync(string username, Guid?token) { var result = new NotificationResult(); var user = await _userRepository.GetUserByLoginAsync(username); return(result); }
public NotificationResult Salvar(Nivel_Classe entidade) { var notificationResult = new NotificationResult(); try { if (entidade.CodNivel == 0 || entidade.CodClasse == 0) { notificationResult.Add(new NotificationError("Qtde. de produtos no Estoque inválido.", NotificationErrorType.USER)); } if (notificationResult.IsValid) { _nivel_Classe_Repositorio.Adicionar(entidade); notificationResult.Add("Produto cadastrado com sucesso."); } notificationResult.Result = entidade; return(notificationResult); } catch (Exception ex) { return(notificationResult.Add(new NotificationError(ex.Message))); } }
public void SetFailedResult(Guid id, string details, bool error = false) { try { Notification failed = m_notificationContext.Notifications.Find(id); if (error) { failed.SendingDateTime = DateTimeOffset.UtcNow.AddMinutes(5); failed.Status = NotificationStatus.Error; } else { failed.Status = NotificationStatus.Error; } NotificationResult notificationResult = new NotificationResult { Id = Guid.NewGuid(), NotificationId = id, SendingDateTime = DateTimeOffset.UtcNow, Description = details, Status = NotificationSendingStatus.Failed }; m_notificationContext.NotificationResults.Add(notificationResult); m_notificationContext.SaveChanges(); } catch (Exception ex) { m_log.Error(m => m(Resources.Exception_UnexpectedError, ex.ToString())); } }
public void Notify() { var eventInfo = new NotificationInfo(Name, Date, ""); NotificationResult notificationResult = Notifier.Notify(eventInfo); UpdateStatus(notificationResult); }
public NotificationResult Salvar(ArmaInventario entidade) { var NotificationResult = new NotificationResult(); try { if (entidade.CodArma != 0 && entidade.CodJogador != 0 && entidade.CodFicha != 0) { entidade.CodArma = entidade.CodArma; entidade.CodJogador = entidade.CodJogador; entidade.CodFicha = entidade.CodFicha; if (NotificationResult.IsValid) { _armaInventarioRepositorio.Adicionar(entidade); NotificationResult.Add("Cadastrado!"); } return(NotificationResult); } else { return(NotificationResult.Add(new NotificationError("Erro no cadastro!", NotificationErrorType.USER))); }; } catch (Exception ex) { return(NotificationResult.Add(new NotificationError(ex.Message))); } }
public NotificationResult Excluir(int idVenda) { var notificationResult = new NotificationResult(); try { if (idVenda <= 0) { return(notificationResult.Add(new NotificationError("Código da Venda Inválido!"))); } Venda entidade = ListarUm(idVenda); if (entidade == null) { return(notificationResult.Add(new NotificationError("Venda não Encontrado!"))); } if (notificationResult.IsValid) { _vendaRepositorio.Remover(entidade); notificationResult.Add("Venda Removida com sucesso."); } return(notificationResult); } catch (Exception ex) { return(notificationResult.Add(new NotificationError(ex.Message))); } }
public NotificationResult Excluir(FichaAtributo entidade) { var NotificationResult = new NotificationResult(); try { if (entidade.CodJogador != 0 && entidade.CodFicha != 0 && entidade.CodJogador != 0) { if (NotificationResult.IsValid) { _fichaAtributoServico.Remover(entidade); NotificationResult.Add("Cadastro excluido com Sucesso!"); return(NotificationResult); } else { return(NotificationResult.Add(new NotificationError("O codigo informado não existe!", NotificationErrorType.USER))); } } else { return(NotificationResult.Add(new NotificationError("O codigo informado não existe!", NotificationErrorType.USER))); } } catch (Exception ex) { return(NotificationResult.Add(new NotificationError(ex.Message))); } }
public async Task <NotificationResult> SendAsync(string from, IEnumerable <string> to, string subject, string body) { var client = new SmtpClient("mail.gosevakuator.ru") { UseDefaultCredentials = false, Credentials = new NetworkCredential("*****@*****.**", "982324Pa") }; MailMessage mailMessage = new MailMessage { From = new MailAddress(from), Body = body, Subject = subject }; mailMessage.To.Add(string.Join(";", to)); var status = MessageStatus.Non; try { await client.SendMailAsync(mailMessage); status = MessageStatus.Sent; } catch { status = MessageStatus.Error; } var result = new NotificationResult(status); return(result); }
public NotificationResult Excluir(int idProduto) { var notificationResult = new NotificationResult(); try { if (idProduto == 0) { return(notificationResult.Add(new NotificationError("Código do Produto Inválido!"))); } Produto entidade = ListarUm(idProduto); if (entidade == null) { return(notificationResult.Add(new NotificationError("Produto não Encontrado!"))); } if (notificationResult.IsValid) { _produtoRepositorio.Remover(entidade); notificationResult.Add("Produto Removido com sucesso."); } return(notificationResult); } catch (Exception ex) { return(notificationResult.Add(new NotificationError(ex.Message))); } }
public NotificationResult Salvar(Aumento_Habilidade entidade) { var notificationResult = new NotificationResult(); try { if (entidade.CodAtributo == 0) { notificationResult.Add(new NotificationError("Atributo não pode ser zero.", NotificationErrorType.USER)); } if (notificationResult.IsValid) { _aumento_Habilidade_Repositorio.Adicionar(entidade); notificationResult.Add("Aumento Habilidade cadastrado com sucesso."); } notificationResult.Result = entidade; return(notificationResult); } catch (Exception ex) { return(notificationResult.Add(new NotificationError(ex.Message))); } }
protected virtual bool?GetConfirmationFromUIDialog() { IResultProvider dialog = this.UIDialogConstructor(); if (dialog == null) { return(null); } INotificationResultCourier resultCourier = this.LordOfNotifications.DisplayNotification(dialog); NotificationResult result = resultCourier.GetResultWithWait(); if (result.Code == ResultCode.OK || result.Code == ResultCode.Yes) { return(true); } if (result.Code == ResultCode.Close || result.Code == ResultCode.No) { return(false); } if (result.Code == ResultCode.PermanentlyClose) { this.ConfirmationSetting.Value = false; } return(null); }
public NotificationResult Salvar(Bonus_Proficiencia entidade) { var notificationResult = new NotificationResult(); try { if (entidade.CodBonusProficiencia == 0) { notificationResult.Add(new NotificationError("CodBonusProficiencia não pode ser zero.", NotificationErrorType.USER)); } if (notificationResult.IsValid) { _bonus_Proficiencia_Repositorio.Adicionar(entidade); notificationResult.Add("Bonus Proficiencia cadastrado com sucesso."); } notificationResult.Result = entidade; return(notificationResult); } catch (Exception ex) { return(notificationResult.Add(new NotificationError(ex.Message))); } }
public NotificationResult Notify(NotificationInfo eventInfo) { var regexEmail = new RegexValidator(); var smtpClient = PrepareSmtpClient(); var email = FormEmail(eventInfo); NotificationResult result = new NotificationResult(); try { if (regexEmail.Email(eventInfo.EmailRecipient) == true) { smtpClient.Send(email); result.IsSuccess = true; } } catch (Exception ex) { if (regexEmail.Email(eventInfo.EmailRecipient) == false) { result.Details = ex.Message; } } return(result); }
public NotificationResult Salvar(Ataque_Furtivo entidade) { var notificationResult = new NotificationResult(); try { if (entidade.CodNivel == 0) { notificationResult.Add(new NotificationError("CodNivel não pode ser zero.", NotificationErrorType.USER)); } if (notificationResult.IsValid) { _ataque_Furtivo_Repositorio.Adicionar(entidade); notificationResult.Add("Ataque_Furtivo cadastrado com sucesso."); } notificationResult.Result = entidade; return(notificationResult); } catch (Exception ex) { return(notificationResult.Add(new NotificationError(ex.Message))); } }
public virtual async Task <NotificationResult> InsertAsync(InsertRecipeCommand command) { var result = new NotificationResult(); var item = new RecipeInfo(command); result.Add(item.GetNotificationResult()); if (!result.IsValid) { return(result); } result.Add(await _recipeRepository.InsertAsync(item)); if (result.IsValid) { if (command.RecipeIngredients != null && command.RecipeIngredients.Count > 0) { foreach (var recipeIngredientCommand in command.RecipeIngredients) { var recipeIngredient = new RecipeIngredientInfo(recipeIngredientCommand); recipeIngredient.SetRecipeId(item.Id.Value); result.Add(await _recipeIngredientRepository.InsertAsync(recipeIngredient)); } } result.Data = item.Id; result.AddMessage(Shared.Domain.Resources.Handler.InsertSuccess_Message); } else { result.AddErrorOnTop(Shared.Domain.Resources.Handler.InsertError_Message); } return(result); }
public NotificationResult Excluir(Pericia entidade) { var NotificationResult = new NotificationResult(); try { if (entidade.CodPericia != 0) { if (NotificationResult.IsValid) { _periciaRepositorio.Remover(entidade); NotificationResult.Add("Cadastro excluido com Sucesso!"); return(NotificationResult); } else { return(NotificationResult.Add(new NotificationError("O codigo informado não existe!", NotificationErrorType.USER))); } } else { return(NotificationResult.Add(new NotificationError("O codigo informado não existe!", NotificationErrorType.USER))); } } catch (Exception ex) { return(NotificationResult.Add(new NotificationError(ex.Message))); } }
public NotificationResult Excluir(int idFornecedor) { var notificationResult = new NotificationResult(); try { if (idFornecedor == 0) { return(notificationResult.Add(new NotificationError("Código do Fornecedor Inválido!"))); } Fornecedor entidade = ListarUm(idFornecedor); if (entidade == null) { return(notificationResult.Add(new NotificationError("Fornecedor não Encontrado!"))); } if (notificationResult.IsValid) { _fornecedorRepositorio.Remover(entidade); notificationResult.Add("Fornecedor Removido com sucesso."); } return(notificationResult); } catch (Exception ex) { return(notificationResult.Add(new NotificationError(ex.Message))); } }
public NotificationResult Atualizar(ArmaInventario entidade) { var NotificationResult = new NotificationResult(); try { if (entidade.CodArma != 0 && entidade.CodJogador != 0 && entidade.CodFicha != 0) { entidade.CodArma = entidade.CodArma; } entidade.CodJogador = entidade.CodJogador; entidade.CodFicha = entidade.CodFicha; if (NotificationResult.IsValid) { _armaInventarioRepositorio.Atualizar(entidade); NotificationResult.Add("Cadastro Alterado com Sucesso!"); return(NotificationResult); } else { return(NotificationResult.Add(new NotificationError("O codigo informado não existe!", NotificationErrorType.USER))); } } catch (Exception) { return(NotificationResult.Add(new NotificationError("O codigo informado não existe!", NotificationErrorType.USER))); } }
private void ProcessPrintJobNotification(NotificationResult nr, CancellationToken cancellationToken) { var inserted = nr.Inserted.GroupBy(c => new PrintJob() { Description = c.Description, JobID = c.JobID, PrintQueue = c.PrintQueue, ReportID = c.ReportID }, c => new{ c.ParameterName, c.ParameterValue }); var deleted = nr.Deleted.GroupBy(c => new PrintJob() { Description = c.Description, JobID = c.JobID, PrintQueue = c.PrintQueue, ReportID = c.ReportID }, c => new { c.ParameterName, c.ParameterValue }).ToDictionary(c => c.Key, c => c.ToArray()); foreach (var row in inserted) { PrintQueue queue; if (deleted.ContainsKey(row.Key) || !_queues.TryGetValue(row.Key.PrintQueue, out queue)) { continue; } _alreadyProcessed?.TryAdd(row.Key.JobID, row.Key.JobID); try { ProcessJob(queue, row.Key.JobID, row.Key.ReportID, row.Key.Description, row.AsEnumerable() .Where(c => c.ParameterName != null) .ToDictionary(c => c.ParameterName, c => c.ParameterValue)); } catch (Exception e) { _progress.Report(new MonitorMessage(string.Format(Strings.PollingQueueUnknownError, e.Message), MonitorMessage.MonitorStates.Error)); Restart(cancellationToken).Wait(cancellationToken); } } }
public NotificationResult Atualizar(Pericia entidade) { var NotificationResult = new NotificationResult(); try { if (entidade.CodPericia != 0) { entidade.CodPericia = entidade.CodPericia; } if (NotificationResult.IsValid) { _periciaRepositorio.Atualizar(entidade); NotificationResult.Add("Cadastro Alterado com Sucesso!"); return(NotificationResult); } else { return(NotificationResult.Add(new NotificationError("O codigo informado não existe!", NotificationErrorType.USER))); } } catch (Exception) { return(NotificationResult.Add(new NotificationError("O codigo informado não existe!", NotificationErrorType.USER))); } }
public NotificationResult Salvar(Equipamentos_Inventario entidade) { var notificationResult = new NotificationResult(); try { if (entidade.CodEquipamento == 0) { notificationResult.Add(new NotificationError("Cod Equipamento não pode ser zero.", NotificationErrorType.USER)); } if (notificationResult.IsValid) { _equipamentos_Inventario_Repositorio.Adicionar(entidade); notificationResult.Add("Equipamentos Inventario cadastrado com sucesso."); } notificationResult.Result = entidade; return(notificationResult); } catch (Exception ex) { return(notificationResult.Add(new NotificationError(ex.Message))); } }
/// <inheritdoc/> public async Task <NotificationResult> Send(ApnsNotification notification, string deviceToken, bool isVoip) { var hostUri = $"{apnsUri}{deviceToken}"; var payload = notification.GetPayload(); var counter = 0; NotificationResult result = NotificationResult.Successful(); while (counter < 5) { HttpResponseMessage response = await SendRequest(isVoip, payload, hostUri); if (response.StatusCode == HttpStatusCode.OK) { return(NotificationResult.Successful()); } result = await GetErrorResult(response); if (result.Error.Code != NotificationErrorCode.ExpiredAccessToken) { return(result); } RefreshToken(DateTimeOffset.Now, true); counter++; } return(result); }
public NotificationResult Salvar(Classe entidade) { var notificationResult = new NotificationResult(); try { if (entidade.CodClasse == 0) { notificationResult.Add(new NotificationError("Cod Classe não pode ser zero.", NotificationErrorType.USER)); } if (notificationResult.IsValid) { _classe_Repositorio.Adicionar(entidade); notificationResult.Add("Classe cadastrado com sucesso."); } notificationResult.Result = entidade; return(notificationResult); } catch (Exception ex) { return(notificationResult.Add(new NotificationError(ex.Message))); } }
public async Task <IActionResult> RefreshToken([FromBody] UserRefreshTokenCommand authentication) { NotificationResult result = new NotificationResult(); using (var client = new HttpClient()) { client.BaseAddress = new Uri(AppSettings.Site.UrlApi); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/x-www-form-urlencoded")); var contentData = new FormUrlEncodedContent(new[] { new KeyValuePair <string, string>("refresh_token", authentication.Refresh_token), new KeyValuePair <string, string>("grant_type", "refresh_token") }); var response = await client.PostAsync("connect/token", contentData); string str = await response.Content.ReadAsStringAsync(); var tokenAuthentication = JsonConvert.DeserializeObject <UserTokenCommandResult>(str); if (response.IsSuccessStatusCode) { result.Data = tokenAuthentication; } else { result.AddError(tokenAuthentication.Error_description); } } return(Ok(result)); }
public NotificationResult Excluir(Comercio entidade) { var notificationResult = new NotificationResult(); try { if (entidade.IdComercio < 0) { notificationResult.Add(new NotificationError("Comercio inválido.")); } if (notificationResult.IsValid) { _comercioRepositorio.Remover(entidade); notificationResult.Add("Comercio Removido com sucesso."); } notificationResult.Result = entidade; return(notificationResult); } catch (Exception ex) { return(notificationResult.Add(new NotificationError(ex.Message))); } }
public NotificationResult Salvar(Pericia entidade) { var NotificationResult = new NotificationResult(); try { if (entidade.CodPericia != 0) { entidade.CodPericia = entidade.CodPericia; if (NotificationResult.IsValid) { _periciaRepositorio.Adicionar(entidade); NotificationResult.Add("Cadastrado!"); } return(NotificationResult); } else { return(NotificationResult.Add(new NotificationError("Erro no cadastro!", NotificationErrorType.USER))); }; } catch (Exception ex) { return(NotificationResult.Add(new NotificationError(ex.Message))); } }
public NotificationResult Salvar(Atributo entidade) { var NotificationResult = new NotificationResult(); try { if (entidade.CodAtributo != 0) { entidade.CodAtributo = entidade.CodAtributo; if (NotificationResult.IsValid) { _atributoServico.Adicionar(entidade); NotificationResult.Add("Cadastrado!"); } return(NotificationResult); } else { return(NotificationResult.Add(new NotificationError("Erro no cadastro!", NotificationErrorType.USER))); }; } catch (Exception ex) { return(NotificationResult.Add(new NotificationError(ex.Message))); } }
public NotificationResult Salvar(Comercio entidade) { var notificationResult = new NotificationResult(); try { if (entidade.IdComercio < 0) { notificationResult.Add(new NotificationError("Comercio inválido.")); } if (notificationResult.IsValid) { if (entidade.IdComercio == 0) { _comercioRepositorio.Adicionar(entidade); } else { _comercioRepositorio.Atualizar(entidade); } notificationResult.Add("Comercio cadastrado com sucesso."); } notificationResult.Result = entidade; return(notificationResult); } catch (Exception ex) { return(notificationResult.Add(new NotificationError(ex.Message))); } }
public NotificationResult Atualizar(Atributo entidade) { var NotificationResult = new NotificationResult(); try { if (entidade.CodAtributo != 0) { entidade.CodAtributo = entidade.CodAtributo; } if (NotificationResult.IsValid) { _atributoServico.Atualizar(entidade); NotificationResult.Add("Cadastro Alterado com Sucesso!"); return(NotificationResult); } else { return(NotificationResult.Add(new NotificationError("O codigo informado não existe!", NotificationErrorType.USER))); } } catch (Exception) { return(NotificationResult.Add(new NotificationError("O codigo informado não existe!", NotificationErrorType.USER))); } }
public async Task <NotificationResult> CreateShoplistWithIngredients(InsertShoplistWithIngredientsCommand command) { var result = new NotificationResult(); var item = new ShoplistInfo(command); result.Add(item.GetNotificationResult()); if (!result.IsValid) { return(result); } result.Add(await _shoplistRepository.InsertAsync(item)); if (result.IsValid) { result.Data = item.Id; /* * foreach (var shoplistItem in command.ShoplistsIngredients) * { * shoplistItem.SetId(item.Id.Value); * await _shoplistIngredientRepository.InsertAsync(shoplistItem); * }*/ result.AddMessage(Shared.Domain.Resources.Handler.InsertSuccess_Message); } else { result.AddErrorOnTop(Shared.Domain.Resources.Handler.InsertError_Message); } return(result); }
public void ParseResultBase_should_parse_TimeStamp_1450936800_correctly() { XDocument xDoc = XDocument.Parse(_successfulResult); NotificationResult notificationResult = new NotificationResult(); ResultParser.ParseResultBase(xDoc, notificationResult); Assert.Equal("1450936800", notificationResult.TimeStamp); }
public void ParseResultBase_should_parse_ResultCode_200_correctly() { XDocument xDoc = XDocument.Parse(_successfulResult); NotificationResult notificationResult = new NotificationResult(); ResultParser.ParseResultBase(xDoc, notificationResult); Assert.Equal("200", notificationResult.ResultCode); }
public void ParseResultBase_should_parse_ErrorMessage_as_null_when_success() { XDocument xDoc = XDocument.Parse(_successfulResult); NotificationResult notificationResult = new NotificationResult(); ResultParser.ParseResultBase(xDoc, notificationResult); Assert.Null(notificationResult.ErrorMessage); }
public void ParseResultBase_should_parse_RemainingCount_988_correctly() { XDocument xDoc = XDocument.Parse(_successfulResult); NotificationResult notificationResult = new NotificationResult(); ResultParser.ParseResultBase(xDoc, notificationResult); Assert.Equal(988, notificationResult.RemainingMessageCount); }
public NotificationResult SendNotification(INotification notification) { Dictionary<string, string> parameters = _requestBuilderHelper.BuildDictionaryForNotificataion(notification); NotificationResult notificationResult = new NotificationResult(); XDocument resultDocument = GetResultDocument(parameters, Method.Add, notificationResult); return notificationResult; }
private void NotifyNotification(NotificationResult notification) { DispatchNonFinalResult(PluginResult.Status.OK, JsonConvert.SerializeObject(notification)); }
private void NotifyColdstartNotificationIfNeeded() { NotificationResult notification; lock (this) { CollectColdstartNotification(); if (this.coldstartNotification == null) { return; } notification = this.coldstartNotification; this.coldstartNotification = null; } NotifyNotification(notification); }
private void CurrentChannel_ShellToastNotificationReceived(object sender, NotificationEventArgs e) { var nodeValues = e.Collection; var title = nodeValues.ContainsKey("wp:Text1") ? nodeValues["wp:Text1"] : string.Empty; var message = nodeValues.ContainsKey("wp:Text2") ? nodeValues["wp:Text2"] : string.Empty; var notification = new NotificationResult { Title = title, Message = message }; if (nodeValues.ContainsKey("wp:Param")) { var queryDict = ParseQueryString(nodeValues["wp:Param"]); foreach (var entry in queryDict) { if (entry.Key == TITLE_PARAMETER_KEY) { notification.Title = entry.Value; // prefer the title found in parameters } else if (entry.Key == MESSAGE_PARAMETER_KEY) { notification.Message = entry.Value; // prefer the message found in parameters } else { notification.AdditionalData.Add(entry.Key, entry.Value); } } notification.AdditionalData.Add(FOREGROUND_ADDITIONAL_DATA, true); } NotifyNotification(notification); }
private void CurrentChannel_HttpNotificationReceived(object sender, HttpNotificationEventArgs e) { var notification = new NotificationResult { Title = string.Empty, Message = string.Empty }; using (var reader = new StreamReader(e.Notification.Body)) { notification.AdditionalData.Add("body", reader.ReadToEnd()); } NotifyNotification(notification); }
private void CollectColdstartNotification() { lock (this) { if (this.coldstartCollected) { return; } this.coldstartCollected = true; } // Retrieve the coldstart notification that started the application. var query = RetrieveQueryString(); if (query.ContainsKey(TITLE_PARAMETER_KEY) || query.ContainsKey(MESSAGE_PARAMETER_KEY)) { var title = query.ContainsKey(TITLE_PARAMETER_KEY) ? query[TITLE_PARAMETER_KEY] : string.Empty; var message = query.ContainsKey(MESSAGE_PARAMETER_KEY) ? query[MESSAGE_PARAMETER_KEY] : string.Empty; var notification = new NotificationResult { Title = title, Message = message }; foreach (string key in query.Keys) { if (key != TITLE_PARAMETER_KEY && key != MESSAGE_PARAMETER_KEY) { notification.AdditionalData.Add(key, query[key]); } } notification.AdditionalData.Add(COLDSTART_ADDITIONAL_DATA, true); this.coldstartNotification = notification; } else { this.coldstartNotification = null; } }
private Task AcknowledgeServerNotificationAsync(ServerNotification notification, NotificationResult result, string customType = null) { _logger.LogInformation("Acknowledging notification {0} of type {1}{2}, result {3}", notification.NotificationId, notification.Type, customType == null ? String.Empty : " - " + customType, result); var acknowledgement = new ClientNotificationWithAcknowledgement { Type = "Acknowledgement", AcknowledgementDetail = new ClientNotificationAcknowledgement { ServerNotificationId = notification.NotificationId, Result = result, SentTime = notification.CreatedOn, Type = notification.Type, CustomNotificationType = customType } }; return QueueClientNotificationAsync(acknowledgement); }
void PerformClick(NotificationResult result) { }