private void btnThem_Click(object sender, EventArgs e)
        {
            if (KiemTraThongTinTrong())
            {
                MessageBox.Show("Làm ơn điền đầy đủ thông tin quyền hạn");
            }
            else
            {
                if (KiemTraThongTinHopLe())
                {
                    QuyenHanDTO quyenHanDTO = new QuyenHanDTO(txtTenQuyenHan.Text, txtMoTa.Text);

                    try
                    {
                        if (quyenHanBLL.ThemQuyenHan(quyenHanDTO))
                        {
                            MessageBox.Show("Thêm quyền hạn thành công");
                            dgvQuyenHan.DataSource = quyenHanBLL.LayDanhSachQuyenHan();
                        }
                        else
                        {
                            MessageBox.Show("Thêm quyền hạn thất bại");
                        }
                    }
                    catch
                    {
                    }
                }
            }
        }
Exemple #2
0
 public bool ThemQuyenHan(QuyenHanDTO quyenHanDTO)
 {
     try
     {
         OpenConnect();
         string store = "sp_QuyenHan_Them";
         sqlCommand             = new SqlCommand(store, connect);
         sqlCommand.CommandType = CommandType.StoredProcedure;
         sqlCommand.Parameters.Add(new SqlParameter("@ten", quyenHanDTO.TenQuyenHan));
         sqlCommand.Parameters.Add(new SqlParameter("@mota", quyenHanDTO.MoTaQuyenHan));
         sqlCommand.ExecuteNonQuery();
         return(true);
     }
     catch
     {
         return(false);
     }
     finally
     {
         CloseConnect();
     }
 }
        private void btnSua_Click(object sender, EventArgs e)
        {
            if (id == "")
            {
                MessageBox.Show("Làm ơn chọn quyền hạn muốn sửa");
            }
            else
            {
                if (KiemTraThongTinTrong())
                {
                    MessageBox.Show("Làm ơn điền đầy đủ thông tin quyền hạn");
                }
                else
                {
                    if (KiemTraThongTinHopLe())
                    {
                        QuyenHanDTO quyenHanDTO = new QuyenHanDTO(Int32.Parse(txtMaQuyenHan.Text), txtTenQuyenHan.Text, txtMoTa.Text);

                        try
                        {
                            if (quyenHanBLL.SuaQuyenHan(quyenHanDTO))
                            {
                                MessageBox.Show("Sửa quyền hạn thành công");
                                dgvQuyenHan.DataSource = quyenHanBLL.LayDanhSachQuyenHan();
                                LamMoiThongTin();
                            }
                            else
                            {
                                MessageBox.Show("Sửa quyền hạn thất bại");
                            }
                        }
                        catch
                        {
                        }
                    }
                }
            }
        }
Exemple #4
0
 public bool SuaQuyenHan(QuyenHanDTO quyenHanDTO)
 {
     return(quyenHanDAL.SuaQuyenHan(quyenHanDTO));
 }
Exemple #5
0
 public bool ThemQuyenHan(QuyenHanDTO quyenHanDTO)
 {
     return(quyenHanDAL.ThemQuyenHan(quyenHanDTO));
 }