Beispiel #1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (txtUserID.Text == "")
            {
                MessageBox.Show("Please select a  record");
            }
            else
            {
                //Getting User ID from Form
                u.id = Convert.ToInt32(txtUserID.Text);

                bool success = dal.Delete(u);
                //if data is deleted then the value of success will be true else it will be false
                if (success == true)
                {
                    //User Deleted Successfully
                    MessageBox.Show("User deleted successfully");
                    clear();
                }
                else
                {
                    //Failed to Delete User
                    MessageBox.Show("Failed to delete user");
                }
                //refreshing Datagrid view
                DataTable dt = dal.Select();
                dgvUsers.DataSource = dt;
            }
        }
Beispiel #2
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            //getting user id from Form
            u.id = Convert.ToInt32(txtUserID.Text);

            bool success = dal.Delete(u);

            //if data is delete the value of success will be true else false

            if (success == true)
            {
                //Data deleted successfull
                MessageBox.Show("User Successfully Deleted.");
                clear();
            }
            else
            {
                //Data Deleted failed
                MessageBox.Show("User Failed to Delete.");
            }
            //Refreshing data grid view
            DataTable dt = dal.Select();

            dgvUsers.DataSource = dt;
        }
Beispiel #3
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (cmbUserType.Text.ToLower() == "admin")
            {
                MessageBox.Show("Bạn không thể xóa tài khoản admin, vui lòng liên hệ admin");
            }
            else
            {
                //Getting User ID from Form
                userBLL.id = Convert.ToInt32(txtBoxUserID.Text);

                bool success = userDAL.Delete(userBLL);

                if (success == true)
                {
                    MessageBox.Show("Người dùng " + txtBoxFirstName.Text + " được xóa khỏi hệ thống thành công");
                    clear();
                }
                else
                {
                    MessageBox.Show("Không thể cập nhật người dùng này " + txtBoxFirstName.Text);
                }

                //refreshing data grid view
                DataTable dataTable = userDAL.Select();
                dgvUser.DataSource = dataTable;
            }
        }
        private void btnDelete_Click(object sender, EventArgs e)
        {
            #region Throw Exception

            if (txtUserID.Text == "" && txtFirstName.Text == "" && txtLastName.Text == "" && txtEmail.Text == "" && txtUsername.Text == "" && txtPassword.Text == "" && txtContact.Text == "" && txtAddress.Text == "" && cmbGender.Text == "" && cmbUserType.Text == "")
            {
                MessageBox.Show(" Please Select First Into The DataGrid View Then Delete Data.... !! ");
            }

            #endregion

            else
            {
                //Getting User ID from form
                u.id = Convert.ToInt32(txtUserID.Text);

                bool success = dal.Delete(u);
                //If the data is deleted the value of success will be true else it will be false
                if (success == true)
                {
                    MessageBox.Show("User Deleted Successfully");
                    clear();
                }
                else
                {
                    MessageBox.Show("Failed to Delete User");
                }

                //Refreshing Datagrid view
                DataTable dt = dal.select();
                dgvUsers.DataSource = dt;

                error();
            }
        }
Beispiel #5
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (u.id > 0)
            {
                u.id = Convert.ToInt32(txtUserId.Text);

                bool success = dal.Delete(u);

                if (success == true)
                {
                    MessageBox.Show("User succesfully Deleted");
                    clear();
                }

                else
                {
                    MessageBox.Show("Failed to Delete the user");
                }
            }
            else
            {
                MessageBox.Show("Please choose user to delete");
            }
            //Refreshing Data Grid View
            DataTable dt = dal.Select();

            dgvUsers.DataSource = dt;
        }
        private void btnDelete_Click(object sender, EventArgs e)
        {
            DataGridView dgv = dgvUser;

            Cursor = Cursors.WaitCursor; // change cursor to hourglass type
            if (dgv.SelectedRows.Count > 0)
            {
                int          n            = dgv.CurrentCell.RowIndex;
                DialogResult dialogResult = MessageBox.Show("Are you sure want to delete this user?", "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dialogResult == DialogResult.Yes)
                {
                    int rowIndex = dgvUser.CurrentCell.RowIndex;

                    uUser.user_id = Convert.ToInt32(dgvUser.Rows[rowIndex].Cells[dalUser.UserID].Value);

                    if (!dalUser.Delete(uUser))
                    {
                        MessageBox.Show("Failed to delete user.");
                    }
                    else
                    {
                        LoadUserList(dgvUser);
                        dgvUser.ClearSelection();
                    }
                }
            }
            else
            {
                MessageBox.Show("Please select a user");
            }
            Cursor = Cursors.Arrow; // change cursor to normal type
        }
Beispiel #7
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            //Getting User ID from form
            u.id = Convert.ToInt32(txtUserID.Text);

            bool success = dal.Delete(u);

            //If the data is deleted the value of success will be true else it will be false
            if (success == true)
            {
                MessageBox.Show("User Deleted Successfully");
                clear();
            }
            else
            {
                MessageBox.Show("Failed to Delete User");
            }

            //Refreshing Datagrid view
            DataTable dt = dal.select();

            dgvUsers.DataSource = dt;

            error();
        }
        private void btnDelete_Click(object sender, EventArgs e)
        {
            //Getting user from form
            u.id = Convert.ToInt32(txtUserID.Text);

            bool success = dal.Delete(u);

            //id data is deleted successfully success is thrue or else it is false

            if (success == true)
            {
                //user deleted succssfully
                MessageBox.Show("User deleted successfully!");
                Clear();
            }
            else
            {
                //user deleting failed
                MessageBox.Show("User deleting failed!");
            }
            //refreshing data grid view

            DataTable dt = dal.Select();

            dgvUsers.DataSource = dt;
        }
Beispiel #9
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         u.Id = Convert.ToInt32(txtUSERID.Text);
         bool success = dal.Delete(u);
         if (success == true)
         {
             MassageBox mb = new MassageBox("Deleted", MsgType.delete);
             mb.Show();
             //MessageBox.Show("User Details Deleted Successfully!!!");
             clear();
         }
         else
         {
             MassageBox mb = new MassageBox("Delete Failed", MsgType.retry);
             mb.Show();
             //MessageBox.Show("Fail to Delete!!!");
         }
         DataTable dt = dal.Select();
         dgvUser.DataSource = dt;
     }
     catch (Exception)
     {
         MassageBox mb = new MassageBox("Select User First!!!", MsgType.retry);
         mb.Show();
     }
 }
Beispiel #10
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            u.id = Convert.ToInt32(txtUserID.Text);
            bool success = dal.Delete(u);

            if (success)
            {
                clearFields();
            }
            MessageBox.Show(success ? "User-i eshte shlyer me sukses" : "Shlyerja e User-it Deshtoi");

            refreshDataGridView();
        }
        private void BtnDelete_Click(object sender, EventArgs e)
        {
            //Getting the user from the form
            u.id = Convert.ToInt32(tbaddUserId.Text);
            bool success = d.Delete(u);

            // if the data is delete the value of success is true else false
            if (success == true)
            {
                MessageBox.Show("User deleted Successfully");
            }
            else
            {
                MessageBox.Show("Failed to delete user");
            }
        }
Beispiel #12
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            u.korisnik_id = int.Parse(txtUserID.Text);

            bool success = dal.Delete(u);

            if (success == true)
            {
                MessageBox.Show("Korisnik uspješno uklonjen");

                DataTable dt = dal.Select();
                dgvUsers.DataSource = dt;

                Clear();
            }
        }
        private void button3_Click(object sender, EventArgs e)
        {
            u.id = Convert.ToInt32(textBox8.Text);
            bool success = dal.Delete(u);

            if (success == true)
            {
                MessageBox.Show("User Deleted Succesfully");//
            }
            else
            {
                MessageBox.Show("Failed to delete user");
            }
            DataTable dt = dal.Select();

            dgvUsers.DataSource = dt;
        }
Beispiel #14
0
        private void btn_delete_Click(object sender, EventArgs e)
        {
            u.id = Convert.ToInt32(txtUserID.Text);

            bool success = dal.Delete(u);

            if (success)
            {
                MessageBox.Show("User sucessfully deleted.");
                Clear();
                DataTable dt = dal.Select();
                dgvUsers.DataSource = dt;
            }
            else
            {
                MessageBox.Show("Failed to delete user.");
            }
        }
        private void btnDeletar_Click(object sender, EventArgs e)
        {
            u.id = Convert.ToInt32(txtUserId.Text);
            bool sucess = dal.Delete(u);

            if (sucess == true)
            {
                MessageBox.Show("Usuário deletado com sucesso!");
                Limpar();
            }
            else
            {
                MessageBox.Show("Não foi possivel deletar usuário!");
            }

            DataTable dt = dal.Select();

            dgvUser.DataSource = dt;
        }
        private void button2_Click(object sender, EventArgs e)
        {
            u.id = Convert.ToInt32(text_id.Text);
            bool success = userdal.Delete(u);

            if (success == true)
            {
                MessageBox.Show("Successfully deleted the item");
                DataTable dt = userdal.Select();
                dgv.DataSource = dt;
                clear();
            }
            else
            {
                MessageBox.Show("Cannot be deleted succesfully");
                DataTable dt = userdal.Select();
                dgv.DataSource = dt;
            }
        }
        private void btnDeletar_Click(object sender, EventArgs e)
        {
            u.id = Convert.ToInt32(txtUserID.Text);

            bool success = dal.Delete(u);

            if (success == true)
            {
                MessageBox.Show("USUÁRIO DELETADO COM SUCESSO!");
                Limpar();
            }
            else
            {
                MessageBox.Show("NÃO FOI POSSÍVEL DELETAR USUÁRIO!");
            }
            DataTable dt = dal.Select();

            dgvUser.DataSource = dt;
        }
Beispiel #18
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            u.id = Convert.ToInt32(txtUserID.Text);

            bool success = dal.Delete(u);

            if (success == true)
            {
                MessageBox.Show("ทำการลบข้อมูลผู็ใช้งานแล้ว");
                clear();
            }
            else
            {
                MessageBox.Show("ไม่สามารถลบข้อมูลผู้ใช้งานได้! กรุณาลองใหม่อีกครั้ง");
            }
            DataTable dt = dal.Select();

            dgvUsers.DataSource = dt;
        }
Beispiel #19
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            //Step 1: Get the UserID from Text Box to Delete the User
            u.user_id = int.Parse(txtUserID.Text);

            //REmove the Physical file of the User Profile

            if (rowHeaderImage != "no-image.jpg")
            {
                //Path of the Project Folder
                string paths = Application.StartupPath.Substring(0, (Application.StartupPath.Length - 10));
                //Give the Path to the Image Folder
                string imagePath = paths + "\\images\\" + rowHeaderImage;

                //Call Clear Function to clear all the textboxes and Picturebox
                Clear();

                //Call Garbage  Collection Function
                GC.Collect();
                GC.WaitForPendingFinalizers();

                //Delete hte Physical File of the User Profile
                File.Delete(imagePath);
            }

            //Step Create the Boolean value to check whether the user deleted or not
            bool success = dal.Delete(u);

            //Let's check whteher the user is Deleted or Not
            if (success == true)
            {
                //User Deleted Successfully
                MessageBox.Show("User Deleted Successfully.");

                //Refresh DataGrid View
                DataTable dt = dal.Select();
                dgvUsers.DataSource = dt;

                //Clear the TextBoxes
                Clear();
            }
        }
        private void BtnDelete_Click(object sender, EventArgs e)
        {
            //Getting the user from the form
            u.id = Convert.ToInt32(tbaddUserId.Text);
            bool success = d.Delete(u);

            // if the data is delete the value of success is true else false
            if (success == true)
            {
                MessageBox.Show("User deleted Successfully");
            }
            else
            {
                MessageBox.Show("Failed to delete user");
            }
            //Referesh DataGrid View
            DataTable dt = d.SelectSI();

            dgvAdduser.DataSource = dt;
            Clear();
        }
Beispiel #21
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            //Getting User Id from
            u.id = Convert.ToInt32(txtID.Text);

            bool success = daL.Delete(u);

            if (success == true)
            {
                MessageBox.Show("User Deleted Succesfully");
                clear();
            }
            else
            {
                MessageBox.Show("Failed to Delete User");
            }
            //Refereshing Grid View
            DataTable dt = daL.Select();

            dgvUsers.DataSource = dt;
        }
Beispiel #22
0
        private void buttonDelete_Click(object sender, EventArgs e)
        {
            //get the userid from text box
            u.user_id = int.Parse(textBoxUserID.Text);

            //boolean for succession of delete
            bool DeleteSuccess = dal.Delete(u);

            if (DeleteSuccess)
            {
                MessageBox.Show($"User deleted successfully");

                //refresh datagrid view
                DataTable dt = dal.Select();
                dataGridViewUsers.DataSource = dt;
            }
            else
            {
                MessageBox.Show("Cant delete the user");
            }
        }
Beispiel #23
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            u.id = Convert.ToInt32(txtUserID.Text);

            bool      success = dal.Delete(u);
            DataTable dt      = dal.select();

            dgvUsers.DataSource = dt;

            if (success == true)
            {
                clear();
                MessageBox.Show("Delete Successfully");
            }
            else
            {
                MessageBox.Show("Delete Failed");
            }
            //DataTable dt = dal.select();
            //dgvUsers.DataSource = dt;
        }
Beispiel #24
0
        private void BtnDelete_Click(object sender, EventArgs e)
        {
            // get userID from form
            u.id = Convert.ToInt32(txtUserID.Text);
            bool success = dal.Delete(u);

            // if data is deleted then success will be true,false otherwise
            if (success == true)
            {
                //User deleted successfully
                MessageBox.Show("User deleted successfully");
            }
            else
            {
                //Failed to delete user
                MessageBox.Show("Failed to delete user.");
            }
            //refreshing data grid view
            DataTable dt = dal.Select();

            dgvUsers.DataSource = dt;
        }
        private void btnDelete_Click(object sender, EventArgs e)
        {
            //Step 1: Get the UserID from Text Box to Delete the User
            u.user_id = int.Parse(txtUserID.Text);

            //Step Create the Boolean value to check whether the user deleted or not
            bool success = dal.Delete(u);

            //Let's check whteher the user is Deleted or Not
            if (success == true)
            {
                //User Deleted Successfully
                MessageBox.Show("User Deleted Successfully.");

                //Refresh DataGrid View
                DataTable dt = dal.Select();
                dgvUsers.DataSource = dt;

                //Clear the TextBoxes
                Clear();
            }
        }
Beispiel #26
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            //Getting  User ID for Deleted A row
            userBl.id = Convert.ToInt32(txtUserID.Text);

            bool success = userDl.Delete(userBl);

            // Data is Deleted Successfully Success is True

            if (success == true)
            {
                MessageBox.Show("Successfuly  Deleting Row  ");
            }
            else
            {
                MessageBox.Show("Failled!!!! TO  Delete Data");
            }
            //Refressing DataGGRid View
            DataTable DT = userDl.Select();

            dgvUsers.DataSource = DT;
        }
Beispiel #27
0
        private void DeleteBtn_Click(object sender, EventArgs e)
        {
            //Step 1: Get the UserID from the text box to delete the user
            u.user_id = int.Parse(txtboxUserID.Text);

            //Step create the boolean value to check whether the uer deleted or not
            bool success = dal.Delete(u);

            //Lets check whether the user is Deleted or not
            if (success == true)
            {
                //User in fact deleted
                MessageBox.Show("User Deleted Successfully");

                //Refresh DataGrid View
                DataTable dt = dal.Select();
                userDataGrid.DataSource = dt;

                //Clear the user tabs after its been updated
                Clear();
            }
        }
Beispiel #28
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            //get the user id from text box to delete the user
            u.user_id = int.Parse(textBoxUserId.Text);

            //create the boolean value to check if the user has been deleted or not
            bool success = dal.Delete(u);

            //check if the user has been deleted or not
            if (success == true)
            {
                //user deleted successfully
                MessageBox.Show("User deleted successfully.");

                //refresh data grid view
                DataTable dt = dal.Select();
                dgvUsers.DataSource = dt;

                //clear the textboxes
                Clear();
            }
        }
Beispiel #29
0
        private void BtnDelete_Click(object sender, EventArgs e)
        {
            //Delete Data From Database where id
            u.id = Convert.ToInt32(txtUserID.Text);
            bool success = dal.Delete(u);

            //if data is deleted then value of success will be true else it will be false
            if (success == true)
            {
                //User Deleted Successfully
                MessageBox.Show("User deleted successfully");
                Clear();
            }
            else
            {
                //Failed to Delete User
                MessageBox.Show("Failed to delete user");
            }
            //Refreshing Data Grid View
            DataTable dt = dal.Select();

            dgvUsers.DataSource = dt;
        }
Beispiel #30
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            u.id = Convert.ToInt32(txtUserID.Text);
            bool success = dal.Delete(u);

            // If data is deleted then the success

            if (success == true)
            {
                MessageBox.Show("deleted Successfully");
                clear();
            }
            else
            {
                MessageBox.Show("Not Deleted");
            }
            //Refresh Data Grid
            // Refreshing Data Grid View.we will create a temporary storage data table to store data.
            DataTable dt = dal.Select();

            // this will refer the data grid view
            dgvUsers.DataSource = dt;
        }