void SendNotification(TypeNotification type, int id) { string tTime = t_Day.text + " " + c_Day.text + "\t" + time.text; string tInfo; int id_icon; switch (type) { case TypeNotification.team_healing: if (StaticValues.Team[id].Actor.Nickname != "") { tInfo = StaticValues.Team[id].Actor.Nickname; } else { tInfo = StaticValues.Team[id].Actor.FirstName; tInfo += " " + StaticValues.Team[id].Actor.LastName; } tInfo += " czeka na rozkazy."; id_icon = 1; break; case TypeNotification.recruiter: tInfo = "Rekruter znalazł:\n" + id + " / " + StaticValues.Camp.RecruiterSettings.amount + " najemników"; id_icon = 2; break; default: tInfo = "" + type; id_icon = 0; break; } Notifications.SpawnNotification(id_icon, tTime, tInfo); }
// Methods public Notification(Guid ownerId, string ownerName, TypeNotification typeNotification, DateTime dateToOccur) { Id = ownerId; OwnerName = ownerName; TypeNotification = typeNotification; DateToOccur = dateToOccur; }
public Notification(Guid ownerId, string ownerName, TypeNotification typeNotification, string information, float unitsLeft, string additionalInformation = null, DuplicateNumberEntityType entityType = DuplicateNumberEntityType.Undefined) : this(ownerId, ownerName, typeNotification, information, additionalInformation) { UnitsLeft = unitsLeft; Status = UnitsLeft >= 0 ? NotificationStatus.Critical : NotificationStatus.Warning; }
public Notification(Guid ownerId, string ownerName, TypeNotification typeNotification, string information, DateTime dayToOccur, string additionalInformation = null, DuplicateNumberEntityType entityType = DuplicateNumberEntityType.Undefined) : this(ownerId, ownerName, typeNotification, information, additionalInformation) { DateToOccur = dayToOccur; Status = DaysLeft <= 0 ? NotificationStatus.Critical : NotificationStatus.Warning; }
public async Task <IHttpActionResult> PutTypeNotification(int id, TypeNotification typeNotification) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != typeNotification.IdTypeNotification) { return(BadRequest()); } db.Entry(typeNotification).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TypeNotificationExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public DomainNotification(string key, object value, TypeNotification typeNotification) { DomainNotificationId = Guid.NewGuid(); Version = 1; Key = key; Value = value; TypeNotification = typeNotification; }
private void Notify(string message, TypeNotification type) { var args = new OrganizerevEntArgs(message, type); if (Notification != null) { Notification(this, args); } }
private void OpenEditorForm(Guid id, TypeNotification typeNotification, string additionalInformation, DuplicateNumberEntityType entityType) { switch (typeNotification) { case TypeNotification.DuplicatePipeNumber: if (entityType == DuplicateNumberEntityType.Pipe) { OpenForm(DocumentTypes.MillPipe, id); } else if (entityType == DuplicateNumberEntityType.Component) { OpenForm(DocumentTypes.ConstructionComponent, id); } else if (entityType == DuplicateNumberEntityType.Spool) { OpenForm(DocumentTypes.ConstructionSpool, id); } else if (entityType == DuplicateNumberEntityType.Joint) { OpenForm(DocumentTypes.ConstructionJoint, id); } else { var e = new NotImplementedException(String.Format("Type editor not set for notification code {0}", typeNotification)); log.Error(e.Message); throw e; } break; case TypeNotification.DuplicateLogin: OpenForm(DocumentTypes.Settings, id, 6); break; case TypeNotification.ExpiredInspectorCertificate: OpenForm(DocumentTypes.Settings, id, 5); break; case TypeNotification.ExpiredWelderCertificate: OpenForm(DocumentTypes.Settings, id, 4); break; case TypeNotification.NotRequiredInspectionOperation: OpenForm(DocumentTypes.Settings, id, 2); break; case TypeNotification.SelectiveInspectionOperation: OpenForm(DocumentTypes.Settings, id, 1); break; case TypeNotification.PostponeConflict: importer.Postpone_PipeImport(additionalInformation); RefreshNitifications(); break; default: var ex = new NotImplementedException(String.Format("Type editor not set for notification code {0}", typeNotification)); log.Error(ex.Message); throw ex; //break; // unreachable code } }
public async Task <IHttpActionResult> GetTypeNotification(int id) { TypeNotification typeNotification = await db.TypeNotification.FindAsync(id); if (typeNotification == null) { return(NotFound()); } return(Ok(typeNotification)); }
public async Task <IHttpActionResult> PostTypeNotification(TypeNotification typeNotification) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.TypeNotification.Add(typeNotification); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = typeNotification.IdTypeNotification }, typeNotification)); }
// Methods public Notification(Guid ownerId, string ownerName, TypeNotification typeNotification, string information, string additionalInformation = null, DuplicateNumberEntityType entityType = DuplicateNumberEntityType.Undefined) { Id = ownerId; OwnerName = ownerName; TypeNotification = typeNotification; Information = information; Status = NotificationStatus.Critical; DateToOccur = default(DateTime); UnitsLeft = 0; AdditionalInformation = additionalInformation; EntityType = entityType; }
private static T ResolveTypeNotification <T>(TypeNotification typeNotification) { if (LisProvaiderNotify.ContainsKey(typeNotification)) { Object Obj = Activator.CreateInstance(LisProvaiderNotify.FirstOrDefault(t => t.Key == typeNotification).Value); if (Obj is T) { return((T)Obj); } } return(default(T)); }
public async Task <IHttpActionResult> DeleteTypeNotification(int id) { TypeNotification typeNotification = await db.TypeNotification.FindAsync(id); if (typeNotification == null) { return(NotFound()); } db.TypeNotification.Remove(typeNotification); await db.SaveChangesAsync(); return(Ok(typeNotification)); }
// TODO: move screen representation to Form private string GetResourceMessage(TypeNotification type, NotificationStatus status) { // TODO: avoid attaching enum names to string names or take care about not changing enum names and bad combinations string resourсeName = string.Format("Notification_{0}_{1}", Enum.GetName(typeof(TypeNotification), type), Enum.GetName(typeof(NotificationStatus), status)); StringResource? res = Program.LanguageManager.FindById(typeof(StringResources), resourсeName); if (res != null) { return Program.LanguageManager.GetString((StringResource)res); } else { var e = new ApplicationException("Wrong id of notification text: " + resourсeName); log.Error(e.Message); throw e; } }
private string GetResourceInformationMessage(TypeNotification type) { string inf; switch (type) { case TypeNotification.NotRequiredInspectionOperation: inf = Program.LanguageManager.GetString(StringResources.Notification_InformationForNotRequiredOperation) + " "; break; case TypeNotification.SelectiveInspectionOperation: inf = Program.LanguageManager.GetString(StringResources.Notification_InformationForSelectiveOperation) + " "; break; case TypeNotification.ExpiredInspectorCertificate: inf = Program.LanguageManager.GetString(StringResources.Notification_InformationForExpiredCertificate) + " "; break; case TypeNotification.ExpiredWelderCertificate: inf = Program.LanguageManager.GetString(StringResources.Notification_InformationForExpiredCertificate) + " "; break; case TypeNotification.DuplicateLogin: inf = Program.LanguageManager.GetString(StringResources.Notification_InformationForDuplicateLogin) + " "; break; case TypeNotification.DuplicatePipeNumber: inf = Program.LanguageManager.GetString(StringResources.Notification_InformationForDublicatePipeNumber) + " "; break; case TypeNotification.PostponeConflict: inf = Program.LanguageManager.GetString(StringResources.Notification_InformationForPostponeConflict) + " "; break; default: inf = ""; break; } return(inf); }
public void ChangeBar(TypeNotification typeNotification, float value) { switch (typeNotification) { case TypeNotification.Mental: StartCoroutine(ChangeValueBar(mentalBar, mentalBar.fillAmount, value)); break; case TypeNotification.Physical: StartCoroutine(ChangeValueBar(physicalBar, physicalBar.fillAmount, value)); break; case TypeNotification.Professional: StartCoroutine(ChangeValueBar(professionalBar, professionalBar.fillAmount, value)); break; case TypeNotification.Social: StartCoroutine(ChangeValueBar(socialBar, socialBar.fillAmount, value)); break; } }
public void Init(TypeNotification typeNotification, float value) { switch (typeNotification) { case TypeNotification.Mental: mentalBar.fillAmount = value; break; case TypeNotification.Physical: physicalBar.fillAmount = value; break; case TypeNotification.Professional: professionalBar.fillAmount = value; break; case TypeNotification.Social: socialBar.fillAmount = value; break; } }
private string GetResourceInformationMessage(TypeNotification type) { string inf; switch (type) { case TypeNotification.NotRequiredInspectionOperation: inf = Program.LanguageManager.GetString(StringResources.Notification_InformationForNotRequiredOperation) + " "; break; case TypeNotification.SelectiveInspectionOperation: inf = Program.LanguageManager.GetString(StringResources.Notification_InformationForSelectiveOperation) + " "; break; case TypeNotification.ExpiredInspectorCertificate: inf = Program.LanguageManager.GetString(StringResources.Notification_InformationForExpiredCertificate) + " "; break; case TypeNotification.ExpiredWelderCertificate: inf = Program.LanguageManager.GetString(StringResources.Notification_InformationForExpiredCertificate) + " "; break; case TypeNotification.DuplicateLogin: inf = Program.LanguageManager.GetString(StringResources.Notification_InformationForDuplicateLogin) + " "; break; case TypeNotification.DuplicatePipeNumber: inf = Program.LanguageManager.GetString(StringResources.Notification_InformationForDublicatePipeNumber) + " "; break; case TypeNotification.PostponeConflict: inf = Program.LanguageManager.GetString(StringResources.Notification_InformationForPostponeConflict) + " "; break; default: inf = ""; break; } return inf; }
private void OpenEditorForm(Guid id, TypeNotification typeNotification) { Type typeEditor = null; int page = -1; switch (typeNotification) { case TypeNotification.DublicatePipeNumber: typeEditor = typeof(MillPipeNewEditXtraForm); break; case TypeNotification.ExpiredCertificate: typeEditor = typeof(SettingsXtraForm); page = 5; break; case TypeNotification.WelderCertificateExpired: typeEditor = typeof(SettingsXtraForm); page = 4; break; default: var ex = new NotImplementedException(); log.Error(ex.Message); throw ex; //break; // unreachable code } var parent = this.MdiParent as PrizmApplicationXtraForm; if (typeEditor == typeof(SettingsXtraForm) && page >= 0) { parent.CreateSettingsChildForm(page); } else { parent.OpenChildForm(typeEditor, id); } }
void SendNotification(TypeNotification type) { Stop(); string tTime = t_Day.text + " " + c_Day.text + "\t" + time.text; string tInfo; int id_icon; switch (type) { case TypeNotification.blacksmith: tInfo = "U kowala zregenerowano punkt akcji."; id_icon = 0; break; case TypeNotification.herbalist: tInfo = "U zielarza zregenerowano punkt akcji."; id_icon = 0; break; case TypeNotification.recruiter: tInfo = "Rekruter powrócił do obozu!"; id_icon = 2; break; case TypeNotification.fee_mercenary: tInfo = "Opłacono najemników!"; id_icon = 3; break; default: tInfo = "" + type; id_icon = 0; break; } Notifications.SpawnNotification(id_icon, tTime, tInfo); }
public static async Task AddNotification <T>(string titre, string message, TypeNotification type, T objetMessage, int salleId) /*where T : IEntity*/ { var hubContext = GlobalHost.ConnectionManager.GetHubContext <OllertHub>(); var db = new OllertDbContext(); var userId = HttpContext.Current.User.Identity.GetUserId(); var currentUser = await db.Users.FirstAsync(u => u.Id == userId); // les ids de connexion SignalR de l' utilisateur var userConnIds = OllertHub.ConnectedUsers.Where(u => u.Key == userId).SelectMany(u => u.Value.ConnectionIds.ToArray()).ToArray(); // Maj de l' interface des clients connectes switch (type) { case TypeNotification.NouveauMessage: hubContext.Clients.AllExcept(userConnIds).newMessage(objetMessage); break; case TypeNotification.MouvementCarte: hubContext.Clients.AllExcept(userConnIds).newMove(objetMessage); break; case TypeNotification.NouvelleCarte: hubContext.Clients.AllExcept(userConnIds).newCard(objetMessage); break; case TypeNotification.EditionCarte: hubContext.Clients.AllExcept(userConnIds).changeCard(objetMessage); break; case TypeNotification.AjoutFichier: hubContext.Clients.AllExcept(userConnIds).addFile(objetMessage); break; case TypeNotification.SuppressionCarte: hubContext.Clients.AllExcept(userConnIds).deleteCard(objetMessage); // TODO break; case TypeNotification.SuppressionFichier: hubContext.Clients.AllExcept(userConnIds).deleteFile(objetMessage); break; case TypeNotification.SuppressionMessage: hubContext.Clients.AllExcept(userConnIds).deleteMessage(objetMessage); // TODO break; case TypeNotification.AjoutEtape: hubContext.Clients.AllExcept(userConnIds).addStep(objetMessage); // TODO break; case TypeNotification.SuppressionEtape: hubContext.Clients.AllExcept(userConnIds).deleteStep(objetMessage); // TODO break; case TypeNotification.ModificationEtape: hubContext.Clients.AllExcept(userConnIds).changeStep(objetMessage); // TODO break; default: break; } var notification = new Notification { Date = DateTime.Now, Titre = titre, Texte = message, Type = type, Createur = currentUser }; db.Notifications.Add(notification); await db.SaveChangesAsync(); // Notification globale hubContext.Clients.AllExcept(userConnIds).newNotification(notification); // Recupere les participants de la salle et envoi l'email sans attendre la fin de la tache // TODO : reactivate mails /*var salle = await db.Salles * .Include(p => p.ParticipantsSalle) * .Include(p => p.ParticipantsSalle.Select(ps => ps.Participant)) * .FirstOrDefaultAsync(s => s.Id == salleId); * if(salle != null) * { * var participants = salle.Participants.ToList(); * participants.Add(salle.Proprietaire); * * foreach (var user in participants.Where(p => p.Id != userId)) * { * if (!string.IsNullOrWhiteSpace(user.Email)) * { * var eventMailer = new NotificationMailer(); * var mailTask = eventMailer.NewEvent(new MailEventViewModel * { * Titre = titre, * Message = message, * SalleId = salleId * }, * currentUser.Email) * .SendAsync(); * } * } * }*/ db.Dispose(); }
public OrganizerevEntArgs(string message, TypeNotification type) { Message = message; Type = type; }
public static NotificationMessageModel GetNotificationSettingByUserIdAndType(int userId, TypeNotification type) { NotificationMessageModel data = null; try { using (var db = new NotificationMessageContext()) { data = db.Notification .Where(p => p.UserId == userId && p.Type == type) .FirstOrDefault(); if (data == null) { data = new NotificationMessageModel() { IsShow = true, Type = type }; } } } catch (Exception e) { data = new NotificationMessageModel() { IsShow = true, Type = type }; } return(data); }
private void RequestNotification(TypeNotification type) { listNotification[type] = listNotificationRequest[type].LoadNotificationFromDB(); }
public bool SendAll(string[] destinatiions, string title, string message, string jsonConfig, TypeNotification typeNotification, string provaider, out string errorMessage) { errorMessage = "not Send"; return(ResolveTypeNotification <INotification>(typeNotification)?.SendAll(destinatiions, title, message, jsonConfig, provaider, out errorMessage) ?? false); }
public async Task <Boolean> SendAsync(string destinatiion, string title, string message, string jsonConfig, TypeNotification typeNotification, string provaider) { return(await ResolveTypeNotification <INotification>(typeNotification)?.SendAsync(destinatiion, title, message, jsonConfig, provaider)); }