Exemplo n.º 1
0
 private void SaveChanges(object sender, RoutedEventArgs e)
 {
     if ((string.IsNullOrWhiteSpace(NameTextBox.Text)))
     {
         MessageBox.Show("Login's length should be more than 6 symbols.");
         return;
     }
     else if (NameTextBox.Text.Length == 0)
     {
         MessageBox.Show("Name's length should be more than 0 symbols.");
         return;
     }
     else if (!DateTime.TryParse(BirthDateTextBox.Text, out DateTime birthdate1))
     {
         MessageBox.Show("Birthdate should be in format 2000-1-1");
         return;
     }
     else if (NameTextBox.Text.Length > 0 && LoginTextBox.Text.Length > 6)
     {
         User.Login      = LoginTextBox.Text;
         User.Name       = NameTextBox.Text;
         User.VKID       = VKTextBox.Text;
         User.TelegramID = TGTextBox.Text;
         User.BirthDate  = DateTime.Parse(BirthDateTextBox.Text);
         if (MessageBox.Show("Do you want to change avatar picture?", "Confirm changes", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
         {
             var chooseAvatar = new ChooseAvatar(User);
             chooseAvatar.Show();
         }
         repository.ChangeUserProfile(User);
     }
 }
Exemplo n.º 2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            int k = 1;

            if (DateTime.TryParse(BirthDateTextBox.Text, out DateTime birthdate))
            {
                k = 0;
            }
            if (LoginTextBox.Text.Length > 6 && NameTextBox.Text.Length > 0 && k == 0)
            {
                user1 = rep.Registration(NameTextBox.Text, LoginTextBox.Text, PasswordBox.Password, DateTime.Parse(BirthDateTextBox.Text), VKTextBox.Text, TGTextBox.Text);
                var chooseAvatar = new ChooseAvatar(user1);
                chooseAvatar.Show();
            }
            else
            {
                if (LoginTextBox.Text.Length <= 6)
                {
                    MessageBox.Show("Login's length should be more than 6 symbols.");
                }
                if (NameTextBox.Text.Length == 0)
                {
                    MessageBox.Show("Name's length should be more than 0 symbols.");
                }
                if (!DateTime.TryParse(BirthDateTextBox.Text, out DateTime birthdate1))
                {
                    MessageBox.Show("Birthdate should be in format 2000-1-1");
                }
            }
        }
Exemplo n.º 3
0
        private void ChangePicClick(object sender, RoutedEventArgs e)
        {
            var choosewin = new ChooseAvatar(User);

            choosewin.Show();
        }