private void btn_done_Click(object sender, EventArgs e) { for (int i = 0; i < dgv_worker1.Rows.Count; i++) { if (Convert.ToInt32(dgv_worker1[4, i].Value) == 0) { continue; } if (_workerQuery.RileID == 3) { if (Convert.ToInt32(dgv_worker1[4, i].Value) > Convert.ToInt32(dgv_worker1[3, i].Value)) { dgv_worker1.Rows[i].ErrorText = "Количество не может быть больше основного количества."; return; } } _addTask[Convert.ToInt32(dgv_worker1[1, i].Value)] = Convert.ToInt32(dgv_worker1[4, i].Value); } CreateApplication(_addTask); MessageBox.Show("Данные обновлены!", "Обновление данных"); _addTask.Clear(); WorkersForm worker1Form = new WorkersForm(_userID, _workerQuery); worker1Form.Show(); status = false; this.Close(); }
private void btn_logIn_Click(object sender, EventArgs e) { if (Authentications.AuthCheckLogIn(tb_userLogin.Text, tb_password.Text)) { int userRoleId; int userID; string connectionString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString; using (SqlConnection connection = new SqlConnection(connectionString)) { connection.Open(); SqlCommand command = new SqlCommand($"Select Role_id From Users Where Login = '******'", connection); userRoleId = Convert.ToInt32(command.ExecuteScalar()); command = new SqlCommand($"Select User_id From Users Where Login = '******'", connection); userID = Convert.ToInt32(command.ExecuteScalar()); } if (userRoleId == 1) { btn17 = true; ChiefWorm chiefWorm = new ChiefWorm(userID); chiefWorm.Show(); Close(); } if (userRoleId == 2) { btn17 = true; WorkersForm worker1Form = new WorkersForm(userID, new FirstWorkerQuery()); worker1Form.Show(); Close(); } if (userRoleId == 3) { btn17 = true; WorkersForm worker1Form = new WorkersForm(userID, new SecondWorkerQuery()); worker1Form.Show(); Close(); } } else { MessageBox.Show("Неверное имя или пароль.", "Ошибка входа"); } }