Cách lấy giá trị kiểu bit và datetime trong SQL dùng LINQ C#?

Em tạo ra 1 class Object NhanVienObj ở tầng Data Transfer Object để trao đổi dữ liệu giữa các tầng.

Giờ lấy dữ liệu kiểu bit và Datetime từ SQL vào cho 1 số thuộc tính của NhanVienObj nhưng em không biết phải làm sao?

//tầng xử lý: business logic layer
public class NhanVienBLL
    {
        QLBanHangDataContext DB;
        //
        //constructor
        //
        public NhanVienBLL()
        {
            DB = new QLBanHangDataContext();
        }
        //
        //get danh sách nhân viên
        //
        public List<NhanVienObj> getNhanViens()
        {
            NhanVienObj objNV;
            List<NhanVienObj> NVList = new List<NhanVienObj>();
            foreach (var item in DB.tblNhanViens)
            {
                objNV = new NhanVienObj();
                objNV.ID = item.maNV;
                objNV.Name = item.tenNV;
                objNV.Sex = item.gioiTinh;//error (giới tính có kiểu bit)
                objNV.Birthday = item.namSinh;//error (namSinh có kiểu Datetime)
                objNV.Phone = item.sdt;
                objNV.Address = item.diaChi;
                objNV.Password = item.matKhau;
                NVList.Add(objNV);
            }
            return NVList;
        }
//tầng Data Transfer Object
public class NhanVienObj
    {
        String id, name, address, phone, password;
        bool sex;
        DateTime birthday;
        
        #region get set property
        public bool Sex
        {
            get { return sex; }
            set { sex = value; }
        }

        public DateTime Birthday
        {
            get { return birthday; }
            set { birthday = value; }
        }

        public String Password
        {
            get { return password; }
            set { password = value; }
        }

        public String Phone
        {
            get { return phone; }
            set { phone = value; }
        }

        public String Address
        {
            get { return address; }
            set { address = value; }
        }

        public String Name
        {
            get { return name; }
            set { name = value; }
        }

        public String ID
        {
            get { return id; }
            set { id = value; }
        }
        #endregion
        
        //
        //constructor
        //
        public NhanVienObj() { }
        public NhanVienObj(String id, String name, bool sex, DateTime birthday, String phone, String address, String password)
        {
            this.ID = id;
            this.Name = name;
            this.Sex = sex;
            this.Birthday = birthday;
            this.Phone = phone;
            this.Address = address;
            this.Password = password;
        }
    }

P/S: Em không biết cách trình bày vấn đề của mình thắc mắc ntn nên câu hỏi của em hơi lủng củng.:sweat:

Vậy sao người khác giúp được :smile:
Cụ thể là thuộc tính gì?
Bạn hãy mô tả lại rõ ràng hơn xem nào.

Em làm được rồi anh :smiley:
Cảm ơn anh nhe!

83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?