예제 #1
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (dgvDocGia.SelectedRows.Count > 0)
            {
                if (tbxHoten.Text != "" && tbxDiaChi.Text != "" && tbxSDT.Text != "" && tbxCMND.Text != "")
                {
                    DataGridViewRow row = dgvDocGia.CurrentRow;

                    DTO_DocGia dtoDocGia = new DTO_DocGia(row.Cells[0].Value.ToString(), tbxHoten.Text, tbxDiaChi.Text, tbxSDT.Text, tbxCMND.Text, dtpNgaySinh.Value, dtpNgayDK.Value);

                    if (busDG.updateDocGia(dtoDocGia))
                    {
                        MessageBox.Show("Sửa thành công !");
                        dgvDocGia.DataSource = busDG.getDocGia();
                    }
                    else
                    {
                        MessageBox.Show("Sửa không thành công !");
                    }
                }
                else
                {
                    MessageBox.Show("Vui lòng nhập đầy đủ thông tin !");
                }
            }
        }
예제 #2
0
        private bool UpdateReader()
        {
            try
            {
                BUS_DocGia updateAuthor = new BUS_DocGia();

                int gioitinh = 1;
                if (radGTMale.Checked == false)
                {
                    gioitinh = 0;
                }

                DTO_DocGia dtoReader = new DTO_DocGia(this.authorId, txtReaderName.Text, int.Parse(txtNK.Text), gioitinh);
                updateAuthor.updateDocGia(dtoReader);
                return(true);
            }
            catch (Exception e)
            {
                return(false);
            }
        }