コード例 #1
1
        public async Task CreateNewMeeting()
        {
            try
            {
                Microsoft.Graph.Event evt = new Microsoft.Graph.Event();

                Location location = new Location();
                location.DisplayName = tbLocation.Text;

                ItemBody body = new ItemBody();
                body.Content = tbBody.Text;
                body.ContentType = BodyType.Html;

                List<Attendee> attendees = new List<Attendee>();
                Attendee attendee = new Attendee();
                EmailAddress email = new EmailAddress();
                email.Address = tbToRecipients.Text;
                attendee.EmailAddress = email;
                attendee.Type = AttendeeType.Required;
                attendees.Add(attendee);

                evt.Subject = tbSubject.Text;
                evt.Body = body;
                evt.Location = location;
                evt.Attendees = attendees;

                DateTimeTimeZone dtStart = new DateTimeTimeZone();
                dtStart.TimeZone = TimeZoneInfo.Local.Id;
                DateTime dts = dtpStartDate.Value.Date + dtpStartTime.Value.TimeOfDay;
                dtStart.DateTime = dts.ToString();
                
                DateTimeTimeZone dtEnd = new DateTimeTimeZone();
                dtEnd.TimeZone = TimeZoneInfo.Local.Id;
                DateTime dte = dtpEndDate.Value.Date + dtpEndTime.Value.TimeOfDay;
                dtEnd.DateTime = dte.ToString();

                evt.Start = dtStart;
                evt.End = dtEnd;
                
                // log the request info
                sdklogger.Log(graphClient.Me.Events.Request().GetHttpRequestMessage().Headers.ToString());
                sdklogger.Log(graphClient.Me.Events.Request().GetHttpRequestMessage().RequestUri.ToString());

                // send the new message
                var createdEvent = await graphClient.Me.Events.Request().AddAsync(evt);

                // log the send and associated id
                sdklogger.Log("Meeting Sent : Id = " + createdEvent.Id);
            }
            catch (Exception ex)
            {
                sdklogger.Log("NewMeetingSend Failed: " + ex.Message);
                sdklogger.Log(ex.Message);
            }
            finally
            {
                // close the form
                Close();
            }
        }
コード例 #2
0
ファイル: Attendee.cs プロジェクト: cronofy/cronofy-csharp
 /// <summary>
 /// Determines whether the specified <see cref="Cronofy.Attendee"/> is
 /// equal to the current <see cref="Cronofy.Attendee"/>.
 /// </summary>
 /// <param name="other">
 /// The <see cref="Cronofy.Attendee"/> to compare with the current
 /// <see cref="Cronofy.Attendee"/>.
 /// </param>
 /// <returns>
 /// <c>true</c> if the specified <see cref="Cronofy.Attendee"/> is equal
 /// to the current <see cref="Cronofy.Attendee"/>; otherwise,
 /// <c>false</c>.
 /// </returns>
 public bool Equals(Attendee other)
 {
     return other != null
         && this.Email == other.Email
         && this.DisplayName == other.DisplayName
         && this.Status == other.Status;
 }
コード例 #3
0
        public void Reading()
        {
            var attendee = new Attendee(new ContentLine("ATTENDEE;MEMBER=\"mailto:[email protected]\",\"mailto:dev@org\":mailto:[email protected]"));
            Assert.AreEqual("*****@*****.**", attendee.MailAddress.Address);
            Assert.AreEqual("*****@*****.**", attendee.Membership.First().Address);
            Assert.AreEqual("dev@org", attendee.Membership.Last().Address);

            attendee = new Attendee(new ContentLine("ATTENDEE;DELEGATED-FROM=\"mailto:[email protected]\":mailto:[email protected]"));
            Assert.AreEqual("*****@*****.**", attendee.MailAddress.Address);
            Assert.AreEqual("*****@*****.**", attendee.DelegatedFrom.First().Address);

            attendee = new Attendee(new ContentLine("ATTENDEE;DELEGATED-TO=\"mailto:[email protected]\",\"mailto:[email protected]\":mailto:[email protected]"));
            Assert.AreEqual("*****@*****.**", attendee.MailAddress.Address);
            Assert.AreEqual("*****@*****.**", attendee.DelegatedTo.First().Address);
            Assert.AreEqual("*****@*****.**", attendee.DelegatedTo.Last().Address);

            attendee = new Attendee(new ContentLine("ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=TENTATIVE;CN=Henry Cabot:mailto:[email protected]"));
            Assert.AreEqual("*****@*****.**", attendee.MailAddress.Address);
            Assert.AreEqual("Henry Cabot", attendee.MailAddress.DisplayName);
            Assert.AreEqual(UserRole.Required, attendee.UserRole);
            Assert.AreEqual(ParticipationStatus.Tentative, attendee.ParticipationStatus);

            attendee = new Attendee(new ContentLine("ATTENDEE;SENT-BY=\"mailto:[email protected]\";CN=John Smith:mailto:[email protected]"));
            Assert.AreEqual("*****@*****.**", attendee.MailAddress.Address);
            Assert.AreEqual("John Smith", attendee.MailAddress.DisplayName);
            Assert.AreEqual("*****@*****.**", attendee.SentBy.Address);

            attendee = new Attendee(new ContentLine("ATTENDEE;CUTYPE=ROOM:mailto:[email protected]"));
            Assert.AreEqual("*****@*****.**", attendee.MailAddress.Address);
            Assert.AreEqual(UserType.Room, attendee.UserType);
        }
コード例 #4
0
ファイル: AttendeeTest.cs プロジェクト: kingzog/4vlib
 public void VAttendee_NewAttendee()
 {
     string email = "mailto:[email protected]";
     CalendarStatus partstat = CalendarStatus.CONFIRMED;
     Attendee actual = new Attendee(new Uri(email)) { ParticipantStatus = partstat };
     Assert.AreEqual(email, actual.Value.AbsoluteUri);
     Assert.AreEqual(partstat, actual.ParticipantStatus);
 }
コード例 #5
0
        Attendee WriteRead(string ics)
        {
            var attendee = new Attendee(new ContentLine(ics));
            var s = new StringWriter();
            attendee.WriteIcs(IcsWriter.Create(s));

            return new Attendee(new ContentLine(s.ToString()));
        }
コード例 #6
0
ファイル: AttendeeTest.cs プロジェクト: kingzog/4vlib
 public void VAttendee_DisplayName()
 {
     Attendee target = new Attendee(null);
     string expected = "Harry Truman";
     string actual;
     target.DisplayName = expected;
     actual = target.DisplayName;
     Assert.AreEqual(expected, actual);
 }
コード例 #7
0
ファイル: AttendeeTest.cs プロジェクト: kingzog/4vlib
 public void VAttendee_ExpectType()
 {
     Attendee target = new Attendee(null);
     ExpectType expected = ExpectType.IMMEDIATE;
     ExpectType actual;
     target.Expect = expected;
     actual = target.Expect;
     Assert.AreEqual(expected, actual);
 }
コード例 #8
0
ファイル: AttendeeTest.cs プロジェクト: kingzog/4vlib
 public void VAttendee_ParticipantStatus()
 {
     Attendee target = new Attendee(null);
     CalendarStatus expected = CalendarStatus.DECLINED;
     CalendarStatus actual;
     target.ParticipantStatus = expected;
     actual = target.ParticipantStatus;
     Assert.AreEqual(expected, actual);
 }
コード例 #9
0
ファイル: AttendeeTest.cs プロジェクト: kingzog/4vlib
 public void VAttendee_Value()
 {
     Attendee target = new Attendee(null);
     Uri expected = new Uri("mailto:[email protected]");
     Uri actual;
     target.Value = expected;
     actual = target.Value;
     Assert.AreEqual(expected, actual);
 }
コード例 #10
0
 private static int AddAttendee(MyEventsContext context, int eventDefinitionId)
 {
     var attendee = new Attendee();
     attendee.EventDefinitionId = eventDefinitionId;
     attendee.Name = Guid.NewGuid().ToString();
     context.Attendees.Add(attendee);
     context.SaveChanges();
     return attendee.AttendeeId;
 }
コード例 #11
0
ファイル: AttendeeTests.cs プロジェクト: kburnell/PickAWinner
 public void GetAll_ShouldReturn_NonNull_ListOf_AttendeeDTO()
 {
     //Act
     IAttendee attendee = new Attendee();
     IList<AttendeeDTO> attendeeDtos = attendee.GetAll();
     //Assert
     attendeeDtos.ShouldNotBeNull("Expected AttendeeDTO List Not To Be Null");
     Assert.IsInstanceOfType(attendeeDtos, typeof (IList<AttendeeDTO>));
 }
コード例 #12
0
ファイル: AttendeeTest.cs プロジェクト: kingzog/4vlib
 public void VAttendee_Rsvp()
 {
     Attendee target = new Attendee(null);
     bool expected = true;
     bool actual;
     target.Rsvp = expected;
     actual = target.Rsvp;
     Assert.AreEqual(expected, actual);
     Assert.AreEqual("YES", target.GetParameter("RSVP"));
 }
コード例 #13
0
ファイル: AttendeeTests.cs プロジェクト: kburnell/PickAWinner
 public void SetHasWon_ShouldReturn_NonNull_Boolean()
 {
     using (new TransactionScope()) {
         //Act
         IAttendee attendee = new Attendee();
         bool returnSuccess = attendee.SetHasWon(1);
         //Assert
         Assert.IsInstanceOfType(returnSuccess, typeof (bool));
     }
 }
コード例 #14
0
        public AttendeeViewModel(Attendee attendee)
        {
            this.Email = attendee.EmailAddress.Address;

            if (attendee.Status != null)
                this.Response = attendee.Status.Response;

            this.AttendeeType = attendee.Type;

        }
コード例 #15
0
ファイル: AttendeeTest.cs プロジェクト: kingzog/4vlib
 public void VAttendee_Constructor()
 {
     Attendee target = new Attendee(null);
     Assert.IsNotNull(target);
     Assert.IsNull(target.Value);
     Assert.AreEqual(CalendarStatus.UNKNOWN, target.ParticipantStatus);
     Assert.AreEqual(CuType.UNKNOWN, target.CalendarUserType);
     Assert.AreEqual(ExpectType.UNKNOWN, target.Expect);
     Assert.AreEqual("NO", target.GetParameter("RSVP"));
 }
        public ActionResult Regist(Attendee attendee)
        {
            if (ModelState.IsValid)
            {
                db.Attendees.Add(attendee);
                db.SaveChanges();
                return RedirectToAction("Complete");
            }

            return View(attendee);
        }
コード例 #17
0
ファイル: Class1.cs プロジェクト: gbhaynes3/OneDayConference
        public void Attendee_Can_Say_They_Plan_On_Attending()
        {
            //Arrange
            var attendee = new Attendee();

            //Act
            attendee.IsAttending = true;

            //Assert
            Assert.IsTrue(attendee.IsAttending);
        }
コード例 #18
0
ファイル: PrototypeDemo.cs プロジェクト: olko/MySpace
 public static CalendarEvent GetExistingEvent()
 {
   var beerParty = new CalendarEvent();
   var friends = new Attendee[1];
   var andriy = new Attendee { FirstName = "Andriy", LastName = "Buday" };
   friends[0] = andriy;
   beerParty.Attendees = friends;
   beerParty.StartDateAndTime = new DateTime(2010, 7, 23, 19, 0, 0);
   beerParty.Priority = Priority.High();
   return beerParty;
 }
コード例 #19
0
        /// <summary>
        /// Adds a new event to user's default calendar
        /// </summary>
        /// <param name="LocationName">string. The name of the event location</param>
        /// <param name="BodyContent">string. The body of the event.</param>
        /// <param name="Attendees">string. semi-colon delimited list of invitee email addresses</param>
        /// <param name="EventName">string. The subject of the event</param>
        /// <param name="start">DateTimeOffset. The start date of the event</param>
        /// <param name="end">DateTimeOffset. The end date of the event</param>
        /// <param name="startTime">TimeSpan. The start hour:Min:Sec of the event</param>
        /// <param name="endTime">TimeSpan. The end hour:Min:Sec of the event</param>
        /// <returns></returns>
        internal async Task<string> AddCalendarEventAsync(
            string LocationName,
            string BodyContent,
            string Attendees,
            string EventName,
            DateTimeOffset start,
            DateTimeOffset end,
            TimeSpan startTime,
            TimeSpan endTime)
        {
            string newEventId = string.Empty;
            Location location = new Location();
            location.DisplayName = LocationName;
            ItemBody body = new ItemBody();
            body.Content = BodyContent;
            body.ContentType = BodyType.Text;
            string[] splitter = { ";" };
            var splitAttendeeString = Attendees.Split(splitter, StringSplitOptions.RemoveEmptyEntries);
            Attendee[] attendees = new Attendee[splitAttendeeString.Length];
            for (int i = 0; i < splitAttendeeString.Length; i++)
            {
                attendees[i] = new Attendee();
                attendees[i].Type = AttendeeType.Required;
                attendees[i].EmailAddress = new EmailAddress() { Address = splitAttendeeString[i], Name = splitAttendeeString[i] };
            }

            Event newEvent = new Event
            {
                Subject = EventName,
                Location = location,
                Attendees = attendees,
                Start = start,
                End = end,
                Body = body,
            };
            //Add new times to start and end dates.
            newEvent.Start = (DateTimeOffset?)CalcNewTime(newEvent.Start, start, startTime);
            newEvent.End = (DateTimeOffset?)CalcNewTime(newEvent.End, end, endTime);

            try
            {
                // Make sure we have a reference to the calendar client
                var exchangeClient = await AuthenticationHelper.EnsureOutlookClientCreatedAsync();

                // This results in a call to the service.
                await exchangeClient.Me.Events.AddEventAsync(newEvent);
                newEventId = newEvent.Id;
            }
            catch (Exception e)
            {
                throw new Exception("We could not create your calendar event: " + e.Message);
            }
            return newEventId;
        }
コード例 #20
0
ファイル: AttendeeTests.cs プロジェクト: kburnell/PickAWinner
 public void InsertAll_ShouldReturn_NonNull_Boolean()
 {
     //Arrange
     IList<AttendeeDTO> attendeeDtos = new List<AttendeeDTO> { new AttendeeDTO { FirstName = "FName", LastName = "LName", Company = "Company", Email = "*****@*****.**", IsEligible = true, HasWon = true } };
     using (new TransactionScope()) {
         //Act
         IAttendee attendee = new Attendee();
         bool returnSuccess = attendee.InsertAll(attendeeDtos);
         //Assert
         Assert.IsInstanceOfType(returnSuccess, typeof(bool));
     }
 }
コード例 #21
0
ファイル: AttendeeTests.cs プロジェクト: kburnell/PickAWinner
 public void DeleteAll_ShouldReturn_NonNull_Boolean()
 {
     //Arrange
     const bool success = true;
     _mockRepo.Expect(x => x.DeleteAll()).Return(success).Repeat.Once();
     _mockRepository.ReplayAll();
     //Act
     IAttendee attendee = new Attendee(_mockRepo);
     bool returnSuccess = attendee.DeleteAll();
     //Assert
     _mockRepository.VerifyAll();
     Assert.IsInstanceOfType(returnSuccess, typeof(bool));
 }
コード例 #22
0
ファイル: AttendeeTests.cs プロジェクト: kburnell/PickAWinner
 public void GetAll_ShouldReturn_NonNull_ListOf_AttendeeDTO()
 {
     //Arrange
     _mockRepo.Expect(x => x.GetAll()).Return(new List<AttendeeDTO> ()).Repeat.Once();
     _mockRepository.ReplayAll();
     //Act
     IAttendee attendee = new Attendee(_mockRepo);
     IList<AttendeeDTO> attendeeDtos = attendee.GetAll();
     //Assert
     _mockRepository.VerifyAll();
     attendeeDtos.ShouldNotBeNull("Expected AttendeeDTO List Not To Be Null");
     Assert.IsInstanceOfType(attendeeDtos, typeof(IList<AttendeeDTO>));
 }
コード例 #23
0
ファイル: AttendeeTests.cs プロジェクト: kburnell/PickAWinner
 public void InsertsAll_ShouldReturn_NonNull_Boolean()
 {
     //Arrange
     const bool success = true;
     _mockRepo.Expect(x => x.InsertAll(new List<AttendeeDTO>())).IgnoreArguments().Return(success).Repeat.Once();
     _mockRepository.ReplayAll();
     //Act
     IAttendee attendee = new Attendee(_mockRepo);
     bool returnSuccess = attendee.InsertAll(new List<AttendeeDTO>());
     //Assert
     _mockRepository.VerifyAll();
     Assert.IsInstanceOfType(returnSuccess, typeof(bool));
 }
コード例 #24
0
ファイル: WinnerTests.cs プロジェクト: kburnell/PickAWinner
 public void Insert_ShouldReturn_NonNull_Boolean()
 {
     using (new TransactionScope()) {
         //Arrange
         long attendeeID = new Attendee().GetAll()[0].AttendeeID;
         long sponsorID = new Sponsor().GetAllThatProvidedSwag()[0].SponsorID;
         long swagID = new Swag().GetAllBySponsor(sponsorID)[0].SwagID;
         //Act
         IWinner winner = new Winner();
         bool result = winner.Insert(new WinnerDTO{Name = "Joe Smith", SponsorID = sponsorID, SwagID = swagID, AttendeeID = attendeeID});
         //Assert
         Assert.IsInstanceOfType(result, typeof (bool));
     }
 }
コード例 #25
0
        public void Should_cascade_attendee()
        {
            var attendee = new Attendee("Joe", "Schmoe");
            var newEvent = new Conference("Some event");

            attendee.RegisterFor(newEvent);

            SaveEntities(newEvent);

            var loaded = SessionSource.CreateSession().Load<Conference>(newEvent.Id);

            loaded.GetAttendees().Count().ShouldEqual(1);
            loaded.GetAttendees().ElementAt(0).Conference.ShouldEqual(loaded);
        }
コード例 #26
0
        public Attendee Get(string emailAddress)
        {
            Attendee attendee = null;

            if (ContactsFeed.Entries.Count(e => e.Emails.Any(a => a.Address == emailAddress)) >= 1)
            {
                var contact = ContactsFeed.Entries.First(c => c.Emails.Any(a => a.Address == emailAddress));
                attendee = new Attendee
                               {
                                   Email = contact.Emails.Count > 0 ? contact.Emails[0].Address : string.Empty,
                                   MobileNumber = contact.Phonenumbers.Count > 0 ? contact.Phonenumbers[0].Value : string.Empty
                               };
            }

            return attendee;
        }
コード例 #27
0
        public void Should_map_attendee_fields()
        {
            var attendee = new Attendee("Joe", "Schmoe")
            {
                Email = "*****@*****.**",
                State = "TX"
            };

            SaveEntities(attendee);

            var loaded = SessionSource.CreateSession().Load<Attendee>(attendee.Id);

            loaded.FirstName.ShouldEqual(attendee.FirstName);
            loaded.LastName.ShouldEqual(attendee.LastName);
            loaded.Email.ShouldEqual(attendee.Email);
            loaded.State.ShouldEqual(attendee.State);
        }
コード例 #28
0
        private void createAttendeeButton_Click(object sender, EventArgs e)
        {
            Attendee[] attendees = new Attendee[2];
            _attendee = new Attendee();

            _attendee.Name = personNameTextBox.Text;
            _attendee.PersonUID = personUIDTextBox.Text; //todo: test GUID's validity
            _attendee.Voting = false;
            _attendee.Chair = false;

            Attendee attendee1 = new Attendee();

            attendee1.Name = "Guid likePerson";
            attendee1.PersonUID = Guid.NewGuid().ToString();
            attendee1.Voting = false;
            attendee1.Chair = false;

            attendees[0] = _attendee;
            attendees[1] = attendee1;
            _mediamanager.CreateAttendees(attendees);
            MessageBox.Show("Attendees were created successfully.");
        }
コード例 #29
0
 public SettingsViewModel(Individual individual, Attendee attendee)
 {
     _individual = individual;
     _attendee   = attendee;
 }
コード例 #30
0
        public async Task UpdateAsync(Attendee attendee, CancellationToken cancellationToken = default(CancellationToken))
        {
            _dbContext.Update(attendee);

            await _dbContext.SaveChangesAsync(cancellationToken);
        }
コード例 #31
0
        private bool IsExternalAttendee(Attendee attendee)
        {
            var address = attendee.EmailAddress?.Address?.ToLowerInvariant();

            return(string.IsNullOrEmpty(address) || !_emailDomains.Any(emailDomain => address.EndsWith(emailDomain)));
        }
コード例 #32
0
 public string HandleAttendee(Attendee attendee)
 {
     return(JsonSerializer.Serialize <Attendee>(attendee));
 }
コード例 #33
0
ファイル: MyEvents.cshtml.cs プロジェクト: pennan88/AspEvent
 public async Task OnGetAsync()
 {
     Attendee = await _context.Attendee.Where(a => a.Id == 1).Include(e => e.Event).FirstOrDefaultAsync();
 }
コード例 #34
0
        public void CanGetWorkshopAttendees()
        {
            using (var dbContext = SqliteInMemory.GetSqliteDbContext())
            {
                dbContext.Database.EnsureCreated();

                var attendeeRepo = new AttendeeRepo <Attendee>(dbContext);


                var project = new Project
                {
                    ProjectName = "Arkansas Disability and Health Project",
                    Description = "Health education for people with disabilities"
                };
                dbContext.Projects.Add(project);
                var employee = new Employee {
                    FirstName = "John", LastName = "Employee"
                };
                dbContext.Employees.Add(employee);
                dbContext.SaveChanges();

                var workshop1 = new Workshop
                {
                    WorkshopName      = "Women Be Healthy",
                    EmployeeId        = employee.Id,
                    ProjectId         = project.Id,
                    Description       = "Women's health class",
                    TrainingDate      = DateTime.Now,
                    SessionIdentifier = "WBH-4181234500000"
                };
                var workshop2 = new Workshop
                {
                    WorkshopName      = "Diabetes",
                    EmployeeId        = employee.Id,
                    ProjectId         = project.Id,
                    Description       = "Diabetes health class",
                    TrainingDate      = DateTime.Now,
                    SessionIdentifier = "DBH-4181234500000"
                };
                dbContext.Workshops.AddRange(workshop1, workshop2);

                var agency = new Agency {
                    AgencyName = "Little Rock High School"
                };
                dbContext.Agencies.Add(agency);
                dbContext.SaveChanges();

                var attendee1 = new Attendee
                {
                    FirstName = "Sarah",
                    LastName  = "Smith",
                    JobTitle  = "Supervisor",
                    AgencyId  = agency.Id
                };
                var attendee2 = new Attendee
                {
                    FirstName = "Andy",
                    LastName  = "Pablo",
                    JobTitle  = "Manager",
                    AgencyId  = agency.Id
                };
                dbContext.Attendees.AddRange(attendee1, attendee2);
                dbContext.SaveChanges();

                dbContext.AttendeeHours.Add(new AttendeeHour
                {
                    AttendeeId = attendee1.Id,
                    WorkshopId = workshop1.Id,
                    PDHours    = 1
                });
                dbContext.AttendeeHours.Add(new AttendeeHour
                {
                    AttendeeId = attendee2.Id,
                    WorkshopId = workshop1.Id,
                    PDHours    = 1
                });
                dbContext.SaveChanges();

                var attendees = attendeeRepo.GetByWorkshop(workshop1.Id);

                Assert.AreEqual(2, attendees.Count);
            }
        }
コード例 #35
0
 public IActionResult DeleteAttendee(Attendee attendee)
 {
     context.Delete(attendee);
     context.Save();
     return(RedirectToAction("ListAttendees"));
 }
コード例 #36
0
 public IActionResult AddAttendee(int Id, [Bind("PortalActivityId, FirstName, LastName, Email")] Attendee attendee)
 {
     _portalRepository.AddAttendee(attendee);
     return(RedirectToAction(nameof(Details), new { Id = attendee.PortalActivityId }));
 }
コード例 #37
0
        /// <summary>
        /// Adds a new event to user's default calendar
        /// </summary>
        /// <param name="LocationName">string. The name of the event location</param>
        /// <param name="BodyContent">string. The body of the event.</param>
        /// <param name="Attendees">string. semi-colon delimited list of invitee email addresses</param>
        /// <param name="EventName">string. The subject of the event</param>
        /// <param name="start">DateTimeOffset. The start date of the event</param>
        /// <param name="end">DateTimeOffset. The end date of the event</param>
        /// <returns></returns>
        internal async Task <String> AddCalendarEventAsync(

            string LocationName,
            string BodyContent,
            string Attendees,
            string Subject,
            DateTimeOffset start,
            DateTimeOffset end
            )
        {
            string   newEventId = string.Empty;
            Location location   = new Location();

            location.DisplayName = LocationName;
            ItemBody body = new ItemBody();

            body.Content     = BodyContent;
            body.ContentType = BodyType.Text;
            string[] splitter            = { ";" };
            var      splitAttendeeString = Attendees.Split(splitter, StringSplitOptions.RemoveEmptyEntries);

            Attendee[] attendees = new Attendee[splitAttendeeString.Length];
            for (int i = 0; i < splitAttendeeString.Length; i++)
            {
                attendees[i]              = new Attendee();
                attendees[i].Type         = AttendeeType.Required;
                attendees[i].EmailAddress = new EmailAddress()
                {
                    Address = splitAttendeeString[i].Trim()
                };
            }


            Event newEvent = new Event
            {
                Subject   = Subject,
                Location  = location,
                Attendees = attendees,
                Start     = start,
                End       = end,
                Body      = body,
            };


            newEvent.Start = (DateTimeOffset?)CalcNewTime(newEvent.Start, start);
            newEvent.End   = (DateTimeOffset?)CalcNewTime(newEvent.End, end);

            try
            {
                // Make sure we have a reference to the Outlook Services client
                var outlookServicesClient = await AuthenticationHelper.EnsureOutlookServicesClientCreatedAsync("Calendar");

                // This results in a call to the service.
                await outlookServicesClient.Me.Events.AddEventAsync(newEvent);

                await((IEventFetcher)newEvent).ExecuteAsync();
                newEventId = newEvent.Id;
            }
            catch (Exception e)
            {
                throw new Exception("We could not create your calendar event: " + e.Message);
            }
            return(newEventId);
        }
コード例 #38
0
        /// <summary>
        /// Adds a new event to user's default calendar
        /// </summary>
        /// <param name="LocationName">string. The name of the event location</param>
        /// <param name="BodyContent">string. The body of the event.</param>
        /// <param name="Attendees">string. semi-colon delimited list of invitee email addresses</param>
        /// <param name="EventName">string. The subject of the event</param>
        /// <param name="start">DateTimeOffset. The start date of the event</param>
        /// <param name="end">DateTimeOffset. The end date of the event</param>
        /// <param name="startTime">TimeSpan. The start hour:Min:Sec of the event</param>
        /// <param name="endTime">TimeSpan. The end hour:Min:Sec of the event</param>
        /// <returns>The Id of the event that was created; Otherwise, null.</returns>
        public static async Task<string> AddCalendarEventWithArgsAsync(
            string LocationName,
            string BodyContent,
            string Attendees,
            string EventName,
            DateTimeOffset start,
            DateTimeOffset end,
            TimeSpan startTime,
            TimeSpan endTime)
        {
            string newEventId = string.Empty;
            Location location = new Location();
            location.DisplayName = LocationName;
            ItemBody body = new ItemBody();
            body.Content = BodyContent;
            body.ContentType = BodyType.Text;
            string[] splitter = { ";" };
            var splitAttendeeString = Attendees.Split(splitter, StringSplitOptions.RemoveEmptyEntries);
            Attendee[] attendees = new Attendee[splitAttendeeString.Length];
            for (int i = 0; i < splitAttendeeString.Length; i++)
            {
                attendees[i] = new Attendee();
                attendees[i].Type = AttendeeType.Required;
                attendees[i].EmailAddress = new EmailAddress() { Address = splitAttendeeString[i] };
            }

            Event newEvent = new Event
            {
                Subject = EventName,
                Location = location,
                Attendees = attendees,
                Start = start,
                End = end,
                Body = body,
            };
            //Add new times to start and end dates.
            newEvent.Start = (DateTimeOffset?)CalcNewTime(newEvent.Start, start, startTime);
            newEvent.End = (DateTimeOffset?)CalcNewTime(newEvent.End, end, endTime);

            // Make sure we have a reference to the calendar client
            var exchangeClient = await GetOutlookClientAsync();

            // This results in a call to the service.
            await exchangeClient.Me.Events.AddEventAsync(newEvent);
            Debug.WriteLine("Added event: " + newEvent.Id);
            return newEvent.Id;

        }
コード例 #39
0
 private static bool IsAttendingConference(Attendee attendee, int conferenceId)
 {
     return(attendee.ConferenceAttendees.Any(ca => ca.ConferenceId == conferenceId));
 }
コード例 #40
0
 public void AttendeeReceivedSwag(Attendee attendee, SwagItem swag)
 {
     _attendeeRepository.AttendeeReceivedSwag(attendee, swag);
 }
コード例 #41
0
        #pragma warning disable 1998
        public async override global::System.Threading.Tasks.Task ExecuteAsync()
        {
            BeginContext(63, 128, true);
            WriteLiteral("\n<div class=\"row\">\n    <div class=\"col-lg-12\">\r\n        <h4>Manage Attendees</h4>\r\n        <div class=\"text-left\">\r\n            ");
            EndContext();
            BeginContext(192, 65, false);
#line 8 "C:\Users\s00732221\Desktop\Project Repo\PrizeDraw\Views\Attendee\Index.cshtml"
            Write(Html.ValidationSummary(false, "", new { @class = "text-danger" }));

#line default
#line hidden
            EndContext();
            BeginContext(257, 2, true);
            WriteLiteral("\r\n");
            EndContext();
#line 9 "C:\Users\s00732221\Desktop\Project Repo\PrizeDraw\Views\Attendee\Index.cshtml"
            if (Model.NumberImportedAttendees != null)
            {
#line default
#line hidden
                BeginContext(331, 28, true);
                WriteLiteral("                <p>Imported ");
                EndContext();
                BeginContext(360, 35, false);
#line 11 "C:\Users\s00732221\Desktop\Project Repo\PrizeDraw\Views\Attendee\Index.cshtml"
                Write(Model.NumberImportedAttendees.Value);

#line default
#line hidden
                EndContext();
                BeginContext(395, 16, true);
                WriteLiteral(" attendees</p>\r\n");
                EndContext();
#line 12 "C:\Users\s00732221\Desktop\Project Repo\PrizeDraw\Views\Attendee\Index.cshtml"
            }

#line default
#line hidden
            BeginContext(426, 24, true);
            WriteLiteral("        </div>\r\n        ");
            EndContext();
            BeginContext(450, 94, false);
            __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "40e5c17282f43234a299edf9ff67c79b3c7ee8c87353", async() => {
                BeginContext(533, 7, true);
                WriteLiteral("Add New");
                EndContext();
            }
                                                                        );
            __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>();
            __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper);
            __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_0);
            __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_1.Value;
            __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_1);
            __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Controller = (string)__tagHelperAttribute_2.Value;
            __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_2);
            await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);

            if (!__tagHelperExecutionContext.Output.IsContentModified)
            {
                await __tagHelperExecutionContext.SetOutputContentAsync();
            }
            Write(__tagHelperExecutionContext.Output);
            __tagHelperExecutionContext = __tagHelperScopeManager.End();
            EndContext();
            BeginContext(544, 435, true);
            WriteLiteral(@"
        <a class=""btn btn-secondary floatLeft"" href=""javascript:showImport();"">Import</a>
        <!-- <form asp-action=""Export"" asp-controller=""Attendee"" method=""post"" enctype=""multipart/form-data"">
         <div>
             <input type=""submit"" value=""Export"" />
         </div>
        </form>-->
        <br />
        <div id=""importAttendees"">
            <hr />
            <div class=""text-left"">
                ");
            EndContext();
            BeginContext(979, 457, false);
            __tagHelperExecutionContext = __tagHelperScopeManager.Begin("form", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "40e5c17282f43234a299edf9ff67c79b3c7ee8c89467", async() => {
                BeginContext(1075, 354, true);
                WriteLiteral(@"
                    <label for=""attendeeFile"">Upload Attendees (csv):</label>
                    <input type=""file"" accept="".csv"" id=""attendeeFile"" name=""attendeeFile"" />
                    <div class=""form-group"">
                        <input type=""submit"" value=""Submit"" class=""btn btn-primary"" />
                    </div>
                ");
                EndContext();
            }
                                                                        );
            __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper>();
            __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper);
            __Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.RenderAtEndOfFormTagHelper>();
            __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper);
            __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.Action = (string)__tagHelperAttribute_3.Value;
            __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_3);
            __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.Controller = (string)__tagHelperAttribute_2.Value;
            __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_2);
            __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.Method = (string)__tagHelperAttribute_4.Value;
            __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_4);
            __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_5);
            await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);

            if (!__tagHelperExecutionContext.Output.IsContentModified)
            {
                await __tagHelperExecutionContext.SetOutputContentAsync();
            }
            Write(__tagHelperExecutionContext.Output);
            __tagHelperExecutionContext = __tagHelperScopeManager.End();
            EndContext();
            BeginContext(1436, 177, true);
            WriteLiteral("\r\n\r\n            </div>\r\n            <hr />\r\n        </div>\r\n        <br />\r\n        <div>\r\n            <table class=\"table\">\r\n                <thead>\r\n                    <tr>\r\n");
            EndContext();
#line 41 "C:\Users\s00732221\Desktop\Project Repo\PrizeDraw\Views\Attendee\Index.cshtml"
            Attendee attendeeDummy = null;                /* workaround for viewmodels with internal lists */

#line default
#line hidden
            BeginContext(1726, 58, true);
            WriteLiteral("                        <th>\r\n                            ");
            EndContext();
            BeginContext(1785, 46, false);
#line 43 "C:\Users\s00732221\Desktop\Project Repo\PrizeDraw\Views\Attendee\Index.cshtml"
            Write(Html.DisplayNameFor(model => attendeeDummy.Id));

#line default
#line hidden
            EndContext();
            BeginContext(1831, 91, true);
            WriteLiteral("\r\n                        </th>\r\n                        <th>\r\n                            ");
            EndContext();
            BeginContext(1923, 53, false);
#line 46 "C:\Users\s00732221\Desktop\Project Repo\PrizeDraw\Views\Attendee\Index.cshtml"
            Write(Html.DisplayNameFor(model => attendeeDummy.FirstName));

#line default
#line hidden
            EndContext();
            BeginContext(1976, 91, true);
            WriteLiteral("\r\n                        </th>\r\n                        <th>\r\n                            ");
            EndContext();
            BeginContext(2068, 52, false);
#line 49 "C:\Users\s00732221\Desktop\Project Repo\PrizeDraw\Views\Attendee\Index.cshtml"
            Write(Html.DisplayNameFor(model => attendeeDummy.LastName));

#line default
#line hidden
            EndContext();
            BeginContext(2120, 91, true);
            WriteLiteral("\r\n                        </th>\r\n                        <th>\r\n                            ");
            EndContext();
            BeginContext(2212, 49, false);
#line 52 "C:\Users\s00732221\Desktop\Project Repo\PrizeDraw\Views\Attendee\Index.cshtml"
            Write(Html.DisplayNameFor(model => attendeeDummy.Email));

#line default
#line hidden
            EndContext();
            BeginContext(2261, 91, true);
            WriteLiteral("\r\n                        </th>\r\n                        <th>\r\n                            ");
            EndContext();
            BeginContext(2353, 55, false);
#line 55 "C:\Users\s00732221\Desktop\Project Repo\PrizeDraw\Views\Attendee\Index.cshtml"
            Write(Html.DisplayNameFor(model => attendeeDummy.MobilePhone));

#line default
#line hidden
            EndContext();
            BeginContext(2408, 91, true);
            WriteLiteral("\r\n                        </th>\r\n                        <th>\r\n                            ");
            EndContext();
            BeginContext(2500, 52, false);
#line 58 "C:\Users\s00732221\Desktop\Project Repo\PrizeDraw\Views\Attendee\Index.cshtml"
            Write(Html.DisplayNameFor(model => attendeeDummy.JobTitle));

#line default
#line hidden
            EndContext();
            BeginContext(2552, 91, true);
            WriteLiteral("\r\n                        </th>\r\n                        <th>\r\n                            ");
            EndContext();
            BeginContext(2644, 51, false);
#line 61 "C:\Users\s00732221\Desktop\Project Repo\PrizeDraw\Views\Attendee\Index.cshtml"
            Write(Html.DisplayNameFor(model => attendeeDummy.Company));

#line default
#line hidden
            EndContext();
            BeginContext(2695, 91, true);
            WriteLiteral("\r\n                        </th>\r\n                        <th>\r\n                            ");
            EndContext();
            BeginContext(2787, 55, false);
#line 64 "C:\Users\s00732221\Desktop\Project Repo\PrizeDraw\Views\Attendee\Index.cshtml"
            Write(Html.DisplayNameFor(model => attendeeDummy.IsCheckedIn));

#line default
#line hidden
            EndContext();
            BeginContext(2842, 146, true);
            WriteLiteral("\r\n                        </th>\r\n                        <th></th>\r\n                    </tr>\r\n                </thead>\r\n                <tbody>\r\n");
            EndContext();
#line 70 "C:\Users\s00732221\Desktop\Project Repo\PrizeDraw\Views\Attendee\Index.cshtml"
            foreach (var item in Model.Attendees)
            {
#line default
#line hidden
                BeginContext(3071, 96, true);
                WriteLiteral("                        <tr>\r\n                            <td>\r\n                                ");
                EndContext();
                BeginContext(3168, 37, false);
#line 74 "C:\Users\s00732221\Desktop\Project Repo\PrizeDraw\Views\Attendee\Index.cshtml"
                Write(Html.DisplayFor(modelItem => item.Id));

#line default
#line hidden
                EndContext();
                BeginContext(3205, 103, true);
                WriteLiteral("\r\n                            </td>\r\n                            <td>\r\n                                ");
                EndContext();
                BeginContext(3309, 44, false);
#line 77 "C:\Users\s00732221\Desktop\Project Repo\PrizeDraw\Views\Attendee\Index.cshtml"
                Write(Html.DisplayFor(modelItem => item.FirstName));

#line default
#line hidden
                EndContext();
                BeginContext(3353, 103, true);
                WriteLiteral("\r\n                            </td>\r\n                            <td>\r\n                                ");
                EndContext();
                BeginContext(3457, 43, false);
#line 80 "C:\Users\s00732221\Desktop\Project Repo\PrizeDraw\Views\Attendee\Index.cshtml"
                Write(Html.DisplayFor(modelItem => item.LastName));

#line default
#line hidden
                EndContext();
                BeginContext(3500, 103, true);
                WriteLiteral("\r\n                            </td>\r\n                            <td>\r\n                                ");
                EndContext();
                BeginContext(3604, 40, false);
#line 83 "C:\Users\s00732221\Desktop\Project Repo\PrizeDraw\Views\Attendee\Index.cshtml"
                Write(Html.DisplayFor(modelItem => item.Email));

#line default
#line hidden
                EndContext();
                BeginContext(3644, 103, true);
                WriteLiteral("\r\n                            </td>\r\n                            <td>\r\n                                ");
                EndContext();
                BeginContext(3748, 46, false);
#line 86 "C:\Users\s00732221\Desktop\Project Repo\PrizeDraw\Views\Attendee\Index.cshtml"
                Write(Html.DisplayFor(modelItem => item.MobilePhone));

#line default
#line hidden
                EndContext();
                BeginContext(3794, 103, true);
                WriteLiteral("\r\n                            </td>\r\n                            <td>\r\n                                ");
                EndContext();
                BeginContext(3898, 43, false);
#line 89 "C:\Users\s00732221\Desktop\Project Repo\PrizeDraw\Views\Attendee\Index.cshtml"
                Write(Html.DisplayFor(modelItem => item.JobTitle));

#line default
#line hidden
                EndContext();
                BeginContext(3941, 103, true);
                WriteLiteral("\r\n                            </td>\r\n                            <td>\r\n                                ");
                EndContext();
                BeginContext(4045, 42, false);
#line 92 "C:\Users\s00732221\Desktop\Project Repo\PrizeDraw\Views\Attendee\Index.cshtml"
                Write(Html.DisplayFor(modelItem => item.Company));

#line default
#line hidden
                EndContext();
                BeginContext(4087, 103, true);
                WriteLiteral("\r\n                            </td>\r\n                            <td>\r\n                                ");
                EndContext();
                BeginContext(4191, 46, false);
#line 95 "C:\Users\s00732221\Desktop\Project Repo\PrizeDraw\Views\Attendee\Index.cshtml"
                Write(Html.DisplayFor(modelItem => item.IsCheckedIn));

#line default
#line hidden
                EndContext();
                BeginContext(4237, 105, true);
                WriteLiteral("\r\n                            </td>\r\n                            <td>\r\n\r\n                                ");
                EndContext();
                BeginContext(4343, 53, false);
#line 99 "C:\Users\s00732221\Desktop\Project Repo\PrizeDraw\Views\Attendee\Index.cshtml"
                Write(Html.ActionLink("Edit", "Edit", new { id = item.Id }));

#line default
#line hidden
                EndContext();
                BeginContext(4396, 36, true);
                WriteLiteral(" |\r\n                                ");
                EndContext();
                BeginContext(4433, 59, false);
#line 100 "C:\Users\s00732221\Desktop\Project Repo\PrizeDraw\Views\Attendee\Index.cshtml"
                Write(Html.ActionLink("Details", "Details", new { id = item.Id }));

#line default
#line hidden
                EndContext();
                BeginContext(4492, 38, true);
                WriteLiteral("\r\n                                <!--");
                EndContext();
                BeginContext(4531, 57, false);
#line 101 "C:\Users\s00732221\Desktop\Project Repo\PrizeDraw\Views\Attendee\Index.cshtml"
                Write(Html.ActionLink("Delete", "Delete", new { id = item.Id }));

#line default
#line hidden
                EndContext();
                BeginContext(4588, 71, true);
                WriteLiteral("-->\r\n                            </td>\r\n                        </tr>\r\n");
                EndContext();
#line 104 "C:\Users\s00732221\Desktop\Project Repo\PrizeDraw\Views\Attendee\Index.cshtml"
            }

#line default
#line hidden
            BeginContext(4682, 82, true);
            WriteLiteral("                </tbody>\r\n            </table>\r\n        </div>\r\n    </div>\n</div>\n");
            EndContext();
            DefineSection("scripts", async() => {
                BeginContext(4782, 405, true);
                WriteLiteral(@"
    <script>
        $(document).ready(function () {
            $('#importAttendees').hide();
        });

        var importToggle = true;
        function showImport() {
            if (importToggle) {
                $('#importAttendees').fadeIn();
            } else {
                $('#importAttendees').fadeOut();
            }

            importToggle = !importToggle;
        }
    </script>
");
                EndContext();
            }
                          );
        }
コード例 #42
0
        public async Task AddAttendeeAsync(Attendee attendee)
        {
            var response = await _httpClient.PostJsonAsync($"/api/attendees", attendee);

            response.EnsureSuccessStatusCode();
        }
コード例 #43
0
        public async Task Update(Attendee request)
        {
            var collection = Database.GetCollection <Attendee>("attendees");
            var id         = request.Id;
            var attendee   = collection.Find(x => x.Id == id)
                             .SingleOrDefault();

            if (attendee == null)
            {
                await Clients.Caller.SendAsync("UpdateFailed", request);

                return;
            }

            if (attendee.RemovedWristbands == null)
            {
                attendee.RemovedWristbands = new string[] {};
            }

            if (string.IsNullOrEmpty(request.Wristband) && string.IsNullOrEmpty(attendee.Wristband))
            {
                request.Wristband = attendee.Wristband;
            }

            if (attendee.ArrivalDate != null)
            {
                if (string.IsNullOrEmpty(request.Wristband) &&
                    (request.RemovedWristbands.Length == 0 || request.ArrivalDate < DateTime.Parse("06/08/2018")))
                {
                    request.ArrivalDate = null;
                }
            }

            foreach (var prop in attendee.GetType().GetProperties())
            {
                var type = prop.PropertyType;
                if (type == typeof(DateTime) || (
                        type.IsGenericType &&
                        type.GetGenericTypeDefinition() == typeof(Nullable <>) &&
                        Nullable.GetUnderlyingType(type) == typeof(DateTime)
                        ))
                {
                    var src = prop.GetValue(request) as DateTime?;
                    var dst = prop.GetValue(attendee) as DateTime?;
                    if (src?.ToUniversalTime() == dst?.ToUniversalTime())
                    {
                        prop.SetValue(request, dst);
                    }
                }
            }

            if (!string.IsNullOrEmpty(request.Wristband) && request.ArrivalDate == null)
            {
                request.ArrivalDate = DateTime.UtcNow;
            }

            var patcher = new JsonDiffPatch();
            var current = JObject.FromObject(attendee) as JToken;
            var updates = JObject.FromObject(request);
            var patches = patcher.Diff(current, updates);

            current = patcher.Patch(current, patches);
            JsonConvert.PopulateObject(current.ToString(), attendee);

            var removed = new List <string>();

            removed.AddRange(attendee.RemovedWristbands != null
                                ? attendee.RemovedWristbands
                                : new string[] {});
            attendee.RemovedWristbands = removed
                                         .Except(new[] { attendee.Wristband })
                                         .Distinct()
                                         .ToArray();

            Logger.Information(JsonConvert.SerializeObject(new {
                attendee.Id,
                patches
            }, Formatting.Indented));

            collection.Update(attendee);
            await Clients.All.SendAsync("Update", attendee);
        }
コード例 #44
0
        public static void AttendeeGoing(int studentID, int bookingID)
        {
            int        attID  = 0;
            HttpClient client = new HttpClient();

            client.BaseAddress = new Uri("http://localhost:15320");

            client.DefaultRequestHeaders.Accept.Add(
                new MediaTypeWithQualityHeaderValue("application/json"));

            HttpResponseMessage response = client.GetAsync("api/Attendees").Result;

            if (response.IsSuccessStatusCode)
            {
                var attendees = response.Content.ReadAsAsync <IEnumerable <Attendee> >().Result;

                foreach (var att in attendees)
                {
                    if ((att.StudentID == studentID) && (att.BookingID == bookingID))
                    {
                        attID = att.AttendeeID;
                        Attendee attendee = new Attendee()
                        {
                            AttendeeID = attID, BookingID = bookingID, StudentID = studentID, Going = 1
                        };
                        try
                        {
                            client.PutAsJsonAsync <Attendee>("api/Attendees/" + attID, attendee);
                        }
                        catch (Exception ex)
                        {
                            MessageDialog msg = new MessageDialog(ex.Message);
                            msg.ShowAsync();
                        }

                        break;
                    }
                }
            }
            else
            {
                MessageDialog message = new MessageDialog("There were some errors during the proccess. Try again.");
                message.ShowAsync();
            }

            //HttpClientHandler httpClientHandler = new HttpClientHandler();
            //using (var client = new HttpClient(httpClientHandler))
            //{
            //    client.BaseAddress = new Uri("http://localhost:15320");
            //    client.DefaultRequestHeaders.Clear();
            //    try
            //    {
            //        await client.PutAsJsonAsync<Attendee>("api/Attendees/" + userToEdit.UserID, userToEdit);

            //    }
            //    catch (Exception ex)
            //    {
            //        new MessageDialog(ex.Message).ShowAsync();
            //    }
            //}
        }
コード例 #45
0
        protected override void Seed(MeetingCoordinator.Models.ApplicationDbContext context)
        {
            //  This method will be called after migrating to the latest version.

            //  You can use the DbSet<T>.AddOrUpdate() helper extension method
            //  to avoid creating duplicate seed data. E.g.
            //
            //    context.People.AddOrUpdate(
            //      p => p.FullName,
            //      new Person { FullName = "Andrew Peters" },
            //      new Person { FullName = "Brice Lambson" },
            //      new Person { FullName = "Rowan Miller" }
            //    );
            //

            //passwords before hash =
            //wcc17 - password
            //wes - password1234
            //melinda64 - hotdog
            //talnius - hotdog1234
            //drchang - theteacher
            context.Attendees.AddOrUpdate(
                a => a.Username,
                new Models.Attendee {
                FirstName = "William", LastName = "Curry", Username = "******", Password = "******"
            },
                new Models.Attendee {
                FirstName = "Wes", LastName = "Gilleland", Username = "******", Password = "******"
            },
                new Models.Attendee {
                FirstName = "Melinda", LastName = "Cundiff", Username = "******", Password = "******"
            },
                new Models.Attendee {
                FirstName = "Jeremy", LastName = "Rice", Username = "******", Password = "******"
            },
                new Models.Attendee {
                FirstName = "Kuangnan", LastName = "Chang", Username = "******", Password = "******"
            }
                );

            context.Rooms.AddOrUpdate(
                r => r.RoomNo,
                new Models.Room {
                Capacity = 20, RoomNo = "WALL445"
            },
                new Models.Room {
                Capacity = 25, RoomNo = "WALL455"
            },
                new Models.Room {
                Capacity = 23, RoomNo = "WALL325"
            },
                new Models.Room {
                Capacity = 30, RoomNo = "COMB329"
            }
                );

            context.SaveChanges();

            Attendee owner = context.Attendees.First(u => u.FirstName == "Wes");

            Attendee[] attendees = new Attendee[]
            {
                context.Attendees.First(a => a.FirstName == "William"),
                context.Attendees.First(a => a.FirstName == "Melinda")
            };

            context.Meetings.AddOrUpdate(
                m => m.ID,
                new Models.Meeting
            {
                Attendees   = attendees,
                Description = "This is a test meeting!",
                EndTime     = new DateTime(2016, 4, 30, 12, 30, 0),
                StartTime   = new DateTime(2016, 4, 30, 12, 0, 0),
                HostingRoom = context.Rooms.First(r => r.RoomNo == "WALL445"),
                Owner       = owner,
                Title       = "Test Case: Please Ignore"
            }
                );
        }
コード例 #46
0
 public AttendeeLabel(Attendee attendee)
 {
     this.UserNumber = attendee?.UserNumber;
 }
コード例 #47
0
        /// <summary>
        /// Schedules an event.
        ///
        /// For purposes of simplicity we only allow the user to enter the startTime
        /// and endTime as hours.
        /// </summary>
        /// <param name="subject">Subject of the meeting</param>
        /// <param name="startTime">The time when the meeting starts</param>
        /// <param name="endTime">Duration of the meeting</param>
        /// <param name="attendeeEmail">Email of person to invite</param>
        /// <returns></returns>
        public async Task ScheduleEventAsync(string subject, string startTime, string endTime, string attendeeEmail)
        {
            DateTime dateTime = DateTime.Today;

            // set the start and end time for the event
            DateTimeTimeZone start = new DateTimeTimeZone
            {
                TimeZone = "Pacific Standard Time",
                DateTime = $"{dateTime.Year}-{dateTime.Month}-{dateTime.Day}T{startTime}:00:00"
            };
            DateTimeTimeZone end = new DateTimeTimeZone
            {
                TimeZone = "Pacific Standard Time",
                DateTime = $"{dateTime.Year}-{dateTime.Month}-{dateTime.Day}T{endTime}:00:00"
            };

            // Adds attendee to the event
            EmailAddress email = new EmailAddress
            {
                Address = attendeeEmail
            };

            Attendee attendee = new Attendee
            {
                EmailAddress = email,
                Type         = AttendeeType.Required,
            };
            List <Attendee> attendees = new List <Attendee>();

            attendees.Add(attendee);

            Event newEvent = new Event
            {
                Subject   = subject,
                Attendees = attendees,
                Start     = start,
                End       = end
            };

            try
            {
                /**
                 * This is the same as a post request
                 *
                 * POST: https://graph.microsoft.com/v1.0/me/events
                 * Request Body
                 * {
                 *      "subject": <event-subject>
                 *      "start": {
                 *          "dateTime": "<date-string>",
                 *          "timeZone": "Pacific Standard Time"
                 *        },
                 *       "end": {
                 *           "dateTime": "<date-string>",
                 *           "timeZone": "Pacific Standard Time"
                 *        },
                 *        "attendees": [{
                 *          emailAddress: {
                 *              address: attendeeEmail
                 *          }
                 *          "type": "required"
                 *        }]
                 *
                 * }
                 *
                 * Learn more about the properties of an Event object in the link below
                 * https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/resources/event
                 * */
                Event calendarEvent = await graphClient
                                      .Me
                                      .Events
                                      .Request()
                                      .AddAsync(newEvent);

                Console.WriteLine($"Added {calendarEvent.Subject}");
            }
            catch (ServiceException error)
            {
                Console.WriteLine(error.Message);
            }
        }
コード例 #48
0
 public RegisterAttendeePayload(Attendee attendee)
     : base(attendee)
 {
 }
コード例 #49
0
ファイル: AttendeeDto.cs プロジェクト: tamphthanh/PhotoShop
 public static AttendeeDto FromAttendee(Attendee attendee)
 => new AttendeeDto
 {
     AttendeeId = attendee.AttendeeId,
     FirstName  = attendee.FirstName
 };
コード例 #50
0
        protected override void Seed()
        {
            var dbFactory = new InfoBoothContextFactory();

            using (var db = dbFactory.Create()) {
                Console.WriteLine("Start seeding...");

                if (db.Rooms.Any() || db.Tracks.Any() || db.Events.Any() || db.Attendees.Any())
                {
                    Console.WriteLine("  Data present in db, quitting...");
                    ListDataFromInfoBoothPerspective(db);
                    return;
                }

                Console.WriteLine(" - Start adding rooms...");
                var rooms = new List <Room> {
                    Room.Create("1A"), Room.Create("1B"), Room.Create("1C"),
                    Room.Create("2A"), Room.Create("2B"), Room.Create("3A"),
                };
                db.AddRange(rooms);
                Console.WriteLine("   Added rooms.");

                Console.WriteLine(" - Start adding tracks...");
                var tracks = new List <Track> {
                    Track.Create("Developer", "Developers, developers, developers!"),
                    Track.Create("DevOps", "It's sysadmin day again!")
                };
                db.AddRange(tracks);
                Console.WriteLine("   Added tracks.");

                Console.WriteLine(" - Start adding attendees...");
                var attendees = new List <Attendee>()
                {
                    Attendee.Create("James", "Smith", "Apple Inc."),
                    Attendee.Create("John", "Wilson", "Sony"),
                    Attendee.Create("Robert", "Lam", "Toshiba"),
                    Attendee.Create("Michael", "Williams", "Apple Inc."),
                    Attendee.Create("Mary", "Brown", "Apple Inc."),
                    Attendee.Create("William", "Jones", "Apple Inc."),
                    Attendee.Create("David", "Miller"),
                    Attendee.Create("Patricia", "Davis", "Sony"),
                    Attendee.Create("Jennifer", "Garcia", "Intel"),
                    Attendee.Create("Richard", "Rodriguez", "Sony"),
                    Attendee.Create("Charles", "Martinez"),
                    Attendee.Create("Joseph", "Anderson", "HP Inc."),
                    Attendee.Create("Thomas", "Moore", "LG Electronics"),
                    Attendee.Create("Daniel", "Thompson", "Microsoft"),
                    Attendee.Create("Linda", "Clark"),
                    Attendee.Create("Barbara", "Taylor", "Microsoft"),
                    Attendee.Create("Michael", "King", "Apple Inc."),
                    Attendee.Create("Richard", "Scott", "Apple Inc."),
                    Attendee.Create("Lisa", "Green", "Dell technologies"),
                    Attendee.Create("Donald", "Evans", "IBM"),
                    Attendee.Create("John", "Carter", "Apple Inc.")
                };
                db.AddRange(attendees);
                Console.WriteLine("   Added attendees.");

                Console.WriteLine(" - Start adding speakers...");
                var speakers = new List <Speaker>()
                {
                    Speaker.Create(Attendee.Create("Scott", "Hanselman", "Microsoft"), "My name is Scott Hanselman. I'm a programmer, teacher, and speaker. I work out of my home office in Portland, Oregon for the Web Platform Team at Microsoft, but this blog, its content and opinions are my own. I blog about technology, culture, gadgets, diversity, code, the web, where we're going and where we've been. I'm excited about community, social equity, media, entrepreneurship and above all, the open web."),
                    Speaker.Create(Attendee.Create("Jimmy", "Bogard", "Los Techies"), "I'm the chief architect at Headspring in Austin, TX. I focus on DDD, distributed systems, and any other acronym-centric design/architecture/methodology. I created AutoMapper and am a co-author of the ASP.NET MVC in Action books."),
                    Speaker.Create(Attendee.Create("Jon", "Skeet", "Google"), " Jon Skeet, a Software Engineer at Google and long-time Stack Overflow contributor. Creator of Noda Time, a better date/time API for .NET, Jon is the author of the book, C# in Depth, and he writes regularly about coding on his blog."),
                    Speaker.Create(Attendee.Create("Todd", "Motto", "Ultimate Angular"), "I’m Todd, a 26 year old front-end engineer from England, UK. I run Ultimate Angular (which just won “Best Angular product for Education” award!), teaching developers and teams how to become Angular experts through online courses."),
                    Speaker.Create(Attendee.Create("Scott", "Allen", "Ode To Code LLC"), "I write software and consult through OdeToCode LLC. I have 25+ years of commercial software development experience across a wide range of technologies. I’ve successfully delivered software products for embedded, Windows, and web platforms. I’ve developed web services for Fortune 500 companies and firmware for startups.")
                };
                db.AddRange(speakers);
                Console.WriteLine("   Added speakers.");

                db.SaveChanges();

                Console.WriteLine(" - Start adding sessions...");
                var sessions = new List <Session>()
                {
                };
                var speakersPerSession = new List <SpeakersPerSession>()
                {
                };

                var session1 =
                    Session.Create(Event.Create(
                                       EventType.Talk, "JavaScript Patterns for 2017",
                                       start: new DateTime(2017, 06, 01, 10, 15, 00),
                                       end: new DateTime(2017, 06, 01, 11, 15, 00),
                                       room: db.Rooms.Where(r => r.Name == "1A").FirstOrDefault()
                                       ),
                                   track: db.Tracks.Where(t => t.Name == "Developer").FirstOrDefault(),
                                   level: SessionLevel.Introductionary,
                                   description: "The JavaScript language and ecosystem have seen dramatic changes in the last 2 years. In this sessions we'll look at patterns for organizing code using modules, talk about some of the pros and cons of new language features, and look at the current state of build tools and build patterns."
                                   );
                sessions.Add(session1);
                speakersPerSession.Add(SpeakersPerSession.Create(db.Speakers.FirstOrDefault(s => s.LastName == "Allen"), session1));

                var session2 =
                    Session.Create(Event.Create(
                                       EventType.Keynote, "If I knew then what I know now.",
                                       start: new DateTime(2017, 06, 01, 09, 00, 00),
                                       end: new DateTime(2017, 06, 01, 10, 00, 00),
                                       room: db.Rooms.Where(r => r.Name == "3A").FirstOrDefault()
                                       ),
                                   track: db.Tracks.Where(t => t.Name == "Developer").FirstOrDefault(),
                                   level: SessionLevel.Introductionary,
                                   description: "I've been coding for money for 25 years. I recently met a programmer who’s been coding for over 50. They asked me how they could become a web developer. Here’s what I told them."
                                   );
                sessions.Add(session2);
                speakersPerSession.Add(SpeakersPerSession.Create(db.Speakers.FirstOrDefault(s => s.LastName == "Hanselman"), session2));

                var session3 =
                    Session.Create(Event.Create(
                                       EventType.Talk, "SOLID Architecture in Slices not Layers",
                                       start: new DateTime(2017, 06, 01, 10, 15, 00),
                                       end: new DateTime(2017, 06, 01, 11, 15, 00),
                                       room: db.Rooms.Where(r => r.Name == "2A").FirstOrDefault()
                                       ),
                                   track: db.Tracks.Where(t => t.Name == "Developer").FirstOrDefault(),
                                   level: SessionLevel.Intermediate,
                                   description: "For too long we've lived under the tyranny of n-tier architectures. Building systems with complicated abstractions, needless indirection and more mocks in our tests than a comedy special. But there is a better way - thinking in terms of architectures of vertical slices instead horizontal layers. Once we embrace slices over layers, we open ourselves to a new, simpler architecture, changing how we build, organize and deploy systems."
                                   );
                sessions.Add(session3);
                speakersPerSession.Add(SpeakersPerSession.Create(db.Speakers.FirstOrDefault(s => s.LastName == "Bogard"), session3));

                var session4 =
                    Session.Create(Event.Create(
                                       EventType.QuestionAndAnswer, "Head to Head: Scott Allen and Jon Skeet with Scott Hanselman",
                                       start: new DateTime(2017, 06, 01, 11, 45, 00),
                                       end: new DateTime(2017, 06, 01, 12, 45, 00),
                                       room: db.Rooms.Where(r => r.Name == "1A").FirstOrDefault()
                                       ),
                                   track: db.Tracks.Where(t => t.Name == "Developer").FirstOrDefault(),
                                   level: SessionLevel.Introductionary,
                                   description: "We’re back with another Stack Overflow Question and Answer session - this time with K. Scott Allen going up against Jon Skeet. In this session, Scott Hanselman will select five questions from Stack Overflow pertaining to .NET and will send these questions to Scott and Jon a week before the talk."
                                   );
                sessions.Add(session4);
                speakersPerSession.AddRange(SpeakersPerSession.Create(new List <Speaker> {
                    db.Speakers.FirstOrDefault(s => s.LastName == "Skeet"), db.Speakers.FirstOrDefault(s => s.LastName == "Allen"), db.Speakers.FirstOrDefault(s => s.LastName == "Hanselman")
                }, session4));

                var session5 =
                    Session.Create(Event.Create(
                                       EventType.Talk, "Domain Driven Design: The Good Parts",
                                       start: new DateTime(2017, 06, 01, 11, 45, 00),
                                       end: new DateTime(2017, 06, 01, 12, 45, 00),
                                       room: db.Rooms.Where(r => r.Name == "2A").FirstOrDefault()
                                       ),
                                   track: db.Tracks.Where(t => t.Name == "Developer").FirstOrDefault(),
                                   level: SessionLevel.Expert,
                                   description: "The greenfield project started out so promising. Instead of devolving into big ball of mud, the team decided to apply domain-driven design principles. Ubiquitous language, proper boundaries, encapsulation, it all made sense."
                                   );
                sessions.Add(session5);
                speakersPerSession.Add(SpeakersPerSession.Create(db.Speakers.FirstOrDefault(s => s.LastName == "Bogard"), session5));

                db.AddRange(sessions);
                db.AddRange(speakersPerSession);
                Console.WriteLine("   Added sessions.");

                SaveChanges(db);

                Console.WriteLine("Seeding done.");

                ListDataFromInfoBoothPerspective(db);
            }
        }
コード例 #51
0
        /// <summary>
        /// Updates an existing event in the user's default calendar
        /// </summary>
        /// <param name="eventId">string. The unique Id of the event to update</param>
        /// <param name="LocationName">string. The name of the event location</param>
        /// <param name="BodyContent">string. The body of the event.</param>
        /// <param name="Attendees">string. semi-colon delimited list of invitee email addresses</param>
        /// <param name="EventName">string. The subject of the event</param>
        /// <param name="start">DateTimeOffset. The start date of the event</param>
        /// <param name="end">DateTimeOffset. The end date of the event</param>
        /// <param name="startTime">TimeSpan. The start hour:Min:Sec of the event</param>
        /// <param name="endTime">TimeSpan. The end hour:Min:Sec of the event</param>
        /// <returns>IEvent. The updated event</returns>
        public static async Task<IEvent> UpdateCalendarEventAsync(string eventId,
            string LocationName,
            string BodyContent,
            string Attendees,
            string EventName,
            DateTimeOffset start,
            DateTimeOffset end,
            TimeSpan startTime,
            TimeSpan endTime)
        {
            // Make sure we have a reference to the Exchange client
            var client = await GetOutlookClientAsync();

            var eventToUpdate = await client.Me.Calendar.Events.GetById(eventId).ExecuteAsync();
            eventToUpdate.Attendees.Clear();
            string[] splitter = { ";" };
            var splitAttendeeString = Attendees.Split(splitter, StringSplitOptions.RemoveEmptyEntries);
            Attendee[] attendees = new Attendee[splitAttendeeString.Length];
            for (int i = 0; i < splitAttendeeString.Length; i++)
            {
                Attendee newAttendee = new Attendee();
                newAttendee.EmailAddress = new EmailAddress() { Address = splitAttendeeString[i] };
                newAttendee.Type = AttendeeType.Required;
                eventToUpdate.Attendees.Add(newAttendee);
            }

            eventToUpdate.Subject = EventName;
            Location location = new Location();
            location.DisplayName = LocationName;
            eventToUpdate.Location = location;
            eventToUpdate.Start = (DateTimeOffset?)CalcNewTime(eventToUpdate.Start, start, startTime);
            eventToUpdate.End = (DateTimeOffset?)CalcNewTime(eventToUpdate.End, end, endTime);
            ItemBody body = new ItemBody();
            body.ContentType = BodyType.Text;
            body.Content = BodyContent;
            eventToUpdate.Body = body;

            // Update the calendar event in Exchange
            await eventToUpdate.UpdateAsync();

            Debug.WriteLine("Updated event: " + eventToUpdate.Id);
            return eventToUpdate;

            // A note about Batch Updating
            // You can save multiple updates on the client and save them all at once (batch) by 
            // implementing the following pattern:
            // 1. Call UpdateAsync(true) for each event you want to update. Setting the parameter dontSave to true 
            //    means that the updates are registered locally on the client, but won't be posted to the server.
            // 2. Call exchangeClient.Context.SaveChangesAsync() to post all event updates you have saved locally  
            //    using the preceding UpdateAsync(true) call to the server, i.e., the user's Office 365 calendar.

        }
コード例 #52
0
 public void Attendees_Tests(Attendee actual, Attendee expected)
 {
     Assert.AreEqual(expected.GetHashCode(), actual.GetHashCode());
     Assert.AreEqual(expected, actual);
 }
コード例 #53
0
 public CheckInAttendeePayload(Attendee attendee, int sessionId, string?clientMutationId)
     : base(attendee, clientMutationId)
 {
     _sessionId = sessionId;
 }
コード例 #54
0
 public void AddAttendee(Attendee attendee)
 {
     _context.Attendees.Add(attendee);
 }