public async Task AddAsync(DateTime meetingStartTime, TimeSpan meetingStartHour, DateTime meetingEnding, TimeSpan meetingEndHour, string title, string description, string place, IEnumerable <string> users, string organiserUsername)
        {
            DateTime startTime = new DateTime(meetingStartTime.Year, meetingStartTime.Month, meetingStartTime.Day, meetingStartHour.Hours, meetingStartHour.Minutes, meetingStartHour.Seconds);
            DateTime endTime   = new DateTime(meetingEnding.Year, meetingEnding.Month, meetingEnding.Day, meetingEndHour.Hours, meetingEndHour.Minutes, meetingEndHour.Seconds);

            var meeting = new Meeting
            {
                MeetingStartTime = startTime,
                MeetingEnding    = endTime,
                Title            = title,
                Description      = description,
                Place            = place,
                OrganiserId      = this.usersService.GetUserByUsername(organiserUsername).Id,
                Organiser        = this.usersService.GetUserByUsername(organiserUsername),
            };

            meeting.Id = Guid.NewGuid().ToString();

            foreach (var user in users)
            {
                var userMeeting = new UserMeeting
                {
                    UserId    = this.usersService.GetUserByUsername(user).Id,
                    User      = this.usersService.GetUserByUsername(user),
                    MeetingId = meeting.Id,
                    Meeting   = meeting,
                };

                meeting.UserMeeting.Add(userMeeting);
            }

            await this.meetingRepository.AddAsync(meeting);

            await this.meetingRepository.SaveChangesAsync();
        }
Beispiel #2
0
        public async Task InsertMeetingAsync(UserMeeting meeting)
        {
            DbContext.UserMeetings.Add(meeting);
            await DbContext.SaveChangesAsync();

            //return meeting;
        }
Beispiel #3
0
            public void _003CInitUI_003Eb__7()
            {
                int num  = 0;
                int num2 = 0;

                foreach (SeriesDataSeriesMeetingMeeting meeting in MeetingList)
                {
                    num++;
                    UserMeeting userMeeting = new UserMeeting();
                    userMeeting.BeginTime       = meeting.BeginTime;
                    userMeeting.EndTime         = meeting.EndTime;
                    userMeeting.ID              = meeting.ID;
                    userMeeting.isBrowserd      = meeting.isBrowserd;
                    userMeeting.isDownload      = meeting.isDownload;
                    userMeeting.Location        = meeting.Location;
                    userMeeting.Name            = meeting.Name;
                    userMeeting.pincode         = meeting.pincode;
                    userMeeting.SeriesMeetingID = meeting.SeriesMeetingID;
                    userMeeting.type            = meeting.type;
                    Home home = Enumerable.FirstOrDefault(Enumerable.OfType <Home>(Application.Current.Windows));
                    if (home != null)
                    {
                        bool invisible = false;
                        if (!_003C_003E4__this.NowSeriesID.Equals("") && !userMeeting.SeriesMeetingID.Equals(_003C_003E4__this.NowSeriesID))
                        {
                            invisible = true;
                        }
                        else
                        {
                            num2++;
                        }
                        _003C_003E4__this.MeetingRoomWP.Children.Add(new MeetingRoom(_003C_003E4__this.UserID, _003C_003E4__this.UserPWD, userMeeting, home.Home_Change2MeetingDataCT_Callback, "", invisible));
                    }
                }
            }
 public MeetingRoom(string UserID, string UserPWD, UserMeeting userMeeting, Home_Change2MeetingDataCT_Function callback, string NewAddMeetingID = "", bool invisible = false)
 {
     InitializeComponent();
     this.UserID      = UserID;
     this.UserPWD     = UserPWD;
     this.userMeeting = userMeeting;
     Home_Change2MeetingDataCT_Event += callback;
     this.NewAddMeetingID             = NewAddMeetingID;
     this.invisible = invisible;
     if (this.invisible)
     {
         base.Visibility = Visibility.Collapsed;
     }
     base.Loaded   += new RoutedEventHandler(MeetingRoom_Loaded);
     base.Unloaded += new RoutedEventHandler(MeetingRoom_Unloaded);
     CacheMinuteTTL = Settings.Default.CacheMinuteTTL;
 }
        //nen  bo tham so vao trong
        public async Task <UserMeeting> GetUserDetailsAsync(string accessToken)
        {
            RestClient restClient = new RestClient();
            var        request    = new RestRequest();

            restClient.BaseUrl = new Uri("https://api.zoom.us/v2/users/me");
            request.AddHeader("Authorization", string.Format("Bearer {0}", accessToken));
            var    response       = restClient.Get(request);
            string ResponseString = "";
            var    userMeeting    = new UserMeeting();

            if (response.StatusCode == System.Net.HttpStatusCode.OK)
            {
                var user = JObject.Parse(response.Content);
                userMeeting.userId    = user["id"].ToString();
                userMeeting.userEmail = user["email"].ToString();
            }
            return(userMeeting);
        }
 public MeetingRoom(string UserID, string UserPWD, UserMeeting userMeeting, Home_Change2MeetingDataCT_Function callback, string NewAddMeetingID = "", bool invisible = false)
 {
     //MouseTool.ShowLoading();
     InitializeComponent();
     this.UserID      = UserID;
     this.UserPWD     = UserPWD;
     this.userMeeting = userMeeting;
     this.Home_Change2MeetingDataCT_Event += callback;
     this.NewAddMeetingID = NewAddMeetingID;
     this.invisible       = invisible;
     //先判斷是從系列會議到底是否隱藏(1)
     if (this.invisible == true)
     {
         this.Visibility = Visibility.Collapsed;
     }
     this.Loaded        += MeetingRoom_Loaded;
     this.Unloaded      += MeetingRoom_Unloaded;
     this.CacheMinuteTTL = PaperLess_Emeeting.Properties.Settings.Default.CacheMinuteTTL;
     //MouseTool.ShowArrow();
 }
Beispiel #7
0
        private void InitUI()
        {
            SeriesMeetingCT_ChangeMeetingRoomWP_Callback = new SeriesMeetingCT_ChangeMeetingRoomWP_Function(ChangeMeetingRoomWP);
            List <SeriesDataSeriesMeetingSeries>  SeriesList  = new List <SeriesDataSeriesMeetingSeries>();
            List <SeriesDataSeriesMeetingMeeting> MeetingList = new List <SeriesDataSeriesMeetingMeeting>();

            foreach (SeriesDataSeriesMeeting seriesMeeting in seriesData.SeriesMeeting)
            {
                SeriesList.Add(seriesMeeting.Series);
                MeetingList.AddRange(seriesMeeting.MeetingList.ToList());
            }


            string CourseOrMeeting_String = PaperLess_Emeeting.Properties.Settings.Default.CourseOrMeeting_String;

            txtCount.Text = string.Format("共 {0} 組系列{1}", SeriesList.Count, CourseOrMeeting_String);

            Task.Factory.StartNew(() =>
            {
                this.Dispatcher.BeginInvoke(new Action(() =>
                {
                    //int i = 0;
                    //SeriesList.ForEach(item =>
                    foreach (SeriesDataSeriesMeetingSeries item in SeriesList)
                    {
                        //i++;
                        SeriesMenu sm = new SeriesMenu(item, SeriesMeetingCT_ChangeMeetingRoomWP_Callback);
                        SeriesMenuSP.Children.Add(sm);
                        if (sm.seriesDataSeriesMeetingSeries.ID.Equals(NowSeriesID) == true)
                        {
                            sm.btnImg.Source = new BitmapImage(new Uri("images/icon_arrow_active.png", UriKind.Relative));
                            //sm.Background = new SolidColorBrush(Color.FromRgb(1, 161, 195));
                            sm.Background = ColorTool.HexColorToBrush("#019fde");
                            sm.txtSeriesName.Foreground = Brushes.White;
                        }
                    }//);
                }));

                this.Dispatcher.BeginInvoke(DispatcherPriority.SystemIdle, new Action(() =>
                                                                                      //this.Dispatcher.BeginInvoke(new Action(() =>
                {
                    int i = 0;
                    //MeetingList.ForEach(item =>
                    int total = 0;
                    foreach (SeriesDataSeriesMeetingMeeting item in MeetingList)
                    {
                        i++;
                        UserMeeting um     = new UserMeeting();
                        um.BeginTime       = item.BeginTime;
                        um.EndTime         = item.EndTime;
                        um.ID              = item.ID;
                        um.isBrowserd      = item.isBrowserd;
                        um.isDownload      = item.isDownload;
                        um.Location        = item.Location;
                        um.Name            = item.Name;
                        um.pincode         = item.pincode;
                        um.SeriesMeetingID = item.SeriesMeetingID;
                        um.type            = item.type;

                        Home Home_Window = App.Current.Windows.OfType <Home>().FirstOrDefault();
                        if (Home_Window != null)
                        {
                            bool invisible = false;
                            if (NowSeriesID.Equals("") == false && um.SeriesMeetingID.Equals(NowSeriesID) == false)
                            {
                                invisible = true;
                            }
                            else
                            {
                                ++total;
                            }
                            var room = new MeetingRoom(UserID, UserPWD, um, Home_Window.Home_Change2MeetingDataCT_Callback, "", invisible);
                            MeetingRoomWP.Children.Add(room);
                        }

                        //string CourseOrMeeting_String = PaperLess_Emeeting.Properties.Settings.Default.CourseOrMeeting_String;
                        //txtCount.Text = string.Format("共 {0} 組系列{1}", total, CourseOrMeeting_String);
                    }//);
                }));
            });
        }
Beispiel #8
0
        async void AcceptButton_Clicked(object sender, EventArgs e)
        {
            if ((IsDateAndTimeCorrect() &&
                 IsActivityPicked() &&
                 IsDescription()))
            {
                var user = repo.GetUserById(int.Parse(Preferences.Get("id", "")));

                repo.UpdateUser("OrganisedMeetings", (user.OrganisedMeetings + 1).ToString(), user.Id);

                var newPin = new Model.Pin {
                    Latitude = pin.Position.Latitude, Longitude = pin.Position.Longitude, Icon = imagePicked
                };
                repo.InsertPin(newPin);

                Meeting meeting = new Meeting
                {
                    OrganizerUser_Id  = user.Id,
                    OrganizerName     = user.Name,
                    OrganizerLastName = user.LastName,
                    OrganizerAge      = user.Age,
                    ActivityName      = activityPicked,
                    ActivityIcon      = imagePicked,
                    Date         = DatePicker.Date,
                    Time         = TimePicker.Time,
                    Participants = 1,
                    Pin_Id       = repo.GetIdByPin(newPin),
                    Description  = Editor.Text
                };
                repo.InsertMeeting(meeting);

                UserMeeting userMeeting = new UserMeeting
                {
                    User_Id    = user.Id,
                    Meeting_Id = meeting.Id
                };

                repo.InsertUserMeeting(userMeeting);

                string path     = "Assets";
                var    assembly = typeof(MainPage).GetTypeInfo().Assembly;
                var    stream   = assembly.GetManifestResourceStream($"{assembly.GetName().Name}.{path}.{imagePicked}");
                pin.Icon = BitmapDescriptorFactory.FromStream(stream, id: imagePicked);
                map.MoveToRegion(MapSpan.FromCenterAndRadius(pin.Position, map.VisibleRegion.Radius));

                pin.Label   = activityPicked;
                pin.Address = "Show more";

                await PopupNavigation.Instance.PopAsync();
            }
            else
            {
                if (!IsDateAndTimeCorrect())
                {
                    await DisplayAlert("Something went wrong.", "The date and time must be greater than today.", "Back");
                }
                if (!IsActivityPicked())
                {
                    await DisplayAlert("Something went wrong.", "You have to choose activity.", "Back");
                }
                if (!IsDescription())
                {
                    await DisplayAlert("Something went wrong.", "You have to write something in the description.", "Back");
                }
            }
        }
Beispiel #9
0
        public async Task <int> Create(MeetingModel meeting)
        {
            var    creator = _dbContext.Users.Find(meeting.UserId);
            string title   = "";

            // create default title if none specified
            if (string.IsNullOrEmpty(meeting.Title))
            {
                title = "Balade avec " + creator.Name;
            }
            else
            {
                title = meeting.Title;
            }

            var meetingDTO = new Meeting();

            meetingDTO.PlaceId      = meeting.PlaceId;
            meetingDTO.UserId       = meeting.UserId;
            meetingDTO.Title        = title;
            meetingDTO.StartDate    = meeting.StartDate;
            meetingDTO.EndDate      = meeting.StartDate + meeting.Duration;
            meetingDTO.CreationDate = DateTime.UtcNow;

            _dbContext.Meetings.Add(meetingDTO);

            _dbContext.SaveChanges(); //commit to get meeting id

            var attendee = new UserMeeting();

            attendee.MeetingId        = meetingDTO.Id;
            attendee.UserId           = meeting.UserId;
            attendee.Status           = (int)UserMeetingStatus.Going;
            attendee.CreationDate     = DateTime.UtcNow;
            attendee.ModificationDate = DateTime.UtcNow;
            _dbContext.UserMeetings.Add(attendee);

            string placeName = _dbContext.Places.Find(meeting.PlaceId).Name;

            var allOtherUsers = _dbContext.Users.Where(user => user.Id != creator.Id).ToList();

            foreach (var friend in allOtherUsers)
            {
                attendee                  = new UserMeeting();
                attendee.MeetingId        = meetingDTO.Id;
                attendee.UserId           = friend.Id;
                attendee.Status           = (int)UserMeetingStatus.Pending;
                attendee.CreationDate     = DateTime.UtcNow;
                attendee.ModificationDate = DateTime.UtcNow;
                _dbContext.UserMeetings.Add(attendee);
            }

            using (var sender = new Sender(_notificationSettings.FirebaseServerKey))
            {
                var registrationIds = allOtherUsers
                                      .Where(user => !string.IsNullOrEmpty(user.PushToken))
                                      .Select(user => user.PushToken)
                                      .ToList();

                var message = new Message
                {
                    RegistrationIds = registrationIds,
                    Notification    = new Notification
                    {
                        Title       = creator.Name + " est parti en balade",
                        Body        = "Cliquez ici pour rejoindre la balade",
                        ClickAction = _endpointSettings.Spa + "/#/meeting/" + meetingDTO.Id,
                        Icon        = _notificationSettings.IconUrl,
                        Badge       = _notificationSettings.BadgeUrl
                    }
                };
                var result = await sender.SendAsync(message);
            }

            _dbContext.SaveChanges();
            return(meetingDTO.Id);
        }
 public void InsertUserMeeting(UserMeeting userMeeting)
 {
     database.InsertUserMeeting(userMeeting);
 }