public async Task WhenConversationBetweenCustomerAndPersonnelThenCheckItsReliable() { // AlertModel value = null; var info = new AlertModel() { CustomerName = "XXXXX", CustonmerMailId = "1234", ItemPurchased = "1", CustomerphoneNumber = "9023489095", Question = "Which Product is better?", Answer = "" }; var response = await _sut.Client.PostAsync(url + "/Query", new StringContent(JsonConvert.SerializeObject(info), Encoding.UTF8, "application/json")); response.StatusCode.Should().Be(HttpStatusCode.OK); var answer = new AlertModel() { Answer = "MX40 is better" }; var reply = await _sut.Client.PostAsync(url + "/Query/XXXXX", new StringContent(JsonConvert.SerializeObject(answer), Encoding.UTF8, "application/json")); reply.StatusCode.Should().Be(HttpStatusCode.OK); }
public List <AlertModel> Get(PagerModel pager, AlertModel filter) { using (var db = new EGULFEntities()) { var resp = db.sp_SelPagAlert( filter.AlertId, filter.AlertTemplateId, filter.From, filter.To, filter.Subject, filter.Body, filter.Status, pager.Start, pager.Offset, pager.SortBy, pager.SortDir).ToList(); if (resp.Count() > 0) { var first = resp.FirstOrDefault(); pager.TotalRecords = first.TotalRecords.HasValue ? first.TotalRecords.Value : 0; } return((from x in resp select new AlertModel() { AlertId = x.AlertId, AlertTemplateId = x.AlertTemplateId, From = x.From, To = x.To, Subject = x.Subject, Body = x.Body, Url = x.Url, Extra = x.Extra, Status = x.Status, CreatedAt = x.CreatedAt, UpdatedAt = x.UpdatedAt, TimeAgo = x.TimeAgo, Icon = x.Icon }).ToList()); } }
public async Task <ActionResult> Edit(string row, MapEntity model) { if (string.IsNullOrEmpty(model.FeaturedDate)) { ModelState.AddModelError("FeaturedDate", "A featured date is required."); } if (!ModelState.IsValid) { return(this.View(model)); } try { await TableStorage.Replace(model); } catch (StorageException error) { Task.Run(() => RavenClient.CaptureException(error)); return(this.AzureStorageErrorResponse(row, MapEntity.FeaturedKey, error)); } string alertMessage = string.Format("The featured map for {0} was updated.", model.FeaturedDate); this.TempData["Alerts"] = AlertModel.CreateSingle(AlertType.Success, alertMessage); this.TempData["Highlight"] = new HighlightModel(AlertType.Info, model.PartitionKey, model.RowKey); return(this.RedirectToAction("Index")); }
public async Task <ActionResult> Create(MapEntity model) { if (!ModelState.IsValid) { return(this.View(model)); } model.PartitionKey = MapEntity.MainKey; model.RowKey = ShortGuid.NewGuid().Value; try { // upload image to blob storage. model.ImageAddress = await UploadImageToStorage(model.RowKey, model.ImageAddress); await TableStorage.Insert(model); } catch (StorageException error) { Task.Run(() => RavenClient.CaptureException(error)); ViewBag.Alerts = new List <AlertModel> { new AlertModel(AlertType.Danger, error.Message) }; return(this.View(model)); } this.TempData["Alerts"] = AlertModel.CreateSingle(AlertType.Success, string.Format("{0} by {1} was created.", model.Title, model.Author)); this.TempData["Highlight"] = new HighlightModel(AlertType.Success, model.PartitionKey, model.RowKey); return(this.RedirectToAction("Index")); }
public void InvokeAlertAddedEvent(AlertModel alert) { if (ShellView != null) { InvokeOnWindowThread(() => { EventAggregator.GetEvent <Events.AlertAddedEvent>().Publish(alert); if (ShellView.WindowState == WindowState.Minimized) { ShellView.WindowState = WindowState.Normal; } if (!ShellView.Topmost) { ShellView.Topmost = true; ShellView.Topmost = false; } }); } else { EventAggregator.GetEvent <Events.AlertAddedEvent>().Publish(alert); } }
/// <summary> /// Method Name : GetAlertList /// Author : Sanket Prajapati /// Creation Date : 27 Dec 2017 /// Purpose : To get Alert List by from API /// Revision : /// </summary> public async Task <APIResponse <List <AlertModel> > > GetAlertList(AlertModel alertModel) { APIResponse <List <AlertModel> > apiResponse = new APIResponse <List <AlertModel> >() { STATUS = false }; if (alertModel is null) { apiResponse.Message = Resource.msgInvalidCustomer; return(apiResponse); } else { string lastLoginDate = null; if (alertModel.CustomerLastLoginDate != DateTime.MinValue) { lastLoginDate = alertModel.CustomerLastLoginDate.ToString(Resource.MM_dd_yyyyDateFormat); } string apiURL = string.Format("{0}{1}/{2}", Resource.BaseAPIUrl + Resource.AlertService, alertModel.CustomerID, lastLoginDate); await GetAlertListAsync(apiResponse, apiURL); return(apiResponse); } }
void AddAlert() { try { bool isUp = txtType.Text == "Üstünde";; if (alerts.Any(p => p.Name == txtCoin.Text && p.IsUp == isUp)) { MessageBox.Show("Önce mevcut alarmı sil"); return; } AlertModel alert = new AlertModel(); alert.Name = txtCoin.Text; alert.Price = Convert.ToDouble(txtPrice.Text); alert.IsUp = isUp; alerts.Add(alert); FillAlerts(); txtCoin.Text = ""; txtPrice.Text = ""; txtType.Text = ""; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public ActionResult MoveTram(LogistiekBeheerModel result) { //Testen var remise = (LogistiekBeheerModel)Session["Remise"]; if (remise == null) { return(RedirectToAction("Index")); } var moveTramResult = remise.Logic.MoveTram(result.Form.TramNumber, result.Form.TrackNumber, result.Form.SectorNumber); if (moveTramResult == "NOT IDLE") { var alertModel = new AlertModel { Message = "De tram ondergaat een service, weet u zeker dat u de tram wilt verplaatsen?", TramId = result.Form.TramNumber, TrackId = result.Form.TrackNumber, SectorId = result.Form.SectorNumber }; TempData["AlertModel"] = alertModel; return(RedirectToAction("MoveTramAlert")); } remise.Error = moveTramResult; if (moveTramResult == null) { remise.Sucess = "De tram is verplaatst."; } return(RedirectToAction("Index")); }
public void TriggerAlerts(INotifications notifications, SettingsModel settings, AlertModel alert) { if (settings.Sound.IsEnabled) { PlaySound(settings.Sound.FilePath); } AlertModel alertCopy = alert.Clone() as AlertModel; alertCopy.Price = Math.Round(alertCopy.Price, settings.Alerts.MaxPriceDecimalPlacesNumber); if (!alertCopy.Time.Offset.Equals(settings.Alerts.TimeZone.BaseUtcOffset)) { alertCopy.Time = alert.Time.ToOffset(settings.Alerts.TimeZone.BaseUtcOffset); } if (settings.Email.IsEnabled) { SendEmail(notifications, settings.Email, alertCopy); } if (settings.Telegram.IsEnabled) { SendTelegramMessage(settings.Telegram, alertCopy); } }
private static void TriggerAlerts(int number, Notifications notifications) { int counter = 0; string[] arrows = { "1", "2", "3" }; while (counter < number) { counter++; var time = DateTimeOffset.Now.AddDays(number).AddMinutes(counter); var alert = new AlertModel { TimeFrame = "Hour", Type = string.Format("Trend Line {0}", arrows[new Random().Next(0, 3)]), Symbol = "EURUSD", Time = time, Price = 1.23456, Comment = counter.ToString(), TriggeredBy = "UITestConsole" }; notifications.ShowPopup(alert); } }
public RequestResult <object> InsUpd(AlertModel model) { RequestResult <object> ER = new RequestResult <object>(); using (var db = new EGULFEntities()) { ObjectParameter Id = new ObjectParameter("AlertId", typeof(int?)); Id.Value = model.AlertId; ER = db.sp_InsUpdAlert(Id, model.AlertTemplateId, model.From, model.To, model.Subject, model.Body, model.Url, model.Extra, model.Status, model.CreatedAt, model.UpdatedAt) .Select(x => new RequestResult <object>() { Status = (bool)x.IsError ? Status.Error : Status.Success, Message = x.Message }).FirstOrDefault(); if (ER == null) { model.AlertId = Convert.ToInt32(Id.Value.ToString()); } return(ER); } }
public async Task <IActionResult> PutAlertModel(ulong id, AlertModel alertModel) { if (id != alertModel.Id) { return(BadRequest()); } _context.Entry(alertModel).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AlertModelExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <AlertModel> > PostAlertModel(AlertModel alertModel) { _context.AlertModels.Add(alertModel); await _context.SaveChangesAsync(); return(CreatedAtAction(nameof(GetAlertModel), new { id = alertModel.Id }, alertModel)); }
/// <summary> /// Method Name : GetAlertList /// Author : Vivek Bhavsar /// Creation Date : 29 Dec 2017 /// Purpose : For Getting Alert List /// Revision : /// </summary> public async Task <APIResponse <List <AlertModel> > > GetAlertList(CustomerModel customerModel) { APIResponse <List <AlertModel> > serviceResponse = new APIResponse <List <AlertModel> > { STATUS = false }; AlertModel alertModel; try { if (customerModel is null) { serviceResponse.Message = errorMessage; return(serviceResponse); } else { alertModel = new AlertModel(); { alertModel.CustomerID = customerModel.CustomerId; alertModel.CustomerLastLoginDate = Convert.ToDateTime(customerModel.LastLoginDate); } serviceResponse = await GetALertListResponse(alertModel); } return(serviceResponse); } catch { serviceResponse.Message = Resource.msgDefaultServieMessage; return(serviceResponse); } }
public AlertModel DeleteIntent(Intencion intencion) { var intento = new IntentoModel(); var resultado = new AlertModel(); try { var fileSavePath = System.Web.HttpContext.Current.Server.MapPath("~/Dialogflow.json/") + ConstantesWeb.DialogFlow.FilePrivateKeyIdJson; if ((System.IO.File.Exists(fileSavePath))) { var cred = GoogleCredential.FromFile(fileSavePath); var channel = new Channel(SessionsClient.DefaultEndpoint.Host, SessionsClient.DefaultEndpoint.Port, cred.ToChannelCredentials()); var client = IntentsClient.Create(channel); client.DeleteIntent(new IntentName(ConstantesWeb.DialogFlow.ProjectId, intencion.IdDialogFlow)); oIBLSolicitud.EliminarIntencionConsulta(intencion.IdDialogFlow); resultado.Mensaje = "DELETE-OK"; } } catch (Exception ex) { resultado.MessageError = "ERROR: " + ex.Message; resultado.Mensaje = "DELETE-ERROR"; } return(resultado); }
/// <summary> /// Method Name : GetALertListResponse /// Author : Vivek Bhavsar /// Creation Date : 29 Dec 2017 /// Purpose : For Getting Alert List /// Revision : /// </summary> /// <param name="alertModel"></param> /// <returns></returns> private async Task <APIResponse <List <AlertModel> > > GetALertListResponse(AlertModel alertModel) { APIResponse <List <AlertModel> > apiResponse = new APIResponse <List <AlertModel> >() { STATUS = false }; try { apiResponse = await alertAPIServices.GetAlertList(alertModel); if (apiResponse.STATUS) { if ((apiResponse.DATA is null) || (apiResponse.DATA != null && apiResponse.DATA.Count <= 0)) { errorMessage = Resource.msgAlertNotfound; apiResponse.STATUS = false; } } else { errorMessage = apiResponse.Message; } return(apiResponse); } catch { apiResponse.Message = Resource.msgDefaultServieMessage; return(apiResponse); } }
public bool UpdateAlert(AlertModel alertModel) { int rowseffected = 0; try { SqlParameter[] parameters = { new SqlParameter("@alertId", alertModel.AlertId) , new SqlParameter("@alertTitle", alertModel.AlertTitle) , new SqlParameter("@alertDate", _sql.ConvertDateTimeForSQL(alertModel.AlertDate)) , new SqlParameter("@alertDateEnd", _sql.ConvertDateTimeForSQL(alertModel.AlertDateEnd)) , new SqlParameter("@alertShortDetails", alertModel.AlertShortDetails) , new SqlParameter("@alertLongDetails", alertModel.AlertLongDetails) , new SqlParameter("@alertImageLocation", alertModel.AlertImageLocation) }; rowseffected = _sql.GetReturnValueFromStoredProcedure("UpdateAlert", parameters); } catch (Exception ex) { string error = string.Format( "There was an error updating Alert #{0} into database AlertService/UpdateAlert", alertModel.AlertId); _logger.LogError(error, ex); } return(rowseffected > 0); }
public AlertModel GetWithValues(int alertTemplateId, Dictionary <string, string> values) { AlertTemplateServices templateServices = new AlertTemplateServices(); AlertTemplateModel template = templateServices.GetById(alertTemplateId); AlertModel alert = new AlertModel(); alert.Body = template.Body; alert.Extra = template.Extra; alert.Subject = template.Subject; alert.Url = template.Url; if (values != null) { foreach (KeyValuePair <string, string> entry in values) { alert.Body = alert.Body != null?alert.Body.Replace("#" + entry.Key + "#", entry.Value) : ""; alert.Extra = alert.Extra != null?alert.Extra.Replace("#" + entry.Key + "#", entry.Value) : ""; alert.Subject = alert.Subject != null?alert.Subject.Replace("#" + entry.Key + "#", entry.Value) : ""; alert.Url = alert.Url != null?alert.Url.Replace("#" + entry.Key + "#", entry.Value) : ""; } } alert.AlertTemplateId = template.AlertTemplateId; alert.Icon = template.Icon; alert.Status = (int)AlertStatus.New; alert.TimeAgo = "Recien"; return(alert); }
public static void AddAlert(AlertModel alert) { AddAlerts(new List <AlertModel>() { alert }); }
static async Task Main(string[] args) { Console.WriteLine("host?(httpもしくはhttpsから入力)"); var host = Console.ReadLine(); var alert = new AlertModel(); Console.WriteLine("head?"); alert.Head = Console.ReadLine(); Console.WriteLine("body?"); alert.Body = Console.ReadLine(); Console.WriteLine("送信中"); using (var ms = new MemoryStream()) using (var sr = new StreamReader(ms)) { var serializer = new DataContractJsonSerializer(typeof(AlertModel)); serializer.WriteObject(ms, alert); ms.Position = 0; var json = sr.ReadToEnd(); using (var client = new HttpClient()) { var response = await client.PostAsync(host + "/api/Alert", new StringContent(json, Encoding.UTF8, @"application/json")); } } Console.WriteLine("送信完了"); }
public IActionResult UpdateAlert(AlertModel alert) { // TODO - J - validate data: dates order etc. bool successfullUpdate = _alertService.UpdateAlert(alert); return(RedirectToAction("AlertManager")); }
public async void Alert(BitmapImage image, string from, string message) { NewAlert = (new AlertModel { AlertImage = image, AlertFrom = from, AlertMessage = message, Time = DateTime.Now.ToString("HH:mm:ss") }); alerts.Add(NewAlert); //SOUNDALERT if (Properties.Settings.Default.IsSoundAlerts == true) { BassNetHelper bh = new BassNetHelper(); bh.Play(Properties.Settings.Default.AlertSound, Properties.Settings.Default.UserVolume); } //TEXTALERT if (Properties.Settings.Default.IsTextAlerts == true) { IsAlertOn = "ON"; await Task.Delay(4000); IsAlertOn = "OFF"; } //VOICEALERT if (Properties.Settings.Default.IsVoiceAlerts == true) { } }
public IActionResult AddAlert() { AlertModel alert = new AlertModel(_userManager.GetUserId(this.User), this.User.Identity.Name); int alertId = _alertService.AddAlert(alert); return(RedirectToAction("EditAlert", new { alertId })); }
public void Post([FromBody] AlertModel value) { var alert = new AlertDomain(); alert.AddAlertDetails(value.AlertName, value.CreatedBy, value.CreatedDateTime); AlertRepository.AddAlertDetails(alert); }
public static void RemoveAlert(AlertModel alert) { RemoveAlerts(new List <AlertModel>() { alert }); }
public async Task <ActionResult> Post(AlertModel alertModel) { try { var isCreated = await _repo.CreateAlert(_mapper.Map <alert>(alertModel)); if (isCreated == 0) { return(NotFound()); } else { alertModel.Id = isCreated; //temp fix //var currentUser = await _userManager.GetUserAsync(User); await _alertHub.Clients.All.SendAsync("sendToReact", alertModel); //await _alertHub.Clients.All.SendAsync("sendToReact", alertModel); return(Ok(new { message = "created" })); } } catch (Exception e) { return(BadRequest(new { message = e.Message })); } }
public void Open(PinDropController pinDrop) { Open(); alert = pinDrop.model; if (!String.IsNullOrEmpty(alert.imageUrl) && alert.imageUrl != "null") { Comms.instance.GetImage(alert.imageUrl, GetImageResponse); } }
/// <summary> /// //Set Color Alert Box And Time And Day Textview /// </summary> /// <param name="viewHolder"></param> /// <param name="position"></param> public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position) { AlertModel alertModel = alertList[position]; var viewholder = holder as AdapterAlertsViewHolder; viewholder.mTextViewTime.Text = AdapterAlertsViewHolder.GetTimeAndDay(alertModel.StartDate); viewholder.tvAlertTitle.Text = alertModel.AlertTitle; AdapterAlertsViewHolder.SetAlertIconAndColor(Convert.ToString(alertModel.AlertType), viewholder.alertIcon, viewholder.mLinearLayoutRandomColor, viewholder.mTextViewTime); }
public void Open(AlertModel model) { Open(); alert = model; if (!String.IsNullOrEmpty(alert.imageUrl) && alert.imageUrl != "null") { Comms.instance.GetImage(alert.imageUrl, GetImageResponse); } }
public JsonResult Get(PagerModel pager, AlertModel filters) { AlertServices service = new AlertServices(); filters.To = SessionWeb.User.PersonId; var collection = service.Get(pager, filters); return(Json(collection, JsonRequestBehavior.AllowGet)); }
protected void DisplayAlert(string alertMessage) { TempData["Alert"] = new AlertModel { Message = alertMessage }; }
public AlertMessage(string title, string message, AlertSeverity severity) { Alert = new AlertModel(title, message, severity); }