Пример #1
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;
        }
Пример #2
0
        public int send(int id)
        {
            var idea = IdeaRepository.find(id);

            if (idea.Status == "Accepted")
            {
                if (ConstructionController.getInstance().add(id))
                {
                    IdeaRepository.remove(id);
                    return(1);
                }

                return(0);
            }

            return(-1);
        }
        private dynamic getConsList()
        {
            List <Construction> constructions = ConstructionController.getInstance().getAll();

            var cons_status = constructions.Where(c => c.Status == "Waiting for constructing" ||
                                                  c.Status == "In progress of constructing");

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

            return(filtered);
        }
        private void btnStart_Click(object sender, RoutedEventArgs e)
        {
            object id_obj = ((Button)sender).CommandParameter;
            int    id;

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


            if (ConstructionController.getInstance().start(id))
            {
                MessageBox.Show("Success to start the construction!");
            }

            else
            {
                MessageBox.Show("Construction has been started!");
            }

            load();
        }
        private void btnFinish_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?", "Finish Construction Confirmation", System.Windows.MessageBoxButton.YesNo);

            if (messageBoxResult == MessageBoxResult.Yes)
            {
                if (ConstructionController.getInstance().finish(id))
                {
                    MessageBox.Show("Success to finish the construction!");
                }

                else
                {
                    MessageBox.Show("Invalid!");
                }
            }
            load();
        }