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; }
// Update Fill MEthods// public void FilUpdateData() { TxtName.Text = _manager.Name; TxtSurname.Text = _manager.Surname; TxtAge.Text = Convert.ToInt32(_manager.Age).ToString(); TxtEmail.Text = _manager.Email; TxtPhone.Text = _manager.Phone; TxtPassword.Hide(); LblPassword.Hide(); BtnSave.Location = new System.Drawing.Point(24, 256); BtnCancel.Location = new System.Drawing.Point(94, 256); BtnSave.Text = "Update"; this.Text = "Yenile"; }