Beispiel #1
0
        List <VaiTroChucNang> ChuyenSangDTO(DataTable bang)
        {
            List <VaiTroChucNang> kq = new List <VaiTroChucNang>();

            foreach (DataRow dong in bang.Rows)
            {
                VaiTroChucNang duLieu = new VaiTroChucNang();
                duLieu.MaChucNang      = (int)dong["MaChucNang"];
                duLieu.Them            = (bool)dong["Them"];
                duLieu.Xoa             = (bool)dong["Xoa"];
                duLieu.Sua             = (bool)dong["Sua"];
                duLieu.TenTrongHeThong = dong["TenTrongHeThong"].ToString();
                kq.Add(duLieu);
            }
            return(kq);
        }
Beispiel #2
0
        //chuyen bang qua thanh list vai tro chuc nang
        public static List <VaiTroChucNang> ChuyenDoiDTOVaiTroChucNang(DataTable bang)
        {
            List <VaiTroChucNang> kq = new List <VaiTroChucNang>();

            foreach (DataRow dong in bang.Rows)
            {
                VaiTroChucNang dulieu = new VaiTroChucNang();
                dulieu.id              = dong["id"].ToString();
                dulieu.MaVaiTro        = dong["MaVaiTro"].ToString();
                dulieu.MaChucNang      = dong["MaChucNang"].ToString();
                dulieu.TruyXuat        = bool.Parse(dong["TruyXuat"].ToString());
                dulieu.Them            = bool.Parse(dong["Them"].ToString());
                dulieu.Xoa             = bool.Parse(dong["Xoa"].ToString());
                dulieu.Sua             = bool.Parse(dong["Sua"].ToString());
                dulieu.TenTrongHeThong = dong["TenTrongHeThong"].ToString();
                kq.Add(dulieu);
            }
            return(kq);
        }