Exemplo n.º 1
0
        public StepsQueryResult Handle(StepQuery query)
        {
            try
            {
                List <FIL.Contracts.Models.CreateEventV1.StepModel> stepModels = new List <FIL.Contracts.Models.CreateEventV1.StepModel>();
                short  currentStep = 1;
                string completedSteps = "", eventName = "";
                var    eventStatus  = FIL.Contracts.Enums.EventStatus.None;
                var    stepDetails  = _stepDetailsRepository.GetAll().Where(s => s.MasterEventTypeId == query.MasterEventType && s.IsEnabled);
                var    steps        = _stepRepository.GetByIds(stepDetails.Select(s => s.StepId).ToList());
                var    zoomUser     = _zoomUserRepository.GetAllByEventId(query.EventId);
                var    eventDetails = _eventDetailRepository.GetByEvent(query.EventId).FirstOrDefault();
                if (query.EventId != 0)
                {
                    var @event = _eventRepository.Get(query.EventId);
                    eventStatus = @event.EventStatusId == 0 ? @event.IsEnabled ? Contracts.Enums.EventStatus.Published : Contracts.Enums.EventStatus.Draft : @event.EventStatusId;
                    eventName   = @event.Name;
                    var eventStepsMapping = _eventStepDetailRepository.GetByEventId(query.EventId);
                    if (eventStepsMapping != null)
                    {
                        completedSteps = eventStepsMapping.CompletedStep;
                        currentStep    = _stepProvider.GetCurrentStep(completedSteps);
                    }
                }
                foreach (var step in steps)
                {
                    FIL.Contracts.Models.CreateEventV1.StepModel stepModel = new Contracts.Models.CreateEventV1.StepModel();
                    var currentStepDetail = stepDetails.Where(s => s.StepId == step.Id).FirstOrDefault();
                    stepModel.Name        = step.Name;
                    stepModel.Description = currentStepDetail.Description;
                    stepModel.Icon        = currentStepDetail.Icon;
                    stepModel.Slug        = currentStepDetail.Slug;
                    stepModel.IsEnabled   = currentStepDetail.IsEnabled;
                    stepModel.SortOrder   = currentStepDetail.SortOrder;
                    stepModel.StepId      = currentStepDetail.Id;
                    stepModels.Add(stepModel);
                }
                stepModels = stepModels.OrderBy(s => s.SortOrder).ToList();

                return(new StepsQueryResult
                {
                    CompletedStep = completedSteps,
                    EventFrequencyType = eventDetails != null ? eventDetails.EventFrequencyType : Contracts.Enums.EventFrequencyType.None,
                    CurrentStep = currentStep,
                    EventId = query.EventId,
                    StepModel = stepModels,
                    EventName = eventName,
                    EventStatus = eventStatus,
                    IsTransacted = zoomUser.Any() ? true : false,
                    Success = true
                });
            }
            catch (Exception e)
            {
                return(new StepsQueryResult {
                });
            }
        }
Exemplo n.º 2
0
 public MyFeelsQueryResult Handle(MyFeelsQuery query)
 {
     try
     {
         var events = new List <FIL.Contracts.Models.Creator.MyFeel>();
         if (query.IsApproveModerateScreen)
         {
             events = _eventRepository.GetApproveModerateFeels(query.IsActive).Take(500).ToList();
         }
         else
         {
             events = _eventRepository.GetMyFeels(query.CreatedBy).Take(500).ToList();
         }
         var steps       = _stepRepository.GetAll().ToList();
         var stepDetails = _stepDetailsRepository.GetAll().Where(s => s.MasterEventTypeId == Contracts.Enums.MasterEventType.Online && s.IsEnabled).OrderBy(s => s.Id).ToList();
         foreach (var currentFeel in events)
         {
             if (currentFeel.EventEndDateTime < DateTime.UtcNow)
             {
                 currentFeel.IsPastEvent = true;
             }
             if (!String.IsNullOrEmpty(currentFeel.TimeZoneOffset))
             {
                 currentFeel.EventStartDateTime = _localTimeZoneConvertProvider.ConvertToLocal(currentFeel.EventStartDateTime, currentFeel.TimeZoneOffset);
                 currentFeel.EventEndDateTime   = _localTimeZoneConvertProvider.ConvertToLocal(currentFeel.EventEndDateTime, currentFeel.TimeZoneOffset);
             }
             currentFeel.EventStartDateTimeString = currentFeel.EventStartDateTime.ToString("MMM dd, yyyy HH:mm").ToUpper();
             currentFeel.EventEndDateTimeString   = currentFeel.EventEndDateTime.ToString("MMM dd, yyyy HH:mm").ToUpper();
             if (currentFeel.CompletedStep != null && !query.IsApproveModerateScreen)
             {
                 var currentStep = GetCurrentTab(stepDetails, currentFeel.CompletedStep);
                 if (currentStep != 0)
                 {
                     currentFeel.CurrentStep           = steps.Where(s => s.Id == stepDetails.Where(p => p.Id == currentStep).FirstOrDefault().StepId).FirstOrDefault().Name;
                     currentFeel.IsShowExclamationIcon = true;
                 }
             }
         }
         return(new MyFeelsQueryResult
         {
             MyFeels = events,
             Success = true
         });
     }
     catch (Exception e)
     {
         return(new MyFeelsQueryResult
         {
             Success = true
         });
     }
 }
Exemplo n.º 3
0
        public short GetCurrentStep(string CompletedStep)
        {
            List <int> completedStepList = CompletedStep.Split(',').Select(int.Parse).OrderByDescending(s => s).ToList();
            var        stepDetails       = _stepDetailsRepository.GetAll().Select(s => s.MasterEventTypeId == Contracts.Enums.MasterEventType.Online && s.IsEnabled);

            if (completedStepList.Count() == stepDetails.Count())
            {
                return(1);
            }
            else
            {
                return((short)Enumerable.Range(1, stepDetails.Count()).Except(completedStepList).FirstOrDefault());
            }
        }