Пример #1
0
        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;
        }
Пример #2
0
        private void DgvClients_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)//select the client to updating or deactiving
        {
            BtnAdd.Hide();
            BtnUpdate.Show();
            BtnDeactive.Show();
            BtnCancel.Show();
            int Id = Convert.ToInt32(DgvClients.Rows[e.RowIndex].Cells[0].Value);

            //index of selected client on datagridview
            _selectedIndex  = e.RowIndex;
            _selectedClient = _clientService.Find(Id);
            //fill the selected client information to the textboxes
            TxtFullname.Text = _selectedClient.Fullname;
            TxtPhone.Text    = _selectedClient.Phone;
        }
Пример #3
0
        private void DgvBooks_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)//select the book to updating or deactiving
        {
            BtnAdd.Hide();
            BtnUpdate.Show();
            BtnDeactive.Show();
            BtnCancel.Show();
            int Id = Convert.ToInt32(DgvBooks.Rows[e.RowIndex].Cells[0].Value);

            _selectedBook = _bookService.Find(Id);
            //index of selected book on datagridview
            _SelectedIndex = e.RowIndex;
            //fill the selected book information to the textboxes
            TxtTitle.Text   = _selectedBook.Title;
            NumPrice.Value  = _selectedBook.Price;
            TxtAuthor.Text  = _selectedBook.Author;
            NmrcCount.Value = _selectedBook.Count;
        }