コード例 #1
0
        public int CreateRoomReservation(MpRoomReservationDto roomReservation)
        {
            string token = ApiLogin();
            var    roomReservationPageId = _configurationWrapper.GetConfigIntValue("RoomReservationPageId");

            var reservationDictionary = new Dictionary <string, object>();

            reservationDictionary.Add("Event_ID", roomReservation.EventId);
            reservationDictionary.Add("Room_ID", roomReservation.RoomId);

            if (roomReservation.RoomLayoutId != 0)
            {
                reservationDictionary.Add("Room_Layout_ID", roomReservation.RoomLayoutId);
            }

            reservationDictionary.Add("Notes", roomReservation.Notes);
            reservationDictionary.Add("Hidden", roomReservation.Hidden);
            reservationDictionary.Add("Cancelled", roomReservation.Cancelled);
            reservationDictionary.Add("Capacity", roomReservation.Capacity);
            reservationDictionary.Add("Label", roomReservation.Label);
            reservationDictionary.Add("Allow_Checkin", roomReservation.CheckinAllowed);
            reservationDictionary.Add("Volunteers", roomReservation.Volunteers);

            try
            {
                return(_ministryPlatformService.CreateRecord(roomReservationPageId, reservationDictionary, token, true));
            }
            catch (Exception e)
            {
                var msg = string.Format("Error creating Room Reservation, roomReservation: {0}", roomReservation);
                _logger.Error(msg, e);
                throw (new ApplicationException(msg, e));
            }
        }
コード例 #2
0
        public void UpdateRoomReservation(MpRoomReservationDto roomReservation)
        {
            string token = ApiLogin();
            var    roomReservationPageId = _configurationWrapper.GetConfigIntValue("RoomReservationPageId");
            var    reservationDictionary = new Dictionary <string, object>
            {
                { "Event_ID", roomReservation.EventId },
                { "Event_Room_ID", roomReservation.EventRoomId },
                { "Room_ID", roomReservation.RoomId },
                { "Notes", roomReservation.Notes },
                { "Hidden", roomReservation.Hidden },
                { "Cancelled", roomReservation.Cancelled },
                { "Capacity", roomReservation.Capacity },
                { "Label", roomReservation.Label },
                { "Allow_Checkin", roomReservation.CheckinAllowed },
                { "Volunteers", roomReservation.Volunteers }
            };

            if (roomReservation.RoomLayoutId != 0)
            {
                reservationDictionary.Add("Room_Layout_ID", roomReservation.RoomLayoutId);
            }

            try
            {
                _ministryPlatformService.UpdateRecord(roomReservationPageId, reservationDictionary, token);
            }
            catch (Exception e)
            {
                var msg = string.Format("Error updating Room Reservation, roomReservation: {0}", roomReservation);
                _logger.Error(msg, e);
                throw (new ApplicationException(msg, e));
            }
        }
コード例 #3
0
        public void DeleteRoomReservation(MpRoomReservationDto roomReservation)
        {
            string token = ApiLogin();
            // TODO: Move this to a classwide variable to support testing, dry it up, etc
            var roomReservationPageId = _configurationWrapper.GetConfigIntValue("RoomReservationPageId");

            _ministryPlatformService.DeleteRecord(roomReservationPageId, roomReservation.EventRoomId, null, token);
        }
コード例 #4
0
        private int AddRoom(int eventId, EventRoomDto room, string token)
        {
            var roomReservation = new MpRoomReservationDto();

            roomReservation.Cancelled      = false;
            roomReservation.EventId        = eventId;
            roomReservation.Hidden         = room.Hidden;
            roomReservation.Notes          = room.Notes;
            roomReservation.RoomId         = room.RoomId;
            roomReservation.RoomLayoutId   = room.LayoutId;
            roomReservation.Capacity       = room.Capacity;
            roomReservation.Label          = room.Label;
            roomReservation.CheckinAllowed = room.CheckinAllowed;
            roomReservation.Volunteers     = room.Volunteers;
            return(_roomService.CreateRoomReservation(roomReservation));
        }