예제 #1
0
 public QuyenBO Tim1Quyen_NhanVien(string maquyen, string manv)
 {
     QuyenBO quyenBO = new QuyenBO();
     CTQuyenCollection ctquyenColl = new CTQuyenCollection();
     SqlConnection cnn = new SqlConnection(cnnstr);
     SqlCommand cmd = new SqlCommand("select * from ChiTietQuyen a,Quyen b, NhanVien_Quyen c where a.MaQuyen=b.MaQuyen AND c.MaCTQuyen=a.MaCTQuyen AND a.MaQuyen=@maquyen AND c.MaNV=@manv ", cnn);
     cmd.Parameters.AddWithValue("@maquyen", maquyen);
     cmd.Parameters.AddWithValue("@manv", manv);
     cnn.Open();
     SqlDataReader dr = cmd.ExecuteReader();
     while (dr.Read())
     {
         //lấy thông tin của quyền
         quyenBO.MaQuyen = dr["MaQuyen"].ToString();
         quyenBO.TenQuyen = dr["TenQuyen"].ToString();
         //lấy chi tiết quyền
         CTQuyen ctquyen = new CTQuyen();
         ctquyen.MaCTQuyen = dr["MaCTQuyen"].ToString();
         ctquyen.TenCTQuyen = dr["TenCTQuyen"].ToString();
         ctquyen.LienKet = dr["LienKet"].ToString();
         ctquyenColl.Add(ctquyen);
     }
     //gán chi tiết phân lọai
     quyenBO.ChiTietQuyen = ctquyenColl;
     cnn.Close();
     return quyenBO;
 }
예제 #2
0
 public QuyenCollection TimDSQuyen_NhanVien(string manv)
 {
     QuyenCollection quyenColl = new QuyenCollection();
     SqlConnection cnn = new SqlConnection(cnnstr);
     string query = "select distinct quyen.maquyen,tenquyen from Quyen,chitietquyen,nhanvien_quyen,nhanvien";
     query += " where Quyen.MaQuyen=ChiTietQuyen.MaQuyen and ChiTietQuyen.MaCTQuyen=NhanVien_Quyen.MaCTQuyen and Nhanvien_Quyen.MaNV=NhanVien.MaNV";
     query += " and nhanvien.manv=@manv";
     SqlCommand cmd = new SqlCommand(query, cnn);
     cmd.Parameters.AddWithValue("@manv", manv);
     cnn.Open();
     SqlDataReader dr = cmd.ExecuteReader();
     while (dr.Read())
     {
         QuyenBO quyenBO = new QuyenBO();
         string maquyen = dr["MaQuyen"].ToString();
         quyenBO = Tim1Quyen_NhanVien(maquyen, manv);
         if (quyenBO.ChiTietQuyen.Count != 0)
             quyenColl.Add(quyenBO);
     }
     cnn.Close();
     return quyenColl;
 }
예제 #3
0
 public void Add(QuyenBO quyenBO)
 {
     List.Add(quyenBO);
 }