Exemplo n.º 1
0
        private void ChangeprofileSave_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (tbLoginnew.Text == "" && tbtelephonenew.Text == "" && tbmailnew.Text == "" && tbmailnew.Text == "" && lbNamenew.Text == "")
                {
                    throw new Exception("Вы не заполнили ни одного поля!");
                }
                Profile newprof = new Profile();

                newprof.ID        = profile.ID;
                newprof.Telephone = tbtelephonenew.Text;
                newprof.Name      = lbNamenew.Text;
                newprof.Login     = tbLoginnew.Text;
                newprof.Mail      = tbmailnew.Text;
                if (tbLoginnew.Text != "")
                {
                    tbLogin.Text = newprof.Login;
                }
                if (lbNamenew.Text != "")
                {
                    lbName.Text = newprof.Name;
                }
                if (tbmailnew.Text != "")
                {
                    mail.Text = newprof.Mail;
                }
                if (tbtelephonenew.Text != "")
                {
                    telephone.Text = newprof.Telephone;
                }
                client.ChangeProfileInformation(newprof);
                newprofilechange.Visibility  = Visibility.Hidden;
                btnBack.Visibility           = Visibility.Hidden;
                ChangeprofileSave.Visibility = Visibility.Hidden;
                Changeprofile.Visibility     = Visibility.Visible;
                tbLogin.Visibility           = Visibility.Visible;
                lbName.Visibility            = Visibility.Visible;
                mail.Visibility      = Visibility.Visible;
                telephone.Visibility = Visibility.Visible;
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show(ex.Message, "Предупреждение");
            }
        }