예제 #1
0
파일: Data.cs 프로젝트: Kromnikov/diploma
 public static User user(string login)
 {
     ds= NDataAccess.DataAccess.GetDataSet(@"SELECT u.login as 'Имя пользователя',u.password as 'Пароль',r.role as 'Роль' FROM Users as u join Roles as r on r.login=u.login where u.login='******'", "Table1", connectionString);
     User user = new User();
     user.login = ds.Tables[0].Rows[0].ItemArray[0].ToString();
     user.password = ds.Tables[0].Rows[0].ItemArray[1].ToString();
     user.role = ds.Tables[0].Rows[0].ItemArray[2].ToString();
     return user;
 }
예제 #2
0
파일: Users.cs 프로젝트: Kromnikov/diploma
        private void edit()
        {
            try
            {
                addButton.Visible =false ;
                saveButton.Visible = true;
                user = Data.Users.user(dataGridView1.CurrentRow.Cells[0].Value.ToString());

                //loginTextBox1.Text = dataGridView1.CurrentRow.Cells[0].Value.ToString();
                //passwordTextBox2.Text = dataGridView1.CurrentRow.Cells[1].Value.ToString();
                //roleComboBox.SelectedIndex = roleComboBox.FindStringExact(dataGridView1.CurrentRow.Cells[2].Value.ToString());

                loginTextBox1.Text = user.login;
                passwordTextBox2.Text = "*****";
                roleComboBox.SelectedIndex = roleComboBox.FindStringExact(user.role);

                enterGroupBox1.Visible = true;
            }
            catch (Exception err) { MessageBox.Show("Выберите сотрудника", "Сотрудник не выбран", MessageBoxButtons.OK, MessageBoxIcon.Error); }
        }