Example #1
0
        private void btnGuestUpdate_Click(object sender, EventArgs e)
        {
            Guest    guestToEdit = _guestService.Get(Int16.Parse(dgvGuests.SelectedRows[0].Cells[0].Value.ToString()));
            frmGuest frmGuest    = new frmGuest(guestToEdit);

            frmGuest.ShowDialog();
            LoadGuests();
        }
Example #2
0
        public HttpResponseMessage Get(HttpRequestMessage request, int id)
        {
            try
            {
                GuestDTO data  = service.Get(id);
                var      guest = new GuestModel();

                if (data != null)
                {
                    guest = mapper.Map <GuestDTO, GuestModel>(data);
                    return(request.CreateResponse(HttpStatusCode.OK, guest));
                }

                return(request.CreateResponse(HttpStatusCode.NotFound));
            }
            catch (Exception exception)
            {
                return(request.CreateResponse(HttpStatusCode.BadRequest));
            }
        }
Example #3
0
        public void UpdateInfo()
        {
            lblRoomName.Text = room.Name;

            // Odada kalan var mı?
            List <Reservation> rList = _reservationService.GetReservationsIfCheckedIn(room.Id);

            // Odada bugün için rezervasyon var mı?

            // Oda hizmete açık mı?
            if (room.IsActive == 1)
            {
                // Odada kalan biri varsa
                if (rList.Count > 0)
                {
                    Guest guest = _guestService.Get(rList[0].GuestId);
                    this.BackColor        = Color.DarkGreen;
                    lblInfo.Text          = guest.FirstName + " " + guest.LastName[0] + ".";
                    lblRoomName.ForeColor = Color.FromArgb(255, 255, 255, 255);
                    lblInfo.ForeColor     = Color.FromArgb(255, 255, 255, 255);
                }
                // Yoksa
                else
                {
                    rList = _reservationService.GetReservationsOfToday(room.Id);

                    // Bugün için giriş yapacak bir rezervasyon var mı?
                    if (rList.Count > 0)
                    {
                        this.BackColor        = Color.CadetBlue;
                        lblInfo.Text          = "";
                        lblRoomName.ForeColor = Color.FromArgb(255, 255, 255, 255);
                        lblInfo.ForeColor     = Color.FromArgb(255, 255, 255, 255);
                    }
                    // Yoksa
                    else
                    {
                        this.BackColor        = SystemColors.ControlDark;
                        lblInfo.Text          = "";
                        lblRoomName.ForeColor = Color.FromArgb(255, 0, 0, 0);
                        lblInfo.ForeColor     = Color.FromArgb(255, 0, 0, 0);
                    }
                }
            }
            else
            {
                this.BackColor = Color.Black;

                lblInfo.Text = "Kullanım Dışı";
            }
        }
Example #4
0
        public HttpResponseMessage Get(HttpRequestMessage request, int id)
        {
            GuestDTO guest = guestService.Get(id);

            if (guest != null)
            {
                var returnGuest = toModelMapper.Map <GuestDTO, GuestModel>(guestService.Get(id));
                return(request.CreateResponse(HttpStatusCode.OK, returnGuest));
            }

            return(request.CreateResponse(HttpStatusCode.NotFound));
        }
Example #5
0
        public void UpdateInfo()
        {
            List <Reservation> rList = _reservationService.GetReservationsByRoomId(_roomId);



            foreach (Reservation r in rList)
            {
                if (r.CheckIn != null && r.CheckOut == null && r.Status == 2)
                {
                    guest       = _guestService.Get(r.GuestId);
                    reservation = r;
                }
            }


            if (reservation == null)
            {
                foreach (Reservation r in rList)
                {
                    if (r.Status == 1 && r.RoomId == _roomId && r.CheckIn == null && r.CheckOut == null)
                    {
                        guest       = _guestService.Get(r.GuestId);
                        reservation = r;
                    }
                }
            }

            if (reservation == null)
            {
                btnCheckInOut.Enabled = false;
                btnCheckInOut.Visible = false;
            }
            else
            {
                lblFirstName.Text = guest.FirstName;
                lblLastName.Text  = guest.LastName;
                lblID.Text        = guest.TCIdNo;

                if (reservation.Status == 2)
                {
                    btnCheckInOut.Text = "Check Out Yap";
                }
            }


            var robotDogs = (from d in _reservationService.GetAll()
                             join f in _guestService.GetAll()
                             on d.GuestId equals f.Id
                             where d.RoomId == _roomId
                             select new
            {
                d.Id,
                f.FirstName,
                f.LastName,
                d.DateIn,
                d.DateOut,
                d.CheckIn,
                d.CheckOut,
                d.Status,
            }
                             ).ToList();

            dgwShowSelectedReservations.DataSource            = robotDogs;
            dgwShowSelectedReservations.Columns[0].Visible    = false;
            dgwShowSelectedReservations.Columns[1].HeaderText = "Ad";
            dgwShowSelectedReservations.Columns[2].HeaderText = "Soyd";
            dgwShowSelectedReservations.Columns[3].HeaderText = "Rezervasyon Başlangıç";
            dgwShowSelectedReservations.Columns[4].HeaderText = "Rezervasyon Bitiş";
            dgwShowSelectedReservations.Columns[5].HeaderText = "Check In";
            dgwShowSelectedReservations.Columns[6].HeaderText = "Check Out";
            dgwShowSelectedReservations.Columns[7].HeaderText = "Durum";

            //    dgwShowSelectedReservations.Columns[0].Visible = false;
            //    dgwShowSelectedReservations.Columns[2].Visible = false;
            //    dgwShowSelectedReservations.Columns[6].Visible = false;
            //    dgwShowSelectedReservations.Columns[7].Visible = false;
            //    foreach(DataGridViewRow dgvr in dgwShowSelectedReservations.Rows)
            //    {
            //        Guest g = _guestService.Get(Convert.ToInt32(dgvr.Cells[1].Value));

            //        dgvr.Cells[1].ValueType;

            //    }
        }
Example #6
0
 public async Task <IActionResult> Get()
 {
     return(Ok(await _guestService.Get()));
 }