/// <summary> /// Finally when the client made the changes that he wants the program checks if all the fields /// all fields are fill. If all fields are fill then the program exec the apropriate querry for the /// update of the rating, else show a error message. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnSelect_Click(object sender, EventArgs e) { LblRatingValue.Show(); LblComment.Show(); LblUsername.Show(); TbxComment.Show(); TbxRatingValue.Show(); CmbUsername.Show(); BtnEdit.Show(); LblSelect.Hide(); CmbSelect.Hide(); BtnSelect.Hide(); SelectedData = DCom.GetData(String.Format(SqlExec, CmbSelect.SelectedValue)); TbxRatingValue.Text = SelectedData.Rows[0]["Rating_Value"].ToString(); TbxComment.Text = SelectedData.Rows[0]["Comment"].ToString(); CmbUsername.DataSource = DCom.GetData("SELECT * FROM users"); CmbUsername.DisplayMember = "Username"; CmbUsername.ValueMember = "Username"; }
private void DgvManagers_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)//select the manager to updating or deactiving { BtnAdd.Hide(); BtnUpdate.Show(); BtnDeactive.Show(); BtnCancel.Show(); TxtPassword.Hide(); LblPassword.Text = "New Password"; LblComment.Show(); TxtNewPassword.Show(); int Id = Convert.ToInt32(DgvManagers.Rows[e.RowIndex].Cells[0].Value); _selectedManager = _managerService.Find(Id); //index of selected manager on datagridview _selectedIndex = e.RowIndex; //fill the selected manager information to the textboxes TxtName.Text = _selectedManager.Name; TxtSurname.Text = _selectedManager.Surname; TxtPhone.Text = _selectedManager.Phone; TxtUsername.Text = _selectedManager.Username; if (_selectedManager.IsAdmin == true) { CmbPosition.SelectedIndex = 0; return; } CmbPosition.SelectedIndex = 1; }