コード例 #1
0
ファイル: QLLoaiHinh.cs プロジェクト: HaDangTu/ProjectOAD
        private void btUpdate_Click(object sender, EventArgs e)
        {
            int currentRow = dgvType.CurrentCellAddress.Y;

            if (-1 < currentRow && currentRow < dgvType.RowCount)
            {
                LoaiHinhDTO loaiHinhDTO = new LoaiHinhDTO();
                loaiHinhDTO.ID  = tbID.Text;
                loaiHinhDTO.Ten = tbName.Text;

                Result result = loaiHinhBUS.Update(loaiHinhDTO);
                if (result.Flag)
                {
                    MessageBox.Show("Cập nhật thông tin loại hình thành công", "Information", MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);
                    LoadDgvType();
                    ResetField();
                }
                else
                {
                    MessageBox.Show("Cập nhật thông tin loại hình thất bại\n Error: " + result.Message, "Error", MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                }
            }
        }