Beispiel #1
0
    /// <summary>
    /// getting orders from microservices
    /// </summary>
    /// <returns></returns>
    public DashboardStatistics GetDashboardStatistics()
    {
        DashboardStatistics statistics          = new DashboardStatistics();
        var statisticClient                     = DIContainer.Resolve <IOrderViewClient>();
        BaseResponseDto <OrderListDto> response = statisticClient.GetOrders(CurrentSiteName, 1, 1000).Result;

        if (response.Success)
        {
            statistics.OpenOrders   = GetOrdersBlock(response.Payload.Orders, OrderStatusConstants.OrderInProgress);
            statistics.OrdersPlaced = GetOrdersBlock(response.Payload.Orders, OrderStatusConstants.OrderPlaced);
        }
        return(statistics);
    }
Beispiel #2
0
 /// <summary>
 /// Get user details using services
 /// </summary>
 public void GetStatistics()
 {
     try
     {
         DashboardStatistics serviceCallResult = GetDashboardStatistics();
         BindSalespersonData();
         if (serviceCallResult != null)
         {
             BindOpenOrdersData(serviceCallResult.OpenOrders);
             BindOrdersPlacedData(serviceCallResult.OrdersPlaced);
         }
     }
     catch (Exception ex)
     {
         EventLogProvider.LogException("Getting Statistics", "GetStatistics", ex);
     }
 }
 /// <summary>
 /// Setups the dashboard statistics.
 /// </summary>
 private void SetupDashboardStatistics()
 {
     var list = new ListResult<DashboardStatistics>();
     var dashboardStatistics = new DashboardStatistics { PersonId = "47744", Status = "true", StatusChangedDate = DateTime.Now };
     var dashboardStatistics1 = new DashboardStatistics { PersonId = "960", Status = "true", StatusChangedDate = DateTime.Now };
     var dashboardStatistics2 = new DashboardStatistics { PersonId = "133", Status = "true", StatusChangedDate = DateTime.Now };
     list.Items.Add(dashboardStatistics);
     list.Items.Add(dashboardStatistics1);
     list.Items.Add(dashboardStatistics2);
     list.TotalResults = list.Items.Count;
     this.embarkationStatisticsRepository.Setup(a => a.GetDashboardStatisticsDetailAsync(It.IsAny<PersonStatusHistorySearchParameters>())).Returns(Task.FromResult(list));
 }
Beispiel #4
0
 /// <summary>
 /// Maps the crew information.
 /// </summary>
 /// <param name="crews">The crews.</param>
 /// <param name="staterooms">The staterooms.</param>
 /// <param name="item">The item.</param>
 /// <param name="personStatusHistory">The person status history.</param>
 /// <param name="crewTypePerson">The crew type person.</param>
 private static void MapCrewInformation(ListResult<Crewmember> crews, ListResult<Entity.Stateroom> staterooms, DashboardStatistics item, PersonStatusHistory personStatusHistory, PersonTypeEntity crewTypePerson)
 {
     var value = crews.Items.FirstOrDefault(a => a.CrewmemberId.Equals(item.PersonId));
     if (value != null)
     {
         personStatusHistory.PersonId = value.CrewmemberId;
         personStatusHistory.FirstName = value.PersonalDetail.FirstName;
         personStatusHistory.MiddleName = value.PersonalDetail.MiddleName;
         personStatusHistory.LastName = value.PersonalDetail.LastName;
         personStatusHistory.Gender = value.PersonalDetail.Gender == "1" ? "M" : value.PersonalDetail.Gender == "2" ? "F" : value.PersonalDetail.Gender;
         personStatusHistory.Age = value.PersonalDetail.Age.HasValue ? value.PersonalDetail.Age.Value : 0;
         personStatusHistory.LastEvent = item.Status;
         personStatusHistory.LastDateTime = item.StatusChangedDate;
         personStatusHistory.PersonTypeId = crewTypePerson.PersonTypeId;
         var stateroom = value.StateroomId != null && staterooms.Items != null ? staterooms.Items.FirstOrDefault(a => a.StateroomId == value.StateroomId) : null;
         personStatusHistory.Stateroom = stateroom != null ? stateroom.StateroomNumber : null;
     }
 }
Beispiel #5
0
        /// <summary>
        /// Maps the person information.
        /// </summary>
        /// <param name="personTypeList">The person type list.</param>
        /// <param name="crews">The crews.</param>
        /// <param name="staterooms">The staterooms.</param>
        /// <param name="item">The item.</param>
        /// <returns>
        /// Return instance of person status history
        /// </returns>
        private static PersonStatusHistory MapPersonInformation(ListResult<PersonTypeEntity> personTypeList, ListResult<Crewmember> crews, ListResult<Entity.Stateroom> staterooms, DashboardStatistics item)
        {
            var personStatusHistory = new PersonStatusHistory();
            var crewTypePerson = personTypeList.Items.FirstOrDefault(personType => personType.Name.Equals(CrewType, StringComparison.OrdinalIgnoreCase));

            if (crewTypePerson != null && crews != null)
            {
                MapCrewInformation(crews, staterooms, item, personStatusHistory, crewTypePerson);
            }

            return personStatusHistory;
        }
Beispiel #6
0
        /// <summary>
        /// Maps the person information.
        /// </summary>
        /// <param name="personTypeList">The person type list.</param>
        /// <param name="guests">The guests.</param>
        /// <param name="staterooms">The staterooms.</param>
        /// <param name="item">The item.</param>
        /// <returns>
        /// Return instance of person status history
        /// </returns>
        private static PersonStatusHistory MapPersonInformation(ListResult<PersonTypeEntity> personTypeList, ListResult<Guest> guests, ListResult<Entity.Stateroom> staterooms, DashboardStatistics item)
        {
            var personStatusHistory = new PersonStatusHistory();
            var guestTypePerson = personTypeList.Items.FirstOrDefault(personType => personType.Name.Equals(GuestType, StringComparison.OrdinalIgnoreCase));

            if (guestTypePerson != null && guests != null)
            {
                MapGuestInformation(guests, staterooms, item, personStatusHistory, guestTypePerson);
            }

            return personStatusHistory;
        }