private void toolStripDel_Click(object sender, EventArgs e) { if (dataGridView1.Rows.Count == 0) { return; } if (!this.dataGridView1.Rows[rowIndex].IsNewRow) { if (DialogResult.No == MessageBox.Show(("Verrà eliminata l'utenza selezionata. Vuoi proseguire ?"), "Elimina Utenza", MessageBoxButtons.YesNo, MessageBoxIcon.Question)) { return; } DataRow row = dataTable.Rows[rowIndex]; if (row == null) { return; } if (int.TryParse(row.ItemArray[0].ToString(), out int intKey)) { UsersDB.DeleteUser(intKey); LoadGridUtenze(); } } }
public JsonResult Delete(Guid userID) { var users = new UsersDB(); users.DeleteUser(userID); return(Json("ok")); }
/// <summary> /// The DeleteUser_Click server event handler /// is used to delete an user for this portal /// </summary> protected override void OnDelete() { // get user id from dropdownlist of users UsersDB users = new UsersDB(); users.DeleteUser(Int32.Parse(allUsers.SelectedItem.Value)); base.OnDelete(); // Rebind list BindData(); }
/// <summary> /// deletex /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="T:System.Web.UI.WebControls.GridViewDeleteEventArgs"/> instance containing the event data.</param> protected void allUsers_RowDeleting(object sender, GridViewDeleteEventArgs e) { GridView usersGrid = (GridView)sender; GridViewRow row = usersGrid.Rows[e.RowIndex]; Guid _userID = new Guid(((Appleseed.Framework.Web.UI.WebControls.LinkButton)row.FindControl("DeleteBtn")).CommandArgument); // TODO: Fix this UsersDB users = new UsersDB(); users.DeleteUser(_userID); OnDelete(); }
private void DeleteUser(int rowIndex) { int? intKey = null; DataRow row = dataTableUser.Rows[rowIndex]; if (row != null) { if (DialogResult.No == MessageBox.Show(("Verrà eliminata l'utenza selezionata. Vuoi proseguire ?"), "Elimina Utenza", MessageBoxButtons.YesNo, MessageBoxIcon.Question)) { return; } int outIntKey; if (int.TryParse(row.ItemArray[0].ToString(), out outIntKey)) { intKey = outIntKey; UsersDB.DeleteUser(outIntKey); LoadGridUtenze(UsersDB.SetQueryUser(string.Empty)); } } }