private object AddDataToObject(EnumMyStruct _eType) { switch (_eType) { case EnumMyStruct.NguoiDung: SQL.Struct.NguoiDung nd = new SQL.Struct.NguoiDung(); nd.SoCMND = string.IsNullOrWhiteSpace(textBox2_SoCMND.Text) ? null : textBox2_SoCMND.Text; nd.TenDangNhap = string.IsNullOrWhiteSpace(textBox3_TenDangNhap.Text) ? null : textBox3_TenDangNhap.Text; nd.MatKhau = null; nd.HoTen = string.IsNullOrWhiteSpace(textBox4_HoTen.Text) ? null : textBox4_HoTen.Text; nd.SoDienThoai = string.IsNullOrWhiteSpace(textBox5_SoDienThoai.Text) ? null : textBox5_SoDienThoai.Text; nd.DiaChiThuongTru = string.IsNullOrWhiteSpace(textBox6_DiaChi.Text) ? null : textBox6_DiaChi.Text; nd.GioiTinh = radioButton1.Checked ? radioButton1.Checked : radioButton2.Checked; nd.NgaySinh = this.dateTimePicker1_NgaySinh.Value; nd.TenNguoiBaoHo = string.IsNullOrWhiteSpace(textBox7_TenNBH.Text) ? null : textBox7_TenNBH.Text; nd.SDTNguoiBaoHo = string.IsNullOrWhiteSpace(textBox8_SDT_NBH.Text) ? null : textBox8_SDT_NBH.Text; nd.DiaChiNguoiBaoHo = string.IsNullOrWhiteSpace(textBox9_DiaChiNBH.Text) ? null : textBox9_DiaChiNBH.Text; nd.DuongDanAnhDaiDien = null; return(nd); case EnumMyStruct.NhanVien: SQL.Struct.NhanVien nv = new SQL.Struct.NhanVien(); nv.MaNhanVien = string.IsNullOrWhiteSpace(textBox3_TenDangNhap.Text) ? null : textBox3_TenDangNhap.Text; nv.MatKhau = null; nv.TenNhanVien = string.IsNullOrWhiteSpace(textBox4_HoTen.Text) ? null : textBox4_HoTen.Text; nv.SoCMND = string.IsNullOrWhiteSpace(textBox2_SoCMND.Text) ? null : textBox2_SoCMND.Text; nv.DiaChi = string.IsNullOrWhiteSpace(textBox6_DiaChi.Text) ? null : textBox6_DiaChi.Text; nv.SoDienThoai = string.IsNullOrWhiteSpace(textBox5_SoDienThoai.Text) ? null : textBox5_SoDienThoai.Text; nv.GioiTinh = radioButton1.Checked ? radioButton1.Checked : radioButton2.Checked; nv.NgaySinh = this.dateTimePicker1_NgaySinh.Value; nv.LaQuanTriVien = this.checkBox1.Checked; return(nv); default: return(null); } }
public Manage_UserEmployee(EnumMyStruct _typeManage) // only manage User or Employee { InitializeComponent(); eTypeManage = _typeManage; this.Text += _typeManage == EnumMyStruct.NguoiDung ? "người dùng" : "nhân viên"; }