Esempio n. 1
0
        private async void TodaysEvents_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Database_Service.Tasks x = (Database_Service.Tasks)TodaysEvents.SelectedItem;
            Application.Current.Resources.Remove("Event");
            Database_Service.SchedServiceClient client = new Database_Service.SchedServiceClient();

            var eventString = await client.GetSpecificMeetingInfoAsync(x.TaskID);

            Models.Event_Details eventDetails = new Models.Event_Details()
            {
                eventName          = eventString.TaskName,
                organizerFirstName = eventString.OrganizerFirstName,
                organizerLastName  = eventString.OrganizerLastName,
                taskID             = eventString.TaskID,
                topics             = eventString.Topic,
                isCancelled        = eventString.Cancelled,
                eventTime          = eventString.TaskTime,
                chatID             = eventString.ChatID,
                address            = eventString.TaskAddress
            };
            Application.Current.Resources.Add("Event", eventDetails);
            this.EventNameBlock.Text = eventDetails.eventName;
            this.AddressBlock.Text   = eventDetails.address;
            this.EventTimeBlock.Text = Convert.ToString(eventDetails.eventTime);
            if (eventDetails.chatID != null)
            {
                this.EventMeetingIDBlock.Text = "Your meeting ID string is: " + eventDetails.chatID;
            }
            this.DisplayMeetingInfoDialog();
        }
        private async void GetImage()
        {
            FileOpenPicker picker = new FileOpenPicker();

            picker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
            picker.FileTypeFilter.Add(".png");
            picker.FileTypeFilter.Add(".jpg");
            picker.FileTypeFilter.Add(".jpeg");

            StorageFile file = await picker.PickSingleFileAsync();

            if (file != null)
            {
                IRandomAccessStream stream = await file.OpenAsync(FileAccessMode.Read);

                BitmapImage image = new BitmapImage();
                await image.SetSourceAsync(stream.CloneStream());

                image.UriSource = new Uri(file.Path);

                MyBuffer buffer = new MyBuffer(new byte[stream.Size]);
                await stream.ReadAsync(buffer.Buffer, (uint)stream.Size, InputStreamOptions.None);

                var newAvatar = buffer.AsByteArray();

                Database_Service.SchedServiceClient client = new Database_Service.SchedServiceClient();
                account.avatarImage = newAvatar;
                Application.Current.Resources["User"] = account;
                await client.UpdateUserAsync(account.clientID, account.phoneNumber, account.address, account.username, newAvatar);

                EventViewModel e = this.DataContext as EventViewModel;
                e.newAvatar(newAvatar);
                DataContext = e;
            }
        }
 private void ConfirmButton_Click(object sender, RoutedEventArgs e)
 {
     Database_Service.SchedServiceClient client = new Database_Service.SchedServiceClient();
     client.UpdateUserAsync(account.clientID, this.PhoneNumberTextBox.Text.Trim(), "", this.UsernameTextBox.Text.Trim(), account.avatarImage);
     Application.Current.Resources.Remove("User");
     this.DisplaySuccessDialog();
 }
Esempio n. 4
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            client = new Database_Service.SchedServiceClient();
            if (eventDetails.topics != null)
            {
                this.MeetingTopics.Text = eventDetails.topics;
            }
            EventViewModel model = new EventViewModel();

            this.DataContext = new EventViewModel();
        }
Esempio n. 5
0
        private async void AddButton_Click(object sender, RoutedEventArgs e)
        {
            Database_Service.SchedServiceClient client = new Database_Service.SchedServiceClient();
            if (radioSelection.Equals("Meeting"))
            {
                meetingId = GenerateKey();
                var message = await client.InsertTaskAsync(account.clientID, radioSelection, this.DateSelection.Date.Date, this.AddressTextBox.Text.Trim(), this.EventNameTextBox.Text.Trim(), meetingId, this.TopicsTextBox.Text.Trim());

                this.DisplaySuccessDialog();
            }
            else if (radioSelection.Equals("Appointment") || radioSelection.Equals("Other"))
            {
                var message = await client.InsertTaskAsync(account.clientID, radioSelection, this.DateSelection.Date.Date, this.AddressTextBox.Text.Trim(), this.EventNameTextBox.Text.Trim(), null, this.TopicsTextBox.Text.Trim());

                this.DisplaySuccessDialog();
            }
            else if (radioSelection.Equals("Existing Meeting"))
            {
                var eventString = await client.AddUserToMeetingThroughChatIDAsync(account.clientID, this.MeetingIDTextBox.Text);

                if (eventString == "")
                {
                    this.DisplaySuccessDialog();
                }

                /*var eventString = await client.GetSpecificMeetingInfoAsync(Convert.ToInt32(this.MeetingIDTextBox.Text.Trim()));
                 * Models.Event_Details eventDetails = new Models.Event_Details()
                 * {
                 *  eventName = eventString.TaskName,
                 *  organizerFirstName = eventString.OrganizerFirstName,
                 *  organizerLastName = eventString.OrganizerLastName,
                 *  taskID = eventString.TaskID,
                 *  topics = eventString.Topic,
                 *  isCancelled = eventString.Cancelled,
                 *  eventTime = eventString.TaskTime,
                 *  chatID = eventString.ChatID,
                 *  address = eventString.TaskAddress
                 * };
                 * Application.Current.Resources.Add("Event", eventDetails);
                 * if (!eventDetails.isCancelled)
                 * {
                 *  var message = await client.InsertTaskAsync(account.clientID, "Meeting", eventDetails.eventTime, eventDetails.address, eventDetails.eventName, eventDetails.chatID, eventDetails.topics);
                 *  this.DisplaySuccessDialog();
                 * }
                 * else
                 * {
                 *  this.DisplayCancelledDialog();
                 * }   */
            }
            else
            {
                this.DisplayErrorDialog();
            }
        }
 private void RegisterButton_Click(object sender, RoutedEventArgs e)
 {
     if (FirstNameTextBox.Text == "" || LastNameTextBox.Text == "" || EmailAddressTextBox.Text == "" || PasswordTextBox.Password == "" || ConfirmPasswordTextBox.Password == "")
     {
         ErrorMessage.Text = "Something has been left incomplete";
     }
     else if (!Regex.IsMatch(FirstNameTextBox.Text.Trim(), @"^[A-Z][a-zA-Z]*$"))
     {
         ErrorMessage.Text = "First name is not allowed";
     }
     else if (!Regex.IsMatch(LastNameTextBox.Text.Trim(), @"^[A-Z][a-zA-Z]*$"))
     {
         ErrorMessage.Text = "Last name is not allowed";
     }
     else if (!Regex.IsMatch(UsernameTextBox.Text.Trim(), @"^([a-zA-Z_])([a-zA-Z0-9]*)"))
     {
         ErrorMessage.Text = "Username is not allowed (Must begin with letter and only letters/numbers are allowed)";
     }
     else if (!Regex.IsMatch(EmailAddressTextBox.Text.Trim(), @"^([a-zA-Z_])([a-zA-Z0-9_\-\.]*)@(\[((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}|((([a-zA-Z0-9\-]+)\.)+))([a-zA-Z]{2,}|(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\])$"))
     {
         ErrorMessage.Text = "Email address is not allowed";
     }
     else if (!Regex.IsMatch(PhoneNumberTextBox.Text.Trim(), @"^[0-9][0-9]*$"))
     {
         ErrorMessage.Text = "Phone number is not allowed (Must be numbers only)";
     }
     else if (PasswordTextBox.Password.Length < 6)
     {
         ErrorMessage.Text = "Password length should be a minimum of 6 characters";
     }
     else if ((string.Compare(PasswordTextBox.Password, ConfirmPasswordTextBox.Password) == -1))
     {
         ErrorMessage.Text = "Password does not match";
     }
     else
     {
         ErrorMessage.Text = "";
         //Run data and create account in database
         try
         {
             Database_Service.SchedServiceClient client = new Database_Service.SchedServiceClient();
             client.CreateUserAsync(this.FirstNameTextBox.Text.Trim(), this.LastNameTextBox.Text.Trim(), this.PhoneNumberTextBox.Text.Trim(), this.EmailAddressTextBox.Text.Trim(), "", this.UsernameTextBox.Text.Trim(), this.PasswordTextBox.Password.Trim());
         }
         catch (Exception)
         {
         }
         finally
         {
             this.DisplaySuccessDialog();
         }
     }
 }
Esempio n. 7
0
        public Home_Page()
        {
            // TODO: Confirm that "Task" works or if we need to reference the event by something else
            //     Models.Event_Details task = Application.Current.Resources["Task"] as Models.Event_Details;

            this.InitializeComponent();
            this.Update_Weather();
            Timer.Tick    += Timer_Tick;
            Timer.Interval = new TimeSpan(0, 0, 1);
            Timer.Start();
            Database_Service.SchedServiceClient client = new Database_Service.SchedServiceClient();
            EventViewModel model = new EventViewModel();

            Models.User_Account account = Application.Current.Resources["User"] as Models.User_Account;
            model.EventList  = client.GetMeetingInfoForUserAsync(account.clientID).GetAwaiter().GetResult();
            this.DataContext = model;
        }
        private async void LoginButton_Click(object sender, RoutedEventArgs e)
        {
            this.LoginButton.IsEnabled = false;
            Database_Service.SchedServiceClient client = new Database_Service.SchedServiceClient();
            string testString;

            if (s == "")
            {
                testString = await client.LoginCheckAsync(this.EmailTextBox.Text.Trim(), this.PasswordTextBox.Password.Trim());
            }
            else
            {
                testString = await client.LoginCheckAsync(this.EmailTextBox.Text.Trim(), s);
            }

            if (testString == "Login Successful")
            {
                var user = await client.GetUserAsync(this.EmailTextBox.Text.Trim());

                Models.User_Account account = new Models.User_Account()
                {
                    clientID    = user.ClientID,
                    username    = user.UserName,
                    avatarImage = user.Avatar,
                    firstName   = user.FirstName,
                    lastName    = user.LastName,
                    phoneNumber = user.Phone,
                    address     = user.Address,
                    email       = user.Email
                };
                Application.Current.Resources.Add("User", account);
                this.DisplaySuccessDialog();
            }
            else
            {
                this.ErrorMessage.Text     = Login_Page.ErrorMessageText;
                this.LoginButton.IsEnabled = true;
            }
        }
 private void DeleteButton_Click(object sender, RoutedEventArgs e)
 {
     Database_Service.SchedServiceClient client = new Database_Service.SchedServiceClient();
     //    client.CancelMeetingAsync( );
 }
Esempio n. 10
0
 private static System.ServiceModel.EndpointAddress GetDefaultEndpointAddress()
 {
     return(SchedServiceClient.GetEndpointAddress(EndpointConfiguration.BasicHttpBinding_ISchedService));
 }
Esempio n. 11
0
 private static System.ServiceModel.Channels.Binding GetDefaultBinding()
 {
     return(SchedServiceClient.GetBindingForEndpoint(EndpointConfiguration.BasicHttpBinding_ISchedService));
 }
Esempio n. 12
0
 public SchedServiceClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) :
     base(SchedServiceClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress)
 {
     this.Endpoint.Name = endpointConfiguration.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
Esempio n. 13
0
 public SchedServiceClient(EndpointConfiguration endpointConfiguration) :
     base(SchedServiceClient.GetBindingForEndpoint(endpointConfiguration), SchedServiceClient.GetEndpointAddress(endpointConfiguration))
 {
     this.Endpoint.Name = endpointConfiguration.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
Esempio n. 14
0
 public SchedServiceClient() :
     base(SchedServiceClient.GetDefaultBinding(), SchedServiceClient.GetDefaultEndpointAddress())
 {
     this.Endpoint.Name = EndpointConfiguration.BasicHttpBinding_ISchedService.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }