Пример #1
0
        private void dgvPhieuDangKy_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0)
            {
                try
                {
                    DataGridViewRow row         = dgvPhieuDangKy.Rows[e.RowIndex];
                    int             columnIndex = dgvPhieuDangKy.CurrentCell.ColumnIndex;
                    string          columnName  = dgvPhieuDangKy.Columns[columnIndex].Name;
                    int             maPhieuDK   = Int32.Parse(row.Cells["MaPhieuDangKy"].Value.ToString());

                    if (columnName.Equals("ChiTiet"))
                    {
                        FormChiTietPhieuDangKy diaglogChiTietPhieuDangKy = new FormChiTietPhieuDangKy(maPhieuDK);
                        diaglogChiTietPhieuDangKy.StartPosition = FormStartPosition.CenterScreen;
                        diaglogChiTietPhieuDangKy.ShowDialog(this);
                    }

                    if (columnName.Equals("XacNhan"))
                    {
                        int trangThai = 0;
                        if (row.Cells["TrangThaiKiemDuyet"].Value.ToString().Equals("1"))
                        {
                            trangThai = 1;
                        }
                        string lyDo = "";
                        if (trangThai == 0)
                        {
                            lyDo = row.Cells["LyDoKhongDuyet"].Value.ToString();
                        }
                        PhieuDangKyDTO phieuDangKyDTO = new PhieuDangKyDTO(maPhieuDK, trangThai, lyDo);
                        try
                        {
                            if (phieuDangKyBLL.SuaKiemDuyetPhieuDangKy(phieuDangKyDTO))
                            {
                                MessageBox.Show("Sửa trạng thái phiếu đăng ký thành công");
                                LoadPhieuDangKy();
                            }
                            else
                            {
                                MessageBox.Show("Sửa trạng thái phiếu đăng ký thất bại");
                            }
                        }
                        catch
                        {
                        }
                    }
                }
                catch { }
            }
        }