Esempio n. 1
0
        private void OnFileReort(CcdRecordModel model)
        {
            if (model == null)
            {
                return;
            }
            var notification = new MessageNotification()
            {
                Title   = "存储记录导出",
                Content = _container.Resolve <FileDownloadView>(new ParameterOverride("model", model)),
            };

            PopupWindows.NormalNotificationRequest.Raise(notification, (callback) => {
            });

            string selectDir = string.Empty;
            // var openFileDialog = new Microsoft.Win32.OpenDiDialog();
            //System.Windows.Forms.FolderBrowserDialog folder = new System.Windows.Forms.FolderBrowserDialog();
            //var result = folder.ShowDialog();
            //if (result == System.Windows.Forms.DialogResult.OK)
            //{
            //    string folderName = folder.SelectedPath;
            //    selectDir = folderName;
            //}
            //if (string.IsNullOrEmpty(selectDir))
            //    return;
        }
Esempio n. 2
0
        /// <summary>
        /// 通知单条消息
        /// </summary>
        /// <param name="msg"></param>
        public void Notify(MessageNotification msg)
        {
            List <MessageNotification> msgList = new List <MessageNotification>();

            msgList.Add(msg);
            BatchNotify(msgList);
        }
 private void ShowMessage(MessageNotification mn)
 {
     mn.message.OnClick();
     if (mn.message.ShowDialog())
     {
         for (int i = 0; i < dialogPrefabs.Count; i++)
         {
             if (dialogPrefabs[i].CanDisplay(mn.message))
             {
                 if ((UnityEngine.Object)messageDialog != (UnityEngine.Object)null)
                 {
                     UnityEngine.Object.Destroy(messageDialog.gameObject);
                     messageDialog = null;
                 }
                 messageDialog = Util.KInstantiateUI <MessageDialogFrame>(ScreenPrefabs.Instance.MessageDialogFrame.gameObject, GameScreenManager.Instance.ssOverlayCanvas.gameObject, false);
                 MessageDialog dialog = Util.KInstantiateUI <MessageDialog>(dialogPrefabs[i].gameObject, GameScreenManager.Instance.ssOverlayCanvas.gameObject, false);
                 messageDialog.SetMessage(dialog, mn.message);
                 messageDialog.Show(true);
                 break;
             }
         }
     }
     Messenger.Instance.RemoveMessage(mn.message);
     mn.Clear();
 }
Esempio n. 4
0
    private void RegisterNotification()
    {
        MessageNotification m = GetComponent <MessageNotification> ();

        m.structureIndex = structureIndex;
        ResourceGenerator.InstanceResourceGenerator.RegisterMessageNotification(m);
    }
Esempio n. 5
0
        public string GetNotifications(int id) // senderId
        {
            var messageNotificationListViewModel = new MessageNotificationListModel(MemberSession.GetMemberId());

            if (messageNotificationListViewModel.Notifications == null ||
                messageNotificationListViewModel.OrderedMessages.Count == 0)
            {
                return(false.ToString());
            }

            messageNotificationListViewModel.CheckNotifications(MemberSession.GetMemberId());

            var messageList = new MessageListModel
            {
                OrderedMessages = messageNotificationListViewModel.OrderedMessages
            };
            var jsonSerialiser = new JavaScriptSerializer();
            var json           = jsonSerialiser.Serialize(messageList);

            // obrisati sve notifikacje od tog Sendera, namenjene receiveru
            var messageNotification = new MessageNotification();

            messageNotification.DeleteAllFrom(id, MemberSession.GetMemberId());

            return(json); // vraca listu nedodatih poruka
        }
Esempio n. 6
0
        /// <summary>
        /// 单条消息推送服务
        /// </summary>
        /// <param name="message">消息数据</param>
        private void PushMessage(MessageNotification msg, List <IMUser> onlineUsers, IHubContext <Hub> hub)
        {
            IMUser user = null;
            List <RecieverEntity> recievers = msg.Recievers;

            foreach (var reciever in recievers)
            {
                user = onlineUsers.SingleOrDefault(a => a.UserName == reciever.Reciever);
                if (user != null)
                {
                    //hub.Clients.Client(user.ConnectionID).onPushingMessage(new
                    //{
                    //    MsgType = 2,
                    //    Title = msg.Title,
                    //    Content = msg.Content,
                    //    Status = msg.Status,
                    //    MsgGUID = msg.MsgGUID,
                    //    SenderID = msg.SenderID,
                    //    Sender = msg.Sender,
                    //    SendTime = msg.SendTime,
                    //    AppName = msg.AppName,
                    //    AppInstanceID = msg.AppInstanceID,
                    //    FormRef = msg.FormRef,
                    //    FormCode = msg.FormCode,
                    //    FormText = msg.FormText
                    //});
                }
            }
        }
Esempio n. 7
0
        public IActionResult PostToConversation([FromBody] Message message)
        {
            Conversation convo         = context.Conversation.Where(c => c.ConversationRoomName == message.ConversationRoomName).SingleOrDefault();
            User         RecievingUser = context.User.Where(u => u.UserId == convo.ConversationStarterId).SingleOrDefault();

            if (convo.ConversationStarterId == ActiveUser.Instance.User.UserId)
            {
                RecievingUser = context.User.Where(u => u.UserId == convo.ConversationRecieverId).SingleOrDefault();
            }

            Message NewMessage = new Message()
            {
                MessageText          = message.MessageText,
                SendingUserId        = ActiveUser.Instance.User.UserId,
                MessageSentDate      = DateTime.Now,
                ConversationRoomName = message.ConversationRoomName,
                Conversation         = context.Conversation.Where(c => c.ConversationRoomName == message.ConversationRoomName).SingleOrDefault()
            };

            MessageNotification mn = new MessageNotification()
            {
                SendingUserId   = ActiveUser.Instance.User.UserId,
                RecievingUserId = RecievingUser.UserId
            };

            context.Add(mn);
            context.Add(NewMessage);

            context.SaveChanges();

            return(new NoContentResult());
        }
Esempio n. 8
0
        public async Task <ActionResult> PostMessage(MessageNotification messageNotification)
        {
            Notification notification = new Notification
            {
                ProductId = null,
                Type      = 0,
                State     = 0
            };

            unitOfWork.Notifications.Add(notification);

            await unitOfWork.Save();

            NotificationText notificationText = new NotificationText
            {
                CustomerId     = User.FindFirst(ClaimTypes.NameIdentifier) != null?User.FindFirst(ClaimTypes.NameIdentifier).Value : null,
                NotificationId = notification.Id,
                TimeStamp      = DateTime.Now,
                Type           = 0,
                Text           = messageNotification.Message,
                Email          = messageNotification.Email,
                Name           = messageNotification.Name
            };


            unitOfWork.NotificationText.Add(notificationText);
            await unitOfWork.Save();

            return(Ok());
        }
Esempio n. 9
0
        protected override void Invoke(MessageNotification context, MessageKind kind, string title, string message, string detail, Window owner)
        {
            if (!(this.AssociatedObject is TaskbarIcon taskbarIcon))
            {
                return;
            }

            BalloonIcon image;

            switch (kind)
            {
            case MessageKind.Warning:
            case MessageKind.CancelableWarning:
                image = BalloonIcon.Warning;
                break;

            case MessageKind.Error:
                image = BalloonIcon.Error;
                break;

            default:
                image = BalloonIcon.Info;
                break;
            }

            taskbarIcon.ShowBalloonTip(message, detail, image);
        }
        public void ConstructorReturnsMessageNotification()
        {
            var fakeMessage = new FakeMessage("some-key", "some-property");

            var sut = new MessageNotification <FakeMessage>(fakeMessage);

            Assert.Equal(fakeMessage, sut.Message);
        }
    private void Awake()
    {
        display = GetComponent <MessageDisplay>();
        anim    = GetComponent <Animator>();

        OnNewMessage.AddListener(UpdateDisplayDelay);
        instance = this;
    }
Esempio n. 12
0
        public Task Handle(MessageNotification <OrderCreatedMessage> notification, CancellationToken cancellationToken)
        {
            var message = notification.Message;

            _logger.LogInformation($"Message received with Id: {message.Id} and CustomerName: {message.CustomerName}");

            return(Task.CompletedTask);
        }
Esempio n. 13
0
        public Task Handle(MessageNotification <StatusUpdatedMessage> notification, CancellationToken cancellationToken)
        {
            var message = notification.Message;

            _logger.LogInformation($"Message received with Id: {message.Id} and Status: {message.Status}");

            return(Task.CompletedTask);
        }
Esempio n. 14
0
        public int GetNumberOfNotifications()
        {
            var message = new MessageNotification();

            var br = message.NumberOfNotifications(MemberSession.GetMemberId());

            return(br);
        }
        public Task Handle(MessageNotification <OtherSampleMessage> notification, CancellationToken cancellationToken)
        {
            var message = notification.Message;

            _logger.LogInformation(
                $"Other sample message received with key: {message.Key} and value: {message.SomeOtherProperty}");

            return(Task.CompletedTask);
        }
Esempio n. 16
0
        public int MessageSeen([FromBody] int id)
        {
            MessageNotification mn = context.MessageNotification.Where(m => m.MessageNotificationId == id).SingleOrDefault();

            mn.Seen = true;

            context.SaveChanges();

            return(context.MessageNotification.Where(MN => MN.RecievingUserId == ActiveUser.Instance.User.UserId && MN.Seen == false).ToList().Count());
        }
Esempio n. 17
0
        public async Task SendOrderRequiresApprovalEmail(MessageNotification <OrderSubmitEventBody> messageNotification)
        {
            var order        = messageNotification.EventBody.Order;
            var templateData = new EmailTemplate <OrderTemplateData>()
            {
                Data    = SendgridMappers.GetOrderTemplateData(order, messageNotification.EventBody.LineItems),
                Message = OrderSubmitEmailConstants.GetOrderRequiresApprovalText()
            };

            await SendSingleTemplateEmail(_settings?.SendgridSettings?.FromEmail, messageNotification?.Recipient?.Email, _settings?.SendgridSettings?.OrderApprovalTemplateID, templateData);
        }
        public void Constructor_ReturnsMessageNotification()
        {
            //Arrange
            var fakeMessage = new FakeMessage("some-property");

            //Act
            var sut = new MessageNotification <FakeMessage>(fakeMessage);

            //Assert
            Assert.Equal(fakeMessage, sut.Message);
        }
Esempio n. 19
0
 private void rtnData(string data)
 {
     if (data.Length > 0)
     {
         if ((bt[0] == 129) && (bt[dataLen + 5] == 129))
         {
             List <byte[]> dataList = new List <byte[]>();
             byte[]        databt   = new byte[10];
             int           ind      = 0;
             for (int i = 0; i < dataLen + 4; i++)
             {
                 if (i > 3)
                 {
                     databt[ind] = bt[i];
                     if (ind == 9)
                     {
                         dataList.Add(databt);
                         ind    = -1;
                         databt = new byte[10];
                     }
                     ind++;
                 }
             }
             if (dataList.Count > 0)
             {
                 for (int i = 0; i < dataList.Count; i++)
                 {
                     string num = "", item = "", checkValue = "", unit = "", datetime = "", error = "";
                     num  = dataList[i][0].ToString();
                     item = "农药残留(国)";
                     double value = (double)(dataList[i][8] + dataList[i][9] * 256);
                     checkValue = (value / 100).ToString("F2");
                     unit       = "%";
                     datetime   = "20" + dataList[i][3] + "-" + dataList[i][4] + "-" + dataList[i][5] + " "
                                  + dataList[i][6] + ":" + dataList[i][7] + ":00";
                     error = "否";
                     AddNewHistoricData(num, item, checkValue, unit, datetime, error);
                 }
                 m_RecordCount         = 0;
                 m_RecordStartPosition = 0;
                 m_RecordEndPosition   = 0;
                 m_DataReadByteCount   = 0;
                 m_DataRead            = string.Empty;
                 m_LatterDataByteCount = 0;
                 if (MessageNotification.GetInstance() != null)
                 {
                     MessageNotification.GetInstance().OnDataRead(MessageNotification.NotificationInfo.ReadDY3000DYData, "");
                 }
             }
         }
     }
 }
Esempio n. 20
0
        public string Conversation(int id) // receiverId
        {
            var messageList = new MessageListModel(id);

            var jsonSerialiser = new JavaScriptSerializer();
            var json           = jsonSerialiser.Serialize(messageList);

            // TODO: postavi da se sve notifikacije obrisu koje su bile za tog usera
            var messageNotification = new MessageNotification();

            messageNotification.DeleteAllFrom(id, MemberSession.GetMemberId());
            return(json);
        }
Esempio n. 21
0
        public async Task SendOrderDeclinedEmail(MessageNotification <OrderSubmitEventBody> messageNotification)
        {
            var order        = messageNotification.EventBody.Order;
            var approval     = messageNotification.EventBody.Approvals.FirstOrDefault();
            var templateData = new EmailTemplate <OrderTemplateData>()
            {
                Data    = SendgridMappers.GetOrderTemplateData(order, messageNotification.EventBody.LineItems),
                Message = OrderSubmitEmailConstants.GetOrderDeclinedText()
            };

            templateData.Data.Comments = approval.Comments;
            await SendSingleTemplateEmail(_settings?.SendgridSettings?.FromEmail, messageNotification?.Recipient?.Email, _settings?.SendgridSettings?.OrderApprovalTemplateID, templateData);
        }
 public MessageNotificationVM(MessageNotification mn)
 {
     ID               = mn.ID;
     Name             = mn.Name;
     Description      = mn.Description;
     SortCode         = mn.SortCode;
     User             = mn.User;
     ObjectId         = mn.ObjectId;
     CreateDateTime   = mn.CreateDateTime;
     NotificationType = mn.NotificationType;
     Status           = mn.Status;
     CreatedUser      = mn.CreatedUser;
     isSee            = mn.isSee;
 }
Esempio n. 23
0
        public async Task <ActionResult> Message(int messageId, string messageText)
        {
            var userIdCurrent = User.Identity.GetUserId();

            var    lastMessage = _messageService.Find(messageId);
            string messageTo;

            if (userIdCurrent == lastMessage.FromUserId)
            {
                messageTo = lastMessage.ToUserId;
            }
            else
            {
                messageTo = lastMessage.FromUserId;
            }


            var message = new Message()
            {
                FromUserId      = userIdCurrent,
                Content         = messageText,
                ObjectState     = ObjectState.Added,
                AdvertisementId = lastMessage.AdvertisementId,
                ToUserId        = messageTo
            };

            _messageService.Insert(message);

            var messageNotification = new MessageNotification()
            {
                Message = message, DateTime = DateTime.Now, ObjectState = ObjectState.Added
            };

            var userNotification = new UserNotification()
            {
                IsRead       = false,
                Notification = messageNotification,
                UserId       = message.ToUserId,
                ObjectState  = ObjectState.Added
            };

            _userNotificationService.Insert(userNotification);

            await _unitOfWorkAsync.SaveChangesAsync();

            TempData[TempKeys.UserMessage] = "Wiadomość została wysłana";

            return(RedirectToAction("Message", new { advertisementId = lastMessage.AdvertisementId }));
        }
Esempio n. 24
0
        public async Task SendPasswordResetEmail(MessageNotification <PasswordResetEventBody> messageNotification)
        {
            var templateData = new EmailTemplate <PasswordResetData>()
            {
                Data = new PasswordResetData
                {
                    FirstName = messageNotification?.Recipient?.FirstName,
                    LastName  = messageNotification?.Recipient?.LastName,
                    PasswordRenewalAccessToken = messageNotification?.EventBody?.PasswordRenewalAccessToken,
                    PasswordRenewalUrl         = messageNotification?.EventBody?.PasswordRenewalUrl
                }
            };

            await SendSingleTemplateEmail(_settings?.SendgridSettings?.FromEmail, messageNotification?.Recipient?.Email, _settings?.SendgridSettings?.BuyerPasswordResetTemplateID, templateData);
        }
Esempio n. 25
0
 static public void SetCurrentMessage(MessageObject message)
 {
     for (int i = 0; i < messages.Count; i++)
     {
         if (message == messages[i].message.mail)
         {
             currentMessage = messages[i];
             if (currentMessage.message.mail == MessageNotification.newMessage)
             {
                 MessageNotification.SeenMessage();
             }
             return;
         }
     }
 }
Esempio n. 26
0
        private void OnMenuCommand(object obj)
        {
            if (SelectedDrive == null)
            {
                return;
            }
            var notification = new MessageNotification()
            {
                Title   = "磁盘格式化",
                Content = _container.Resolve <FormatView>(new ParameterOverride("name", SelectedDrive.DriveLetter)),
            };

            PopupWindows.NormalNotificationRequest.Raise(notification, (callback) => {
            });
        }
Esempio n. 27
0
        private void OnDownloadFile(DirectoryInfoModel model)
        {
            if (model == null)
            {
                return;
            }
            var notification = new MessageNotification()
            {
                Title   = "文件下载",
                Content = _container.Resolve <FileDownloadView>(new ParameterOverride("fileName", model.FullName)),
            };

            PopupWindows.NormalNotificationRequest.Raise(notification, (callback) => {
            });
        }
Esempio n. 28
0
        public static void SendMessage(MessageNotification model)
        {
            UserOnline             us      = new UserOnline();
            List <UserOnlineModel> list    = us.GetUserOnline();
            IHubContext            context = GlobalHost.ConnectionManager.GetHubContext <UserNoti>();

            foreach (UserOnlineModel item in list)
            {
                if (item.UserName.Trim().ToLower() == model.ToUser.Trim().ToLower() && item.Company == model.CompanyID)
                {
                    context.Clients.Client(item.ClientID).showUsersNotification(model);
                    break;
                }
            }
        }
Esempio n. 29
0
        public async Task SendNewUserEmail(MessageNotification <PasswordResetEventBody> messageNotification)
        {
            var templateData = new EmailTemplate <NewUserData>()
            {
                Data = new NewUserData
                {
                    FirstName = messageNotification?.Recipient?.FirstName,
                    LastName  = messageNotification?.Recipient?.LastName,
                    PasswordRenewalAccessToken = messageNotification?.EventBody?.PasswordRenewalAccessToken,
                    BaseAppURL = _settings?.UI?.BaseAdminUrl,
                    Username   = messageNotification?.EventBody?.Username
                }
            };

            await SendSingleTemplateEmail(_settings?.SendgridSettings?.FromEmail, messageNotification?.Recipient?.Email, _settings?.SendgridSettings?.NewUserTemplateID, templateData);
        }
Esempio n. 30
0
        private async Task <MessageResource> SendTwilio(string messageText, MessageNotification notification)
        {
            TwilioClient.Init((string)notification.ConfigData.AccountSid, (string)notification.ConfigData.AuthToken);

            try
            {
                return(await MessageResource.CreateAsync(
                           to : new PhoneNumber($"+1{(string)notification.Recipient.Phone}"),
                           from : new PhoneNumber((string)notification.ConfigData.FromNumber),
                           body : messageText));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }