Beispiel #1
0
        public override Notification Map(NotificationEntity objectToMap)
        {
            var notificationMedia = _notificationMediumRepository.GetAll().ToList();
            NotificationMedium notificationMedium = notificationMedia.FirstOrDefault(nm => nm.Id == objectToMap.NotificationMediumId);

            if (notificationMedium != null)
            {
                switch (notificationMedium.Medium)
                {
                case NotificationMediumType.EmailNotification:
                    return(MapNotificationEmail(objectToMap));

                case NotificationMediumType.PhoneNotification:
                case NotificationMediumType.SmsNotification:
                case NotificationMediumType.FaxNotification:
                    return(MapNotificationPhone(objectToMap));
                }
            }
            else
            {
                throw new NotSupportedException();
                // Log that the notification medium was not found...
            }
            var notification = new Notification(objectToMap.NotificationId);

            _notificationPopulator.Populate(objectToMap, notification);
            return(notification);
        }
Beispiel #2
0
        public override NotificationType Map(NotificationTypeEntity objectToMap)
        {
            var notificationMedia = _notificationMediumRepository.GetAll().ToList();
            NotificationMedium notificationMedium = notificationMedia.FirstOrDefault(nm => nm.Id == objectToMap.NotificationMediumId);

            return(new NotificationType(objectToMap.NotificationTypeId)
            {
                DataRecorderMetaData =
                    new DataRecorderMetaData(0, objectToMap.DateCreated, objectToMap.DateModified)
                {
                    DataRecorderModifier =
                        objectToMap.ModifiedByOrgRoleUserId != null
                                               ? new OrganizationRoleUser(objectToMap.ModifiedByOrgRoleUserId.Value)
                                               : null
                },
                Description = objectToMap.Description,
                IsServiceEnabled = objectToMap.IsServiceEnabled,
                IsQueuingEnabled = objectToMap.IsQueuingEnabled,
                NotificationTypeAlias = objectToMap.NotificationTypeNameAlias,
                NotificationTypeName = objectToMap.NotificationTypeName,
                NumberOfAttempts = objectToMap.NoOfAttempts,
                IsActive = objectToMap.IsActive,
                NotificationMedium = notificationMedium,
                AllowTemplateCreation = objectToMap.AllowTemplateCreation
            });
        }
Beispiel #3
0
        public void CanSaveExistingBasicNotification()
        {
            NotificationMedium notificationMedium = _notificationMedia.First(nt => !nt.Medium.ToLower().Contains("email") && !nt.Medium.ToLower().Contains("phone"));
            Notification       domainObject       = GetNotificationToSave(_notificationTypes.First(), notificationMedium);

            var savedNotification   = _notificationRepository.Save(domainObject);
            var updatedNotification = _notificationRepository.Save(savedNotification);

            Assert.AreNotEqual(0, savedNotification.Id);
            Assert.AreEqual(savedNotification.Id, updatedNotification.Id);
        }
Beispiel #4
0
        public void FillSecondPage(string empNumber, string empTitle, string empFistName, string empMInitial,
                                   string empLastName, string empWorkNum, string empMobileNum, string empWorkExt, string empWorkHr,
                                   string empRdo, string empUnitAssignment, string empRPDept, string empRPStreetAddress,
                                   string empRPAddressline, string empRPCity, string empRPState, string empRPZip,
                                   string empRPISFirstName, string empRPISMInitial, string empRPISLastName, string empRPISPhoneNo,
                                   string sameAsReportingParty, string ReportingFN, string ReportingMI, string ReportingLN, string notifySupervisor,
                                   string supervisorFN, string supervisorMI, string supervisorLN, string dateNotified, string timeHH, string timeMM,
                                   string timeAmPm, string notificationMean)
        {
            waitForPageUntilElementIsVisible(By.Id("input_5_94"), 8);

            ENumber.EnterText(empNumber);
            ETitle.EnterText(empTitle);
            EFirstName.EnterText(empFistName);
            EMiddleInitial.EnterText(empMInitial);
            ELastName.EnterText(empLastName);
            EWorkNo.EnterText(empWorkNum);
            EMobileNo.EnterText(empMobileNum);
            EWorkExt.EnterText(empWorkExt);
            EWorkHr.EnterText(empWorkHr);
            ERDO.EnterText(empRdo);
            EUnitAssignement.EnterText(empUnitAssignment);
            RPDept.EnterText(empRPDept);
            //RPHeadFN.EnterText("Andrew");
            //RPHeadMI.EnterText("T");
            //RPHeadLN.EnterText("Tran");
            RPStreetAddress.EnterText(empRPStreetAddress);
            RPAddressLine2.EnterText(empRPAddressline);
            RPCity.EnterText(empRPCity);
            RPState.EnterText(empRPState);
            RPZip.EnterText(empRPZip);

            RPISFirstName.EnterText(empRPISFirstName);
            RPISMInitial.EnterText(empRPISMInitial);
            RPISLastName.EnterText(empRPISLastName);
            RPISPhoneNumber.EnterText(empRPISPhoneNo);

            if (sameAsReportingParty.ToLower() == "yes")
            {
                SameAsReportingPartyCb.Clicks();
            }
            else
            {
                ReportingPartyFN.EnterText(ReportingFN);
                ReportingPartyMI.EnterText(ReportingMI);
                ReportingPartyLN.EnterText(ReportingLN);
            }
            if (notifySupervisor.ToLower() == "yes")
            {
                NotifySuperVisorYes.Clicks();
                NotifedSupervisorFN.EnterText(supervisorFN);
                NotifedSupervisorMI.EnterText(supervisorMI);
                NotifedSupervisorLN.EnterText(supervisorLN);
                NotifedSupervisorDate.EnterText(dateNotified);
                NotifedSupervisorHH.EnterText(timeHH);
                NotifedSupervisorMM.EnterText(timeMM);
                NotifedSupervisorAM.EnterText(timeAmPm);
                NotificationMedium.EnterText(notificationMean);
            }
            else if (notifySupervisor.ToLower() == "no")
            {
                NotifySuperVisorNo.Clicks();
            }
            else
            {
                NotifySuperVisorDontKnow.Clicks();
            }



            SPBtnNext.Clicks();
        }
Beispiel #5
0
        /// <summary>
        /// The add new schedule to a survey.
        /// </summary>
        /// <param name="surveyId">
        /// The survey id.
        /// </param>
        /// <param name="name">
        /// The name.
        /// </param>
        /// <param name="description">
        /// The description.
        /// </param>
        /// <returns>
        /// The <see cref="SchedulerRoot"/>.
        /// </returns>
        public SchedulerRoot AddInvitation(long surveyId, string name, string description, NotificationMedium medium)
        {
            if (surveyId < 1)
            {
                return(_result.ErrorToObject(new SchedulerRoot(), "Invalid parameter(s)"));
            }

            if (medium == NotificationMedium.App)
            {
                return(_result.ErrorToObject(new SchedulerRoot(), "App medium is invalid in invitation!"));
            }

            var requestArg = JsonConvert.SerializeObject(
                new { ScheduleName = name, ScheduleDescription = description, SurveyID = surveyId, Medium = medium });

            requestArg = JsonConvert.SerializeObject(new { Data = requestArg });
            Task <Result> x = RequestHandler.SendRequestAsync(
                string.Empty,
                "api/UserSchedule/AddNewSchedule",
                HttpMethod.Post,
                RouteStyle.Rpc,
                requestArg);

            x.Wait();

            return(x.Result.JsonToObject(new SchedulerRoot(), "Schedules"));
        }
        /// <summary>
        /// The add survey notification.
        /// </summary>
        /// <param name="surveyId">
        /// The survey id.
        /// </param>
        /// <param name="name">
        /// The name.
        /// </param>
        /// <param name="description">
        /// The description.
        /// </param>
        /// <param name="medium">
        /// The medium.
        /// </param>
        /// <returns>
        /// The <see cref="NotificationRoot"/>.
        /// </returns>
        public NotificationRoot AddSurveyNotification(long surveyId, string name, string description, NotificationMedium medium)
        {
            if (surveyId < 1 || string.IsNullOrEmpty(name) || string.IsNullOrEmpty(description))
            {
                return(_result.ErrorToObject(new NotificationRoot(), "Invalid parameter(s)"));
            }

            var requestArg = JsonConvert.SerializeObject(
                new { Name = name, Description = description, SurveyID = surveyId, Medium = medium, JobType = 2 });

            requestArg = JsonConvert.SerializeObject(new { Data = requestArg });

            Task <Result> x = RequestHandler.SendRequestAsync(
                string.Empty,
                "api/UserNotification/AddNewNotification",
                HttpMethod.Post,
                RouteStyle.Rpc,
                requestArg);

            x.Wait();

            return(x.Result.JsonToObject(new NotificationRoot(), "Notifications"));
        }
Beispiel #7
0
 private Notification GetNotificationToSave(NotificationType notificationType, NotificationMedium notificationMedium)
 {
     return(new Notification
     {
         NotificationDate = DateTime.Now,
         NotificationType = notificationType,
         NotificationMedium = notificationMedium,
         UserId = 1,
         DateCreated = DateTime.Now,
         Source = "Notification occurred",
         RequestedBy = 1
     });
 }