private void btnAtualiza_Click(object sender, EventArgs e)
        {
            u.id          = Convert.ToInt32(txtUserId.Text);
            u.pr_nome     = txtFirstName.Text;
            u.sb_nome     = txtLastName.Text;
            u.email       = txtEmail.Text;
            u.user_name   = txtUserName.Text;
            u.password    = txtSenha.Text;
            u.contato     = txtContato.Text;
            u.nm_endereco = txtEndereco.Text;
            u.sexo        = cbxSexo.Text;
            u.user_type   = cbxTpUser.Text;
            u.data        = DateTime.Now;
            u.add_por     = 1;

            bool sucess = dal.update(u);

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

            DataTable dt = dal.Select();

            dgvUser.DataSource = dt;
        }
        private void button3_Click(object sender, EventArgs e)
        {
            u.id         = Convert.ToInt32(text_id.Text);
            u.first_name = first_name.Text;
            u.last_name  = last_name.Text;
            u.email      = email.Text;
            u.username   = username.Text;
            u.password   = password.Text;
            u.contact    = contact.Text;
            u.address    = address.Text;
            u.gender     = gender.Text;
            u.user_type  = userType.Text;
            u.added_date = DateTime.Now;
            u.added_by   = 1;

            bool success = userdal.update(u);

            if (success == true)
            {
                MessageBox.Show("Successfully Updated");
                clear();
                DataTable dt = userdal.Select();
                dgv.DataSource = dt;
            }
            else
            {
                MessageBox.Show("Error! while updating!");
                DataTable dt = userdal.Select();
                dgv.DataSource = dt;
            }
        }
Пример #3
0
        private void updateUser()
        {
            getDataFromInput();
            uUser.user_id      = userID;
            uUser.updated_date = DateTime.Now;
            uUser.updated_by   = MainDashboard.USER_ID;

            bool success = dalUser.update(uUser);

            if (success)
            {
                //Data Successfully Inserted
                MessageBox.Show("User successfully updated");
                Close();
            }
            else
            {
                //Failed to insert data
                MessageBox.Show("Failed to update user");
            }
        }
Пример #4
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            // Get the value from user UI
            u.id         = Convert.ToInt32(txtUserID.Text);
            u.first_name = txtFirstName.Text;
            u.last_name  = txtLastName.Text;
            u.email      = txtEmail.Text;
            u.username   = txtUsername.Text;
            u.password   = txtPassword.Text;
            u.contact    = txtContact.Text;
            u.address    = txtAddress.Text;
            u.gender     = cmbGender.Text;
            u.user_type  = cmbUserType.Text;
            u.added_date = DateTime.Now;
            u.added_by   = 1;

            //update data into database
            bool success = dal.update(u);

            // if data is updated successfully then the valu of success is true else it will be false
            if (success == true)
            {
                //Data updated successfully
                MessageBox.Show("User successfully updated");
                clear();
            }
            else
            {
                //Data update fail
                MessageBox.Show("Failed to Update User");
                clear();
            }
            //refreshing Data Grid view
            DataTable dt = dal.Select();

            dgvUser.DataSource = dt;
        }