internal static void DeleteReminder(NotificationList notificationList)
 {
     foreach (var item in notificationList)
     {
         var reminder = ScheduledActionService.Find(item.Name);
         if (reminder != null)
             ScheduledActionService.Remove(item.Name);
     }
 }
 public StaticServiceData()
 {
     CategoryList = new CategoryList();
     TypeTransactionList = new TypeTransactionList();
     TypeTransactionReasonList = new TypeTransactionReasonList();
     NotificationList = new NotificationList();
     TypeFrequencyList = new TypeFrequencyList();
     IntervalList = new TypeIntervalList();
     RecurrenceRuleList = new RecurrenceRuleList();
 }
 public void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
 }
Ejemplo n.º 4
0
        public void Construct_from_Notification_adds_notification()
        {
            var notification = new Notification("hello1");

            var notificationList = new NotificationList("param", notification);

            notificationList.ShouldSatisfyAllConditions(
                () => notificationList.Count.ShouldBe(1),
                () => notificationList["param"].First().ShouldBe(notification)
                );
        }
Ejemplo n.º 5
0
        public static CommandResult ToCommandResult(this IdentityResult identityResult)
        {
            var notifications = new NotificationList();

            foreach (var error in identityResult.Errors)
            {
                notifications.AddNotification(error.Code, error.Description);
            }

            return(CommandResult.Fail(notifications));
        }
Ejemplo n.º 6
0
        private void AddNotification(Notification notification)
        {
            foreach (var not in NotificationList)
            {
                if (not.Equals(notification))
                {
                    return;
                }
            }

            NotificationList.Add(notification);
        }
Ejemplo n.º 7
0
        public void Construct_from_NotificationArray_adds_array()
        {
            List <Notification> notifications = new List <Notification>
            {
                new Notification("message1"),
                new Notification("message2")
            };

            var notificationList = new NotificationList("param", notifications);

            notificationList["param"].ShouldBeSameAs(notifications);
        }
Ejemplo n.º 8
0
 public void AddNotification(string Text, int UserName)
 {
     using (Model1 ent = new Model1())
     {
         NotificationList obj = new NotificationList();
         obj.Text        = Text;
         obj.UserId      = UserName;
         obj.CreatedDate = DateTime.Now.ToUniversalTime();
         ent.NotificationLists.Add(obj);
         ent.SaveChanges();
     }
 }
Ejemplo n.º 9
0
        private async void LoadListData()
        {
            if (CrossConnectivity.Current.IsConnected)
            {
                HttpClientHelper apicall = null;
                if (_type == "User")
                {
                    apicall = new HttpClientHelper(string.Format(ApiUrls.Url_GetUserNotificationData), Settings.AccessTokenSettings);
                }
                else
                {
                    isAdmin = true;
                    apicall = new HttpClientHelper(string.Format(ApiUrls.Url_GetAdminNotificationData), Settings.AccessTokenSettings);
                }

                var response = await apicall.GetResponse <List <AdminNotificationResponseModel> >();

                if (response != null)
                {
                    if (response.Count > 0)
                    {
                        IsStatusVisible = false;
                        foreach (var item in response.ToList())
                        {
                            AdminNotificationModel notificationModel = new AdminNotificationModel();
                            if (isAdmin == false)
                            {
                                notificationModel.NotificationInfo = "Admin approved your complaint for service " + item.productName + " in " + item.catagory + " catagory";
                            }
                            else
                            {
                                notificationModel.NotificationInfo = item.userName + " registered complaint for service " + item.productName + " in " + item.catagory + " catagory";
                            }
                            NotificationList.Add(notificationModel);
                        }
                    }
                    else
                    {
                        IsStatusVisible = true;
                    }
                    NotificationData = new ReadOnlyObservableCollection <AdminNotificationModel>(NotificationList);
                }
                UserDialogs.Instance.HideLoading();
            }
            else
            {
                UserDialogs.Instance.HideLoading();
                await Application.Current.MainPage.DisplayAlert("Network", AppConstant.NETWORK_FAILURE, "OK");

                return;
            }
        }
Ejemplo n.º 10
0
        private async Task <(NotificationList, NotificationList)> GetNotificationListsAsync(string userId)
        {
            var notificationTransportId = await feedRepo.GetUsersFeedNotificationTransportId(userId);

            var importantNotifications = new List <Notification>();

            if (notificationTransportId != null)
            {
                importantNotifications = await feedRepo.GetNotificationForFeedNotificationDeliveries(userId, n => n.InitiatedBy, notificationTransportId.Value);
            }

            var commentsNotifications = new List <Notification>();

            if (commentsFeedNotificationTransportId != null)
            {
                commentsNotifications = await feedRepo.GetNotificationForFeedNotificationDeliveries(userId, n => n.InitiatedBy, commentsFeedNotificationTransportId.Value);
            }

            log.Info($"[GetNotificationList] Step 1 done: found {importantNotifications.Count} important notifications and {commentsNotifications.Count} comment notifications");

            importantNotifications = RemoveBlockedNotifications(importantNotifications).ToList();
            commentsNotifications  = RemoveBlockedNotifications(commentsNotifications, importantNotifications).ToList();

            log.Info($"[GetNotificationList] Step 2 done, removed blocked notifications: left {importantNotifications.Count} important notifications and {commentsNotifications.Count} comment notifications");

            importantNotifications = RemoveNotActualNotifications(importantNotifications).ToList();
            commentsNotifications  = RemoveNotActualNotifications(commentsNotifications).ToList();

            log.Info($"[GetNotificationList] Step 3 done, removed not actual notifications: left {importantNotifications.Count} important notifications and {commentsNotifications.Count} comment notifications");

            var importantLastViewTimestamp = await feedRepo.GetFeedViewTimestamp(userId, notificationTransportId ?? -1);

            var commentsLastViewTimestamp = await feedRepo.GetFeedViewTimestamp(userId, commentsFeedNotificationTransportId ?? -1);

            log.Info("[GetNotificationList] Step 4, building models");

            var allNotifications  = importantNotifications.Concat(commentsNotifications).ToList();
            var notificationsData = await notificationDataPreloader.LoadAsync(allNotifications);

            var importantNotificationList = new NotificationList
            {
                LastViewTimestamp = importantLastViewTimestamp,
                Notifications     = importantNotifications.Select(notification => BuildNotificationInfo(notification, notificationsData)).ToList(),
            };
            var commentsNotificationList = new NotificationList
            {
                LastViewTimestamp = commentsLastViewTimestamp,
                Notifications     = commentsNotifications.Select(notification => BuildNotificationInfo(notification, notificationsData)).ToList(),
            };

            return(importantNotificationList, commentsNotificationList);
        }
    public static void Main()
    {
        NotificationList <int> list = new NotificationList <int>();

        list.ItemAdded += delegate(object o, ItemInsertedArgs <int> args) {
            Console.WriteLine("A new item was added to the list: {0} at index {1}", args.Item, args.Index);
        };

        for (int i = 0; i < 10; i++)
        {
            list.Add(i);
        }
    }
Ejemplo n.º 12
0
        private async Task Init()
        {
            var notifications = await _notificationService.Get <List <Model.Notification> >(new NotificationSearchRequest()
            {
                UserId = APIService.loggedProfile.UserId
            });

            var sorted = notifications.OrderByDescending(a => a.NotifDateTime).ToList();

            NotificationList.AddRange(sorted);
            NotifInt           = notifications.Count;
            NotificationNumber = "Notifications: " + NotifInt.ToString();
        }
Ejemplo n.º 13
0
        public void Failed_should_set_properties()
        {
            var notificationList = new NotificationList("key1", "Hello world");
            var exception        = new Exception("Oopsie!");

            var result = CommandResult.Fail(notificationList, exception);

            result.ShouldSatisfyAllConditions(
                () => result.Succeeded.ShouldBeFalse(),
                () => result.Status.ShouldBe(CommandResultStatus.Exception),
                () => result.Notifications.ShouldBe(notificationList),
                () => result.Exception.ShouldBe(exception));
        }
Ejemplo n.º 14
0
        public void Fail_should_return_correct_properties()
        {
            var notifications = new NotificationList("key1", "notification1");
            var exception     = new Exception("Oopsie!");

            var result = AggregateResult <ConcreteAggregate> .Fail(notifications, exception);

            result.ShouldSatisfyAllConditions(
                () => result.Succeeded.ShouldBeFalse(),
                () => result.Notifications.ShouldBe(notifications),
                () => result.Exception.ShouldBe(exception),
                () => result.NewAggregate.ShouldBeNull());
        }
        public void TestSelectJoinWithAggregateFunction()
        {
            string tsql = @"
                SELECT
                    COUNT(shelf.id_home),
                    COUNT(id_author)
                FROM
                    book
                    INNER JOIN shelf ON book.id_shelf = shelf.id
                WHERE
                    shelf.id = 2
                GROUP BY
                    shelf.count
            ";

            TableNameDeclareCheckVisitor visitor = visitTSql(tsql);
            NotificationList             list    = visitor.getNotificationList();

            int expectedNotificationCount = 1;
            int actual = list.GetAll().Count;

            Assert.AreEqual(
                expectedNotificationCount,
                actual,
                "集計関数で規約に抵触する可能性のある数を勘違い"
                );

            List <Notification> illegalList = list.GetIllegalList();

            expectedNotificationCount = 1;
            actual = illegalList.Count;
            Assert.AreEqual(
                expectedNotificationCount,
                actual,
                "集計関数で規約違反の発見数を勘違い"
                );

            Notification actualIllegal   = illegalList[0];
            Notification expectedIllegal = new Notification(
                NotificationLevel.Illegal,
                IllegalType.NotDeclaredTableName,
                "集計関数でJOINがあるのにテーブルを宣言してない",
                "id_author"
                );

            Assert.AreEqual(
                expectedIllegal,
                actualIllegal,
                "SELECT文内でJOINがあるのに集計関数でテーブル名を宣言しない規約の違反で要素が違う"
                );
        }
Ejemplo n.º 16
0
        private void OnEntityDeath(BaseCombatEntity entity, HitInfo info)
        {
            if (info == null)
            {
                return;
            }

            if (!IsRaidEntity(entity))
            {
                return;
            }
            if (info.InitiatorPlayer == null)
            {
                return;
            }

            var buildingPrivilege = entity.GetBuildingPrivilege();

            if (buildingPrivilege == null || buildingPrivilege.authorizedPlayers.IsEmpty())
            {
                return;
            }

            var victims = new List <ulong>(buildingPrivilege.authorizedPlayers.Count);

            foreach (PlayerNameID victim in buildingPrivilege.authorizedPlayers)
            {
                if (victim == null)
                {
                    continue;
                }
                if (config.usePermissions && !permission.UserHasPermission(victim.userid.ToString(), PERMISSION))
                {
                    return;
                }
                if (victim.userid == info.InitiatorPlayer.userID)
                {
                    return;
                }
                if (disabled.Contains(victim.userid))
                {
                    continue;
                }
                victims.Add(victim.userid);
            }

            NotificationList.SendNotificationTo(
                victims, NotificationChannel.SmartAlarm, lang.GetMessage(AlarmLoc.TITLE, this),
                string.Format(lang.GetMessage(AlarmLoc.BODY, this),
                              entity.ShortPrefabName, GetGrid(entity.transform.position)), Util.GetServerPairingData());
        }
Ejemplo n.º 17
0
        private async Task <(NotificationList, NotificationList)> GetNotificationListsAsync(string userId)
        {
            var notificationTransport = await feedRepo.GetUsersFeedNotificationTransportAsync(userId).ConfigureAwait(false);

            var importantNotifications = new List <Notification>();

            if (notificationTransport != null)
            {
                importantNotifications = (await feedRepo.GetFeedNotificationDeliveriesAsync(userId, n => n.Notification.InitiatedBy, transports: notificationTransport).ConfigureAwait(false))
                                         .Select(d => d.Notification)
                                         .ToList();
            }

            var commentsNotifications = (await feedRepo.GetFeedNotificationDeliveriesAsync(userId, n => n.Notification.InitiatedBy, transports: commentsFeedNotificationTransport).ConfigureAwait(false))
                                        .Select(d => d.Notification)
                                        .ToList();

            logger.Information($"[GetNotificationList] Step 1 done: found {importantNotifications.Count} important notifications and {commentsNotifications.Count} comment notifications");

            importantNotifications = RemoveBlockedNotifications(importantNotifications).ToList();
            commentsNotifications  = RemoveBlockedNotifications(commentsNotifications, importantNotifications).ToList();

            logger.Information($"[GetNotificationList] Step 2 done, removed blocked notifications: left {importantNotifications.Count} important notifications and {commentsNotifications.Count} comment notifications");

            importantNotifications = RemoveNotActualNotifications(importantNotifications).ToList();
            commentsNotifications  = RemoveNotActualNotifications(commentsNotifications).ToList();

            logger.Information($"[GetNotificationList] Step 3 done, removed not actual notifications: left {importantNotifications.Count} important notifications and {commentsNotifications.Count} comment notifications");

            var importantLastViewTimestamp = await feedRepo.GetFeedViewTimestampAsync(userId, notificationTransport?.Id ?? -1).ConfigureAwait(false);

            var commentsLastViewTimestamp = await feedRepo.GetFeedViewTimestampAsync(userId, commentsFeedNotificationTransport.Id).ConfigureAwait(false);

            logger.Information("[GetNotificationList] Step 4, building models");

            var allNotifications  = importantNotifications.Concat(commentsNotifications).ToList();
            var notificationsData = await notificationDataPreloader.LoadAsync(allNotifications).ConfigureAwait(false);

            var importantNotificationList = new NotificationList
            {
                LastViewTimestamp = importantLastViewTimestamp,
                Notifications     = importantNotifications.Select(notification => BuildNotificationInfo(notification, notificationsData)).ToList(),
            };
            var commentsNotificationList = new NotificationList
            {
                LastViewTimestamp = commentsLastViewTimestamp,
                Notifications     = commentsNotifications.Select(notification => BuildNotificationInfo(notification, notificationsData)).ToList(),
            };

            return(importantNotificationList, commentsNotificationList);
        }
Ejemplo n.º 18
0
        public static CommandResult Fail(NotificationList notifications, Exception exception)
        {
            var result = new CommandResult
            {
                Succeeded = false,
                Status    = exception == null
                        ? CommandResultStatus.ValidationError
                        : CommandResultStatus.Exception,
                Notifications = notifications ?? new NotificationList(),
                Exception     = exception
            };

            return(result);
        }
        public async Task GetAllNotifications()
        {
            NotificationList notificationsResponse = await this.client.GetNotificationsAsync();

            Assert.IsNotNull(notificationsResponse);
            Assert.IsNotNull(notificationsResponse.notifications);

            List <Notification> notifications = notificationsResponse.notifications;

            foreach (Notification notification in notifications)
            {
                NotifyAssertions.AssertNotification(notification);
            }
        }
        public void TestSelectJoinWithOrder()
        {
            string tsql = @"
                SELECT
                    book.id,
                    *
                FROM
                    book
                    INNER JOIN shelf ON book.id_shelf = shelf.id
                ORDER BY
                    book.name,
                    id_book
            ";

            TableNameDeclareCheckVisitor visitor = visitTSql(tsql);
            NotificationList             list    = visitor.getNotificationList();

            int expectedNotificationCount = 1;
            int actual = list.GetAll().Count;

            Assert.AreEqual(
                expectedNotificationCount,
                actual,
                "ORDERで規約に抵触する可能性のある数を勘違い"
                );

            List <Notification> illegalList = list.GetIllegalList();

            expectedNotificationCount = 1;
            actual = illegalList.Count;
            Assert.AreEqual(
                expectedNotificationCount,
                actual,
                "ORDERで規約違反の発見数を勘違い"
                );

            Notification actualIllegal   = illegalList[0];
            Notification expectedIllegal = new Notification(
                NotificationLevel.Illegal,
                IllegalType.NotDeclaredTableName,
                "ORDERでJOINがあるのにテーブルを宣言してない",
                "id_book"
                );

            Assert.AreEqual(
                expectedIllegal,
                actualIllegal,
                "SELECT文内でJOINがあるのにORDERでテーブル名を宣言しない規約の違反で要素が違う"
                );
        }
Ejemplo n.º 21
0
        private void ChatRaidAlarm(BasePlayer player, string command, string[] args)
        {
            if (config.usePermissions && !permission.UserHasPermission(player.UserIDString, PERMISSION))
            {
                SendReply(player, lang.GetMessage(AlarmLoc.NO_PERMISSION, this, player.UserIDString));
                return;
            }
            if (args.Length == 0)
            {
                SendReply(player, lang.GetMessage(AlarmLoc.HELP, this, player.UserIDString));
                return;
            }

            switch (args[0].ToLower())
            {
            case "status":
                SendReply(player, GetStatusText(player));
                break;

            case "enable":
                disabled.Remove(player.userID);
                SendReply(player, lang.GetMessage(AlarmLoc.STATUS_ENABLED, this, player.UserIDString));
                break;

            case "disable":
                disabled.Add(player.userID);
                SendReply(player, lang.GetMessage(AlarmLoc.STATUS_DISABLED, this, player.UserIDString));
                break;

            case "test":
                if (disabled.Contains(player.userID))
                {
                    SendReply(player, lang.GetMessage(AlarmLoc.STATUS_DISABLED, this, player.UserIDString));
                    return;
                }

                NotificationList.SendNotificationTo(player.userID, NotificationChannel.SmartAlarm,
                                                    lang.GetMessage(AlarmLoc.TITLE, this, player.UserIDString),
                                                    string.Format(lang.GetMessage(AlarmLoc.BODY, this, player.UserIDString),
                                                                  string.Format(lang.GetMessage(AlarmLoc.TEST_DESTROYED, this, player.UserIDString)),
                                                                  GetGrid(player.transform.position)), Util.GetServerPairingData());
                SendReply(player, lang.GetMessage(AlarmLoc.TEST_SENT, this, player.UserIDString));
                break;

            default:
                SendReply(player, lang.GetMessage(AlarmLoc.HELP_COMMANDS, this, player.UserIDString));
                break;
            }
        }
        public void TestUpdateFromJoinWithWhere()
        {
            string tsql = @"
                UPDATE book
                SET
                    id_shelf = shelf.id
                FROM
                    book
                    INNER JOIN shelf ON shelf.id = book.id_shelf
                WHERE
                    book.id = 1 AND
                    id_book < 2
            ";
            TableNameDeclareCheckVisitor visitor = visitTSql(tsql);
            NotificationList             list    = visitor.getNotificationList();

            int expectedNotificationCount = 1;
            int actual = list.GetAll().Count;

            Assert.AreEqual(
                expectedNotificationCount,
                actual,
                "UPDATE文でJOIN(WHERE付き)を行ったら規約に抵触する可能性のある数を勘違い"
                );

            List <Notification> illegalList = list.GetIllegalList();

            expectedNotificationCount = 1;
            actual = illegalList.Count;
            Assert.AreEqual(
                expectedNotificationCount,
                actual,
                "UPDATE文でJOIN(WHERE付き)を行ったら規約違反の発見数を勘違い"
                );

            Notification actualIllegal   = illegalList[0];
            Notification expectedIllegal = new Notification(
                NotificationLevel.Illegal,
                IllegalType.NotDeclaredTableName,
                "UPDATE文でJOIN(WHERE付き)するときにテーブルを宣言してない",
                "id_book"
                );

            Assert.AreEqual(
                expectedIllegal,
                actualIllegal,
                "UPDATE文でJOIN(WHERE付き)したが、テーブル名を宣言しなかった時の違反要素が違う"
                );
        }
Ejemplo n.º 23
0
        public void TestAddNotification()
        {
            NotificationList notificationList = new NotificationList();

            int expectedIllegalCount = 0;

            Assert.AreEqual(expectedIllegalCount, notificationList.GetIllegalList().Count);

            expectedIllegalCount = 1;
            notificationList.Add(NotificationLevel.Illegal, IllegalType.NotDeclaredTableName, "hello", "hello");
            Assert.AreEqual(expectedIllegalCount, notificationList.GetIllegalList().Count);

            notificationList.Add(NotificationLevel.Warning, IllegalType.NotDeclaredTableName, "hello", "hello");
            Assert.AreEqual(expectedIllegalCount, notificationList.GetIllegalList().Count);
        }
Ejemplo n.º 24
0
        /// <summary>
        /// Add notification and do other ui stuff.
        /// </summary>
        /// <param name="notification">notification.</param>
        private async Task addNotification(string notification, DateTime time)
        {
            NotificationList.Insert(0, new NotificationItem(notification, time));
            if (!IsNotificationOpen)
            {
                UnreadNotificationCount++;
            }
            Notification = notification;

            await Task.Run(() =>
            {
                System.Threading.Thread.Sleep(Properties.Settings.Default.HideNotificationDelayMsec);
                Notification = Properties.Resources.NotificationListPlaceholder;
            });
        }
Ejemplo n.º 25
0
        public static AggregateResult <ExamplePerson> Create(string name, string emailAddress)
        {
            var person        = new ExamplePerson();
            var notifications = new NotificationList();

            person.SetName(name).AddNotificationsTo(notifications);
            person.SetEmailAddress(emailAddress).AddNotificationsTo(notifications);

            if (!notifications.HasNotifications)
            {
                person.AddEvent(new ExamplePersonCreated(person.Id, person.Name, person.EmailAddress));
            }

            return(person.OrNotifications(notifications)
                   .AsResult <ExamplePerson>());
        }
Ejemplo n.º 26
0
        private void FillNotification()
        {
            Notification n;

            foreach (var contract in ContractList)
            {
                n = new Notification(contract);

                if (!n.HasNotification)
                {
                    continue;
                }

                NotificationList.Add(n);
            }
        }
        public IActionResult AddPhoneToNotifyList(NotificationList notification)
        {
            bool belongsToUser = (_context.AspNetUsers.Where(u => u.PhoneNumber == notification.PhoneNumber) != null);
            bool alreadyAdded  = (_context.NotificationList.Where(n => n.PhoneNumber == notification.PhoneNumber &&
                                                                  n.ActivityId == notification.ActivityId) != null);
            bool isNotUserOrPreAdded = belongsToUser && alreadyAdded;

            if (isNotUserOrPreAdded)
            {
                _context.NotificationList.Add(notification);
                _context.SaveChanges();
                return(RedirectToAction("Index"));
            }
            ViewBag.Error = "Phone Number is already added or belongs to a user.";
            return(View(notification));
        }
Ejemplo n.º 28
0
        public void Case_fail_without_exception_should_set_properties()
        {
            var aggregate       = new ConcreteAggregate();
            var notifications   = new NotificationList("Anvil", "Must not land on Road Runner");
            var aggregateResult = AggregateResult <ConcreteAggregate> .Fail(notifications);

            var commandResult = aggregateResult.ToCommandResult();

            commandResult.ShouldSatisfyAllConditions(
                () => commandResult.Succeeded.ShouldBeFalse(),
                () => commandResult.Notifications["Anvil"]
                .ShouldContain(n => n.Message.Contains("Must not land on Road Runner"), 1),
                () => commandResult.Exception.ShouldBeNull(),
                () => commandResult.Status.ShouldBe(CommandResultStatus.ValidationError)
                );
        }
Ejemplo n.º 29
0
        public void DeveRetornarSucesso()
        {
            //arrange
            var notificacao = new NotificationList();
            var command     = new CriarClienteCommand("Nome", "*****@*****.**", "62347448005", Enums.TipoDocumento.Cpf,
                                                      Enums.Sexo.Masculino, DateTime.Now, "Rua", "Bairro", "127-A", "Cidade", Enums.TipoEndereco.Comercial);

            this.emailService.Setup(service => service.Send(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>()));

            //act
            var handler = new ClienteHandler(this.clienteRepositoryMock.Object, this.emailService.Object, notificacao);
            var result  = handler.Handle(command);

            //assert
            result.Sucess.Should().BeTrue();
        }
Ejemplo n.º 30
0
        private void InitNotificationList()
        {
            string serializedList        = Application.Current.Properties["SerializedUserNotif"] as string;
            List <UserNotification> list = null;

            if (serializedList != null)
            {
                list = JsonConvert.DeserializeObject <List <UserNotification> >(serializedList);

                NotificationList = list;
            }
            else
            {
                NotificationList = new List <UserNotification>();
            }
            switch (_modelType)
            {
            case NotificationSettingsViewModelType.MutualHelpCourse:
                TitleLabel       = "Add course you would like to get notify when anyone add Help Request related to it";
                EmptyListLabel   = "You still don't have any Mutual Help related notifications.";
                NotificationList = NotificationList.FindAll(un => un.StudentId == Settings.StudentId && un.Topic.StartsWith("HRC"));
                break;

            case NotificationSettingsViewModelType.MutualHelpFaculty:
                TitleLabel       = "Add course you would like to get notify when anyone add Help Request related to it";
                EmptyListLabel   = "You still don't have any Mutual Help related notifications.";
                NotificationList = NotificationList.FindAll(un => un.StudentId == Settings.StudentId && un.Topic.StartsWith("HRF"));
                break;

            case NotificationSettingsViewModelType.NotebooksStorage:
                TitleLabel       = "Add course you would like to get notify when anyone add Notebook related to it";
                EmptyListLabel   = "You still don't have any Notebooks related notifications.";
                NotificationList = NotificationList.FindAll(un => un.StudentId == Settings.StudentId && un.Topic.StartsWith("NS"));
                break;

            case NotificationSettingsViewModelType.StudyGroup:
                TitleLabel       = "Add course you would like to get notify when anyone add Study Group related to it";
                EmptyListLabel   = "You still don't have any Mutual Help related notifications.";
                NotificationList = NotificationList.FindAll(un => un.StudentId == Settings.StudentId && un.Topic.StartsWith("SG"));
                break;
            }

            if (NotificationList.Count == 0)
            {
                IsNotificationListEmpty = true;
            }
        }
Ejemplo n.º 31
0
        public override NotificationList BuildNotificationList()
        {
            //throw new NotImplementedException();
            NotificationDao  ticketDao        = new NotificationDao(_connection);
            NotificationList notificationList = new NotificationList();

            foreach (Department department in _departmentModel.departments)
            {
                ViolationList violationList = new ViolationList(department.Name, _subjectKey, _urlKey);
                ticketDao.GetDepartmentManager(department.Id, ref violationList);
                ticketDao.GetOverDueTaskViolations(Convert.ToString(department.Id),
                                                   Convert.ToString(department.PastDueDays), ref violationList);
                AddAdditionalRecipients(department, ref violationList);
                notificationList.violations.Add(violationList);
            }
            return(notificationList);
        }
Ejemplo n.º 32
0
        public override NotificationList BuildNotificationList()
        {
            NotificationDao ticketDao = new NotificationDao(_connection);
            NotificationList topicList = new NotificationList();

            foreach (Topic topic in _topicModel.HelpTopics)
            {
                ViolationList list = new ViolationList(topic.Name, _subjectKey, _urlKey);
                ticketDao.GetHelpTopicDeptManager(topic.Id, ref list);
                ticketDao.GetSlaViolations(topic.PastDueDays, topic.Id, ref list);
                ticketDao.GetCustomDateViolations(topic.PastDueDays, topic.Id, topic.Form.DueDateField, ref list);
                AddAdditionalRecipients(topic, ref list);
                topicList.violations.Add(list);
            }

            return topicList;
        }
Ejemplo n.º 33
0
        public HttpResponseMessage FetchNotification(NotificationViewModel objNotificationViewModel)
        {
            try
            {
                NotificationList             objNotificationList = new NotificationList();
                List <NotificationViewModel> objListNotification = new List <NotificationViewModel>();
                string mobileNumber        = objNotificationViewModel.MobileNumber;
                var    getNotificationList = (from notification in dbContext.Mandi_Notification
                                              orderby notification.Tr_Date descending
                                              select new
                {
                    notification.SerialNumber,
                    notification.MobileNumber,
                    notification.Message,
                    notification.Tr_Date
                }).Where(x => x.MobileNumber == mobileNumber).ToList();

                if (getNotificationList != null)
                {
                    foreach (var i in getNotificationList)
                    {
                        NotificationViewModel objNotificationViewModelList = new NotificationViewModel()
                        {
                            SerialNumber = i.SerialNumber,
                            MobileNumber = i.MobileNumber,
                            Message      = i.Message,
                            Tr_Date      = i.Tr_Date
                        };
                        objListNotification.Add(objNotificationViewModelList);
                    }

                    objNotificationList.Notifications = objListNotification;
                    return(Request.CreateResponse(HttpStatusCode.OK, objNotificationList));
                }
                objResponse.Message = "Notification not found";
                return(Request.CreateResponse(HttpStatusCode.OK, objResponse));
            }
            catch (Exception ex)
            {
                Log.Info(Convert.ToString(ex.InnerException));
                Log.Info(ex.Message);
                objCommonClasses.InsertExceptionDetails(ex, "UserController", "FetchNotification");
                return(Request.CreateErrorResponse(HttpStatusCode.ExpectationFailed, ex.Message));
            }
        }
Ejemplo n.º 34
0
 public NotificationsForm(NotificationList notificationList)
 {
     InitializeComponent();
     Translate();
 }
Ejemplo n.º 35
0
        private void InitialSetup() {
            if (Game != null) {
                IsLoadingSavingConnectionConfig = true;

                AssignEventHandlers();

                // Assume full access until we're told otherwise.
                Layer.Initialize(Parent, this);

                // I may move these events to within Layer, depends on the end of the restructure.
                Layer.LayerStarted += Layer_LayerOnline;
                Layer.LayerShutdown += Layer_LayerOffline;
                Layer.AccountPrivileges.AccountPrivilegeAdded += new AccountPrivilegeDictionary.AccountPrivilegeAlteredHandler(AccountPrivileges_AccountPrivilegeAdded);
                Layer.AccountPrivileges.AccountPrivilegeRemoved += new AccountPrivilegeDictionary.AccountPrivilegeAlteredHandler(AccountPrivileges_AccountPrivilegeRemoved);

                foreach (AccountPrivilege apPriv in Layer.AccountPrivileges) {
                    apPriv.AccountPrivilegesChanged += new AccountPrivilege.AccountPrivilegesChangedHandler(item_AccountPrivilegesChanged);
                }

                Privileges = new CPrivileges(CPrivileges.FullPrivilegesFlags);
                EventsLogging = new EventCaptures(this);
                Console = new ConnectionConsole(this);
                PunkbusterConsole = new PunkbusterConsole(this);
                ChatConsole = new ChatConsole(this);
                PluginConsole = new PluginConsole(this);
                MapGeometry = new MapGeometry(this);
                MapGeometry.MapZones.MapZoneAdded += new MapZoneDictionary.MapZoneAlteredHandler(MapZones_MapZoneAdded);
                MapGeometry.MapZones.MapZoneChanged += new MapZoneDictionary.MapZoneAlteredHandler(MapZones_MapZoneChanged);
                MapGeometry.MapZones.MapZoneRemoved += new MapZoneDictionary.MapZoneAlteredHandler(MapZones_MapZoneRemoved);

                if (CurrentServerInfo == null) {
                    CurrentServerInfo = new CServerInfo();
                }

                ListSettings = new ListsSettings(this);
                ServerSettings = new ServerSettings(this);
                PlayerListSettings = new PlayerListSettings();
                PlayerList = new PlayerDictionary();
                TeamNameList = new List<CTeamName>();
                MapListPool = new NotificationList<CMap>();
                ReservedSlotList = new NotificationList<string>();
                SpectatorList = new NotificationList<string>();
                Variables = new VariableDictionary();
                SV_Variables = new VariableDictionary();
                Reasons = new NotificationList<string>();
                FullVanillaBanList = new List<CBanInfo>();
                FullTextChatModerationList = new TextChatModerationDictionary();
                Weapons = new WeaponDictionary();
                Specializations = new SpecializationDictionary();

                if (Regex.Match(HostName, @"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$").Success == true) {
                    Variables.SetVariable("SERVER_COUNTRY", Parent.GetCountryName(HostName));
                    Variables.SetVariable("SERVER_COUNTRY_CODE", Parent.GetCountryCode(HostName));
                }
                else {
                    IPAddress ipServer = FrostbiteConnection.ResolveHostName(HostName);
                    Variables.SetVariable("SERVER_COUNTRY", Parent.GetCountryName(ipServer.ToString()));
                    Variables.SetVariable("SERVER_COUNTRY_CODE", Parent.GetCountryCode(ipServer.ToString()));
                }

                Console.Logging = Parent.OptionsSettings.ConsoleLogging;
                EventsLogging.Logging = Parent.OptionsSettings.EventsLogging;
                ChatConsole.Logging = Parent.OptionsSettings.ChatLogging;
                PluginConsole.Logging = Parent.OptionsSettings.PluginLogging;

                //this.m_blLoadingSavingConnectionConfig = true;

                if (CurrentServerInfo.GameMod == GameMods.None) {
                    ExecuteConnectionConfig(Game.GameType + ".def", 0, null, false);
                }
                else {
                    ExecuteConnectionConfig(Game.GameType + "." + CurrentServerInfo.GameMod + ".def", 0, null, false);
                }

                // load override global_vars.def
                ExecuteGlobalVarsConfig("global_vars.def", 0, null);

                ExecuteConnectionConfig("reasons.cfg", 0, null, false);

                lock (Parent) {
                    if (Username.Length == 0 || Parent.OptionsSettings.LayerHideLocalPlugins == false) {
                        CompilePlugins(Parent.OptionsSettings.PluginPermissions);
                    }
                }

                string configDirectoryPath = Path.Combine(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configs"), FileHostNamePort);
                string oldConfigFilePath = Path.Combine(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configs"), string.Format("{0}.cfg", FileHostNamePort));

                if (File.Exists(oldConfigFilePath) == false && Directory.Exists(configDirectoryPath) == true) {
                    string[] pluginConfigPaths = Directory.GetFiles(configDirectoryPath, "*.cfg");

                    if (Parent.OptionsSettings.UsePluginOldStyleLoad == true) {
                        foreach (string pluginConfigPath in pluginConfigPaths) {
                            ExecuteConnectionConfig(pluginConfigPath, 0, null, false);
                        }
                    }

                    BeginLoginSequence();

                    if (Parent.OptionsSettings.UsePluginOldStyleLoad == false) {
                        foreach (string pluginConfigPath in pluginConfigPaths) {
                            ExecuteConnectionConfig(pluginConfigPath, 0, null, true);
                        }
                    }

                    IsLoadingSavingConnectionConfig = false;
                }
                else {
                    if (Parent.OptionsSettings.UsePluginOldStyleLoad == true) {
                        ExecuteConnectionConfig(FileHostNamePort + ".cfg", 0, null, false);
                    }

                    BeginLoginSequence();

                    if (Parent.OptionsSettings.UsePluginOldStyleLoad == false) {
                        ExecuteConnectionConfig(FileHostNamePort + ".cfg", 0, null, true);
                    }

                    IsLoadingSavingConnectionConfig = false;
                    SaveConnectionConfig();

                    try
                    {
                        if (Directory.Exists(configDirectoryPath) == true && File.Exists(Path.Combine(configDirectoryPath, string.Format("{0}.cfg", FileHostNamePort))) == true)
                        {
                            try
                            {
                                if (File.Exists(oldConfigFilePath) == true) {
                                    File.Delete(oldConfigFilePath);
                                }
                            }
                            catch (Exception e) {
                                FrostbiteConnection.LogError("RemoveOldConfig", String.Empty, e);
                            }
                        }
                    }
                    catch (Exception e) {
                        FrostbiteConnection.LogError("MigrateConfig", "Error writing new config structure during migration", e);
                    }
                }

            }
        }
        private void LoadLiveNotifications(Action<NotificationList, Exception> callback)
        {
            var client = new StaticClient();

            client.GetAllNotificationsAsync(-1);
            client.GetAllNotificationsCompleted += (o, e) =>
            {
                //if (e.Error == null)
                //    SetupNotificationData(e.Result, true);
                if (e.Error == null)
                {
                    var notificationList = new NotificationList();
                    foreach (var item in e.Result)
                        notificationList.Add(item);

                    callback(notificationList, null);
                }
                else
                    callback(null, e.Error);
            };
        }
        private void SaveNotification()
        {
            vm.IsLoading = true;

            var saveOC = vm.Notifications.Where(t => t.HasChanges).ToObservableCollection();
            NotificationList deletedList = new NotificationList();
            vm.Notifications.Where(x => x.IsDeleted).ToList().ForEach(x=>
            {
                deletedList.Add(x);
            });

             App.Instance.StaticServiceData.SaveNotification(saveOC, (error) =>
            {
                if (error != null)
                    MessageBox.Show(AppResources.SaveFailed);
                else
                {
                    Model.Reminders.DeleteReminder(deletedList);
                    Model.Reminders.SetupReminders();
                }

                vm.IsLoading = false;

            });

            pivotContainer.SelectedIndex = 1;
            save.IsEnabled = vm.Notifications.HasItemsWithChanges() && vm.IsLoading == false;
        }
        private async void LoadCachedNotifications(Action<NotificationList, Exception> callback)
        {
            var retVal = new NotificationList();
            try
            {
                foreach (var item in await StorageUtility.ListItems(STATIC_NOTIFICATION_FOLDER, App.Instance.User.UserName))
                {

                    var staticType = await StorageUtility.RestoreItem<Notification>(STATIC_NOTIFICATION_FOLDER, item, App.Instance.User.UserName);
                    NotificationList.Add(staticType);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.ToString());
                //callback(null, ex);
            }
            
            //SetupNotificationData(retVal, false);
            //NotificationList = retVal;

            callback(NotificationList, null);
        }
        private async void LoadCachedNotifications(Action<NotificationList, Exception> callback)
        {
            var retVal = new NotificationList();
            try
            {
                foreach (var item in await StorageUtility.ListItems(STATIC_NOTIFICATION_FOLDER, ""))
                {

                    var staticType = await StorageUtility.RestoreItem<BMA.BusinessLogic.Notification>(STATIC_NOTIFICATION_FOLDER, item, "");
                    retVal.Add(staticType);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.ToString());
            }
            callback(retVal, null);
        }
Ejemplo n.º 40
0
        private void InitialSetup() {
            if (Game != null) {
                IsLoadingSavingConnectionConfig = true;

                AssignEventHandlers();

                // Assume full access until we're told otherwise.
                Layer.Initialize(Parent, this);

                // I may move these events to within Layer, depends on the end of the restructure.
                Layer.LayerOnline += new PRoConLayer.LayerEmptyParameterHandler(Layer_LayerOnline);
                Layer.LayerOffline += new PRoConLayer.LayerEmptyParameterHandler(Layer_LayerOffline);
                Layer.AccountPrivileges.AccountPrivilegeAdded += new AccountPrivilegeDictionary.AccountPrivilegeAlteredHandler(AccountPrivileges_AccountPrivilegeAdded);
                Layer.AccountPrivileges.AccountPrivilegeRemoved += new AccountPrivilegeDictionary.AccountPrivilegeAlteredHandler(AccountPrivileges_AccountPrivilegeRemoved);

                foreach (AccountPrivilege apPriv in Layer.AccountPrivileges) {
                    apPriv.AccountPrivilegesChanged += new AccountPrivilege.AccountPrivilegesChangedHandler(item_AccountPrivilegesChanged);
                }

                Privileges = new CPrivileges(CPrivileges.FullPrivilegesFlags);
                EventsLogging = new EventCaptures(this);
                Console = new ConnectionConsole(this);
                PunkbusterConsole = new PunkbusterConsole(this);
                ChatConsole = new ChatConsole(this);
                PluginConsole = new PluginConsole(this);
                MapGeometry = new MapGeometry(this);
                MapGeometry.MapZones.MapZoneAdded += new MapZoneDictionary.MapZoneAlteredHandler(MapZones_MapZoneAdded);
                MapGeometry.MapZones.MapZoneChanged += new MapZoneDictionary.MapZoneAlteredHandler(MapZones_MapZoneChanged);
                MapGeometry.MapZones.MapZoneRemoved += new MapZoneDictionary.MapZoneAlteredHandler(MapZones_MapZoneRemoved);

                if (CurrentServerInfo == null) {
                    CurrentServerInfo = new CServerInfo();
                }

                ListSettings = new ListsSettings(this);
                ServerSettings = new ServerSettings(this);
                PlayerListSettings = new PlayerListSettings();
                PlayerList = new PlayerDictionary();
                TeamNameList = new List<CTeamName>();
                MapListPool = new NotificationList<CMap>();
                ReservedSlotList = new NotificationList<string>();
                Variables = new VariableDictionary();
                SV_Variables = new VariableDictionary();
                Reasons = new NotificationList<string>();
                FullVanillaBanList = new List<CBanInfo>();
                FullTextChatModerationList = new TextChatModerationDictionary();
                Weapons = new WeaponDictionary();
                Specializations = new SpecializationDictionary();

                if (Regex.Match(HostName, @"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$").Success == true) {
                    Variables.SetVariable("SERVER_COUNTRY", Parent.GetCountryName(HostName));
                    Variables.SetVariable("SERVER_COUNTRY_CODE", Parent.GetCountryCode(HostName));
                }
                else {
                    IPAddress ipServer = FrostbiteConnection.ResolveHostName(HostName);
                    Variables.SetVariable("SERVER_COUNTRY", Parent.GetCountryName(ipServer.ToString()));
                    Variables.SetVariable("SERVER_COUNTRY_CODE", Parent.GetCountryCode(ipServer.ToString()));
                }

                Console.Logging = Parent.OptionsSettings.ConsoleLogging;
                EventsLogging.Logging = Parent.OptionsSettings.EventsLogging;
                ChatConsole.Logging = Parent.OptionsSettings.ChatLogging;
                PluginConsole.Logging = Parent.OptionsSettings.PluginLogging;

                //this.m_blLoadingSavingConnectionConfig = true;

                if (CurrentServerInfo.GameMod == GameMods.None) {
                    ExecuteConnectionConfig(Game.GameType + ".def", 0, null, false);
                }
                else {
                    ExecuteConnectionConfig(Game.GameType + "." + CurrentServerInfo.GameMod + ".def", 0, null, false);
                }

                // load override global_vars.def
                ExecuteGlobalVarsConfig("global_vars.def", 0, null);

                ExecuteConnectionConfig("reasons.cfg", 0, null, false);

                lock (Parent) {
                    if (Username.Length == 0 || Parent.OptionsSettings.LayerHideLocalPlugins == false) {
                        CompilePlugins(Parent.OptionsSettings.PluginPermissions);
                    }
                }

                if (Parent.OptionsSettings.UsePluginOldStyleLoad == true) {
                    ExecuteConnectionConfig(FileHostNamePort + ".cfg", 0, null, false);
                }

                //this.m_blLoadingSavingConnectionConfig = false;

                // this.ManuallyDisconnected = true;

                // this.ConnectionError = false;

                BeginLoginSequence();

                if (Parent.OptionsSettings.UsePluginOldStyleLoad == false) {
                    ExecuteConnectionConfig(FileHostNamePort + ".cfg", 0, null, true);
                }

                IsLoadingSavingConnectionConfig = false;
            }
        }