Ejemplo n.º 1
0
        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();
                }
            }
        }
Ejemplo n.º 2
0
        public JsonResult Delete(Guid userID)
        {
            var users = new UsersDB();

            users.DeleteUser(userID);
            return(Json("ok"));
        }
Ejemplo n.º 3
0
        /// <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();
        }
Ejemplo n.º 4
0
        /// <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));
                }
            }
        }