Example #1
0
        /* сохранение значения поля TextBox в переменную Password и
         * переход на форму CreatorMenu*/
        private void Button2_Click(object sender, RoutedEventArgs e)
        {
            Data.UserAutorized.Password = TextBox3.Text;

            MessageBoxResult result = MessageBox.Show("Изменение пароля прошло успешно!", "Информация", MessageBoxButton.OK);

            result = MessageBoxResult.OK;

            if (Data.UserAutorized.TypeAcc == 1)
            {
                Window cm = new CreatorMenu();
                Hide();
                cm.ShowDialog();
                Show();
            }
            else if (Data.UserAutorized.TypeAcc == 2)
            {
                Window sm = new SpecialistMenu();
                Hide();
                sm.ShowDialog();
                Show();
            }
            else if (Data.UserAutorized.TypeAcc == 3)
            {
                Window tm = new TechnicianMenu();
                Hide();
                tm.ShowDialog();
                Show();
            }
        }
Example #2
0
 private void ComboBox3_IsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e)
 {
     if (ComboBox3.SelectedIndex == 0)
     {
         Window cm = new CreatorMenu();
         Hide();
         cm.ShowDialog();
         Show();
     }
     else if (ComboBox3.SelectedIndex == 1)
     {
         Window sm = new SpecialistMenu();
         Hide();
         sm.ShowDialog();
         Show();
     }
     else if (ComboBox3.SelectedIndex == 2)
     {
         Window tm = new TechnicianMenu();
         Hide();
         tm.ShowDialog();
         Show();
     }
 }
Example #3
0
 // закрытие формы
 private void Button1_Click(object sender, RoutedEventArgs e)
 {
     if (Data.UserAutorized.TypeAcc == 1)
     {
         Window cm = new CreatorMenu();
         Hide();
         cm.ShowDialog();
         Show();
     }
     else if (Data.UserAutorized.TypeAcc == 2)
     {
         Window sm = new SpecialistMenu();
         Hide();
         sm.ShowDialog();
         Show();
     }
     else if (Data.UserAutorized.TypeAcc == 3)
     {
         Window tm = new TechnicianMenu();
         Hide();
         tm.ShowDialog();
         Show();
     }
 }
Example #4
0
        // сохранение изменений профиля
        private void Button2_Click(object sender, RoutedEventArgs e)
        {
            var userTA = new dbDataSetTableAdapters.WorkersTableAdapter();

            var users  = userTA.GetDataByWHEREPhoneIsNull();
            var users1 = userTA.GetDataByWHEREPhoneIsNotNull();

            if (users.Count == 0)
            {
                MessageBox.Show("Поле Phone пусто!", "Информация", MessageBoxButton.OK);
            }
            else if (users1.Count != 0)
            {
                MessageBox.Show("Поле Phone не пусто!", "Информация", MessageBoxButton.OK);
            }

            var users2 = userTA.GetDataByWHEREEmailIsNull();
            var users3 = userTA.GetDataByWHEREEmailIsNotNull();

            if (users2.Count == 0)
            {
                MessageBox.Show("Поле Email пусто!", "Информация", MessageBoxButton.OK);
            }
            else if (users3.Count != 0)
            {
                MessageBox.Show("Поле Email не пусто!", "Информация", MessageBoxButton.OK);
            }


            if ((DataRowView)ComboBox1.SelectedItem == null)
            {
                MessageBox.Show("Заполните поле!", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            if (TextBox7.Text.Trim() == String.Empty)
            {
                MessageBox.Show("Заполните поле!", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            if (TextBox8.Text.Trim() == String.Empty)
            {
                MessageBox.Show("Заполните поле!", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            dbDataSet.TypeAccountRow typeAccount = ((DataRowView)ComboBox1.SelectedItem).Row as dbDataSet.TypeAccountRow;

            typeaccount = typeAccount.ID;
            login       = TextBox2.Text;

            var user1TA = new dbDataSetTableAdapters.WorkersTableAdapter();

            if (login != Data.UserAutorized.Login)
            {
                var userDataTable = user1TA.GetDataByLogin(login);
                if (userDataTable.Count > 0)
                {
                    MessageBox.Show("Логин занят!", "", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }
            }

            surname    = TextBox4.Text;
            name       = TextBox5.Text;
            patronymic = TextBox6.Text;
            CheckPhone(TextBox7.Text);
            CheckEmail(TextBox8.Text);
            Data.UserAutorized.TypeAcc    = typeaccount;
            Data.UserAutorized.Login      = login;
            Data.UserAutorized.Surname    = surname;
            Data.UserAutorized.Name       = name;
            Data.UserAutorized.Patronymic = patronymic;
            Data.UserAutorized.Phone      = TextBox7.Text;
            Data.UserAutorized.Email      = TextBox8.Text;

            userTA.Update(Data.UserAutorized);

            MessageBoxResult result = MessageBox.Show("Редактирование прошло успешно!", "Информация", MessageBoxButton.OK);

            result = MessageBoxResult.OK;

            if (Data.UserAutorized.TypeAcc == 1)
            {
                Window cm = new CreatorMenu();
                Hide();
                cm.ShowDialog();
                Show();
            }
            else if (Data.UserAutorized.TypeAcc == 2)
            {
                Window sm = new SpecialistMenu();
                Hide();
                sm.ShowDialog();
                Show();
            }
            else if (Data.UserAutorized.TypeAcc == 3)
            {
                Window tm = new TechnicianMenu();
                Hide();
                tm.ShowDialog();
                Show();
            }
        }