public static NotificationDatesSummary Load( NotificationStatus currentStatus, DateTime? notificationReceivedDate, Guid notificationId, DateTime? paymentReceivedDate, bool paymentIsComplete, DateTime? commencementDate, string nameOfOfficer, DateTime? completedDate, DateTime? transmittedDate, DateTime? acknowledgedDate, DateTime? decisionRequiredDate, DateTime? fileClosedDate, string archiveReference) { return new NotificationDatesSummary { CurrentStatus = currentStatus, NotificationReceivedDate = notificationReceivedDate, NotificationId = notificationId, PaymentReceivedDate = paymentReceivedDate, PaymentIsComplete = paymentIsComplete, CommencementDate = commencementDate, NameOfOfficer = nameOfOfficer, CompletedDate = completedDate, TransmittedDate = transmittedDate, AcknowledgedDate = acknowledgedDate, DecisionRequiredDate = decisionRequiredDate, FileClosedDate = fileClosedDate, ArchiveReference = archiveReference }; }
public MvcHtmlString DisplayColorClass(NotificationStatus status) { string statusColor; switch (status) { case NotificationStatus.InAssessment: case NotificationStatus.ReadyToTransmit: case NotificationStatus.Transmitted: case NotificationStatus.DecisionRequiredBy: case NotificationStatus.Unlocked: case NotificationStatus.Reassessment: statusColor = "s-orange"; break; case NotificationStatus.Consented: statusColor = "s-green"; break; case NotificationStatus.Objected: case NotificationStatus.Withdrawn: case NotificationStatus.ConsentWithdrawn: statusColor = "s-red"; break; default: statusColor = "s-blue"; break; } return new MvcHtmlString(statusColor); }
public NotificationAssessmentDecision(Guid notificationId, DateTime date, DateTime? consentedFrom, DateTime? consentedTo, NotificationStatus status) { NotificationId = notificationId; Date = date; ConsentedFrom = consentedFrom; ConsentedTo = consentedTo; Status = status; }
public NotificationStatusChange(NotificationStatus status, User user) { Guard.ArgumentNotNull(() => user, user); User = user; Status = status; ChangeDate = new DateTimeOffset(SystemTime.UtcNow, TimeSpan.Zero); }
public void UpdateShipmentPeriod(ShipmentPeriod shipmentPeriod, NotificationStatus status) { if (shipmentPeriod.FirstDate < SystemTime.UtcNow.Date && status == NotificationStatus.NotSubmitted) { throw new InvalidOperationException(string.Format( "The start date cannot be in the past on shipment info {0}", Id)); } ShipmentPeriod = shipmentPeriod; }
private SubmitSideBarViewModel CreateModel(bool isComplete, NotificationStatus status) { var submitSummaryData = new SubmitSummaryData { Status = status }; var progress = new NotificationApplicationCompletionProgress { IsAllComplete = isComplete }; return new SubmitSideBarViewModel(submitSummaryData, 500, progress); }
// 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; } }
public void HideGUI() { if ( notificationStatus != NotificationStatus.Nothing ) { if ( notificationTween != null ) { notificationTween.destroy (); notificationTween = null; } notificationText.text = ""; notificationStatus = NotificationStatus.Nothing; } notificationText.gameObject.SetActive( false ); fpsDisplay.showFPS = false; }
public JsonNetResult GetUserNotifications(string notificationStatus, string userId) { var notifications = new List <UserNotification>(); var accountCommunicationServiceClient = new AccountCommunicationService.AccountCommunicationServiceClient(); try { accountCommunicationServiceClient.Open(); //Convert notification status to Enum NotificationStatus _convertedNotificationStatus = (NotificationStatus)Enum.Parse(typeof(NotificationStatus), notificationStatus); notifications = accountCommunicationServiceClient.GetAccountUserNotifications(_convertedNotificationStatus, userId, Common.SharedClientKey).ToList(); //Close the connection WCFManager.CloseConnection(accountCommunicationServiceClient); } catch (Exception e) { #region Manage Exception string exceptionMessage = e.Message.ToString(); var currentMethod = System.Reflection.MethodBase.GetCurrentMethod(); string currentMethodString = currentMethod.DeclaringType.FullName + "." + currentMethod.Name; // Abort the connection & manage the exception WCFManager.CloseConnection(accountCommunicationServiceClient, exceptionMessage, currentMethodString); #endregion } JsonNetResult jsonNetResult = new JsonNetResult(); jsonNetResult.Formatting = Newtonsoft.Json.Formatting.Indented; jsonNetResult.SerializerSettings.DateTimeZoneHandling = DateTimeZoneHandling.Local; //<-- Convert UTC times to LocalTime jsonNetResult.Data = notifications; return(jsonNetResult); }
/// <summary> /// Create Notification text from note and type /// </summary> /// <param name="note"></param> /// <param name="status"></param> /// <returns></returns> private string GetNotificationText(Notification note, NotificationStatus status) { var noteText = ""; var item = GetWorkItemFromID(note.ItemId); var noteFormatText = status.description; var workItemText = "<span class=\"itemLink\" data-itemid=\"" + note.ItemId + "\">Work Item</span>"; if (note.Type == (int)Notification.Types.Approved || note.Type == (int)Notification.Types.Denied || note.Type == (int)Notification.Types.ItemAssignedOff || note.Type == (int)Notification.Types.AssignedTo || note.Type == (int)Notification.Types.ItemChanged) { var owners = GetOwners(); var owner = owners.First(); noteText = string.Format(noteFormatText, workItemText, owner.FirstName + " " + owner.LastName); } else { var creatorUser = GetUser(item.CreatedBy); noteText = string.Format(noteFormatText, workItemText, creatorUser.FullName); } noteText += " (" + note.CreatedOn.ToString("MM/dd/yy") + ")"; return(noteText); }
void Update() { if (notificationStatus == NotificationStatus.Showing) { if (notificationRestDuration > 0) { float deltaTime = Mathf.Min(0.02f, Time.unscaledDeltaTime); notificationRestDuration -= deltaTime; if (notificationRestDuration <= 0) { if (notificationTween != null) { notificationTween.destroy(); } notificationTween = Go.to(this, kMessageInDuration, new GoTweenConfig() .floatProp("notification", 0) .onComplete(t => { OnMessageMovedOut(); notificationTween = null; })); notificationStatus = NotificationStatus.MovingOut; } } } }
private byte[] GetImage(NotificationStatus status) { Image image; switch (status) { case NotificationStatus.Warning: image = new Bitmap(Resources.warning); break; case NotificationStatus.Critical: image = new Bitmap(Resources.critical_warning); break; default: image = new Bitmap(Resources.warning); break; } MemoryStream stream = new MemoryStream(); image.Save(stream, ImageFormat.Png); return(stream.ToArray()); }
public void AddNotification(string userId, Notification notification) { var status = this.notificationsContainer.Get(userId); if (status == null) { status = new NotificationStatus(); status.Notifications = new List <Notification>(); } var toremove = status.Notifications.Where(n => notification.DateTime.Subtract(n.DateTime).TotalSeconds >= ConfigurationConstants.NotificationTimeInterval).ToList(); foreach (var item in toremove) { status.Notifications.Remove(item); } if (!status.Notifications.Select(n => n.SenderId == notification.SenderId).Any()) { status.Notifications.Add(notification); } this.notificationsContainer.Save(userId, status); }
public void ShowMessage(string message, float duration = 3.0f, float delay = 0, NotificationMode notificationMode = NotificationMode.FadeInOut, System.Action onComplete = null) { ShowGUI(); onMessageFinished = onComplete; notificationText.gameObject.SetActive(true); notificationText.text = message; notificationRestDuration = duration; this.notificationMode = notificationMode; if (notificationTween != null) { notificationTween.destroy(); notificationTween = null; } if (notificationMode == NotificationMode.FadeOut) { notification = 1; notificationStatus = NotificationStatus.Showing; OnMessageMovedIn(); } else { notification = 0; notificationTween = Go.to(this, kMessageInDuration, new GoTweenConfig() .floatProp("notification", 1) .setDelay(delay) .onComplete(t => { OnMessageMovedIn(); notificationTween = null; })); notificationStatus = NotificationStatus.MovingIn; } }
public void CancelAllNotifications() { foreach (int i in notifs) { NotificationStatus status = AndroidNotificationCenter.CheckScheduledNotificationStatus(i); switch (status) { case NotificationStatus.Scheduled: AndroidNotificationCenter.CancelNotification(i); break; case NotificationStatus.Delivered: AndroidNotificationCenter.CancelNotification(i); break; case NotificationStatus.Unknown: AndroidNotificationCenter.CancelNotification(i); break; default: break; } } }
public Notification SendNotification(Notification notification) { bool emailsent = false; if (notification != null) { try { MailMessage mail = new MailMessage(); //mail.From = new MailAddress(notification.sender); mail.From = new MailAddress("*****@*****.**"); mail.Subject = notification.subject; string Body = notification.body; mail.Body = Body; mail.IsBodyHtml = true; //testing server mail setup SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.Port = 587; smtp.Credentials = new System.Net.NetworkCredential("*****@*****.**", "16121612");// Enter senders User name and password smtp.EnableSsl = true; //production and development server mail setup if (Request.Url.Host == "sdb.science.ust.hk" || Request.Url.Host == "sfs-dev1.ust.hk") { smtp.Host = "smtp.ust.hk"; smtp.Port = 25; smtp.Credentials = null; smtp.UseDefaultCredentials = false; } //add recipients to mail object notification.NotificationRecipients.Where(r => r.recipient_type == "to").ToList().ForEach(r => mail.To.Add(r.email)); notification.NotificationRecipients.Where(r => r.recipient_type == "cc").ToList().ForEach(r => mail.CC.Add(r.email)); if (notification.NotificationRecipients.Count() < 150) { notification.NotificationRecipients.Where(r => r.recipient_type == "bcc").ToList().ForEach(r => mail.Bcc.Add(r.email)); smtp.Send(mail); } else { int count = 0; foreach (var recipient in notification.NotificationRecipients.Where(r => r.recipient_type == "bcc")) { mail.Bcc.Add(recipient.email); count++; if (count % 150 == 0) { smtp.Send(mail); emailsent = true; //reset Bcc List mail.Bcc.Clear(); } } if (mail.Bcc.Count() > 0) { smtp.Send(mail); } } emailsent = true; NotificationStatus status = db.NotificationStatus.Where(s => s.name == "Sent").SingleOrDefault(); notification.status_id = status.id; notification.send_time = DateTime.Now; notification.modified = DateTime.Now; notification.modified_by = User.Identity.Name; db.SaveChanges(); return(notification); } catch (Exception e) { if (emailsent) { Session["FlashMessage"] += "<br/><br/>Notifications sent with error. <br/><br/>" + e.Message; NotificationStatus status = db.NotificationStatus.Where(s => s.name == "Error").SingleOrDefault(); notification.status_id = status.id; notification.send_time = DateTime.Now; notification.modified = DateTime.Now; notification.modified_by = User.Identity.Name; return(notification); } else { Session["FlashMessage"] += "<br/><br/>Failed to send notifications. <br/><br/>" + e.Message; } } } return(notification); }
public Notification CreateNotification(String type, Program program) { NotificationType notificationtype = db.NotificationTypes.Where(t => t.name == type).SingleOrDefault(); NotificationStatus notificationstatus = db.NotificationStatus.Where(s => s.name == "Pending").SingleOrDefault(); if (type == "ProgramPublished") { if (notificationtype.NotificationTemplate != null) { string body = ""; string subject = ""; string directlink = "https://sdb.science.ust.hk/mySCI/Program/Showcase/" + program.id.ToString(); body = notificationtype.NotificationTemplate.body; body = body.Replace("[program id]", program.id.ToString()); body = body.Replace("[program name]", program.name); body = body.Replace("[program period]", program.start_time); body = body.Replace("[program deadline]", String.Format("{0:yyyy-MM-dd HH:mm}", program.application_end_time)); body = body.Replace("[program directlink]", "<a href='" + directlink + "' target='_blank'>" + directlink + "</a>"); subject = notificationtype.NotificationTemplate.subject; subject = subject.Replace("[program id]", program.id.ToString()); subject = subject.Replace("[program name]", program.name); subject = subject.Replace("[program period]", program.start_time); subject = subject.Replace("[program deadline]", String.Format("{0:yyyy-MM-dd HH:mm}", program.application_end_time)); subject = subject.Replace("[program directlink]", "<a href='" + directlink + "' target='_blank'>" + directlink + "</a>"); Notification notification = new Notification { send_time = DateTime.Now, sender = notificationtype.NotificationTemplate.sender, subject = subject, body = body, status_id = notificationstatus.id, type_id = notificationtype.id, template_id = notificationtype.NotificationTemplate.id, program_id = program.id, created = DateTime.Now, created_by = WebSecurity.CurrentUserName, modified = DateTime.Now, modified_by = WebSecurity.CurrentUserName }; //db.Notifications.Add(notification); //db.SaveChanges(); foreach (var student in db.StudentProfiles) { if (IsEligible(program, student)) { notification.NotificationRecipients.Add(new NotificationRecipient { email = student.email, recipient_type = "bcc", student_id = student.id }); } } if (!String.IsNullOrEmpty(notificationtype.NotificationTemplate.cc)) { List <NotificationRecipient> ccList = new List <NotificationRecipient>(); notificationtype.NotificationTemplate.cc.Split(',').ToList().ForEach(s => ccList.Add(new NotificationRecipient { email = s.Trim(), recipient_type = "cc" })); notification.NotificationRecipients = notification.NotificationRecipients.Concat(ccList).ToList(); } if (!String.IsNullOrEmpty(notificationtype.NotificationTemplate.bcc)) { List <NotificationRecipient> bccList = new List <NotificationRecipient>(); notificationtype.NotificationTemplate.bcc.Split(',').ToList().ForEach(s => bccList.Add(new NotificationRecipient { email = s.Trim(), recipient_type = "to" })); //change "bcc" to "to" for mass mail notification.NotificationRecipients = notification.NotificationRecipients.Concat(bccList).ToList(); } db.Notifications.Add(notification); try { db.SaveChanges(); return(notification); } catch (Exception e) { Session["FlashMessage"] += "<br/><br/>Failed to create notification record. <br/><br/>" + e.Message; } } else { Session["FlashMessage"] += "<br/><br/>Notification Template is not correctly configured"; } } if (type == "ProgramDeadlindReminder") { if (notificationtype.NotificationTemplate != null) { string body = ""; string subject = ""; string directlink = "https://sdb.science.ust.hk/mySCI/Program/Showcase/" + program.id.ToString(); body = notificationtype.NotificationTemplate.body; body = body.Replace("[program id]", program.id.ToString()); body = body.Replace("[program name]", program.name); body = body.Replace("[program period]", program.start_time); body = body.Replace("[program deadline]", String.Format("{0:yyyy-MM-dd HH:mm}", program.application_end_time)); body = body.Replace("[program directlink]", "<a href='" + directlink + "' target='_blank'>" + directlink + "</a>"); subject = notificationtype.NotificationTemplate.subject; subject = subject.Replace("[program id]", program.id.ToString()); subject = subject.Replace("[program name]", program.name); subject = subject.Replace("[program period]", program.start_time); subject = subject.Replace("[program deadline]", String.Format("{0:yyyy-MM-dd HH:mm}", program.application_end_time)); subject = subject.Replace("[program directlink]", "<a href='" + directlink + "' target='_blank'>" + directlink + "</a>"); Notification notification = new Notification { send_time = DateTime.Now, sender = notificationtype.NotificationTemplate.sender, subject = subject, body = body, status_id = notificationstatus.id, type_id = notificationtype.id, template_id = notificationtype.NotificationTemplate.id, program_id = program.id, created = DateTime.Now, created_by = WebSecurity.CurrentUserName, modified = DateTime.Now, modified_by = WebSecurity.CurrentUserName }; //db.Notifications.Add(notification); //db.SaveChanges(); foreach (var student in db.StudentProfiles) { if (IsEligible(program, student) && !student.Applications.Any(a => a.program_id == program.id)) { notification.NotificationRecipients.Add(new NotificationRecipient { email = student.email, recipient_type = "bcc", student_id = student.id }); } } if (!String.IsNullOrEmpty(notificationtype.NotificationTemplate.cc)) { List <NotificationRecipient> ccList = new List <NotificationRecipient>(); notificationtype.NotificationTemplate.cc.Split(',').ToList().ForEach(s => ccList.Add(new NotificationRecipient { email = s.Trim(), recipient_type = "cc" })); notification.NotificationRecipients = notification.NotificationRecipients.Concat(ccList).ToList(); } if (!String.IsNullOrEmpty(notificationtype.NotificationTemplate.bcc)) { List <NotificationRecipient> bccList = new List <NotificationRecipient>(); notificationtype.NotificationTemplate.bcc.Split(',').ToList().ForEach(s => bccList.Add(new NotificationRecipient { email = s.Trim(), recipient_type = "to" })); //change "bcc" to "to" for mass mail notification.NotificationRecipients = notification.NotificationRecipients.Concat(bccList).ToList(); } db.Notifications.Add(notification); try { db.SaveChanges(); return(notification); } catch (Exception e) { Session["FlashMessage"] += "<br/><br/>Failed to create notification record. <br/><br/>" + e.Message; } } else { Session["FlashMessage"] += "<br/><br/>Notification Template is not correctly configured"; } } return(null); }
public List<Notification> FindBy(NotificationStatus status, UserProfile userProfile) { if (_notifications == null) Refresh(); var result = _notifications.Where<Notification>(x => x.Status == status && x.Owner.Id == userProfile.Id).ToList<Notification>(); return result; }
public async Task <List <ViewModels.StatusByUserRequestModel> > StatusRequestByUser(string RequestByUserName, NotificationStatus Status) { var NotificationStatus = Status.ToString(); //StatusByUserRequestModel //http://bvusolutions.com/Geo/Notification/StatusByUserRequest.php?RequestByUserName=Username2&TaskStatus=Ongoing var url = $"http://bvusolutions.com/Geo/Notification/StatusByUserRequest.php?RequestByUserName={RequestByUserName}&TaskStatus={NotificationStatus}"; var ExistRequest = new Browser().JsonWebAsync <List <ViewModels.StatusByUserRequestModel> >(url); await Task.WhenAll(ExistRequest); return(ExistRequest.Result); }
public NodeRemoveChildNotification(NotificationStatus Status_in, GenericNode <T> Node_in, GenericNode <T> ChildNode_in, int ChildIndex_in) : base(Status_in, Node_in, ChildNode_in, ChildIndex_in) { }
public NodeClearChildrenNotification(NotificationStatus Status_in, GenericNode <T> Node_in) : base(Status_in, Node_in) { }
void Update() { if ( notificationStatus == NotificationStatus.Showing ) if (notificationRestDuration > 0 ) { float deltaTime = Mathf.Min( 0.02f, Time.unscaledDeltaTime ); notificationRestDuration -= deltaTime; if ( notificationRestDuration <= 0 ) { if ( notificationTween != null ) notificationTween.destroy (); notificationTween = Go.to (this, kMessageInDuration, new GoTweenConfig() .floatProp("notification", 0) .onComplete( t => { OnMessageMovedOut(); notificationTween = null; } )); notificationStatus = NotificationStatus.MovingOut; } } //*** Check keyboard { if ( Input.GetKeyDown(KeyCode.F) && (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)) ) showFPS = !showFPS; } }
private static BasicSearchResult ConvertToSearchResults(Guid notificationId, string notificationNumber, string exporterName, ChemicalComposition wasteTypeValue, NotificationStatus status, bool showSummaryLink) { var searchResult = new BasicSearchResult { Id = notificationId, NotificationNumber = notificationNumber, ExporterName = exporterName, WasteType = wasteTypeValue != default(ChemicalComposition) ? EnumHelper.GetShortName(wasteTypeValue) : string.Empty, NotificationStatus = EnumHelper.GetDisplayName(status), ShowShipmentSummaryLink = showSummaryLink }; return(searchResult); }
// Action result extension method // Used within actions to add Notifications to results public static ActionResult WithNotification(this ActionResult actionResult, NotificationStatus notificationStatus, string message) { return new WithNotificationResult(actionResult, notificationStatus, message); }
void OnMessageMovedIn() { notificationStatus = NotificationStatus.Showing; }
public void Add(NotificationStatus notificationStatus, string message) { _notifications.Add(new Notification { NotificationStatus = notificationStatus, Message = message }); }
public void ShowMessage( string message, float duration = 3.0f, float delay = 0, NotificationMode notificationMode = NotificationMode.FadeInOut, System.Action onComplete = null ) { ShowGUI (); onMessageFinished = onComplete; notificationText.gameObject.SetActive( true ); notificationText.text = message; notificationRestDuration = duration; this.notificationMode = notificationMode; if ( notificationTween != null ) { notificationTween.destroy (); notificationTween = null; } if ( notificationMode == NotificationMode.FadeOut ) { notification = 1; notificationStatus = NotificationStatus.Showing; OnMessageMovedIn(); } else { notification = 0; notificationTween = Go.to ( this, kMessageInDuration, new GoTweenConfig() .floatProp("notification", 1) .setDelay (delay) .onComplete( t => { OnMessageMovedIn(); notificationTween = null; } )); notificationStatus = NotificationStatus.MovingIn; } }
private void changeStatus(string message, NotificationStatus status) { if (this.label_Status.InvokeRequired) { delegateChangeStatus d = new delegateChangeStatus(changeStatus); this.Invoke(d, new object[] { message, status }); } else { switch(status) { case NotificationStatus.DoTweet: case NotificationStatus.DoRetweet: case NotificationStatus.DoFavorite: case NotificationStatus.DoUnFavorite: case NotificationStatus.DoDelete: break; case NotificationStatus.GetReply: this.label_Status.ForeColor = Color.RoyalBlue; this.label_Status.BackColor = Color.AliceBlue; break; case NotificationStatus.BeRetweet: this.label_Status.ForeColor = Color.DarkGreen; this.label_Status.BackColor = Color.AliceBlue; break; case NotificationStatus.BeFavorite: this.label_Status.ForeColor = Color.DarkOrange; this.label_Status.BackColor = Color.AliceBlue; break; default: break; } this.label_Status.Text = message; if (message.Contains(Environment.NewLine)) { this.label_Status.Text = message.Substring(0, message.IndexOf(Environment.NewLine)) + "..."; } else if (58 < message.Length) { this.label_Status.Text = message.Substring(0, 58) + "..."; } if (this.label_Status.Text != string.Empty) { this.timerCount = 0; this.timer_ShowStatus.Stop(); } string log = message.Replace(Environment.NewLine, " "); logger.Debug("Get status: {0}", log); this.timer_ShowStatus.Start(); } }
public NodeNotification(NotificationStatus Status_in, GenericNode <T> Node_in) { this.Status = Status_in; this.Node = Node_in; }
public void ChangeNotification(int userId, int notId, NotificationStatus status) { objDao.ClearNotification(userId, notId, status); }
void OnMessageMovedOut() { notificationStatus = NotificationStatus.Nothing; notificationText.gameObject.SetActive( false ); if ( onMessageFinished != null ) onMessageFinished(); }
public NotificationStatusChangeEvent(NotificationAssessment notificationAssessment, NotificationStatus targetStatus) { NotificationAssessment = notificationAssessment; TargetStatus = targetStatus; }
private Domain.NotificationAssessment.NotificationAssessment CreateNotificationAssessment(Guid notificationApplicationId, NotificationStatus status) { var assessment = new Domain.NotificationAssessment.NotificationAssessment(notificationApplicationId); ObjectInstantiator<Domain.NotificationAssessment.NotificationAssessment>.SetProperty(n => n.Status, status, assessment); return assessment; }
public void Seen() => Status = NotificationStatus.Seen;
public void SetNotificationStatus(NotificationStatus status, long scheduleId, params long[] userIds) { _userSchedule.MarkAs(status, scheduleId, userIds); }
public NodeUpdateNotification(NotificationStatus Status_in, GenericNode <T> Node_in) : base(Status_in, Node_in) { }
/// <summary> /// Asynchronous method that adds a Notification class to the context /// </summary> /// <param name="id"></param> /// <param name="delivererId"></param> /// <param name="deliveryId"></param> /// <param name="createdAt"></param> /// <param name="expiredAt"></param> /// <param name="status"></param> /// <returns>true or false</returns> public async Task <bool> AddNotification(Guid id, Guid delivererId, Guid deliveryId, DateTime createdAt, DateTime expiredAt, NotificationStatus status) { try { _logger.Information($"A request has been made to add a Notification with id {id} to the context."); bool result = await _notificationsRepo.AddNotification(id, delivererId, deliveryId, createdAt, expiredAt, status); return(result ? result : throw new Exception($"Dependency failure: The repository returned false.")); } catch (Exception e) // Error handling { _logger.Error($"INotificationsService says: {e.Message} Exception occured on line " + $"{new StackTrace(e, true).GetFrame(0).GetFileLineNumber()}."); return(false); } }
public NodeChildNotification(NotificationStatus Status_in, GenericNode <T> Node_in, GenericNode <T> ChildNode_in, int ChildIndex_in) : base(Status_in, Node_in) { this.ChildNode = ChildNode_in; this.ChildIndex = ChildIndex_in; }
/// <summary> /// درج مقادیر اولیه در دیتابیس به هنگام ساخت دیتابیس /// </summary> /// <param name="context">شی دیتابیس اصلی برنامه</param> protected override void Seed(AsefianContext context) { foreach (var item in Language.GetList()) { context.Language.Add(item); } #region Account foreach (var item in UserType.GetList()) { context.UserType.Add(item); } foreach (var item in BalanceType.GetList()) { context.BalanceType.Add(item); } foreach (var item in Browser.GetList()) { context.Browser.Add(item); } foreach (var item in DeviceType.GetList()) { context.DeviceType.Add(item); } foreach (var item in GroupStatus.GetList()) { context.GroupStatus.Add(item); } foreach (var item in NotificationStatus.GetList()) { context.NotificationStatus.Add(item); } foreach (var item in NotificationType.GetList()) { context.NotificationType.Add(item); } foreach (var item in Account.Enum.OperatingSystem.GetList()) { context.OperatingSystem.Add(item); } foreach (var item in Sex.GetList()) { context.Sex.Add(item); } foreach (var item in TokenType.GetList()) { context.TokenType.Add(item); } foreach (var item in UserAddressStatus.GetList()) { context.UserAddressStatus.Add(item); } foreach (var item in UserFavoriteFolderStatus.GetList()) { context.UserFavoriteFolderStatus.Add(item); } foreach (var item in UserFavoriteStatus.GetList()) { context.UserFavoriteStatus.Add(item); } foreach (var item in UserStatus.GetList()) { context.UserStatus.Add(item); } #endregion #region Blog foreach (var item in ArticleFileStatus.GetList()) { context.ArticleFileStatus.Add(item); } foreach (var item in ArticleStatus.GetList()) { context.ArticleStatus.Add(item); } foreach (var item in NewsStatus.GetList()) { context.NewsStatus.Add(item); } #endregion #region Core foreach (var item in BranchStatus.GetList()) { context.BranchStatus.Add(item); } foreach (var item in LocationType.GetList()) { context.LocationType.Add(item); } foreach (var item in SliderContentStatus.GetList()) { context.SliderContentStatus.Add(item); } foreach (var item in SliderStatus.GetList()) { context.SliderStatus.Add(item); } foreach (var item in SliderType.GetList()) { context.SliderType.Add(item); } #endregion #region Data foreach (var item in ExportStatus.GetList()) { context.ExportStatus.Add(item); } foreach (var item in ContactUsStatus.GetList()) { context.ContactUsStatus.Add(item); } foreach (var item in SpecialProjectStatus.GetList()) { context.SpecialProjectStatus.Add(item); } foreach (var item in SpecialProjectFileStatus.GetList()) { context.SpecialProjectFileStatus.Add(item); } foreach (var item in BrandStatus.GetList()) { context.BrandStatus.Add(item); } foreach (var item in CategoryFeatureStatus.GetList()) { context.CategoryFeatureStatus.Add(item); } foreach (var item in CategoryFeatureType.GetList()) { context.CategoryFeatureType.Add(item); } foreach (var item in CategoryStatus.GetList()) { context.CategoryStatus.Add(item); } foreach (var item in CategoryType.GetList()) { context.CategoryType.Add(item); } foreach (var item in DownloadCenterStatus.GetList()) { context.DownloadCenterStatus.Add(item); } foreach (var item in ProductFileStatus.GetList()) { context.ProductFileStatus.Add(item); } foreach (var item in ProductFileType.GetList()) { context.ProductFileType.Add(item); } foreach (var item in ProductFilterStatus.GetList()) { context.ProductFilterStatus.Add(item); } foreach (var item in ProductFilterType.GetList()) { context.ProductFilterType.Add(item); } foreach (var item in ProductFilterValueStatus.GetList()) { context.ProductFilterValueStatus.Add(item); } foreach (var item in ProductStatus.GetList()) { context.ProductStatus.Add(item); } foreach (var item in ServiceStatus.GetList()) { context.ServiceStatus.Add(item); } #endregion #region Financial foreach (var item in CouponStatus.GetList()) { context.CouponStatus.Add(item); } foreach (var item in CouponType.GetList()) { context.CouponType.Add(item); } foreach (var item in DeliveryType.GetList()) { context.DeliveryType.Add(item); } foreach (var item in InquiryStatus.GetList()) { context.InquiryStatus.Add(item); } foreach (var item in InvoiceDetailStatus.GetList()) { context.InvoiceDetailStatus.Add(item); } foreach (var item in InvoiceStatus.GetList()) { context.InvoiceStatus.Add(item); } foreach (var item in PaymentType.GetList()) { context.PaymentType.Add(item); } #endregion #region Support foreach (var item in FaqCategoryStatus.GetList()) { context.FaqCategoryStatus.Add(item); } foreach (var item in FaqStatus.GetList()) { context.FaqStatus.Add(item); } foreach (var item in MessageBoxStatus.GetList()) { context.MessageBoxStatus.Add(item); } foreach (var item in NewsLetterStatus.GetList()) { context.NewsLetterStatus.Add(item); } foreach (var item in TicketMessageType.GetList()) { context.TicketMessageType.Add(item); } foreach (var item in TicketPriority.GetList()) { context.TicketPriority.Add(item); } foreach (var item in TicketStatus.GetList()) { context.TicketStatus.Add(item); } foreach (var item in MessageType.GetList()) { context.MessageType.Add(item); } #endregion var admin = new User() { FirstName = "مدیر", LastName = "سیستم", MobileNumber = "09122424519", MobileNumberValid = true, Email = "*****@*****.**", EmailValid = true, SexId = Sex.Male.Id, TypeId = UserType.Insider.Id, Password = PasswordUtility.Encrypt("alialiali"), StatusId = UserStatus.Active.Id, Permission = 1, CreateDate = DateTime.Now, ModifyDate = DateTime.Now, CreateIp = "::1", ModifyIp = "::1" }; context.User.Add(admin); }
public void ListAll(string RequestByUserName, NotificationStatus Status) { var NotificationStatus = Status.ToString(); }
public IAsyncResult Begin_notifyIndividualEvent(AsyncCallback callback, object state, NotificationStatus notificationStatus, List<string> receiverMids) { return send_notifyIndividualEvent(callback, state, notificationStatus, receiverMids); }
public List<Notification> FindBy(NotificationStatus status) { if (_notifications == null) Refresh(); var result = _notifications.Where<Notification>(x => x.Status == status).ToList<Notification>(); return result; }
public void notifyIndividualEvent(NotificationStatus notificationStatus, List<string> receiverMids) { #if !SILVERLIGHT send_notifyIndividualEvent(notificationStatus, receiverMids); recv_notifyIndividualEvent(); #else var asyncResult = Begin_notifyIndividualEvent(null, null, notificationStatus, receiverMids); End_notifyIndividualEvent(asyncResult); #endif }
/// <summary> /// Set All User Notifications Status /// </summary> /// <param name="userId"></param> /// <param name="status"></param> /// <returns></returns> public async Task <RServiceResult <bool> > SetAllNotificationsStatus(Guid userId, NotificationStatus status) { try { var notifications = await _context.Notifications.Where(n => n.UserId == userId).ToListAsync(); foreach (var notification in notifications) { notification.Status = status; } _context.UpdateRange(notifications); await _context.SaveChangesAsync(); return(new RServiceResult <bool>(true)); } catch (Exception exp) { return(new RServiceResult <bool>(false, exp.ToString())); } }
/// <summary> /// Add log for push notification /// </summary> /// <param name="message">Messsage of notification</param> /// <param name="deviceId">Device id to whom notification sent</param> /// <param name="deviceType">Device type to whom notification sent</param> /// <param name="type">Type of notification</param> /// <param name="status">Status of notification</param> void IPushNotificationManager.AddNotificationLog(string message, string deviceId, DeviceType deviceType, NotificationType type, NotificationStatus status) { Context = new HyggeMailEntities(); Context.PushNotifications.Add(new PushNotification { CreatedOn = DateTime.Now, DeviceId = deviceId, DeviceTypeId = Convert.ToInt16(deviceType), Message = message, StatusId = Convert.ToInt16(status), TypeId = Convert.ToInt16(type) }); Context.SaveChanges(); }
public Notification CreateNotification(String type, Interview interview, Application application) { NotificationType notificationtype = db.NotificationTypes.Where(t => t.name == type).SingleOrDefault(); NotificationStatus notificationstatus = db.NotificationStatus.Where(s => s.name == "Pending").SingleOrDefault(); if (type == "InterviewAssigned") { if (notificationtype.NotificationTemplate != null) { string body = ""; string subject = ""; body = notificationtype.NotificationTemplate.body; body = body.Replace("[student id]", application.student_id); body = body.Replace("[student name]", application.StudentProfile.name); body = body.Replace("[application id]", application.id.ToString()); body = body.Replace("[program id]", application.program_id.ToString()); body = body.Replace("[program name]", application.Program.name); body = body.Replace("[submit date]", String.Format("{0:yyyy-MM-dd HH:mm:ss}", application.submitted)); body = body.Replace("[interview date]", String.Format("{0:yyyy-MM-dd}", interview.start_time)); body = body.Replace("[interview time]", String.Format("{0:HH:mm}", interview.start_time) + " to " + String.Format("{0:HH:mm}", interview.end_time)); body = body.Replace("[interview venue]", interview.InterviewVenue.name); subject = notificationtype.NotificationTemplate.subject; subject = subject.Replace("[student id]", application.student_id); subject = subject.Replace("[student name]", application.StudentProfile.name); subject = subject.Replace("[application id]", application.id.ToString()); subject = subject.Replace("[program id]", application.program_id.ToString()); subject = subject.Replace("[program name]", application.Program.name); subject = subject.Replace("[submit date]", String.Format("{0:yyyy-MM-dd HH:mm:ss}", application.submitted)); subject = subject.Replace("[interview date]", String.Format("{0:yyyy-MM-dd}", interview.start_time)); subject = subject.Replace("[interview time]", String.Format("{0:HH:mm}", interview.start_time) + " to " + String.Format("{0:HH:mm}", interview.end_time)); subject = subject.Replace("[interview venue]", interview.InterviewVenue.name); Notification notification = new Notification { send_time = DateTime.Now, sender = notificationtype.NotificationTemplate.sender, subject = subject, body = body, status_id = notificationstatus.id, type_id = notificationtype.id, template_id = notificationtype.NotificationTemplate.id, application_id = application.id, created = DateTime.Now, created_by = WebSecurity.CurrentUserName, modified = DateTime.Now, modified_by = WebSecurity.CurrentUserName }; //db.Notifications.Add(notification); //db.SaveChanges(); notification.NotificationRecipients.Add(new NotificationRecipient { email = application.StudentProfile.email, recipient_type = "to", student_id = application.student_id }); if (!String.IsNullOrEmpty(notificationtype.NotificationTemplate.cc)) { List <NotificationRecipient> ccList = new List <NotificationRecipient>(); notificationtype.NotificationTemplate.cc.Split(',').ToList().ForEach(s => ccList.Add(new NotificationRecipient { email = s.Trim(), recipient_type = "cc" })); notification.NotificationRecipients = notification.NotificationRecipients.Concat(ccList).ToList(); } if (!String.IsNullOrEmpty(notificationtype.NotificationTemplate.bcc)) { List <NotificationRecipient> bccList = new List <NotificationRecipient>(); notificationtype.NotificationTemplate.bcc.Split(',').ToList().ForEach(s => bccList.Add(new NotificationRecipient { email = s.Trim(), recipient_type = "bcc" })); notification.NotificationRecipients = notification.NotificationRecipients.Concat(bccList).ToList(); } db.Notifications.Add(notification); try { db.SaveChanges(); return(notification); } catch (Exception e) { Session["FlashMessage"] += "<br/><br/>Failed to create notification record. <br/><br/>" + e.Message; } } else { Session["FlashMessage"] += "<br/><br/>Notification Template is not correctly configured"; } } return(null); }
public Postgres() { notificationStatus = new NotificationStatus(); }
public void CanMarkFileClosedAtAnyTime(NotificationStatus currentStatus) { SetNotificationStatus(currentStatus); notificationAssessment.MarkFileClosed(fileClosedDate); Assert.Equal(NotificationStatus.FileClosed, notificationAssessment.Status); }
private byte[] GetImage(NotificationStatus status) { Image image; switch (status) { case NotificationStatus.Warning: image = new Bitmap(Resources.warning); break; case NotificationStatus.Critical: image = new Bitmap(Resources.critical_warning); break; default: image = new Bitmap(Resources.warning); break; } MemoryStream stream = new MemoryStream(); image.Save(stream, ImageFormat.Png); return stream.ToArray(); }
private void showNortificationForm(NotificationStatus notificationType, Status tweet) { switch(notificationType) { case NotificationStatus.GetReply: string title = @"You got a reply from @{0}."; this.notifyIcon.BalloonTipTitle = string.Format(title, tweet.User.ScreenName); this.notifyIcon.BalloonTipText = tweet.Text.Length < 40 ? tweet.Text : (tweet.Text.Substring(0, 40) + "..."); this.notifyIcon.ShowBalloonTip(5000); break; default: break; } }
/// <summary> /// Removes and notification status and nulls to passed object /// </summary> public void RemoveNotification() { NotificationItem = null; Status = NotificationStatus.None; }
public Notification(string text, NotificationStatus status) { Text = text; NotificationStatus = status; }
/// <summary> /// اضافه نمودن یک پیام جدید در دیکشنری /// </summary> /// <param name="message">پیام</param> /// <param name="status">نوع پیام</param> public void Notify(string message, NotificationStatus status = NotificationStatus.Information) { Notifications.Add(new Notification { NotificationStatus = status, Message = message }); }
public IAsyncResult send_notifyIndividualEvent(AsyncCallback callback, object state, NotificationStatus notificationStatus, List<string> receiverMids)
private void SetNotificationStatus(NotificationStatus status) { ObjectInstantiator<NotificationAssessment>.SetProperty(x => x.Status, status, notificationAssessment); }
public void CanParseExportStatus(NotificationStatus status) { model.SelectedNotificationStatusId = (int)status; Assert.Equal(status, model.GetExportNotificationStatus()); }
public void send_notifyIndividualEvent(NotificationStatus notificationStatus, List<string> receiverMids) #endif { oprot_.WriteMessageBegin(new TMessage("notifyIndividualEvent", TMessageType.Call, seqid_)); notifyIndividualEvent_args args = new notifyIndividualEvent_args(); args.NotificationStatus = notificationStatus; args.ReceiverMids = receiverMids; args.Write(oprot_); oprot_.WriteMessageEnd(); #if SILVERLIGHT return oprot_.Transport.BeginFlush(callback, state); #else oprot_.Transport.Flush(); #endif }
public WithNotificationResult(ActionResult result, NotificationStatus notificationStatus, string message) { _result = result; _notificationStatus = notificationStatus; _message = message; }
private void SetNotificationStatus(NotificationStatus status) { ObjectInstantiator <NotificationAssessment> .SetProperty(x => x.Status, status, notificationAssessment); }