private void Load()
        {
            txtName.Text = "Good to see you back, " + employee.Name + "!";

            List <PersonalRequest> pers_reqs = PersonalRequestController.getInstance().getAll();

            var pers_status = pers_reqs.Where(p => p.Type == "Resignation" && p.Status == "Pending");

            var pers_filtered = pers_status.Select(p => new
            {
                p.Id,
                p.EmployeeID,
                EmployeeName = p.Employee.Name,
                p.Title,
                p.Description,
                p.Date
            });

            viewResign.ItemsSource   = pers_filtered;
            viewEmployee.ItemsSource = EmployeeController.getInstance().getAll();
            viewWork.ItemsSource     = getWorkList();
            viewRaise.ItemsSource    = getRaiseList();
            viewFire.ItemsSource     = getFireList();
            viewIdeas.ItemsSource    = getIdeaList();
        }
        private void btnPersonal_Click(object sender, RoutedEventArgs e)
        {
            if (txtDescPersonal.Text == "" || txtTitlePersonal.Text == "")
            {
                MessageBox.Show("Invalid Input");
                return;
            }

            if (btnRaise.IsChecked == true)
            {
                PersonalRequestController.getInstance().add(employee.Id, txtTitlePersonal.Text, txtDescPersonal.Text, "Raise salary");
                MessageBox.Show("Success send raise salary request!");
            }

            else if (btnFiring.IsChecked == true)
            {
                PersonalRequestController.getInstance().add(employee.Id, txtTitlePersonal.Text, txtDescPersonal.Text, "Fire employee");
                MessageBox.Show("Success send firing employee request!");
            }

            else
            {
                PersonalRequestController.getInstance().add(employee.Id, txtTitlePersonal.Text, txtDescPersonal.Text, "Resignation");
                MessageBox.Show("Success send resignation letter!");
            }

            txtTitlePersonal.Clear();
            txtDescPersonal.Clear();
        }
示例#3
0
        public void load()
        {
            List <PurchaseRequest> reqs      = PurchaseRequestController.getInstance().getAll();
            List <Idea>            ideas     = IdeaController.getInstance().getAll();
            List <FundRequest>     funds     = FundRequestController.getInstance().getAll();
            List <Construction>    cons      = ConstructionController.getInstance().getAll();
            List <PersonalRequest> pers_reqs = PersonalRequestController.getInstance().getAll();

            var pers_status = pers_reqs.Where(p => p.EmployeeID == employee.Id && (p.Status == "Accepted" || p.Status == "Rejected"));

            var cons_status = cons.Where(c => c.Status == "In progress of constructing" || c.Status == "Finish constructing");

            var funds_status = funds.Where(p => (p.Status == "Accepted" || p.Status == "Rejected") &&
                                           p.DepartmentId == employee.DepartmentID);

            var idea_status = ideas.Where(i => i.Status == "Accepted" || i.Status == "Rejected");

            var req_status = reqs.Where(p => (p.Status == "Accepted" || p.Status == "Rejected") &&
                                        p.DepartmentId == employee.DepartmentID);

            var req_filtered = req_status.Select(p => new
            {
                p.Id,
                p.Information,
                p.Note,
                p.Status,
                p.Date
            });

            var cons_filtered = cons_status.Select(c => new
            {
                c.Id,
                title       = c.Idea.Tittle,
                information = c.Idea.Information,
                c.Status
            });

            var pers_filterd = pers_status.Select(p => new
            {
                p.Id,
                p.Title,
                p.Description,
                p.Date,
                p.Note,
                p.Status,
                p.Type
            });

            viewFund.ItemsSource     = funds_status;
            viewPurchase.ItemsSource = req_filtered;
            viewIdeas.ItemsSource    = idea_status;
            viewCons.ItemsSource     = cons_filtered;
            viewRA.ItemsSource       = AttractionRideController.getInstance().getAll();
            viewPers.ItemsSource     = pers_filterd;
        }
        private dynamic getRaiseList()
        {
            List <PersonalRequest> raises = PersonalRequestController.getInstance().getAll();

            var raise_status = raises.Where(p => p.Type == "Raise salary" && p.Status == "Pending");

            var raise_filtered = raise_status.Select(p => new
            {
                p.Id,
                p.Title,
                p.Description,
                p.Date
            });

            return(raise_filtered);
        }
        private dynamic getFireList()
        {
            List <PersonalRequest> fires = PersonalRequestController.getInstance().getAll();

            var fires_status = fires.Where(p => p.Type == "Fire employee" && p.Status == "Pending");

            var fires_filtered = fires_status.Select(p => new
            {
                p.Id,
                p.Title,
                p.Description,
                p.Date
            });

            return(fires_filtered);
        }
        private dynamic getPersList()
        {
            List <PersonalRequest> pers_reqs = PersonalRequestController.getInstance().getAll();

            var pers_status = pers_reqs.Where(p => p.EmployeeID == employee.Id && (p.Status == "Accepted" || p.Status == "Rejected"));

            var pers_filterd = pers_status.Select(p => new
            {
                p.Id,
                p.Title,
                p.Description,
                p.Date,
                p.Note,
                p.Status,
                p.Type
            });

            return(pers_filterd);
        }
        private void load()
        {
            txtName.Text = "Good to see you back, " + employee.Name + "!";

            List <PersonalRequest> pers_reqs = PersonalRequestController.getInstance().getAll();

            var pers_status = pers_reqs.Where(p => p.Type == "Leaving permit" && p.Status == "Pending");

            var pers_filtered = pers_status.Select(p => new
            {
                p.Id,
                EmployeeName = p.Employee.Name,
                p.Title,
                p.Description,
                p.Date
            });

            viewEmployee.ItemsSource = EmployeeController.getInstance().getAll();
            viewLeaving.ItemsSource  = pers_filtered;
            viewPers.ItemsSource     = getPersList();
            viewFund.ItemsSource     = getFundList();
            viewWork.ItemsSource     = getWorkList();
        }
        private void btnRejFire_Click(object sender, RoutedEventArgs e)
        {
            object id_obj = ((Button)sender).CommandParameter;
            int    id;

            int.TryParse(id_obj.ToString(), out id);


            MessageBoxResult messageBoxResult = System.Windows.MessageBox.Show("Are you sure?", "Reject Confirmation", System.Windows.MessageBoxButton.YesNo);

            if (txtNoteFire.Text == "")
            {
                MessageBox.Show("Note must be inputted!");
                return;
            }

            if (messageBoxResult == MessageBoxResult.Yes)
            {
                PersonalRequestController.getInstance().update(id, txtNoteFire.Text, "Rejected");
                MessageBox.Show("Success rejected the request!");
            }
            txtNoteFire.Clear();
            Load();
        }