public DaiLyDTO this[string id] { get { DaiLyDTO people = list.Find(x => x.Madl == id); if (people is null) { people = new DaiLyDTO(); people.Tendaily = "<Không tìm thấy>"; } return(people); } }
public void SetData(DaiLyDTO x) { try { // lấy dữ liệu từ đối tượng và set vào các textbox madl = x.Madl; TxtTenDaiLy.Text = x.Tendaily; txtMaDL.Text = x.Madl.ToString(); txtPhone.Text = x.Sdt; txtDiaChi.Text = x.Diachi; txCHuDAiLy.Text = x.Tenchudaily.ToString(); txtTenNhanVien.Text = x.Tennv; } catch { } }
public void GetFullInfo(string danhsach = "DaiLy_NhanVien") { list.Clear(); DataTable ds = DataProvider.Instance.ExecuteQuery(danhsach); for (int i = 0; i < ds.Rows.Count; i++) { DaiLyDTO people; //DateTime ngaysinh = Convert.ToDateTime(ds.Rows[i]["NgaySinh"]); people = new DaiLyDTO((int)ds.Rows[i]["MaDaL"], ds.Rows[i]["MaNV"].ToString(), ds.Rows[i]["TenNV"].ToString(), ds.Rows[i]["DiaChi"].ToString(), ds.Rows[i]["TenChuDaiLy"].ToString(), ds.Rows[i]["TenDaiLy"].ToString(), ds.Rows[i]["SDT"].ToString(), ds.Rows[i]["MaDL"].ToString()); Add(people); } }
private bool SaveObj() { // Khởi tạo đối tượng NhanVien nếu chưa có nhan = new DaiLyDTO(); // Lấy họ tên đã được tách ra // Lưu vào obj nhan.Madl = txtMaDL.Text; nhan.Sdt = txtPhone.Text; //nhan.Email = txtEmail.Text; nhan.Diachi = txtDiaChi.Text; nhan.Tenchudaily = txCHuDAiLy.Text; nhan.Tendaily = TxtTenDaiLy.Text; nhan.Tennv = txtTenNhanVien.Text; //data.NV.Add(nhan); return(true); }
public void Add(DaiLyDTO x) { list.Add(x); }