public ShowBookingDetailsController(IBookingVenue IBookingVenue, IVenue IVenue, ITotalbilling ITotalbilling, DatabaseContext context)
 {
     _IBookingVenue = IBookingVenue;
     _IVenue        = IVenue;
     _ITotalbilling = ITotalbilling;
     _context       = context;
 }
Exemple #2
0
 public Performance(string name, decimal basePrice, IVenue venue, DateTime startTime, PerformanceType type)
 {
     this.Name      = name;
     this.BasePrice = basePrice;
     this.Venue     = venue;
     this.ValidateVenue();
     this.StartTime = startTime;
     this.Type      = type;
     this.tickets   = new List <ITicket>();
 }
 public Performance(string name, decimal basePrice, IVenue venue, DateTime startTime, PerformanceType type)
 {
     this.Name = name;
     this.BasePrice = basePrice;
     this.Venue = venue;
     this.ValidateVenue();
     this.StartTime = startTime;
     this.Type = type;
     this.tickets = new List<ITicket>();
 }
        public void TestBookingConstructorNullClientRaisesArgumentNullException()
        {
            //instanciate mock objects
            Date   mockDate  = Substitute.For <Date>(12, 9, 2019);
            Time   mockTime  = Substitute.For <Time>(12, 54);
            IVenue mockVenue = Substitute.For <IVenue>();
            string ID        = "123";

            new Booking(ID, BookingType.SIMPLE,
                        null, mockDate, mockTime, mockVenue);
        }
        public void TestBookingConstructorNullTimeRaisesArgumentNullException()
        {
            //instanciate mock objects
            Client mockClient = Substitute.For <Client>("CliID", "CoName", "CoAddress");
            Date   mockDate   = Substitute.For <Date>(12, 9, 2019);
            IVenue mockVenue  = Substitute.For <IVenue>();
            string ID         = "123";

            new Booking(ID, BookingType.SIMPLE,
                        mockClient, mockDate, null, mockVenue);
        }
        public async Task <IResult <IVenue> > UpdateAsync(IVenue venue)
        {
            Throw.IfNull(venue, nameof(venue));
            _logger.LogMethodEnter();

            try
            {
                _logger.LogInformationObject("Venue update object.", venue);
                _logger.LogInformationObject("Venue update URI", _updateVenueUri);

                var venueJson = JsonConvert.SerializeObject(venue);

                var        content    = new StringContent(venueJson, Encoding.UTF8, "application/json");
                HttpClient httpClient = new HttpClient();
                httpClient.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", _settings.ApiKey);
                var response = await httpClient.PostAsync(_updateVenueUri, content);

                _logger.LogHttpResponseMessage("Venue add service http response", response);

                if (response.IsSuccessStatusCode)
                {
                    var json = await response.Content.ReadAsStringAsync();

                    _logger.LogInformationObject("Venue update service json response", json);

                    var venueResult = JsonConvert.DeserializeObject <Venue>(json);

                    return(Result.Ok <IVenue>(venueResult));
                }
                else
                {
                    return(Result.Fail <IVenue>("Venue update service unsuccessful http response"));
                }
            }

            catch (HttpRequestException hre)
            {
                _logger.LogException("Venue update service http request error", hre);
                return(Result.Fail <IVenue>("Venue update service http request error."));
            }
            catch (Exception e)
            {
                _logger.LogException("Venue update service unknown error.", e);

                return(Result.Fail <IVenue>("Venue update service unknown error."));
            }
            finally
            {
                _logger.LogMethodExit();
            }
        }
        public void TestBookingGetBookingType()
        {
            //instanciate mock objects
            Client mockClient = Substitute.For <Client>("CliID", "CoName", "CoAddress");
            Date   mockDate   = Substitute.For <Date>(12, 9, 2019);
            Time   mockTime   = Substitute.For <Time>(12, 54);
            IVenue mockVenue  = Substitute.For <IVenue>();
            string ID         = "123";

            Booking booking = new Booking(ID, BookingType.SIMPLE,
                                          mockClient, mockDate, mockTime, mockVenue);

            Assert.AreEqual(BookingType.SIMPLE, booking.GetBookingType());
        }
Exemple #8
0
        private void FindPerfomances(IVenue venue, DateTime searchDate)
        {
            var foundPerfomances = this.Performances.Where(p => p.Venue == venue && p.StartTime.CompareTo(searchDate) >= 0)
                                   .OrderBy(p => p.StartTime)
                                   .ThenByDescending(p => p.BasePrice)
                                   .ThenBy(p => p.Name);

            if (foundPerfomances.Any())
            {
                foreach (var peformance in foundPerfomances)
                {
                    this.Output.AppendFormat("--{0}", peformance.Name).AppendLine();
                }
            }
        }
        private void Fill(IVenue venue, IDataReader dataReader, string prefix = "")
        {
            var sqlDataReader = dataReader as SqlDataReader;

            venue.VenueID     = sqlDataReader.GetSafe <int>("VenueID");
            venue.Name        = sqlDataReader.GetSafe <string>($"{prefix}VenueName");
            venue.Description = sqlDataReader.GetSafe <string>($"{prefix}VenueDescription");
            venue.Street      = sqlDataReader.GetSafe <string>($"{prefix}VenueStreet");
            venue.City        = sqlDataReader.GetSafe <string>($"{prefix}VenueCity");
            venue.State       = sqlDataReader.GetSafe <string>($"{prefix}VenueState");
            venue.PostalCode  = sqlDataReader.GetSafe <string>($"{prefix}VenuePostalCode");
            venue.WebsiteUrl  = sqlDataReader.GetSafe <string>($"{prefix}VenueWebsiteUrl");
            venue.MapUrl      = sqlDataReader.GetSafe <string>($"{prefix}VenueMapUrl");
            venue.IsDeleted   = sqlDataReader.GetSafe <bool>($"{prefix}VenueIsDeleted");
        }
Exemple #10
0
        /// <summary>
        /// Initialize a new instance of <see cref="InputVenueMessageContent"/>.
        /// </summary>
        /// <param name="latitude">Latitude of the venue in degrees.</param>
        /// <param name="longitude">Longitude of the venue in degrees.</param>
        /// <param name="venue">Venue.</param>
        /// <exception cref="ArgumentNullException"></exception>
        public InputVenueMessageContent(float latitude, float longitude, IVenue venue)
        {
            if (venue == null)
            {
                throw new ArgumentNullException(nameof(venue));
            }

            Latitude        = latitude;
            Longitude       = longitude;
            Title           = venue.Title ?? throw new ArgumentNullException(nameof(venue.Title));
            Address         = venue.Address ?? throw new ArgumentNullException(nameof(venue.Address));
            FoursquareId    = venue.FoursquareId;
            FoursquareType  = venue.FoursquareType;
            GooglePlaceId   = venue.GooglePlaceId;
            GooglePlaceType = venue.GooglePlaceType;
        }
Exemple #11
0
        public static BookingCollection GetAllBookings()
        {
            BookingCollection bookings = new BookingCollection();

            try
            {
                using (DatabaseEntities context = new DatabaseEntities())
                {
                    IQueryable <Booking> query = from booking in context.Bookings
                                                 where (booking.confirmed == false)
                                                 select booking;

                    foreach (Booking booking in query)
                    {
                        Client client = GetClient(booking.clientID);
                        if (client == null)
                        {
                            throw new Exception("Null returned for client");
                        }
                        booking.client = client;

                        IActivity activity = GetActivity(booking.activityID);
                        if (activity == null)
                        {
                            throw new Exception("Null returned for activity");
                        }
                        booking.activity = activity;

                        IVenue venue = GetVenue(booking.venueID);
                        if (venue == null)
                        {
                            throw new Exception("Null returned for venue");
                        }
                        booking.venue = venue;
                        booking.SetDateAndTime();

                        bookings.Add(booking);
                    }
                }
            }
            catch (Exception exception)
            {
                ShowErrorMessage(exception);
            }

            return(bookings);
        }
        public void TestBookingGetExtras()
        {
            string returnValue = "Extras\nVenueName";
            //instanciate mock objects
            Client mockClient = Substitute.For <Client>("CliID", "CoName", "CoAddress");
            Date   mockDate   = Substitute.For <Date>(12, 9, 2019);
            Time   mockTime   = Substitute.For <Time>(12, 54);
            IVenue mockVenue  = Substitute.For <IVenue>();

            mockVenue.venueExtras.Returns(returnValue);
            string ID = "123";

            Booking booking = new Booking(ID, BookingType.SIMPLE,
                                          mockClient, mockDate, mockTime, mockVenue);

            Assert.IsTrue(booking.GetExtras().Contains("Extras"));
        }
        public void TestBookingUpdateCostsWithNoActivity()
        {
            //instanciate mock objects
            Client mockClient = Substitute.For <Client>("CliID", "CoName", "CoAddress");
            IVenue mockVenue  = Substitute.For <IVenue>();
            Date   mockDate   = Substitute.For <Date>(12, 9, 2019);
            Time   mockTime   = Substitute.For <Time>(12, 54);
            string ID         = "123";

            Booking booking = new Booking(ID, BookingType.SIMPLE,
                                          mockClient, mockDate, mockTime, mockVenue);

            mockVenue.cost.Returns(15);

            booking.UpdateCosts();
            Assert.AreEqual <decimal>(15, booking.cost);
        }
        public void BookingCollectionGetByIDReturnsNullOnNoBookingFound()
        {
            BookingCollection testCollection = new BookingCollection();

            Date   mockDate   = Substitute.For <Date>(12, 9, 2019);
            Time   mockTime   = Substitute.For <Time>(12, 54);
            IVenue mockVenue  = Substitute.For <IVenue>();
            Client mockClient = Substitute.For <Client>("123", "CompanyName1", "CompanyAddress1");

            Booking booking1 = new Booking("1", BookingType.FACILITATED,
                                           mockClient, mockDate, mockTime, mockVenue);
            Booking booking2 = new Booking("2", BookingType.FACILITATED,
                                           mockClient, mockDate, mockTime, mockVenue);

            testCollection.Add(booking1);
            testCollection.Add(booking2);

            Assert.AreEqual <Booking>(null, testCollection.GetByID("3"));
        }
        public void TestBookingConstructor()
        {
            //instanciate mock objects
            Client mockClient = Substitute.For <Client>("CliID", "CoName", "CoAddress");
            Date   mockDate   = Substitute.For <Date>(12, 9, 2019);
            Time   mockTime   = Substitute.For <Time>(12, 54);
            IVenue mockVenue  = Substitute.For <IVenue>();
            string ID         = "123";

            Booking booking = new Booking(ID, BookingType.SIMPLE,
                                          mockClient, mockDate, mockTime, mockVenue);

            Assert.AreEqual(ID, booking.bookingID);
            Assert.AreEqual(mockClient.GetID(), booking.client.GetID());
            Assert.AreEqual(mockDate.GetDatabaseFormat(), booking.GetDate().GetDatabaseFormat());
            Assert.AreEqual(mockTime.GetFormatted(), booking.GetTime().GetFormatted());
            Assert.AreEqual(mockVenue, booking.venue);
            Assert.AreEqual(BookingType.SIMPLE, booking.GetBookingType());
            Assert.AreEqual(0.0M, booking.cost);
        }
        public void TestBookingGetActivity()
        {
            //instanciate mock objects
            Client mockClient = Substitute.For <Client>("CliID", "CoName", "CoAddress");
            Date   mockDate   = Substitute.For <Date>(12, 9, 2019);
            Time   mockTime   = Substitute.For <Time>(12, 54);
            IVenue mockVenue  = Substitute.For <IVenue>();

            IActivity mockActivity = Substitute.For <Activity>();

            mockActivity.activityName = "testName";
            string ID = "123";

            Booking booking = new Booking(ID, BookingType.SIMPLE,
                                          mockClient, mockDate, mockTime, mockVenue);

            booking.activity = mockActivity;

            Assert.AreEqual(mockActivity.activityName, booking.GetActivity().activityName);
        }
        public void TestBookingUpdateTime()
        {
            //instanciate mock objects
            Client mockClient = Substitute.For <Client>("CliID", "CoName", "CoAddress");
            IVenue mockVenue  = Substitute.For <IVenue>();
            Date   mockDate   = Substitute.For <Date>(12, 9, 2019);
            Time   time       = new Time(12, 54);
            string ID         = "123";

            Booking booking = new Booking(ID, BookingType.SIMPLE,
                                          mockClient, mockDate, time, mockVenue);
            PrivateObject privateAccessor = new PrivateObject(time);

            int hour   = 12;
            int minute = 10;

            booking.UpdateTime(hour, minute);

            Assert.AreEqual(hour, privateAccessor.GetField("hour"));
            Assert.AreEqual(minute, privateAccessor.GetField("minute"));
        }
        public void BookingCollectionDeleteIDSuccess()
        {
            BookingCollection testCollection = new BookingCollection();

            Date   mockDate   = Substitute.For <Date>(12, 9, 2019);
            Time   mockTime   = Substitute.For <Time>(12, 54);
            IVenue mockVenue  = Substitute.For <IVenue>();
            Client mockClient = Substitute.For <Client>("123", "CompanyName1", "CompanyAddress1");

            Booking booking1 = new Booking("1", BookingType.FACILITATED,
                                           mockClient, mockDate, mockTime, mockVenue);
            Booking booking2 = new Booking("2", BookingType.FACILITATED,
                                           mockClient, mockDate, mockTime, mockVenue);

            testCollection.Add(booking1);
            testCollection.Add(booking2);

            testCollection.DeleteID("1");

            Assert.AreEqual <int>(1, testCollection.GetSize());
            Assert.IsTrue(testCollection.Contains(booking2));
        }
        public void TestBookingUpdateDate()
        {
            //instanciate mock objects
            Client mockClient = Substitute.For <Client>("CliID", "CoName", "CoAddress");
            Time   mockTime   = Substitute.For <Time>(12, 54);
            IVenue mockVenue  = Substitute.For <IVenue>();
            Date   date       = new Date(12, 9, 2019);
            string ID         = "123";

            Booking booking = new Booking(ID, BookingType.SIMPLE,
                                          mockClient, date, mockTime, mockVenue);
            PrivateObject privateAccessor = new PrivateObject(date);

            int day   = 12;
            int month = 10;
            int year  = 1234;

            booking.UpdateDate(day, month, year);
            Assert.AreEqual(day, privateAccessor.GetField("day"));
            Assert.AreEqual(month, privateAccessor.GetField("month"));
            Assert.AreEqual(year, privateAccessor.GetField("year"));
        }
        public void BookingCollectionGetClientBookingsReturnsEmptyList()
        {
            BookingCollection testCollection = new BookingCollection();

            Date   mockDate  = Substitute.For <Date>(12, 9, 2019);
            Time   mockTime  = Substitute.For <Time>(12, 54);
            IVenue mockVenue = Substitute.For <IVenue>();

            Client client1 = new Client("123", "CompanyName1", "CompanyAddress1");
            Client client2 = new Client("456", "CompanyName2", "CompanyAddress2");

            Booking booking1 = new Booking("1", BookingType.FACILITATED,
                                           client1, mockDate, mockTime, mockVenue);
            Booking booking2 = new Booking("2", BookingType.FACILITATED,
                                           client1, mockDate, mockTime, mockVenue);

            testCollection.Add(booking1);
            testCollection.Add(booking2);

            Assert.AreEqual(0, testCollection.GetClientBookings(client2).Count);
            Assert.IsInstanceOfType(testCollection.GetClientBookings(client1), typeof(BookingCollection));
        }
Exemple #21
0
 public Opportunity(
     int id,
     StudyMode studyMode,
     AttendanceMode attendanceMode,
     AttendancePattern attendancePattern,
     bool isDfe1619Funded,
     IDescriptionDate startDate,
     IVenue venue,
     string region,
     IDuration duration)
 {
     if (id <= 0)
     {
         throw new ArgumentOutOfRangeException(nameof(id));
     }
     if (!Enum.IsDefined(typeof(StudyMode), studyMode))
     {
         throw new ArgumentOutOfRangeException(nameof(studyMode));
     }
     if (!Enum.IsDefined(typeof(AttendanceMode), attendanceMode))
     {
         throw new ArgumentOutOfRangeException(nameof(attendanceMode));
     }
     if (!Enum.IsDefined(typeof(AttendancePattern), attendancePattern))
     {
         throw new ArgumentOutOfRangeException(nameof(attendancePattern));
     }
     Id                = id;
     StudyMode         = studyMode;
     AttendanceMode    = attendanceMode;
     AttendancePattern = attendancePattern;
     IsDfe1619Funded   = isDfe1619Funded;
     StartDate         = startDate ?? throw new ArgumentNullException(nameof(startDate));
     Venue             = venue;
     Region            = (venue == null && string.IsNullOrWhiteSpace(region)) ? _defaultRegion.ToSentenceCase() : region.ToSentenceCase();
     Duration          = duration ?? throw new ArgumentNullException(nameof(duration));
 }
Exemple #22
0
        public Booking(string ID, BookingType bookingType, Client client, Date date, Time time, IVenue venue)
        {
            //bookingType can never be null

            if (String.IsNullOrEmpty(ID))
            {
                throw new ArgumentNullException("Booking ID is null");
            }
            if (client == null)
            {
                throw new ArgumentNullException("Client is null");
            }
            if (date == null)
            {
                throw new ArgumentNullException("Date is null");
            }
            if (time == null)
            {
                throw new ArgumentNullException("Time is null");
            }
            if (venue == null)
            {
                throw new ArgumentNullException("Venue is null");
            }


            this.bookingTypeEnum = bookingType;
            this.client          = client;
            bookingDate          = date;
            bookingTime          = time;
            this.bookingID       = ID.Trim();
            this.venue           = venue;
            this.cost            = 0.0M;
            cost      = 0.0M;
            confirmed = false;
        }
Exemple #23
0
        /// <summary>
        /// Join the Venue and start participating.  AutoSend default devices if AutoSend == true
        /// </summary>
        public static void JoinVenue(IVenue venue)
        {
            lock(venue)
            {
                if (Conference.ActiveVenue != null)
                {
                    throw new InvalidOperationException("Cannot join a venue when already joined to a venue.");
                }

                if (venue.VenueData.VenueType == VenueType.Invalid)
                {
                    throw new ArgumentException("Can not join a venue that is of type Invalid");
                }

                // (pfb) Why are we checking this here?  When would it happen?
                if (rtpSession == null)
                {
                    // Do this first, or else the locks in the eventHandlers will throw, due to null argument
                    Conference.activeVenue = venue;

                    HookRtpEvents();

                    #region Start the RtpSession
                    try
                    {
                        // Pri3: Add casting of a Participant to an RtpParticipant
                        Participant p = Conference.LocalParticipant;
                        RtpParticipant rp = new RtpParticipant(p.Identifier, p.Name);
                        rp.Email = p.Email;
                        rp.Location = Conference.Location;
                        rp.Phone = p.Phone;

                        if (Conference.ReflectorEnabled && MSR.LST.Net.Utility.IsMulticast(venue.EndPoint))
                        {
                            IPEndPoint refEP;
                            IPAddress reflectorIP;
                            int unicastPort;

                            // Resolve the reflector address
                            try
                            {
                                reflectorIP = System.Net.Dns.GetHostEntry(
                                    Conference.ReflectorAddress).AddressList[0];
                            }
                            catch(Exception e)
                            {
                                throw new Exception("Reflector address not found - "
                                    + Conference.ReflectorAddress, e);
                            }

                            // Send a join request to the reflector and receive the RTP unicast port back
                            regClient = new RegistrarClient(reflectorIP, Conference.ReflectorJoinPort);
                            try
                            {
                                unicastPort = regClient.join(venue.EndPoint.Address, venue.EndPoint.Port);
                            }
                            catch(Exception e)
                            {
                                throw new Exception("Reflector join request failed", e);
                            }

                            refEP = new IPEndPoint(reflectorIP, unicastPort);

                            rtpSession = new RtpSession(venue.EndPoint, rp, true, true, refEP);
                        }
                        else
                        {
                            rtpSession = new RtpSession(venue.EndPoint, rp, true, true);
                        }
                    }
                    catch (System.Net.Sockets.SocketException se)
                    {
                        eventLog.WriteEntry(se.ToString(), EventLogEntryType.Error, 99);
                        LeaveVenue();

                        if (se.ErrorCode == 10013)
                        {
                            throw new Exception("A security error occurred connecting to the network "
                                + "(WSAEACCES).  Common causes of this error are; no network "
                                + "connection can be found, a change to the .NET Framework or "
                                + "Winsock without a reboot, or recently disconnecting from a "
                                + "VPN session which leaves Winsock in an indeterminate state.  "
                                + "Check your network connectivity or reboot your computer and try "
                                + "again.");
                        }
                        else
                        {
                            throw;
                        }
                    }
                    catch (Exception e)
                    {
                        eventLog.WriteEntry(e.ToString(), EventLogEntryType.Error, 99);
                        LeaveVenue();
                        throw;
                    }

                    #endregion
                }
            }
        }
Exemple #24
0
        public Opportunity(
            int id,
            StudyMode studyMode,
            AttendanceMode attendanceMode,
            AttendancePattern attendancePattern,
            bool isDfe1619Funded,
            IDescriptionDate startDate,
            IVenue venue,
            string region,
            IDuration duration,
            string price,
            string priceDescription,
            string endDate,
            string timetable,
            string langOfAssess,
            string langofIns,
            string places,
            string enquireto,
            string applyto,
            string applyfrom,
            string applyuntil,
            string applyuntildesc,
            string url,
            string[] a10,
            string[] items,
            ItemChoice[] itemsElementName,
            ApplicationAcceptedThroughoutYear applicationAcceptedThroughout,
            bool applicationAcceptedThroughoutSpecified


            )
        {
            if (id <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(id));
            }
            if (!Enum.IsDefined(typeof(StudyMode), studyMode))
            {
                throw new ArgumentOutOfRangeException(nameof(studyMode));
            }
            if (!Enum.IsDefined(typeof(AttendanceMode), attendanceMode))
            {
                throw new ArgumentOutOfRangeException(nameof(attendanceMode));
            }
            if (!Enum.IsDefined(typeof(AttendancePattern), attendancePattern))
            {
                throw new ArgumentOutOfRangeException(nameof(attendancePattern));
            }
            Id                = id;
            StudyMode         = studyMode;
            AttendanceMode    = attendanceMode;
            AttendancePattern = attendancePattern;
            IsDfe1619Funded   = isDfe1619Funded;
            StartDate         = startDate ?? throw new ArgumentNullException(nameof(startDate));
            Venue             = venue;
            Region            = (venue == null && string.IsNullOrWhiteSpace(region)) ? _defaultRegion.ToSentenceCase() : region.ToSentenceCase();
            Duration          = duration ?? throw new ArgumentNullException(nameof(duration));
            //OppDetails
            Price                 = price;
            PriceDescription      = priceDescription;// DFC-4427 Removed ToSentenceCase();
            EndDate               = endDate;
            Timetable             = timetable;
            LanguageOfAssessment  = langOfAssess;
            LanguageOfInstruction = langofIns;
            PlacesAvailable       = places;
            EnquireTo             = enquireto;
            ApplyTo               = applyto;
            ApplyFrom             = applyfrom;
            ApplyUntil            = applyuntil;
            ApplyUntilDescription = applyuntildesc;
            URL              = Uri.IsWellFormedUriString(url, UriKind.Absolute) ? url : string.Empty;
            A10              = a10;
            Items            = items;
            ItemsElementName = itemsElementName;
            ApplicationAcceptedThroughoutYear          = applicationAcceptedThroughout;
            ApplicationAcceptedThroughoutYearSpecified = applicationAcceptedThroughoutSpecified;
        }
 public Theatre(string name, decimal basePrice, IVenue venue, DateTime startTime)
     : base(name, basePrice, venue, startTime, PerformanceType.Theatre)
 {
 }
 public ShowBookingDetailsController(IBookingVenue IBookingVenue, IVenue IVenue, ITotalbilling ITotalbilling)
 {
     _IBookingVenue = IBookingVenue;
     _IVenue        = IVenue;
     _ITotalbilling = ITotalbilling;
 }
Exemple #27
0
        /// <summary>
        /// Join the Venue and start participating.  AutoSend default devices if AutoSend == true
        /// The optional password is used generate a symmetric encryption key...
        /// </summary>
        public static void JoinVenue(IVenue venue,String password)
        {
            foreach (Participant p in participants.Values) {
                //If there was an active warning on the local particpant at the time of the 
                //previous venue leave, it needs to be cleaned up.
                p.ThroughputWarnings.Clear();
            }

            lock(venue)
            {
                if (Conference.ActiveVenue != null)
                {
                    throw new InvalidOperationException(Strings.AlreadyJoinedToVenue);
                }

                if (venue.VenueData.VenueType == VenueType.Invalid)
                {
                    throw new ArgumentException(Strings.InvalidVenueType);
                }

                // (pfb) Why are we checking this here?  When would it happen?
                if (rtpSession == null)
                {
                    // Do this first, or else the locks in the eventHandlers will throw, due to null argument
                    Conference.activeVenue = venue;
                    
                    HookRtpEvents();

                    #region Start the RtpSession
                    try
                    {
                        // Pri3: Add casting of a Participant to an RtpParticipant
                        Participant p = Conference.LocalParticipant;
                        RtpParticipant rp = new RtpParticipant(p.Identifier, p.Name);
                        rp.Email = p.Email;
                        rp.Location = Conference.Location;
                        rp.Phone = p.Phone;

                        if (Conference.ReflectorEnabled && MSR.LST.Net.Utility.IsMulticast(venue.EndPoint))
                        {
                            IPEndPoint refEP;
                            IPAddress reflectorIP;
                            
                            // Resolve the reflector address
                            try
                            {
                                reflectorIP = System.Net.Dns.GetHostEntry(
                                    Conference.ReflectorAddress).AddressList[0];
                            }
                            catch(Exception e)
                            {
                                //Starting with .Net 4, passing an IP address to GetHostEntry excepts.  We'll check
                                //here to see if the user entered an IP address before rethowing.
                                if (!IPAddress.TryParse(Conference.ReflectorAddress, out reflectorIP)) {
                                    throw new Exception(string.Format(CultureInfo.CurrentCulture,
                                        Strings.ReflectorAddressNotFound, Conference.ReflectorAddress), e);
                                }
                            }

                            // andrew: reflector registation is now done via UDP, and has been
                            // pushed down into UDPListener...

                            refEP = new IPEndPoint(reflectorIP, ReflectorRtpPort);

                            StartDiagnosticMonitor(venue.Name, venue.EndPoint);
                            
                            rtpSession = new RtpSession(venue.EndPoint, rp, true, true, refEP);
                            if (password != null)
                            {
                                PacketTransform xform = MakePacketTransform(password);
                                rtpSession.PacketTransform = xform;
                            }
                        } 
                        else
                        {
                            StartDiagnosticMonitor(venue.Name, venue.EndPoint);
                            
                            rtpSession = new RtpSession(venue.EndPoint, rp, true, true);
                            if (password != null)
                            {
                                PacketTransform xform = MakePacketTransform(password);
                                rtpSession.PacketTransform = xform;
                            }
                        }

                        // andrew: notify RTP of our venue name; this is for diagnostic purposes
                        rtpSession.VenueName = venue.Name;

                    }
                    catch (System.Net.Sockets.SocketException se)
                    {
                        eventLog.WriteEntry(se.ToString(), EventLogEntryType.Error, 99);
                        LeaveVenue();

                        if (se.ErrorCode == 10013)
                        {
                            throw new Exception(Strings.SecurityErrorOccurredConnecting);
                        }
                        else
                        {
                            throw;
                        }
                    }
                    catch (Exception e)
                    {
                        eventLog.WriteEntry(e.ToString(), EventLogEntryType.Error, 99);                        
                        LeaveVenue();
                        throw;
                    }

                    #endregion
                }
            }
        }
            protected override void Build(XmlNode node)
            {
                artists = new List<IArtist>();

                this.id = GetValueForElement(node.SelectSingleNode(ID));
                this.url = GetValueForElement(node.SelectSingleNode(URL));
                this.ticketUrl = GetValueForElement(node.SelectSingleNode(TICKET_URL));
                this.date = GetValueForElement(node.SelectSingleNode(DATE));

                XmlNodeList artistNodes = node.SelectNodes(ARTISTS);

                foreach (XmlNode artistNode in artistNodes)
                {
                    artists.Add(new ArtistData(artistNode));
                }

                XmlNode venueNode = node.SelectSingleNode(VENUE);
                this.venue = new VenueData(venueNode);
            }
 public VenueController(IVenue IVenue, IHostingEnvironment hostingEnvironment)
 {
     _IVenue      = IVenue;
     _environment = hostingEnvironment;
 }
Exemple #30
0
        /// <summary>
        /// Leave the Venue and do all the cleanup work.
        /// </summary>
        public static void LeaveVenue()
        {
            if( Conference.ActiveVenue == null )
                throw new InvalidOperationException("Cannot exit a venue when not in a venue!");

            lock(Conference.ActiveVenue)
            {
                // So nothing new is created from the network
                UnhookRtpEvents();

                // Clean up participants + owned capabilities
                foreach(Participant p in new ArrayList(participants.Values))
                {
                    // A dependency on the local participant dictates that we should always have the local participant
                    //   in the venue.
                    if( p != Conference.localParticipant )
                        RemoveParticipant(p);
                }

                Debug.Assert(participants.Count == 1);

                // Dispose remaining capabilities (channels)
                foreach(ICapability ic in new ArrayList(capabilities.Values))
                {
                    DisposeCapability(ic);
                }

                Debug.Assert(capabilities.Count == 0);
                Debug.Assert(capabilityViewers.Count == 0);
                Debug.Assert(capabilitySenders.Count == 0);

                // Clear collection of form positions
                capabilityForms.Clear();

                // Leave the network
                if (rtpSession != null)
                {
                    rtpSession.Dispose();
                    rtpSession = null;
                }

                // Send a leave request to the reflector if the reflector was enabled when joining
                // the venue. Do this after leaving the Session, so that BYE packets have been sent
                // through reflector
                if (Conference.ReflectorEnabled && regClient != null)
                {
                    regClient.leave();
                }

                Conference.activeVenue = null;
            }
        }
 private void FindPerfomances(IVenue venue, DateTime searchDate)
 {
     var foundPerfomances = this.Performances.Where(p => p.Venue == venue && p.StartTime.CompareTo(searchDate) >= 0)
         .OrderBy(p => p.StartTime)
         .ThenByDescending(p => p.BasePrice)
             .ThenBy(p => p.Name);
     if (foundPerfomances.Any())
     {
         foreach (var peformance in foundPerfomances)
         {
             this.Output.AppendFormat("--{0}", peformance.Name).AppendLine();
         }
     }
 }
Exemple #32
0
        /// <summary>
        /// Leave the Venue and do all the cleanup work.
        /// </summary>
        public static void LeaveVenue()
        {
            if( Conference.ActiveVenue == null )
                throw new InvalidOperationException(Strings.CannotExitNotInVenue);

            lock(Conference.ActiveVenue)
            {
                StopDiagnosticMonitor();

                // So nothing new is created from the network
                UnhookRtpEvents();

                // Clean up participants + owned capabilities
                foreach(Participant p in new ArrayList(participants.Values))
                {
                    // A dependency on the local participant dictates that we should always have the local participant
                    //   in the venue.
                    if( p != Conference.localParticipant )
                        RemoveParticipant(p);
                }

                Debug.Assert(participants.Count == 1);

                // Dispose remaining capabilities (channels)
                foreach(ICapability ic in new ArrayList(capabilities.Values))
                {
                    DisposeCapability(ic);
                }

                Debug.Assert(capabilities.Count == 0);
                Debug.Assert(capabilityViewers.Count == 0);
                Debug.Assert(capabilitySenders.Count == 0);
                
                // Clear collection of form positions
                capabilityForms.Clear();

                // Leave the network
                if (rtpSession != null)
                {
                    rtpSession.Dispose();
                    rtpSession = null;
                }

                // andrew: termination of reflector sessions is now done in UdpListner.  This should happen
                // as a side-effect of disposing the RTP session.

                Conference.activeVenue = null;
            }

            originalWindowPositions.Clear();
            Utilities.SaveWindowPersistenceData(windowPersistenceData);
        }
 protected void InsertVenue(IVenue venue)
 {
     this.venues.Add(venue);
 }
Exemple #34
0
 public Theatre(string name, decimal basePrice, IVenue venue, DateTime startTime)
     : base(name, basePrice, venue, startTime, PerformanceType.Theatre)
 {
 }
Exemple #35
0
 public BookingController(IBookingVenue IBookingVenue, IVenue IVenue)
 {
     _IBookingVenue = IBookingVenue;
     _IVenue        = IVenue;
 }
Exemple #36
0
 protected void InsertVenue(IVenue venue)
 {
     this.venues.Add(venue);
 }
 public VenueDataController(IVenue IVenue)
 {
     _IVenue = IVenue;
 }
 private List<IPerformance> GetPerformancesForVenue(IVenue venue)
 {
     return base.Performances.Where(p => p.Venue == venue).ToList();
 }
Exemple #39
0
 public Concert(string name, decimal basePrice, IVenue venue, DateTime startTime)
     : base(name, basePrice, venue, startTime, PerformanceType.Concert)
 {
 }
 public AllVenueController(IVenue IVenue)
 {
     _IVenue = IVenue;
 }
 public Concert(string name, decimal basePrice, IVenue venue, DateTime startTime)
     : base(name, basePrice, venue, startTime, PerformanceType.Concert)
 {
 }
Exemple #42
0
 public static void JoinVenue(IVenue venue)
 {
     JoinVenue(venue, null);
 }