Example #1
0
        private void InitData()
        {
            bus_CardHolder = new BUS_CardHolder();
            bUS_Department = new BUS_Department();

            worker = new BackgroundWorker();
            worker.WorkerSupportsCancellation = true;
            worker.DoWork             += Worker_DoWork;
            worker.RunWorkerCompleted += Worker_RunWorkerCompleted;

            tbTitle.Text = "Lựa chọn nhân viên cho " + parent.Name;

            //Get employee not in this department
            lstNonDeptUsers = new List <ListDetailItem>();

            List <DTO_CardHolder> nonDeptUsers = Repository.lstAllCardHolders.Where(u => u.Department == null || u.Department.Id != parent.Id).ToList();

            if (nonDeptUsers != null && nonDeptUsers.Count > 0)
            {
                foreach (DTO_CardHolder holder in nonDeptUsers)
                {
                    ListDetailItem item = new ListDetailItem();
                    item.TextBinding = holder.Name;
                    item.Key         = holder.Id;
                    item.IsChecked   = false;

                    lstNonDeptUsers.Add(item);
                }

                lbListEmp.ItemsSource = lstNonDeptUsers;
            }
        }
Example #2
0
        public LaunchWindow(DTO_CardHolder loginUser)
        {
            InitializeComponent();
            this.loginUser = loginUser;

            bus_Card       = new BUS_Card();
            bus_CardHolder = new BUS_CardHolder();
            bus_Device     = new BUS_Device();
            bus_Schedule   = new BUS_Schedule();
            bus_Door       = new BUS_Door();
            bus_DoorMode   = new BUS_DoorMode();
            bUS_Right      = new BUS_Right();
            bUS_Department = new BUS_Department();

            lstDataType = new List <string>()
            {
                "CARD", "HOLDER", "DEVICE", "SCHEDULE", "DOOR", "DOOR_MODE", "RIGHT", "DEPARTMENT", "LOADHOLDERDEPT"
            };

            wokerLoadAllData = new BackgroundWorker();
            wokerLoadAllData.WorkerReportsProgress = true;
            wokerLoadAllData.DoWork             += WokerLoadAllData_DoWork;
            wokerLoadAllData.ProgressChanged    += WokerLoadAllData_ProgressChanged;
            wokerLoadAllData.RunWorkerCompleted += WokerLoadAllData_RunWorkerCompleted;

            wokerLoadAllData.RunWorkerAsync();
        }
Example #3
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            bUS_Department = new BUS_Department();

            myDeptWorker = new BackgroundWorker();
            myDeptWorker.WorkerSupportsCancellation = true;
            myDeptWorker.DoWork             += MyDoorWorker_DoWork;
            myDeptWorker.RunWorkerCompleted += MyDoorWorker_RunWorkerCompleted;
        }
Example #4
0
        private void InitData()
        {
            bUS_Department = new BUS_Department();

            #region Define background worker
            myDeptWorker = new BackgroundWorker();
            myDeptWorker.WorkerSupportsCancellation = true;
            myDeptWorker.DoWork             += MyDeptWorker_DoWork;
            myDeptWorker.RunWorkerCompleted += MyDeptWorker_RunWorkerCompleted;

            getDeptWorker = new BackgroundWorker();
            getDeptWorker.WorkerSupportsCancellation = true;
            getDeptWorker.DoWork             += GetDeptWorker_DoWork;
            getDeptWorker.RunWorkerCompleted += GetDeptWorker_RunWorkerCompleted;
            #endregion
        }
Example #5
0
        private void InitData()
        {
            bUS_CardHolder = new BUS_CardHolder();
            bUS_Department = new BUS_Department();

            #region Init background worker
            workerDelDept = new BackgroundWorker();
            workerDelDept.WorkerSupportsCancellation = true;
            workerDelDept.DoWork             += Worker_DoWork;
            workerDelDept.RunWorkerCompleted += Worker_RunWorkerCompleted;

            workerDelEmp = new BackgroundWorker();
            workerDelEmp.WorkerSupportsCancellation = true;
            workerDelEmp.DoWork             += WorkerDelEmp_DoWork;
            workerDelEmp.RunWorkerCompleted += WorkerDelEmp_RunWorkerCompleted;

            workerReloadDept = new BackgroundWorker();
            workerReloadDept.WorkerSupportsCancellation = true;
            workerReloadDept.DoWork             += WorkerReloadDept_DoWork;;
            workerReloadDept.RunWorkerCompleted += WorkerReloadDept_RunWorkerCompleted;
            #endregion
        }
Example #6
0
        private void InitData()
        {
            bUS_CardHolder = new BUS_CardHolder();
            bUS_Department = new BUS_Department();

            myCardHolderWorker = new BackgroundWorker();
            myCardHolderWorker.WorkerSupportsCancellation = true;
            myCardHolderWorker.DoWork             += MyCardHolderWorker_DoWork;
            myCardHolderWorker.RunWorkerCompleted += MyCardHolderWorker_RunWorkerCompleted;

            getCardHolderWorker = new BackgroundWorker();
            getCardHolderWorker.WorkerSupportsCancellation = true;
            getCardHolderWorker.DoWork             += GetCardHolderWorker_DoWork;
            getCardHolderWorker.RunWorkerCompleted += GetCardHolderWorker_RunWorkerCompleted;

            delCardHolderWorker = new BackgroundWorker();
            delCardHolderWorker.WorkerSupportsCancellation = true;
            delCardHolderWorker.DoWork             += DelCardHolderWorker_DoWork;
            delCardHolderWorker.RunWorkerCompleted += DelCardHolderWorker_RunWorkerCompleted;

            workerReloadDept = new BackgroundWorker();
            workerReloadDept.WorkerSupportsCancellation = true;
            workerReloadDept.DoWork             += WorkerReloadDept_DoWork;;
            workerReloadDept.RunWorkerCompleted += WorkerReloadDept_RunWorkerCompleted;

            cboGender.ItemsSource = Enum.GetValues(typeof(EType.Gender));

            cboDepartment.ItemsSource       = Repository.lstAllDepartment;
            cboDepartment.DisplayMemberPath = "Name";
            cboDepartment.SelectedValuePath = "Id";

            if (holder != null)
            {
                List <DTO_Card> listCards = Repository.lstAllCards.Where(card => card.Holder == holder.Id).ToList();
                lbListCard.ItemsSource = listCards;
            }
        }