コード例 #1
0
        public Login()
        {
            InitializeComponent();
            TextFieldsViewModel tfvm = new TextFieldsViewModel();

            txtTaiKhoan.DataContext  = tfvm;
            dispatcherTimer.Tick    += dispatcherTimer_Tick;
            dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 100);
        }
コード例 #2
0
        public AddEmployee()
        {
            InitializeComponent();
            dpNVL.Language      = System.Windows.Markup.XmlLanguage.GetLanguage("vi-VN");
            dpNgaySinh.Language = System.Windows.Markup.XmlLanguage.GetLanguage("vi-VN");
            manvLast            = BUS.NhanVienBUS.GetLastNhanVien().Rows[0][0].ToString();
            tbMaNV.Text         = NextID(manvLast, "NV");
            mahdLast            = BUS.HopDongBUS.GetLastHopDong().Rows[0][0].ToString();
            tbMaHD.Text         = NextID(mahdLast, "HD");
            TextFieldsViewModel tfvm = new TextFieldsViewModel();

            tbHoTen.DataContext     = tfvm;
            tbCMND.DataContext      = tfvm;
            tbLCB.DataContext       = tfvm;
            dpNVL.SelectedDate      = DateTime.Today;
            dpNgayKyHD.SelectedDate = DateTime.Today;

            DirectoryInfo d = new DirectoryInfo(Directory.GetParent(Directory.GetParent(Directory.GetCurrentDirectory()).ToString()).ToString() + @"\Resources\Images\Avatar"); //Assuming Test is your Folder

            FileInfo[]    Files          = d.GetFiles("*.*");                                                                                                                   //Getting Text files
            List <string> listAvatarName = new List <string>();

            foreach (FileInfo file in Files)
            {
                listAvatarName.Add(file.Name);
            }
            cbHinhAnh.ItemsSource = listAvatarName;

            DataTable tbTemp = BUS.PhongBanBUS.GetPhongBan();

            listPB = new List <PhongBan>();
            foreach (DataRow row in tbTemp.Rows)
            {
                listPB.Add(new PhongBan {
                    ID = row[0].ToString().Trim(), Name = row[1].ToString(), MaBP = row[2].ToString()
                });
            }
            cbPhongBan.ItemsSource       = listPB;
            cbPhongBan.DisplayMemberPath = "Name";
            cbPhongBan.SelectedValuePath = "ID";
            cbPhongBan.SelectedValue     = "PB002";

            //tbTemp = BUS.ChucVuBUS.GetChucVu();
            //listCV = new List<ChucVu>();
            //foreach (DataRow row in tbTemp.Rows)
            //{
            //    listCV.Add(new ChucVu { ID = row[0].ToString().Trim(), Name = row[1].ToString() });
            //}
            //cbChucVu.ItemsSource = listCV;
            //cbChucVu.DisplayMemberPath = "Name";
            //cbChucVu.SelectedValuePath = "ID";
            //cbChucVu.SelectedValue = "CV004";

            //tbTemp = BUS.LoaiLuongBUS.GetLoaiLuong();
            //listLL = new List<LoaiLuong>();
            //foreach (DataRow row in tbTemp.Rows)
            //{
            //    listLL.Add(new LoaiLuong { ID = row[0].ToString().Trim(), Name = row[1].ToString() });
            //}
            //cbLoaiLuong.ItemsSource = listLL;
            //cbLoaiLuong.DisplayMemberPath = "Name";
            //cbLoaiLuong.SelectedValuePath = "ID";
            //cbLoaiLuong.SelectedValue = "1";

            tbTemp = BUS.TinhTrangBUS.GetTinhTrang();
            listTT = new List <TinhTrang>();
            foreach (DataRow row in tbTemp.Rows)
            {
                listTT.Add(new TinhTrang {
                    ID = row[0].ToString().Trim(), Name = row[1].ToString()
                });
            }
            cbTinhTrang.ItemsSource       = listTT;
            cbTinhTrang.DisplayMemberPath = "Name";
            cbTinhTrang.SelectedValuePath = "ID";
            cbTinhTrang.SelectedValue     = "1";


            listGT = new List <GioiTinh>();
            listGT.Add(new GioiTinh {
                ID = false, Name = "Nữ"
            });
            listGT.Add(new GioiTinh {
                ID = true, Name = "Nam"
            });
            cbGioiTinh.ItemsSource       = listGT;
            cbGioiTinh.DisplayMemberPath = "Name";
            cbGioiTinh.SelectedValuePath = "ID";
            cbGioiTinh.SelectedValue     = true;

            tbTemp = BUS.QuanHuyenBUS.GetQuanHuyen();
            listQH = new List <QuanHuyen>();
            foreach (DataRow row in tbTemp.Rows)
            {
                listQH.Add(new QuanHuyen {
                    ID = row[0].ToString().Trim(), Name = row[1].ToString(), MaTinh = row[2].ToString()
                });
            }
            cbQuanHuyen.ItemsSource       = listQH;
            cbQuanHuyen.DisplayMemberPath = "Name";
            cbQuanHuyen.SelectedValuePath = "ID";
            cbQuanHuyen.SelectedValue     = "01";

            tbTemp  = BUS.TinhTPBUS.GetTinhTP();
            listTTP = new List <TinhTP>();
            foreach (DataRow row in tbTemp.Rows)
            {
                listTTP.Add(new TinhTP {
                    ID = row[0].ToString().Trim(), Name = row[1].ToString(), MaQG = row[2].ToString()
                });
            }
            cbTinhTP.ItemsSource       = listTTP;
            cbTinhTP.DisplayMemberPath = "Name";
            cbTinhTP.SelectedValuePath = "ID";
            cbTinhTP.SelectedValue     = "46";


            tbTemp = BUS.QuocGiaBUS.GetQuocGia();
            listQG = new List <QuocGia>();
            foreach (DataRow row in tbTemp.Rows)
            {
                listQG.Add(new QuocGia {
                    ID = row[0].ToString().Trim(), Name = row[1].ToString()
                });
            }
            cbQuocGia.ItemsSource       = listQG;
            cbQuocGia.DisplayMemberPath = "Name";
            cbQuocGia.SelectedValuePath = "ID";
            cbQuocGia.SelectedValue     = "84";

            tbTemp = BUS.TonGiaoBUS.GetTonGiao();
            listTG = new List <TonGiao>();
            foreach (DataRow row in tbTemp.Rows)
            {
                listTG.Add(new TonGiao {
                    ID = row[0].ToString().Trim(), Name = row[1].ToString()
                });
            }
            cbTonGiao.ItemsSource       = listTG;
            cbTonGiao.DisplayMemberPath = "Name";
            cbTonGiao.SelectedValuePath = "ID";
            cbTonGiao.SelectedValue     = "1";

            tbTemp = BUS.DanTocBUS.GetDanToc();
            listDT = new List <DanToc>();
            foreach (DataRow row in tbTemp.Rows)
            {
                listDT.Add(new DanToc {
                    ID = row[0].ToString().Trim(), Name = row[1].ToString()
                });
            }
            cbDanToc.ItemsSource       = listDT;
            cbDanToc.DisplayMemberPath = "Name";
            cbDanToc.SelectedValuePath = "ID";
            cbDanToc.SelectedValue     = "01";

            tbTemp  = BUS.LoaiHopDongBUS.GetLoaiHopDong();
            listLHD = new List <LoaiHopDong>();
            foreach (DataRow row in tbTemp.Rows)
            {
                listLHD.Add(new LoaiHopDong {
                    ID = row[0].ToString().Trim(), Name = row[1].ToString()
                });
            }
            cbMaLoaiHD.ItemsSource       = listLHD;
            cbMaLoaiHD.DisplayMemberPath = "Name";
            cbMaLoaiHD.SelectedValuePath = "ID";
            cbMaLoaiHD.SelectedValue     = "1";

            tbTemp   = BUS.TinhTrangHopDongBUS.GetTinhTrangHopDong();
            listTTHD = new List <TinhTrangHopDong>();
            foreach (DataRow row in tbTemp.Rows)
            {
                listTTHD.Add(new TinhTrangHopDong {
                    ID = row[0].ToString().Trim(), Name = row[1].ToString()
                });
            }
            cbMaTTHD.ItemsSource       = listTTHD;
            cbMaTTHD.DisplayMemberPath = "Name";
            cbMaTTHD.SelectedValuePath = "ID";
            cbMaTTHD.SelectedValue     = "1";
        }