Ejemplo n.º 1
0
        private void ExecuteInsertRSMethod(object obj)
        {
            if (SelectedService == null)
            {
                MessageBox.Show("추가할 서비스를 선택해주세요.");
                return;
            }
            List <ReservedServiceVo> list = _reservedServiceRepository.GetReservedServices(SelectedRes.ResNum);

            if (list.FirstOrDefault(x => (x.SerId == SelectedService.ServiceId)) != null)
            {
                MessageBox.Show("이미 존재하는 서비스입니다.");
                return;
            }
            ReservedServiceVo rv = new ReservedServiceVo();

            rv.ResNum = SelectedRes.ResNum;
            rv.SerId  = SelectedService.ServiceId;
            ServiceVo s           = ServiceList.Single(x => x.ServiceId == rv.SerId);
            ushort    serviceTime = s.ServiceTime;

            if (HasReservations(SelectedRes.StylistId, SelectedRes.EndAt, SelectedRes.EndAt + new TimeSpan(serviceTime / 60, serviceTime % 60, 0)))
            {
                MessageBox.Show("이미 예약이 존재한 시간대입니다.");
                return;
            }
            _reservedServiceRepository.InsertReservedService(rv);
            ServiceCommands.Add(new DataCommandViewModel <ReservedServiceVo>(SelectedService.ServiceName, new Command(RemoveRS), rv));
            TimeSpan ts = new TimeSpan(SelectedService.ServiceTime / 60, SelectedService.ServiceTime % 60, 0);

            SelectedRes.EndAt = SelectedRes.EndAt + ts;
            _reservationRepository.UpdateReservation(SelectedRes);
        }
Ejemplo n.º 2
0
        public void Upload()
        {
            _resRep.InsertReservation(ReservationVo);
            uint id = _resRep.GetRecentNum();

            foreach (ServiceVo service in ResServices)
            {
                ReservedServiceVo reservedService = new ReservedServiceVo();
                reservedService.ResNum = id;
                reservedService.SerId  = service.ServiceId;
                _reservedServiceRepository.InsertReservedService(reservedService);
            }
        }