Ejemplo n.º 1
0
        /// <summary>
        /// Maps alert details
        /// </summary>
        /// <param name="alert">alert detail</param>
        /// <returns>Entities alertType data</returns>
        internal static Entities.AlertType MapAlertDetails(Entity.Alert alert)
        {
            var objAlertType = new Entities.AlertType();
            if (alert != null)
            {
                objAlertType.Description = alert.Description;
                objAlertType.TypeId = Convert.ToString(alert.TypeId, CultureInfo.InvariantCulture);

                objAlertType.IsOverride = alert.IsOverride;
                objAlertType.ExpiryDate = alert.ExpiryDate;
                objAlertType.DueDate = alert.StartDate;
                objAlertType.IsSoundEnable = alert.IsSoundEnable;
                objAlertType.AddedDate = alert.AddedDate;
                objAlertType.MessageFrom = alert.MessageFrom;
                objAlertType.DepartmentId = alert.CrewDepartmentId;

                if (alert.IsTemplate)
                {
                    objAlertType.TemplateName = alert.TemplateName;
                    objAlertType.OrderCode = alert.Rank;
                    objAlertType.IsTemplate = alert.IsTemplate;
                }

                if (alert.AlertId != null)
                {
                    objAlertType.ModifiedBy = alert.UserName;
                    objAlertType.AlertTypeId = alert.AlertId;
                }
                else
                {
                    objAlertType.AddedBy = alert.UserName;
                }

                objAlertType.ApplicationId = Convert.ToString(DIContainer.Instance.Resolve<IApplicationSettings>().ApplicationId, CultureInfo.CurrentCulture);
                objAlertType.IsMessage = alert.IsMessage;

                if (alert.Persons.Count > 0)
                {
                    var shipId = DIContainer.Instance.Resolve<IApplicationSettings>().ShipId;
                    foreach (var personAlertData in alert.Persons)
                    {
                        var objPersonAlert = new Entities.Alert();
                        objPersonAlert.PersonId = personAlertData.PersonId;
                        objPersonAlert.PersonTypeId = personAlertData.PersonTypeId;
                        objPersonAlert.ShipId = shipId;
                        objPersonAlert.VoyageId = personAlertData.VoyageId;
                        objPersonAlert.StatusId = personAlertData.StatusId;
                        objAlertType.Alerts.Add(objPersonAlert);
                    }
                }
            }

            return objAlertType;
        }
Ejemplo n.º 2
0
        public async Task RetrieveAlertAsync()
        {
            var alertType = new Entities.AlertType { AddedBy = "Ryan", AddedDate = DateTime.Now, AlertTypeId = "1", AllowCheckIn = true, ApplicationId = "2", DepartmentId = "2", Description = "agree", DueDate = DateTime.Now, ExpiryDate = DateTime.Now, IsDenyAshore = true, IsDenyBoarding = true, IsMessage = true, IsOverride = true, IsSoundEnable = true, IsTemplate = true, MessageFrom = "trott", ModifiedBy = "jhone", OrderCode = "33", TemplateName = "edd", TypeId = "3" };
            alertType.Alerts.Add(new Entities.Alert { AlertTypeId = "1", PersonId = "1", PersonTypeId = "1", ShipId = "1", StatusId = "1", VoyageId = "1" });
            alertType.Alerts.Add(new Entities.Alert { AlertTypeId = "2", PersonId = "2", PersonTypeId = "2", ShipId = "2", StatusId = "2", VoyageId = "2" });
            alertType.Alerts.Add(new Entities.Alert { AlertTypeId = "3", PersonId = "3", PersonTypeId = "3", ShipId = "3", StatusId = "3", VoyageId = "3" });
            this.alertType.Items.Add(alertType);

            this.guest.Items.Add(new Guest { AddedDate = DateTime.Now, LastModifiedDate = DateTime.Now, GuestId = "2", SecurityPhotoAddress = "http://devweb03.decurtis.com/ImagingMediaService/MediaItems/200092", PersonalDetail = new PersonalDetail { Birthdate = DateTime.Now, CitizenshipCountryId = "2", DepartmentId = "2", DepartmentPOC = "2", Email = "*****@*****.**", FirstName = "bryan", Gender = "M", LastName = "Finch", MaritalStatus = "Single", MiddleName = "trot", Note = "agree", Occupation = "eng", PassportNo = "3432", Title = "Mr", VisitorCardId = "3" }, ReservationDetail = new Reservation { DocumentNumber = "43", DocumentTypeId = "4", LoyaltyLevelTypeId = "4", ReservationId = "4", ReservationNumber = "4423", StateroomId = "2" } });

            this.crewmember.Items.Add(new Crewmember { AddedDate = DateTime.Now, CrewmemberId = "32", DepartmentId = "2", CrewmemberStatusId = "rayana", ShipId = "2", CrewmemberTypeId = "3", EmployeeNo = "2", IsActive = true, LastModifiedDate = DateTime.Now, RoleId = "2", SecurityPhotoAddress = "http://gei.webv/btzay/izazh/nccmu.aspx", SourceId = "2", StateroomId = "2", UserAccountId = "3", EmbarkDetail = new EmbarkDetail { AshoreDate = DateTime.Now, OnboardDate = DateTime.Now }, PersonalDetail = new PersonalDetail { Birthdate = DateTime.Now, CitizenshipCountryId = "2", DepartmentId = "2", DepartmentPOC = "2", Email = "*****@*****.**", FirstName = "bryan", Gender = "M", LastName = "Finch", MaritalStatus = "Single", MiddleName = "trot", Note = "agree", Occupation = "eng", PassportNo = "3432", Title = "Mr", VisitorCardId = "3" } });

            this.entitiesVisitorList.Items.Add(new Entities.Visitor { VisitorTypeId = "98", AddedDate = DateTime.Now, CompanyContactNumber = "324234234", CompanyName = "fdf", LastModifiedDate = DateTime.Now, SecurityPhotoAddress = "hhttp://gei.webv/btzay/izazh/nccmu.aspx", VisitorId = "98", PersonalDetail = new PersonalDetail { Title = "Mr.", FirstName = "John", LastName = "Dennis", CitizenshipCountryId = "97", Gender = "W5XYT7YP", MaritalStatus = "JSJNNTF", Occupation = "B", Email = "*****@*****.**", Birthdate = DateTime.Now.Date } });

            var stateRooms = new ListResult<Stateroom>();
            stateRooms.Items.Add(new Stateroom { StateroomId = "1", Capacity = 2, StateroomCategoryId = "2", StateroomNumber = "2" });

            this.guestRepository.Setup(mockItem => mockItem.RetrieveGuests(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsNotNull<string>(), It.IsAny<int?>(), It.IsAny<int?>())).Returns(Task.FromResult(this.guest));

            this.crewRepository.Setup(mockItem => mockItem.RetrieveCrewmembersList(It.IsNotNull<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<int?>(), It.IsAny<int?>(), It.IsNotNull<CrewDepths>())).Returns(Task.FromResult(this.crewmember));

            this.shipRepository.Setup(mockItem => mockItem.GetStateroomListAsync(It.IsNotNull<string>(), It.IsNotNull<string>(), It.IsAny<string>(), It.IsAny<int?>(), It.IsAny<int?>())).Returns(Task.FromResult(stateRooms));

            this.visitorRepository.Setup(mockItem => mockItem.RetrieveVisitors(It.IsNotNull<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<int?>(), It.IsAny<int?>(), It.IsNotNull<VisitorDepths>(), It.IsAny<string>())).Returns(Task.FromResult(this.entitiesVisitorList));

            this.alertRepository.Setup(mockItem => mockItem.GetAsync(It.IsNotNull<string>(), It.IsNotNull<string>())).Returns(Task.FromResult(this.alertType.Items.FirstOrDefault()));

            var alert = await this.alertData.GetAsync("2", "Deny Ashore");
            Assert.IsNotNull(alert);
        }
        /// <summary>
        /// Setups the search request.
        /// </summary>
        private void SetupSearchRequest()
        {
            filter = new AlertListRequestSearchParameters
            {
                AlertTypeIds = "1",
                ApplicationId = "1",
                DenyAshore = false,
                DenyBoarding = false,
                IsAlert = false,
                IsExpiredAlert = false,
                IsMessage = true,
                IsRecentAlert = true,
                IsTemplate = false,
                MaxResults = 50,
                OrderBy = null,
                PageNumber = 1,
                PersonIds = "1",
                ShipId = "5",
                ShipTime = DateTime.Now,
                TypeIds = "1"
            };

            var alertType = new Entities.AlertType
            {
                AddedBy = "Ryan",
                AddedDate = DateTime.Now,
                AlertTypeId = "1",
                AllowCheckIn = true,
                ApplicationId = "2",
                DepartmentId = "2",
                Description = "agree",
                DueDate = DateTime.Now,
                ExpiryDate = DateTime.Now,
                IsDenyAshore = true,
                IsDenyBoarding = true,
                IsMessage = true,
                IsOverride = true,
                IsSoundEnable = true,
                IsTemplate = false,
                MessageFrom = "trott",
                ModifiedBy = "jhone",
                OrderCode = "33",
                TemplateName = "edd",
                TypeId = "3"
            };
            alertType.Alerts.Add(new Entities.Alert { PersonId = "1" });
            alertTypes = new Entities.AlertTypeCollection
            {
                alertType
            };
        }
Ejemplo n.º 4
0
        public async Task PutAlertAsyncTest()
        {
            var alertType = new Entities.AlertType { AddedBy = "Ryan", AddedDate = DateTime.Now, AlertTypeId = "1", AllowCheckIn = true, ApplicationId = "2", DepartmentId = "2", Description = "agree", DueDate = DateTime.Now, ExpiryDate = DateTime.Now, IsDenyAshore = true, IsDenyBoarding = true, IsMessage = true, IsOverride = true, IsSoundEnable = true, IsTemplate = true, MessageFrom = "trott", ModifiedBy = "jhone", OrderCode = "33", TemplateName = "edd", TypeId = "3" };
            alertType.Alerts.Add(new Entities.Alert { AlertTypeId = "1", PersonId = "1", PersonTypeId = "1", ShipId = "1", StatusId = "1", VoyageId = "1" });
            alertType.Alerts.Add(new Entities.Alert { AlertTypeId = "2", PersonId = "2", PersonTypeId = "2", ShipId = "2", StatusId = "2", VoyageId = "2" });
            alertType.Alerts.Add(new Entities.Alert { AlertTypeId = "3", PersonId = "3", PersonTypeId = "3", ShipId = "3", StatusId = "3", VoyageId = "3" });
            this.alertType.Items.Add(alertType);

            var alert = new Alert
            { UserName = "******", TypeId = 1, TemplateName = "abc", AddedDate = DateTime.Now, AlertId = "1", CreatedBy = "deny", CrewDepartmentId = "3", Description = "onboard", ExpiryDate = DateTime.Now, IsActive = true, IsAllowOnboardCheckIn = true, IsMessage = true, IsOverride = true, IsSoundEnable = true, IsTemplate = true, MessageFrom = "abc", Name = "Deny Onboard", PersonCount = 3, Rank = "3", StartDate = DateTime.Now, Status = "yes" };

            var alertItems = this.alertType.Items.Where(item => item.AlertTypeId.Equals(AlertIds)).FirstOrDefault();
            alertItems.DepartmentId = "3";

            this.alertType.AssignItems(new List<Entities.AlertType> { alertItems });

            await this.alertData.UpdateAsync(AlertIds, alert);

            var alertUpdatedItems = this.alertType.Items.Where(item => item.AlertTypeId.Equals(AlertIds)).FirstOrDefault();

            Assert.IsNotNull(alertUpdatedItems);
            Assert.AreEqual("3", alertUpdatedItems.DepartmentId);
        }