Ejemplo n.º 1
0
        public void SchedulingSqlRepository_GetAll_ShouldBeOk()
        {
            //Ação
            var result = _repository.GetAll();

            //Verifica
            result.Should().NotBeNull();
        }
Ejemplo n.º 2
0
        public async Task <IEnumerable <HoraryViewModel> > GetHoraryDrop(int type, int fieldItem, DateTime date, int horaryId)
        {
            List <HoraryViewModel> list = new List <HoraryViewModel>();
            var result = await _schedulingRepository.GetAll();


            if (type == 1)
            {
                int dayOfWeek = (int)date.DayOfWeek;

                var horary = await _horaryRepository.GetAll();

                foreach (var item in horary.Where(p => p.FieldItemId == fieldItem && p.DayWeek == dayOfWeek && p.State == true && p.Active == true))
                {
                    Scheduling scheduling = result.Where(p => p.Date == date && p.HoraryType == HoraryType.Default && p.HoraryId == item.Id).FirstOrDefault();

                    if (scheduling == null)
                    {
                        var newItem = new HoraryViewModel {
                            Hour = item.Hour, Id = item.Id
                        };
                        list.Add(newItem);
                    }
                    else
                    {
                        if (horaryId == scheduling.HoraryId)
                        {
                            var newItem = new HoraryViewModel {
                                Hour = item.Hour, Id = item.Id
                            };
                            list.Add(newItem);
                        }
                    }
                }
            }
            else
            {
                var horaryExtra = await _horaryExtraRepository.GetAll();

                foreach (var item in horaryExtra.Where(p => p.FieldItemId == fieldItem && p.Date == date))
                {
                    Scheduling scheduling = result.Where(p => p.Date == date && p.HoraryType == HoraryType.Extra && p.HoraryId == item.Id).FirstOrDefault();

                    if (scheduling == null)
                    {
                        var newItem = new HoraryViewModel {
                            Hour = item.Hour, Id = item.Id
                        };
                        list.Add(newItem);
                    }
                    else
                    {
                        if (horaryId == scheduling.HoraryId)
                        {
                            var newItem = new HoraryViewModel {
                                Hour = item.Hour, Id = item.Id
                            };
                            list.Add(newItem);
                        }
                    }
                }
            }

            return(list.OrderBy(p => p.Hour).Select(_mapper.Map <HoraryViewModel>));
        }
Ejemplo n.º 3
0
 public IEnumerable <Scheduling> GetAll()
 {
     return(_repository.GetAll());
 }
Ejemplo n.º 4
0
        public async Task <IEnumerable <SchedulingViewModel> > GetAll()
        {
            var result = await _schedulingRepository.GetAll();

            return(result.Select(_mapper.Map <SchedulingViewModel>));
        }
        public void SchedulingRepository_GetAll_ShouldBeOk()
        {
            var result = _repository.GetAll();

            result.Should().NotBeNull();
        }
Ejemplo n.º 6
0
 public IQueryable <Scheduling> GetSchedulings()
 {
     return(_schedulingRepository.GetAll());
 }