private void btnEditarPlayerVip_Click(object sender, EventArgs e) { try { if (gridRegistroGeral.SelectedCells.Count == 1) { int indexCell = gridRegistroGeral.CurrentCell.RowIndex; if (indexCell >= 0) { // Convert para int32 (caso o usuário extrapole o limite) e verifica se é maior que 32.000 (smallint) if (!string.IsNullOrEmpty(txtQtdDiasPlayerVip.Text)) { if (Convert.ToInt32(txtQtdDiasPlayerVip.Text) > 32000) { MessageBox.Show("A quantidade de dias do Player Vip excede 32.000 dias. Favor diminuir!", "Extrapolação de limites numéricos", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } } string _nickVip = gridRegistroGeral.Rows[indexCell].Cells[2].Value.ToString(); if (MessageBox.Show(string.Format("Deseja fazer as alterações no Player Vip \"{0}\"", _nickVip), "Confirmação!", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { bool retornoEdicao = _businessOperations.BusinessEditarPlayerVip(new PlayersVip { PlayerID = Convert.ToInt32(gridRegistroGeral.Rows[indexCell].Cells[0].Value.ToString()), PlayerNome = txtNomePlayerVip.Text.Trim(), PlayerNick = txtNickPlayerVip.Text.Trim(), PlayerAtivo = rdbPlayerVipAtivoSim.Checked, PlayerEhAdmin = rdbPlayerVipEhAdminSim.Checked, PlayerDataInclusaoSLOTVip = dtpDataCadastroPlayerVip.Value, PlayerDiasVIP = string.IsNullOrEmpty(txtQtdDiasPlayerVip.Text.Trim()) == true ? (short)0 : Convert.ToInt16(txtQtdDiasPlayerVip.Text.Trim()), }); if (retornoEdicao) { MessageBox.Show(string.Format("Sucesso ao fazer as alterações no Player Vip \"{0}\"", _nickVip), "Registro eliminado!", MessageBoxButtons.OK, MessageBoxIcon.Information); CarregarTodosPlayersVip(); } } } } } catch (Exception ex) { MessageBox.Show("Erro ao editar o Player Vip: " + ex.Message, "Erro!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }